From 77d636cc164eebeb119943f62b7ca1b837f878a8 Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Thu, 12 Oct 2017 21:29:32 +0000 Subject: [PATCH 01/81] Add debugging section to testing_guide/best_practices.md. --- doc/development/testing_guide/best_practices.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 613423dbd9a..b3ce2133161 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -267,6 +267,20 @@ RSpec.configure do |config| end ``` +### Debugging + +If you need to debug Capybara tests, using the following lines, +you can get the current URL of Capybara server, logged in user email. Then you +can add some arbitrary sleep to halt the test and go check out the page. + +Default user password is `12345678`. + +``` +puts current_url +puts user.email +sleep(200) +``` + --- [Return to Testing documentation](index.md) From 88bd5fa274d0b9d9ccd8be26f83d422517880fe3 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Thu, 12 Oct 2017 21:38:52 +0000 Subject: [PATCH 02/81] Update best_practices.md --- doc/development/testing_guide/best_practices.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index b3ce2133161..386fe2a35eb 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -267,15 +267,20 @@ RSpec.configure do |config| end ``` -### Debugging +### Debugging Capybara -If you need to debug Capybara tests, using the following lines, -you can get the current URL of Capybara server, logged in user email. Then you -can add some arbitrary sleep to halt the test and go check out the page. +Sometimes you may need to debug Capybara tests by observing browser behavior. -Default user password is `12345678`. +You can stall capybara and view the website on the browser by adding a long sleep command in your spec and then opening your browser +to the capybara url. -``` +You can get the capybara url by doing `puts current_url`. +You can also get the user's email by doing `puts user.email`. + +The default password for the user is `12345678`. + +Example: +```ruby puts current_url puts user.email sleep(200) From 9bccea6e3438e26479e0f38e7833286daa10ed5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Mon, 16 Oct 2017 10:37:53 +0200 Subject: [PATCH 03/81] Add LiveDebugger#live_debug to debug Capybara in feature tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- .../testing_guide/best_practices.md | 49 ++++++++++++------- spec/spec_helper.rb | 1 + spec/support/live_debugger.rb | 21 ++++++++ spec/support/login_helpers.rb | 10 +++- 4 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 spec/support/live_debugger.rb diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 386fe2a35eb..d07a368abfd 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -58,6 +58,36 @@ writing one](testing_levels.md#consider-not-writing-a-system-test)! - It's ok to look for DOM elements but don't abuse it since it makes the tests more brittle +#### Debugging Capybara + +Sometimes you may need to debug Capybara tests by observing browser behavior. + +You can stall Capybara and view the website on the browser by using the +`live_debug` method in your spec. The current page will be automatically opened +in your default browser. +You may need to sign-in first (the current user's credentials are displayed in +the terminal). + +To resume the test run, you only need to press `c`. + +For example: + +```ruby +$ bin/rspec spec/features/auto_deploy_spec.rb:34 +Running via Spring preloader in process 8999 +Run options: include {:locations=>{"./spec/features/auto_deploy_spec.rb"=>[34]}} + +Current example is paused for live debugging +The current user credentials are: user2 / 12345678 +Press 'c' to continue the execution of the example +Please press 'c' to continue the execution of the example! ;) <- I pressed `d` here +Back to the example! +. + +Finished in 34.51 seconds (files took 0.76702 seconds to load) +1 example, 0 failures +``` + ### `let` variables GitLab's RSpec suite has made extensive use of `let` variables to reduce @@ -267,25 +297,6 @@ RSpec.configure do |config| end ``` -### Debugging Capybara - -Sometimes you may need to debug Capybara tests by observing browser behavior. - -You can stall capybara and view the website on the browser by adding a long sleep command in your spec and then opening your browser -to the capybara url. - -You can get the capybara url by doing `puts current_url`. -You can also get the user's email by doing `puts user.email`. - -The default password for the user is `12345678`. - -Example: -```ruby -puts current_url -puts user.email -sleep(200) -``` - --- [Return to Testing documentation](index.md) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 48cacba6a8a..0dc417b3cb6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -49,6 +49,7 @@ RSpec.configure do |config| config.include LoginHelpers, type: :feature config.include SearchHelpers, type: :feature config.include WaitForRequests, :js + config.include LiveDebugger, :js config.include StubConfiguration config.include EmailHelpers, :mailer, type: :mailer config.include TestEnv diff --git a/spec/support/live_debugger.rb b/spec/support/live_debugger.rb new file mode 100644 index 00000000000..b15aba01e68 --- /dev/null +++ b/spec/support/live_debugger.rb @@ -0,0 +1,21 @@ +require 'io/console' + +module LiveDebugger + def live_debug + `open #{current_url}` + + puts "\nCurrent example is paused for live debugging" + puts "The current user credentials are: #{@current_user.username} / 12345678" if @current_user + puts "Press 'c' to continue the execution of the example" + + loop do + if $stdin.getch == 'c' + break + else + puts "Please press 'c' to continue the execution of the example! ;)" + end + end + + puts "Back to the example!" + end +end diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb index 3e117530151..2ca05bb1778 100644 --- a/spec/support/login_helpers.rb +++ b/spec/support/login_helpers.rb @@ -3,6 +3,14 @@ require_relative 'devise_helpers' module LoginHelpers include DeviseHelpers + # Overriding Devise::Test::IntegrationHelpers#sign_in to store @current_user + # since we may need it in LiveDebugger#live_debug. + def sign_in(resource, scope: nil) + super + + @current_user = resource + end + # Internal: Log in as a specific user or a new user of a specific role # # user_or_role - User object, or a role to create (e.g., :admin, :user) @@ -28,7 +36,7 @@ module LoginHelpers gitlab_sign_in_with(user, **kwargs) - user + @current_user = user end def gitlab_sign_in_via(provider, user, uid) From a3368a988d9ed90dfe67b34017782d45b5897574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 17 Oct 2017 17:42:21 +0200 Subject: [PATCH 04/81] Improve the LiveDebugger exit handler and documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- .../testing_guide/best_practices.md | 4 ++-- spec/support/live_debugger.rb | 22 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index d07a368abfd..12e6ec169e0 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -62,10 +62,10 @@ writing one](testing_levels.md#consider-not-writing-a-system-test)! Sometimes you may need to debug Capybara tests by observing browser behavior. -You can stall Capybara and view the website on the browser by using the +You can pause Capybara and view the website on the browser by using the `live_debug` method in your spec. The current page will be automatically opened in your default browser. -You may need to sign-in first (the current user's credentials are displayed in +You may need to sign in first (the current user's credentials are displayed in the terminal). To resume the test run, you only need to press `c`. diff --git a/spec/support/live_debugger.rb b/spec/support/live_debugger.rb index b15aba01e68..9c0570bcbf7 100644 --- a/spec/support/live_debugger.rb +++ b/spec/support/live_debugger.rb @@ -2,20 +2,24 @@ require 'io/console' module LiveDebugger def live_debug + puts "\nCurrent example is paused for live debugging." + puts "Opening #{current_url} in your default browser..." + puts "The current user credentials are: #{@current_user.username} / 12345678" if @current_user + puts "Press '^C' to continue the execution of the example" + `open #{current_url}` - puts "\nCurrent example is paused for live debugging" - puts "The current user credentials are: #{@current_user.username} / 12345678" if @current_user - puts "Press 'c' to continue the execution of the example" - - loop do - if $stdin.getch == 'c' - break - else - puts "Please press 'c' to continue the execution of the example! ;)" + catch :unpause_test do + trap('INT') { throw :unpause_test } + loop do + sleep(1) end end + # If the command is 'DEFAULT', the Ruby's default handler will be invoked. + # http://docs.rubydocs.org/rails-4-2-8-ruby-2-3-4/Ruby%202.3.4/classes/Kernel.html#method-i-trap + trap('INT') { 'DEFAULT' } + puts "Back to the example!" end end From 73e3d6b8a0594ff081103ce1bbb7cb8370503975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 17 Oct 2017 17:42:43 +0200 Subject: [PATCH 05/81] Ensure no exception is raised if the Gitaly process is already gone in TestEnv.cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/support/test_env.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index a27bfdee3d2..fff120fcb88 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -182,6 +182,8 @@ module TestEnv return unless @gitaly_pid Process.kill('KILL', @gitaly_pid) + rescue Errno::ESRCH + # The process can already be gone if the test run was INTerrupted. end def setup_factory_repo From 06376254b0f1afbeb60724079e78db7e9ecba21f Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 26 Oct 2017 13:03:44 +0200 Subject: [PATCH 06/81] Make NamespaceSelect a module --- app/assets/javascripts/dispatcher.js | 5 +- app/assets/javascripts/namespace_select.js | 135 +++++++++------------ 2 files changed, 59 insertions(+), 81 deletions(-) diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index f20162c48e9..cda19d43717 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -16,7 +16,7 @@ import CILintEditor from './ci_lint_editor'; /* global GroupsSelect */ /* global Search */ /* global Admin */ -/* global NamespaceSelects */ +import NamespaceSelect from './namespace_select'; /* global NewCommitForm */ /* global NewBranchForm */ /* global Project */ @@ -571,7 +571,8 @@ import Diff from './diff'; new UsersSelect(); break; case 'projects': - new NamespaceSelects(); + document.querySelectorAll('.js-namespace-select') + .forEach(dropdown => new NamespaceSelect({ dropdown })); break; case 'labels': switch (path[2]) { diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js index 5da2db063a4..de987b3d947 100644 --- a/app/assets/javascripts/namespace_select.js +++ b/app/assets/javascripts/namespace_select.js @@ -1,85 +1,62 @@ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, vars-on-top, one-var-declaration-per-line, comma-dangle, object-shorthand, no-else-return, prefer-template, quotes, prefer-arrow-callback, no-param-reassign, no-cond-assign, max-len */ import Api from './api'; -(function() { - window.NamespaceSelect = (function() { - function NamespaceSelect(opts) { - this.onSelectItem = this.onSelectItem.bind(this); - var fieldName, showAny; - this.dropdown = opts.dropdown; - showAny = true; - fieldName = 'namespace_id'; - if (this.dropdown.attr('data-field-name')) { - fieldName = this.dropdown.data('fieldName'); - } - if (this.dropdown.attr('data-show-any')) { - showAny = this.dropdown.data('showAny'); - } - this.dropdown.glDropdown({ - filterable: true, - selectable: true, - filterRemote: true, - search: { - fields: ['path'] - }, - fieldName: fieldName, - toggleLabel: function(selected) { - if (selected.id == null) { - return selected.text; - } else { - return selected.kind + ": " + selected.full_path; - } - }, - data: function(term, dataCallback) { - return Api.namespaces(term, function(namespaces) { - var anyNamespace; - if (showAny) { - anyNamespace = { - text: 'Any namespace', - id: null - }; - namespaces.unshift(anyNamespace); - namespaces.splice(1, 0, 'divider'); - } - return dataCallback(namespaces); - }); - }, - text: function(namespace) { - if (namespace.id == null) { - return namespace.text; - } else { - return namespace.kind + ": " + namespace.full_path; - } - }, - renderRow: this.renderRow, - clicked: this.onSelectItem - }); +export default class NamespaceSelect { + constructor(opts) { + this.onSelectItem = this.onSelectItem.bind(this); + var fieldName, showAny; + this.dropdown = $(opts.dropdown); + showAny = true; + fieldName = 'namespace_id'; + if (this.dropdown.attr('data-field-name')) { + fieldName = this.dropdown.data('fieldName'); } - - NamespaceSelect.prototype.onSelectItem = function(options) { - const { e } = options; - return e.preventDefault(); - }; - - return NamespaceSelect; - })(); - - window.NamespaceSelects = (function() { - function NamespaceSelects(opts) { - var ref; - if (opts == null) { - opts = {}; - } - this.$dropdowns = (ref = opts.$dropdowns) != null ? ref : $('.js-namespace-select'); - this.$dropdowns.each(function(i, dropdown) { - var $dropdown; - $dropdown = $(dropdown); - return new window.NamespaceSelect({ - dropdown: $dropdown + if (this.dropdown.attr('data-show-any')) { + showAny = this.dropdown.data('showAny'); + } + this.dropdown.glDropdown({ + filterable: true, + selectable: true, + filterRemote: true, + search: { + fields: ['path'] + }, + fieldName: fieldName, + toggleLabel: function(selected) { + if (selected.id == null) { + return selected.text; + } else { + return selected.kind + ": " + selected.full_path; + } + }, + data: function(term, dataCallback) { + return Api.namespaces(term, function(namespaces) { + var anyNamespace; + if (showAny) { + anyNamespace = { + text: 'Any namespace', + id: null + }; + namespaces.unshift(anyNamespace); + namespaces.splice(1, 0, 'divider'); + } + return dataCallback(namespaces); }); - }); - } + }, + text: function(namespace) { + if (namespace.id == null) { + return namespace.text; + } else { + return namespace.kind + ": " + namespace.full_path; + } + }, + renderRow: this.renderRow, + clicked: this.onSelectItem + }); + } - return NamespaceSelects; - })(); -}).call(window); + onSelectItem(options) { + const { e } = options; + return e.preventDefault(); + } +} From fcc82ab601f1881558fc246f440f0ebe95bccab7 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 26 Oct 2017 13:04:42 +0200 Subject: [PATCH 07/81] Inline onSelectItem of NamespaceSelect --- app/assets/javascripts/namespace_select.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js index de987b3d947..959b52c5608 100644 --- a/app/assets/javascripts/namespace_select.js +++ b/app/assets/javascripts/namespace_select.js @@ -3,7 +3,6 @@ import Api from './api'; export default class NamespaceSelect { constructor(opts) { - this.onSelectItem = this.onSelectItem.bind(this); var fieldName, showAny; this.dropdown = $(opts.dropdown); showAny = true; @@ -51,12 +50,10 @@ export default class NamespaceSelect { } }, renderRow: this.renderRow, - clicked: this.onSelectItem + clicked(options) { + const { e } = options; + return e.preventDefault(); + }, }); } - - onSelectItem(options) { - const { e } = options; - return e.preventDefault(); - } } From 6bae610c67040a71f19ad74125dc70bf6c33bc0b Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 26 Oct 2017 13:17:02 +0200 Subject: [PATCH 08/81] Replace showAny for NamespaceSelect by isFilter --- app/assets/javascripts/namespace_select.js | 9 +++------ app/views/admin/projects/index.html.haml | 2 +- app/views/admin/projects/show.html.haml | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js index 959b52c5608..b53c1591bed 100644 --- a/app/assets/javascripts/namespace_select.js +++ b/app/assets/javascripts/namespace_select.js @@ -3,16 +3,13 @@ import Api from './api'; export default class NamespaceSelect { constructor(opts) { - var fieldName, showAny; + const isFilter = opts.dropdown.dataset.isFilter === 'true'; + var fieldName; this.dropdown = $(opts.dropdown); - showAny = true; fieldName = 'namespace_id'; if (this.dropdown.attr('data-field-name')) { fieldName = this.dropdown.data('fieldName'); } - if (this.dropdown.attr('data-show-any')) { - showAny = this.dropdown.data('showAny'); - } this.dropdown.glDropdown({ filterable: true, selectable: true, @@ -31,7 +28,7 @@ export default class NamespaceSelect { data: function(term, dataCallback) { return Api.namespaces(term, function(namespaces) { var anyNamespace; - if (showAny) { + if (isFilter) { anyNamespace = { text: 'Any namespace', id: null diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 4d8754afdd2..c37d8ac45b9 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -14,7 +14,7 @@ = hidden_field_tag :namespace_id, params[:namespace_id] - namespace = Namespace.find(params[:namespace_id]) - toggle_text = "#{namespace.kind}: #{namespace.full_path}" - = dropdown_toggle(toggle_text, { toggle: 'dropdown' }, { toggle_class: 'js-namespace-select large' }) + = dropdown_toggle(toggle_text, { toggle: 'dropdown', is_filter: 'true' }, { toggle_class: 'js-namespace-select large' }) .dropdown-menu.dropdown-select.dropdown-menu-align-right = dropdown_title('Namespaces') = dropdown_filter("Search for Namespace") diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index ab4165c0bf2..42f92079d85 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -115,7 +115,7 @@ = f.label :new_namespace_id, "Namespace", class: 'control-label' .col-sm-10 .dropdown - = dropdown_toggle('Search for Namespace', { toggle: 'dropdown', field_name: 'new_namespace_id', show_any: 'false' }, { toggle_class: 'js-namespace-select large' }) + = dropdown_toggle('Search for Namespace', { toggle: 'dropdown', field_name: 'new_namespace_id' }, { toggle_class: 'js-namespace-select large' }) .dropdown-menu.dropdown-select = dropdown_title('Namespaces') = dropdown_filter("Search for Namespace") From 46259f74d0571ce8607fddd74093b96284ef2489 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 26 Oct 2017 13:37:58 +0200 Subject: [PATCH 09/81] Reduce eslint-disable from NamespaceSelect --- app/assets/javascripts/namespace_select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js index b53c1591bed..69e83d784bf 100644 --- a/app/assets/javascripts/namespace_select.js +++ b/app/assets/javascripts/namespace_select.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, vars-on-top, one-var-declaration-per-line, comma-dangle, object-shorthand, no-else-return, prefer-template, quotes, prefer-arrow-callback, no-param-reassign, no-cond-assign, max-len */ +/* eslint-disable func-names, space-before-function-paren, no-var, comma-dangle, object-shorthand, no-else-return, prefer-template, quotes, prefer-arrow-callback, max-len */ import Api from './api'; export default class NamespaceSelect { From 34d53d2b5a150d10de3c84cb73f8a67f7fe297a7 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 26 Oct 2017 14:47:17 +0200 Subject: [PATCH 10/81] Add failing test for https://gitlab.com/gitlab-org/gitlab-ce/issues/37277 --- spec/javascripts/namespace_select_spec.js | 65 +++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 spec/javascripts/namespace_select_spec.js diff --git a/spec/javascripts/namespace_select_spec.js b/spec/javascripts/namespace_select_spec.js new file mode 100644 index 00000000000..9d7625ca269 --- /dev/null +++ b/spec/javascripts/namespace_select_spec.js @@ -0,0 +1,65 @@ +import NamespaceSelect from '~/namespace_select'; + +describe('NamespaceSelect', () => { + beforeEach(() => { + spyOn($.fn, 'glDropdown'); + }); + + it('initializes glDropdown', () => { + const dropdown = document.createElement('div'); + + // eslint-disable-next-line no-new + new NamespaceSelect({ dropdown }); + + expect($.fn.glDropdown).toHaveBeenCalled(); + }); + + describe('as input', () => { + let glDropdownOptions; + + beforeEach(() => { + const dropdown = document.createElement('div'); + // eslint-disable-next-line no-new + new NamespaceSelect({ dropdown }); + glDropdownOptions = $.fn.glDropdown.calls.argsFor(0)[0]; + }); + + it('prevents click events', () => { + const dummyEvent = new Event('dummy'); + spyOn(dummyEvent, 'preventDefault'); + + glDropdownOptions.clicked({ e: dummyEvent }); + + expect(dummyEvent.preventDefault).toHaveBeenCalled(); + }); + }); + + describe('as filter', () => { + let glDropdownOptions; + + beforeEach(() => { + const dropdown = document.createElement('div'); + dropdown.dataset.isFilter = 'true'; + // eslint-disable-next-line no-new + new NamespaceSelect({ dropdown }); + glDropdownOptions = $.fn.glDropdown.calls.argsFor(0)[0]; + }); + + it('does not prevent click events', () => { + const dummyEvent = new Event('dummy'); + spyOn(dummyEvent, 'preventDefault'); + + glDropdownOptions.clicked({ e: dummyEvent }); + + expect(dummyEvent.preventDefault).not.toHaveBeenCalled(); + }); + + it('sets URL of dropdown items', () => { + const dummyNamespace = { id: 'eal' }; + + const itemUrl = glDropdownOptions.url(dummyNamespace); + + expect(itemUrl).toContain(`namespace_id=${dummyNamespace.id}`); + }); + }); +}); From 1c17ddba662872bf6ad9a9fe04137023476df50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 26 Oct 2017 18:03:33 +0200 Subject: [PATCH 11/81] Simplify the live debugger resume mechanism: press any key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- doc/development/testing_guide/best_practices.md | 5 ++--- spec/support/live_debugger.rb | 13 ++----------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 12e6ec169e0..bbdeee05579 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -68,7 +68,7 @@ in your default browser. You may need to sign in first (the current user's credentials are displayed in the terminal). -To resume the test run, you only need to press `c`. +To resume the test run, press any key. For example: @@ -79,8 +79,7 @@ Run options: include {:locations=>{"./spec/features/auto_deploy_spec.rb"=>[34]}} Current example is paused for live debugging The current user credentials are: user2 / 12345678 -Press 'c' to continue the execution of the example -Please press 'c' to continue the execution of the example! ;) <- I pressed `d` here +Press any key to resume the execution of the example! Back to the example! . diff --git a/spec/support/live_debugger.rb b/spec/support/live_debugger.rb index 9c0570bcbf7..8359a81059b 100644 --- a/spec/support/live_debugger.rb +++ b/spec/support/live_debugger.rb @@ -5,20 +5,11 @@ module LiveDebugger puts "\nCurrent example is paused for live debugging." puts "Opening #{current_url} in your default browser..." puts "The current user credentials are: #{@current_user.username} / 12345678" if @current_user - puts "Press '^C' to continue the execution of the example" + puts "Press any key to resume the execution of the example!!" `open #{current_url}` - catch :unpause_test do - trap('INT') { throw :unpause_test } - loop do - sleep(1) - end - end - - # If the command is 'DEFAULT', the Ruby's default handler will be invoked. - # http://docs.rubydocs.org/rails-4-2-8-ruby-2-3-4/Ruby%202.3.4/classes/Kernel.html#method-i-trap - trap('INT') { 'DEFAULT' } + loop until $stdin.getch puts "Back to the example!" end From de5f2ef4007cd6e13bd866cd36fd7a95a27bc131 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Thu, 28 Sep 2017 19:05:01 +0200 Subject: [PATCH 12/81] Updated Static Icons from CI Area --- .../stylesheets/framework/dropdowns.scss | 2 +- app/assets/stylesheets/pages/builds.scss | 16 +++++++------ app/helpers/ci_status_helper.rb | 24 +++++++++---------- app/views/projects/jobs/_sidebar.html.haml | 5 ++-- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index 63697fd38a7..9e49fb41a41 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -99,7 +99,7 @@ color: $gray-darkest; } - .fa-chevron-down { + .fa-chevron-down, { font-size: $dropdown-chevron-size; position: relative; top: -2px; diff --git a/app/assets/stylesheets/pages/builds.scss b/app/assets/stylesheets/pages/builds.scss index 50ec5110bf1..e87ffe4f374 100644 --- a/app/assets/stylesheets/pages/builds.scss +++ b/app/assets/stylesheets/pages/builds.scss @@ -333,8 +333,10 @@ svg { position: relative; - top: 2px; + top: 3px; margin-right: 3px; + width: 14px; + height: 14px; } } @@ -348,9 +350,10 @@ svg { position: relative; - top: 2px; + top: 3px; margin-right: 3px; - height: 13px; + height: 14px; + width: 14px; } a { @@ -369,7 +372,7 @@ .build-job { position: relative; - .fa-arrow-right { + .icon-arrow-right { position: absolute; left: 15px; top: 20px; @@ -379,7 +382,7 @@ &.active { font-weight: $gl-font-weight-bold; - .fa-arrow-right { + .icon-arrow-right { display: block; } } @@ -392,8 +395,7 @@ background-color: $row-hover; } - .fa-refresh { - font-size: 13px; + .icon-retry { margin-left: 3px; } } diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 8022547a6ad..85a8b2c8b97 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -63,34 +63,34 @@ module CiStatusHelper def ci_icon_for_status(status) if detailed_status?(status) - return custom_icon(status.icon) + return sprite_icon(status.icon) end icon_name = case status when 'success' - 'icon_status_success' + 'status_success' when 'success_with_warnings' - 'icon_status_warning' + 'status_warning' when 'failed' - 'icon_status_failed' + 'status_failed' when 'pending' - 'icon_status_pending' + 'status_pending' when 'running' - 'icon_status_running' + 'status_running' when 'play' - 'icon_play' + 'play' when 'created' - 'icon_status_created' + 'status_created' when 'skipped' - 'icon_status_skipped' + 'status_skipped' when 'manual' - 'icon_status_manual' + 'status_manual' else - 'icon_status_canceled' + 'status_canceled' end - custom_icon(icon_name) + sprite_icon(icon_name) end def pipeline_status_cache_key(pipeline_status) diff --git a/app/views/projects/jobs/_sidebar.html.haml b/app/views/projects/jobs/_sidebar.html.haml index 7da4ffd5e43..b5067367802 100644 --- a/app/views/projects/jobs/_sidebar.html.haml +++ b/app/views/projects/jobs/_sidebar.html.haml @@ -91,7 +91,7 @@ - builds.select{|build| build.status == build_status}.each do |build| .build-job{ class: sidebar_build_class(build, @build), data: { stage: build.stage } } = link_to project_job_path(@project, build) do - = icon('arrow-right') + = sprite_icon('arrow-right', size:16, css_class: 'icon-arrow-right') %span{ class: "ci-status-icon-#{build.status}" } = ci_icon_for_status(build.status) %span @@ -100,4 +100,5 @@ - else = build.id - if build.retried? - %i.fa.fa-refresh.has-tooltip{ data: { container: 'body', placement: 'bottom' }, title: 'Job was retried' } + %span.has-tooltip{ data: { container: 'body', placement: 'bottom' }, title: 'Job was retried' } + = sprite_icon('retry', size:16, css_class: 'icon-retry') From b2501c79569ef9b6ff3516be1924d9367794bc4f Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Thu, 28 Sep 2017 19:25:10 +0200 Subject: [PATCH 13/81] Fix the size of a status icon --- app/helpers/ci_status_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 85a8b2c8b97..4dd573c61f1 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -90,7 +90,7 @@ module CiStatusHelper 'status_canceled' end - sprite_icon(icon_name) + sprite_icon(icon_name, size: 16) end def pipeline_status_cache_key(pipeline_status) From fb1f75781d267a552a389407264a66198c5f47c8 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Thu, 28 Sep 2017 23:37:34 +0200 Subject: [PATCH 14/81] Fixed SVG Output Test --- spec/helpers/ci_status_helper_spec.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/helpers/ci_status_helper_spec.rb b/spec/helpers/ci_status_helper_spec.rb index 6a3945c0ebc..72fa23d6ae2 100644 --- a/spec/helpers/ci_status_helper_spec.rb +++ b/spec/helpers/ci_status_helper_spec.rb @@ -8,17 +8,13 @@ describe CiStatusHelper do describe '#ci_icon_for_status' do it 'renders to correct svg on success' do - expect(helper).to receive(:render) - .with('shared/icons/icon_status_success.svg', anything) - - helper.ci_icon_for_status(success_commit.status) + expect(helper.ci_icon_for_status(success_commit.status)) + .to have_content('status_success') end it 'renders the correct svg on failure' do - expect(helper).to receive(:render) - .with('shared/icons/icon_status_failed.svg', anything) - - helper.ci_icon_for_status(failed_commit.status) + expect(helper.ci_icon_for_status(failed_commit.status)) + .to have_content('status_failed') end end From 6c1210d1d27007a0210490cb9ed444dc54c6a2d6 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Fri, 29 Sep 2017 09:17:10 +0200 Subject: [PATCH 15/81] Need to render it into String cause its a content_tag --- spec/helpers/ci_status_helper_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/helpers/ci_status_helper_spec.rb b/spec/helpers/ci_status_helper_spec.rb index 72fa23d6ae2..2b658bb7fac 100644 --- a/spec/helpers/ci_status_helper_spec.rb +++ b/spec/helpers/ci_status_helper_spec.rb @@ -8,12 +8,12 @@ describe CiStatusHelper do describe '#ci_icon_for_status' do it 'renders to correct svg on success' do - expect(helper.ci_icon_for_status(success_commit.status)) + expect(helper.ci_icon_for_status(success_commit.status).to_s) .to have_content('status_success') end it 'renders the correct svg on failure' do - expect(helper.ci_icon_for_status(failed_commit.status)) + expect(helper.ci_icon_for_status(failed_commit.status).to_s) .to have_content('status_failed') end end From f8ce8d2817a1fc852b7b1807217275ccc242a2f9 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Fri, 29 Sep 2017 11:19:51 +0200 Subject: [PATCH 16/81] CHanged to String Statuses --- spec/helpers/ci_status_helper_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/helpers/ci_status_helper_spec.rb b/spec/helpers/ci_status_helper_spec.rb index 2b658bb7fac..224e01c492a 100644 --- a/spec/helpers/ci_status_helper_spec.rb +++ b/spec/helpers/ci_status_helper_spec.rb @@ -8,13 +8,13 @@ describe CiStatusHelper do describe '#ci_icon_for_status' do it 'renders to correct svg on success' do - expect(helper.ci_icon_for_status(success_commit.status).to_s) - .to have_content('status_success') + expect(helper.ci_icon_for_status('success').to_s) + .to include 'status_success' end it 'renders the correct svg on failure' do - expect(helper.ci_icon_for_status(failed_commit.status).to_s) - .to have_content('status_failed') + expect(helper.ci_icon_for_status('failed'.status).to_s) + .to include 'status_failed' end end From f5c8c511d058b20bba130569eaf90916e363e2ea Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Fri, 29 Sep 2017 12:47:55 +0200 Subject: [PATCH 17/81] Now one test works lets get the other one green --- spec/helpers/ci_status_helper_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/helpers/ci_status_helper_spec.rb b/spec/helpers/ci_status_helper_spec.rb index 224e01c492a..bc2422aba90 100644 --- a/spec/helpers/ci_status_helper_spec.rb +++ b/spec/helpers/ci_status_helper_spec.rb @@ -13,7 +13,7 @@ describe CiStatusHelper do end it 'renders the correct svg on failure' do - expect(helper.ci_icon_for_status('failed'.status).to_s) + expect(helper.ci_icon_for_status('failed').to_s) .to include 'status_failed' end end From df43481746193b3dd27eb4395911529c386ec4b6 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Fri, 29 Sep 2017 19:40:08 +0200 Subject: [PATCH 18/81] Comma to much --- app/assets/stylesheets/framework/dropdowns.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index 9e49fb41a41..63697fd38a7 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -99,7 +99,7 @@ color: $gray-darkest; } - .fa-chevron-down, { + .fa-chevron-down { font-size: $dropdown-chevron-size; position: relative; top: -2px; From e3c7d26425808f3bb68e1a03c46ff3e138cb65c9 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Mon, 2 Oct 2017 10:40:32 +0200 Subject: [PATCH 19/81] Updated also Badge + Dropdown Icons --- app/views/ci/status/_badge.html.haml | 4 ++-- app/views/ci/status/_dropdown_graph_badge.html.haml | 4 ++-- lib/gitlab/ci/status/canceled.rb | 2 +- lib/gitlab/ci/status/created.rb | 2 +- lib/gitlab/ci/status/failed.rb | 2 +- lib/gitlab/ci/status/manual.rb | 2 +- lib/gitlab/ci/status/pending.rb | 2 +- lib/gitlab/ci/status/running.rb | 2 +- lib/gitlab/ci/status/skipped.rb | 2 +- lib/gitlab/ci/status/success.rb | 2 +- lib/gitlab/ci/status/success_warning.rb | 2 +- spec/lib/gitlab/ci/status/canceled_spec.rb | 2 +- spec/lib/gitlab/ci/status/created_spec.rb | 2 +- spec/lib/gitlab/ci/status/failed_spec.rb | 2 +- spec/lib/gitlab/ci/status/manual_spec.rb | 2 +- spec/lib/gitlab/ci/status/pending_spec.rb | 2 +- spec/lib/gitlab/ci/status/running_spec.rb | 2 +- spec/lib/gitlab/ci/status/skipped_spec.rb | 2 +- spec/lib/gitlab/ci/status/success_spec.rb | 2 +- spec/lib/gitlab/ci/status/success_warning_spec.rb | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/views/ci/status/_badge.html.haml b/app/views/ci/status/_badge.html.haml index 39c7fb0eba2..35a3563dff1 100644 --- a/app/views/ci/status/_badge.html.haml +++ b/app/views/ci/status/_badge.html.haml @@ -5,9 +5,9 @@ - if link && status.has_details? = link_to status.details_path, class: css_classes, title: title do - = custom_icon(status.icon) + = sprite_icon(status.icon) = status.text - else %span{ class: css_classes, title: title } - = custom_icon(status.icon) + = sprite_icon(status.icon) = status.text diff --git a/app/views/ci/status/_dropdown_graph_badge.html.haml b/app/views/ci/status/_dropdown_graph_badge.html.haml index dcfb7f0c32d..75f7c127618 100644 --- a/app/views/ci/status/_dropdown_graph_badge.html.haml +++ b/app/views/ci/status/_dropdown_graph_badge.html.haml @@ -7,11 +7,11 @@ - if status.has_details? = link_to status.details_path, class: 'mini-pipeline-graph-dropdown-item', data: { toggle: 'tooltip', title: tooltip, container: 'body' } do - %span{ class: klass }= custom_icon(status.icon) + %span{ class: klass }= sprite_icon(status.icon) %span.ci-build-text= subject.name - else .menu-item.mini-pipeline-graph-dropdown-item{ data: { toggle: 'tooltip', title: tooltip, container: 'body' } } - %span{ class: klass }= custom_icon(status.icon) + %span{ class: klass }= sprite_icon(status.icon) %span.ci-build-text= subject.name - if status.has_action? diff --git a/lib/gitlab/ci/status/canceled.rb b/lib/gitlab/ci/status/canceled.rb index e5fdc1f8136..e6195a60d4f 100644 --- a/lib/gitlab/ci/status/canceled.rb +++ b/lib/gitlab/ci/status/canceled.rb @@ -11,7 +11,7 @@ module Gitlab end def icon - 'icon_status_canceled' + 'status_canceled' end def favicon diff --git a/lib/gitlab/ci/status/created.rb b/lib/gitlab/ci/status/created.rb index d188bd286a6..846f00b83dd 100644 --- a/lib/gitlab/ci/status/created.rb +++ b/lib/gitlab/ci/status/created.rb @@ -11,7 +11,7 @@ module Gitlab end def icon - 'icon_status_created' + 'status_created' end def favicon diff --git a/lib/gitlab/ci/status/failed.rb b/lib/gitlab/ci/status/failed.rb index 38e45714c22..27ce85bd3ed 100644 --- a/lib/gitlab/ci/status/failed.rb +++ b/lib/gitlab/ci/status/failed.rb @@ -11,7 +11,7 @@ module Gitlab end def icon - 'icon_status_failed' + 'status_failed' end def favicon diff --git a/lib/gitlab/ci/status/manual.rb b/lib/gitlab/ci/status/manual.rb index a4a7edadac9..fc387e2fd25 100644 --- a/lib/gitlab/ci/status/manual.rb +++ b/lib/gitlab/ci/status/manual.rb @@ -11,7 +11,7 @@ module Gitlab end def icon - 'icon_status_manual' + 'status_manual' end def favicon diff --git a/lib/gitlab/ci/status/pending.rb b/lib/gitlab/ci/status/pending.rb index 5164260b861..6780780db32 100644 --- a/lib/gitlab/ci/status/pending.rb +++ b/lib/gitlab/ci/status/pending.rb @@ -11,7 +11,7 @@ module Gitlab end def icon - 'icon_status_pending' + 'status_pending' end def favicon diff --git a/lib/gitlab/ci/status/running.rb b/lib/gitlab/ci/status/running.rb index 993937e98ca..ee13905e46d 100644 --- a/lib/gitlab/ci/status/running.rb +++ b/lib/gitlab/ci/status/running.rb @@ -11,7 +11,7 @@ module Gitlab end def icon - 'icon_status_running' + 'status_running' end def favicon diff --git a/lib/gitlab/ci/status/skipped.rb b/lib/gitlab/ci/status/skipped.rb index 0c942920b02..0dbdc4de426 100644 --- a/lib/gitlab/ci/status/skipped.rb +++ b/lib/gitlab/ci/status/skipped.rb @@ -11,7 +11,7 @@ module Gitlab end def icon - 'icon_status_skipped' + 'status_skipped' end def favicon diff --git a/lib/gitlab/ci/status/success.rb b/lib/gitlab/ci/status/success.rb index d7af98857b0..731013ec017 100644 --- a/lib/gitlab/ci/status/success.rb +++ b/lib/gitlab/ci/status/success.rb @@ -11,7 +11,7 @@ module Gitlab end def icon - 'icon_status_success' + 'status_success' end def favicon diff --git a/lib/gitlab/ci/status/success_warning.rb b/lib/gitlab/ci/status/success_warning.rb index 4d7d82e04cf..32b4cf43e48 100644 --- a/lib/gitlab/ci/status/success_warning.rb +++ b/lib/gitlab/ci/status/success_warning.rb @@ -15,7 +15,7 @@ module Gitlab end def icon - 'icon_status_warning' + 'status_warning' end def group diff --git a/spec/lib/gitlab/ci/status/canceled_spec.rb b/spec/lib/gitlab/ci/status/canceled_spec.rb index 530639a5897..dc74d7e28c5 100644 --- a/spec/lib/gitlab/ci/status/canceled_spec.rb +++ b/spec/lib/gitlab/ci/status/canceled_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::Canceled do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_canceled' } + it { expect(subject.icon).to eq 'status_canceled' } end describe '#favicon' do diff --git a/spec/lib/gitlab/ci/status/created_spec.rb b/spec/lib/gitlab/ci/status/created_spec.rb index aef982e17f1..ce4333f2aca 100644 --- a/spec/lib/gitlab/ci/status/created_spec.rb +++ b/spec/lib/gitlab/ci/status/created_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::Created do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_created' } + it { expect(subject.icon).to eq 'status_created' } end describe '#favicon' do diff --git a/spec/lib/gitlab/ci/status/failed_spec.rb b/spec/lib/gitlab/ci/status/failed_spec.rb index 9a25743885c..a4a92117c7f 100644 --- a/spec/lib/gitlab/ci/status/failed_spec.rb +++ b/spec/lib/gitlab/ci/status/failed_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::Failed do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_failed' } + it { expect(subject.icon).to eq 'status_failed' } end describe '#favicon' do diff --git a/spec/lib/gitlab/ci/status/manual_spec.rb b/spec/lib/gitlab/ci/status/manual_spec.rb index 6fdc3801d71..0463f2e1aff 100644 --- a/spec/lib/gitlab/ci/status/manual_spec.rb +++ b/spec/lib/gitlab/ci/status/manual_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::Manual do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_manual' } + it { expect(subject.icon).to eq 'status_manual' } end describe '#favicon' do diff --git a/spec/lib/gitlab/ci/status/pending_spec.rb b/spec/lib/gitlab/ci/status/pending_spec.rb index ffc53f0506b..0e25358dd8a 100644 --- a/spec/lib/gitlab/ci/status/pending_spec.rb +++ b/spec/lib/gitlab/ci/status/pending_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::Pending do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_pending' } + it { expect(subject.icon).to eq 'status_pending' } end describe '#favicon' do diff --git a/spec/lib/gitlab/ci/status/running_spec.rb b/spec/lib/gitlab/ci/status/running_spec.rb index 0babf1fb54e..9c9d431bb5d 100644 --- a/spec/lib/gitlab/ci/status/running_spec.rb +++ b/spec/lib/gitlab/ci/status/running_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::Running do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_running' } + it { expect(subject.icon).to eq 'status_running' } end describe '#favicon' do diff --git a/spec/lib/gitlab/ci/status/skipped_spec.rb b/spec/lib/gitlab/ci/status/skipped_spec.rb index 670747c9f0b..63694ca0ea6 100644 --- a/spec/lib/gitlab/ci/status/skipped_spec.rb +++ b/spec/lib/gitlab/ci/status/skipped_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::Skipped do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_skipped' } + it { expect(subject.icon).to eq 'status_skipped' } end describe '#favicon' do diff --git a/spec/lib/gitlab/ci/status/success_spec.rb b/spec/lib/gitlab/ci/status/success_spec.rb index ff65b074808..2f67df71c4f 100644 --- a/spec/lib/gitlab/ci/status/success_spec.rb +++ b/spec/lib/gitlab/ci/status/success_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::Success do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_success' } + it { expect(subject.icon).to eq 'status_success' } end describe '#favicon' do diff --git a/spec/lib/gitlab/ci/status/success_warning_spec.rb b/spec/lib/gitlab/ci/status/success_warning_spec.rb index 7e2269397c6..4582354e739 100644 --- a/spec/lib/gitlab/ci/status/success_warning_spec.rb +++ b/spec/lib/gitlab/ci/status/success_warning_spec.rb @@ -14,7 +14,7 @@ describe Gitlab::Ci::Status::SuccessWarning do end describe '#icon' do - it { expect(subject.icon).to eq 'icon_status_warning' } + it { expect(subject.icon).to eq 'status_warning' } end describe '#group' do From d01d509bd8612f9879fa762de8ea3763bcff81cf Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Thu, 5 Oct 2017 23:16:37 +0200 Subject: [PATCH 20/81] Fixing Icons --- .../components/graph/action_component.vue | 18 ++++--- .../graph/dropdown_action_component.vue | 10 +++- .../graph/dropdown_job_component.vue | 2 +- .../components/graph/job_component.vue | 2 +- .../pipelines/components/stage.vue | 10 ++-- .../components/mr_widget_pipeline.js | 12 ++--- .../javascripts/vue_shared/ci_status_icons.js | 43 --------------- .../vue_shared/components/ci_icon.vue | 15 +++--- .../vue_shared/components/icon.vue | 54 +++++++++++++++++++ .../stylesheets/pages/merge_requests.scss | 5 +- app/assets/stylesheets/pages/pipelines.scss | 8 +-- spec/javascripts/jobs/mock_data.js | 2 +- .../pipelines/graph/action_component_spec.js | 2 +- .../pipelines/graph/job_component_spec.js | 2 +- spec/javascripts/pipelines/graph/mock_data.js | 12 ++--- .../graph/stage_column_component_spec.js | 2 +- .../components/mr_widget_pipeline_spec.js | 10 +--- .../vue_shared/ci_action_icons_spec.js | 27 ---------- .../vue_shared/ci_status_icon_spec.js | 27 ---------- 19 files changed, 112 insertions(+), 151 deletions(-) delete mode 100644 app/assets/javascripts/vue_shared/ci_status_icons.js create mode 100644 app/assets/javascripts/vue_shared/components/icon.vue delete mode 100644 spec/javascripts/vue_shared/ci_action_icons_spec.js delete mode 100644 spec/javascripts/vue_shared/ci_status_icon_spec.js diff --git a/app/assets/javascripts/pipelines/components/graph/action_component.vue b/app/assets/javascripts/pipelines/components/graph/action_component.vue index 54227425d2a..59a944f74a9 100644 --- a/app/assets/javascripts/pipelines/components/graph/action_component.vue +++ b/app/assets/javascripts/pipelines/components/graph/action_component.vue @@ -1,6 +1,7 @@ @@ -145,9 +142,10 @@ export default { aria-expanded="false"> 1 ? 'stages' : 'stage'; }, @@ -38,8 +36,10 @@ export default { diff --git a/spec/javascripts/vue_shared/components/icon_spec.js b/spec/javascripts/vue_shared/components/icon_spec.js index e2922ca2ca1..104da4473ce 100644 --- a/spec/javascripts/vue_shared/components/icon_spec.js +++ b/spec/javascripts/vue_shared/components/icon_spec.js @@ -1,41 +1,44 @@ import Vue from 'vue'; import Icon from '~/vue_shared/components/icon.vue'; - -const IconComponent = Vue.extend(Icon); +import mountComponent from '../../helpers/vue_mount_component_helper'; describe('Sprite Icon Component', function () { describe('Initialization', function () { + let icon; + beforeEach(function () { - this.propsData = { + const IconComponent = Vue.extend(Icon); + + icon = mountComponent(IconComponent, { name: 'test', size: 99, cssClasses: 'extraclasses', - }; + }); + }); - this.icon = new IconComponent({ - propsData: this.propsData, - }).$mount(); + afterEach(() => { + icon.$destroy(); }); it('should return a defined Vue component', function () { - expect(this.icon).toBeDefined(); + expect(icon).toBeDefined(); }); it('should have as a child element', function () { - expect(this.icon.$el.tagName).toBe('svg'); + expect(icon.$el.tagName).toBe('svg'); }); it('should have as a child element with the correct href', function () { - expect(this.icon.$el.firstChild.tagName).toBe('use'); - expect(this.icon.$el.firstChild.getAttribute('xlink:href')).toBe(`${gon.sprite_icons}#test`); + expect(icon.$el.firstChild.tagName).toBe('use'); + expect(icon.$el.firstChild.getAttribute('xlink:href')).toBe(`${gon.sprite_icons}#test`); }); it('should properly compute iconSizeClass', function () { - expect(this.icon.iconSizeClass).toBe('s99'); + expect(icon.iconSizeClass).toBe('s99'); }); it('should properly render img css', function () { - const classList = this.icon.$el.classList; + const classList = icon.$el.classList; const containsSizeClass = classList.contains('s99'); const containsCustomClass = classList.contains('extraclasses'); expect(containsSizeClass).toBe(true); From 5c8a614c114226f53616255ac7322d17056be847 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Wed, 18 Oct 2017 12:34:43 +0200 Subject: [PATCH 31/81] Added Missing Semicolon --- .../javascripts/pipelines/components/graph/action_component.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/pipelines/components/graph/action_component.vue b/app/assets/javascripts/pipelines/components/graph/action_component.vue index 0ca86d09dbd..547140b1a43 100644 --- a/app/assets/javascripts/pipelines/components/graph/action_component.vue +++ b/app/assets/javascripts/pipelines/components/graph/action_component.vue @@ -39,7 +39,7 @@ computed: { cssClass() { - const actionIconDash = gl.text.dasherize(this.actionIcon) + const actionIconDash = gl.text.dasherize(this.actionIcon); return `${actionIconDash} js-icon-${actionIconDash}`; }, }, From 1c015eda90dabb45e5f9f0344ec6dfb9be6eba81 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Mon, 30 Oct 2017 12:31:20 +0100 Subject: [PATCH 32/81] Fixed different sizes --- .../pipelines/components/stage.vue | 6 +++- app/assets/stylesheets/pages/pipelines.scss | 33 ++++++++++++++++--- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/pipelines/components/stage.vue b/app/assets/javascripts/pipelines/components/stage.vue index 24a15339622..c8bccb4f20d 100644 --- a/app/assets/javascripts/pipelines/components/stage.vue +++ b/app/assets/javascripts/pipelines/components/stage.vue @@ -122,6 +122,10 @@ export default { triggerButtonClass() { return `ci-status-icon-${this.stage.status.group}`; }, + + borderlessIcon() { + return `${this.stage.status.icon}_borderless`; + } }, }; @@ -145,7 +149,7 @@ export default { aria-hidden="true" :aria-label="stage.title"> + :name="borderlessIcon"/> Date: Mon, 30 Oct 2017 13:25:26 +0100 Subject: [PATCH 33/81] Missing Comma added --- app/assets/javascripts/pipelines/components/stage.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/pipelines/components/stage.vue b/app/assets/javascripts/pipelines/components/stage.vue index c8bccb4f20d..ac9d9c901ca 100644 --- a/app/assets/javascripts/pipelines/components/stage.vue +++ b/app/assets/javascripts/pipelines/components/stage.vue @@ -125,7 +125,7 @@ export default { borderlessIcon() { return `${this.stage.status.icon}_borderless`; - } + }, }, }; From b9236909b39d5e1b6a44d66fa74de211cd4ff7d5 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Mon, 30 Oct 2017 15:12:07 +0100 Subject: [PATCH 34/81] Needed to change 0px to 0 --- app/assets/stylesheets/pages/pipelines.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss index 237224cb770..afe8cdd91a9 100644 --- a/app/assets/stylesheets/pages/pipelines.scss +++ b/app/assets/stylesheets/pages/pipelines.scss @@ -770,7 +770,7 @@ button.mini-pipeline-graph-dropdown-toggle { svg.icon-action-retry { width: 16px; height: 16px; - top: 0px; + top: 0; left: -3px; } From 4485dc831ff23417cb398f656c7f91e47eeb9905 Mon Sep 17 00:00:00 2001 From: Brendan O'Leary Date: Mon, 30 Oct 2017 17:29:56 +0000 Subject: [PATCH 35/81] Fixes to changed / broken links --- doc/university/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/university/README.md b/doc/university/README.md index 170582bcd0c..676a06e7d10 100644 --- a/doc/university/README.md +++ b/doc/university/README.md @@ -51,10 +51,10 @@ The curriculum is composed of GitLab videos, screencasts, presentations, project #### 1.5. Migrating from other Source Control -1. [Migrating from BitBucket/Stash](https://docs.gitlab.com/ee/workflow/importing/import_projects_from_bitbucket.html) -1. [Migrating from GitHub](https://docs.gitlab.com/ee/workflow/importing/import_projects_from_github.html) -1. [Migrating from SVN](https://docs.gitlab.com/ee/workflow/importing/migrating_from_svn.html) -1. [Migrating from Fogbugz](https://docs.gitlab.com/ee/workflow/importing/import_projects_from_fogbugz.html) +1. [Migrating from BitBucket/Stash](https://docs.gitlab.com/ee/user/project/import/bitbucket.html) +1. [Migrating from GitHub](https://docs.gitlab.com/ee/user/project/import/github.html) +1. [Migrating from SVN](https://docs.gitlab.com/ee/user/project/import/svn.html) +1. [Migrating from Fogbugz](https://docs.gitlab.com/ee/user/project/import/fogbugz.html) #### 1.6. GitLab Inc. @@ -76,13 +76,13 @@ The curriculum is composed of GitLab videos, screencasts, presentations, project - Being part of our Great Community and Contributing to GitLab 1. [Getting Started with the GitLab Development Kit (GDK)](https://about.gitlab.com/2016/06/08/getting-started-with-gitlab-development-kit/) 1. [Contributing Technical Articles to the GitLab Blog](https://about.gitlab.com/2016/01/26/call-for-writers/) -1. [GitLab Training Workshops](https://about.gitlab.com/training) +1. [GitLab Training Workshops](https://docs.gitlab.com/ce/university/training/end-user/) +1. [GitLab Professional Services](https://about.gitlab.com/services/) #### 1.8 GitLab Training Material 1. [Git and GitLab Terminology](glossary/README.md) 1. [Git and GitLab Workshop - Slides](https://docs.google.com/presentation/d/1JzTYD8ij9slejV2-TO-NzjCvlvj6mVn9BORePXNJoMI/edit?usp=drive_web) -1. [Git and GitLab Revision](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/university/training/end-user) --- From 6bd2d594d78adf03885015e078eb38832f10ee8a Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Tue, 31 Oct 2017 11:20:40 +0200 Subject: [PATCH 36/81] Change to new GitLab Runner name --- doc/ci/docker/using_docker_build.md | 8 ++++---- doc/ci/docker/using_docker_images.md | 4 ++-- doc/ci/examples/php.md | 4 ++-- .../test-and-deploy-python-application-to-heroku.md | 2 +- .../test-and-deploy-ruby-application-to-heroku.md | 2 +- doc/ci/git_submodules.md | 4 ++-- doc/development/testing_guide/testing_levels.md | 2 +- doc/install/requirements.md | 2 +- doc/university/glossary/README.md | 2 +- doc/university/training/topics/git_log.md | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md index 4586caa457d..0a2419b7ed2 100644 --- a/doc/ci/docker/using_docker_build.md +++ b/doc/ci/docker/using_docker_build.md @@ -31,12 +31,12 @@ There are three methods to enable the use of `docker build` and `docker run` dur The simplest approach is to install GitLab Runner in `shell` execution mode. GitLab Runner then executes job scripts as the `gitlab-runner` user. -1. Install [GitLab Runner](https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/#installation). +1. Install [GitLab Runner](https://gitlab.com/gitlab-org/gitlab-runner/#installation). 1. During GitLab Runner installation select `shell` as method of executing job scripts or use command: ```bash - sudo gitlab-ci-multi-runner register -n \ + sudo gitlab-runner register -n \ --url https://gitlab.com/ \ --registration-token REGISTRATION_TOKEN \ --executor shell \ @@ -93,7 +93,7 @@ In order to do that, follow the steps: mode: ```bash - sudo gitlab-ci-multi-runner register -n \ + sudo gitlab-runner register -n \ --url https://gitlab.com/ \ --registration-token REGISTRATION_TOKEN \ --executor docker \ @@ -178,7 +178,7 @@ In order to do that, follow the steps: 1. Register GitLab Runner from the command line to use `docker` and share `/var/run/docker.sock`: ```bash - sudo gitlab-ci-multi-runner register -n \ + sudo gitlab-runner register -n \ --url https://gitlab.com/ \ --registration-token REGISTRATION_TOKEN \ --executor docker \ diff --git a/doc/ci/docker/using_docker_images.md b/doc/ci/docker/using_docker_images.md index f7493794b6a..ecb8f15c851 100644 --- a/doc/ci/docker/using_docker_images.md +++ b/doc/ci/docker/using_docker_images.md @@ -501,8 +501,8 @@ First start with creating a file named `build_script`: ```bash cat < build_script -git clone https://gitlab.com/gitlab-org/gitlab-ci-multi-runner.git /builds/gitlab-org/gitlab-ci-multi-runner -cd /builds/gitlab-org/gitlab-ci-multi-runner +git clone https://gitlab.com/gitlab-org/gitlab-runner.git /builds/gitlab-org/gitlab-runner +cd /builds/gitlab-org/gitlab-runner make EOF ``` diff --git a/doc/ci/examples/php.md b/doc/ci/examples/php.md index f2dd12b67d3..6768a2e012f 100644 --- a/doc/ci/examples/php.md +++ b/doc/ci/examples/php.md @@ -267,10 +267,10 @@ terminal execute: ```bash # Check using docker executor -gitlab-ci-multi-runner exec docker test:app +gitlab-runner exec docker test:app # Check using shell executor -gitlab-ci-multi-runner exec shell test:app +gitlab-runner exec shell test:app ``` ## Example project diff --git a/doc/ci/examples/test-and-deploy-python-application-to-heroku.md b/doc/ci/examples/test-and-deploy-python-application-to-heroku.md index 73aebaf6d7f..7ffb600386e 100644 --- a/doc/ci/examples/test-and-deploy-python-application-to-heroku.md +++ b/doc/ci/examples/test-and-deploy-python-application-to-heroku.md @@ -57,7 +57,7 @@ First install [Docker Engine](https://docs.docker.com/installation/). To build this project you also need to have [GitLab Runner](https://about.gitlab.com/gitlab-ci/#gitlab-runner). You can use public runners available on `gitlab.com`, but you can register your own: ``` -gitlab-ci-multi-runner register \ +gitlab-runner register \ --non-interactive \ --url "https://gitlab.com/" \ --registration-token "PROJECT_REGISTRATION_TOKEN" \ diff --git a/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md b/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md index 6fa64a67e82..4b5030d51f2 100644 --- a/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md +++ b/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md @@ -52,7 +52,7 @@ First install [Docker Engine](https://docs.docker.com/installation/). To build this project you also need to have [GitLab Runner](https://about.gitlab.com/gitlab-ci/#gitlab-runner). You can use public runners available on `gitlab.com`, but you can register your own: ``` -gitlab-ci-multi-runner register \ +gitlab-runner register \ --non-interactive \ --url "https://gitlab.com/" \ --registration-token "PROJECT_REGISTRATION_TOKEN" \ diff --git a/doc/ci/git_submodules.md b/doc/ci/git_submodules.md index 36c6e153d95..c83d3f6f248 100644 --- a/doc/ci/git_submodules.md +++ b/doc/ci/git_submodules.md @@ -61,7 +61,7 @@ correctly with your CI jobs: 1. First, make sure you have used [relative URLs](#configuring-the-gitmodules-file) for the submodules located in the same GitLab server. -1. Next, if you are using `gitlab-ci-multi-runner` v1.10+, you can set the +1. Next, if you are using `gitlab-runner` v1.10+, you can set the `GIT_SUBMODULE_STRATEGY` variable to either `normal` or `recursive` to tell the runner to fetch your submodules before the job: ```yaml @@ -71,7 +71,7 @@ correctly with your CI jobs: See the [`.gitlab-ci.yml` reference](yaml/README.md#git-submodule-strategy) for more details about `GIT_SUBMODULE_STRATEGY`. -1. If you are using an older version of `gitlab-ci-multi-runner`, then use +1. If you are using an older version of `gitlab-runner`, then use `git submodule sync/update` in `before_script`: ```yaml diff --git a/doc/development/testing_guide/testing_levels.md b/doc/development/testing_guide/testing_levels.md index 9b9ba0baa71..1cbd4350284 100644 --- a/doc/development/testing_guide/testing_levels.md +++ b/doc/development/testing_guide/testing_levels.md @@ -126,7 +126,7 @@ always in-sync with the codebase. [GitLab Workhorse]: https://gitlab.com/gitlab-org/gitlab-workhorse [Gitaly]: https://gitlab.com/gitlab-org/gitaly [GitLab Pages]: https://gitlab.com/gitlab-org/gitlab-pages -[GitLab Runner]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner +[GitLab Runner]: https://gitlab.com/gitlab-org/gitlab-runner [GitLab Omnibus]: https://gitlab.com/gitlab-org/omnibus-gitlab [GitLab QA]: https://gitlab.com/gitlab-org/gitlab-qa [part of GitLab Rails]: https://gitlab.com/gitlab-org/gitlab-ce/tree/master/qa diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 3d7becd18fc..2bf7d2129f6 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -184,7 +184,7 @@ Runner. We recommend using a separate machine for each GitLab Runner, if you plan to use the CI features. -[security reasons]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/security/index.md +[security reasons]: https://gitlab.com/gitlab-org/gitlab-runner/blob/master/docs/security/index.md ## Supported web browsers diff --git a/doc/university/glossary/README.md b/doc/university/glossary/README.md index 9544de41b9a..f29240ed4af 100644 --- a/doc/university/glossary/README.md +++ b/doc/university/glossary/README.md @@ -456,7 +456,7 @@ A route table contains rules (called routes) that determine where network traffi ### Runners -Actual build machines/containers that [run and execute tests](https://gitlab.com/gitlab-org/gitlab-ci-multi-runner) you have specified to be run on GitLab CI. +Actual build machines/containers that [run and execute tests](https://gitlab.com/gitlab-org/gitlab-runner) you have specified to be run on GitLab CI. ### Sidekiq diff --git a/doc/university/training/topics/git_log.md b/doc/university/training/topics/git_log.md index 32ebceff491..a3a2077a69b 100644 --- a/doc/university/training/topics/git_log.md +++ b/doc/university/training/topics/git_log.md @@ -49,8 +49,8 @@ git log --since=1.month.ago --until=3.weeks.ago ``` cd ~/workspace -git clone git@gitlab.com:gitlab-org/gitlab-ci-multi-runner.git -cd gitlab-ci-multi-runner +git clone git@gitlab.com:gitlab-org/gitlab-runner.git +cd gitlab-runner git log --author="Travis" git log --since=1.month.ago --until=3.weeks.ago git log --since=1.month.ago --until=1.day.ago --author="Travis" From 6b662718e07ee6e2c51c11525bc6b95927065f4c Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 19 Oct 2017 13:36:47 -0500 Subject: [PATCH 37/81] Use count expectation so `all` finder will wait (patience) Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/34435 Address flakey specs --- .../filtered_search/recent_searches_spec.rb | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index eef7988e2bd..4fff056cb70 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -27,9 +27,8 @@ describe 'Recent searches', :js do input_filtered_search('foo', submit: true) input_filtered_search('bar', submit: true) - items = all('.filtered-search-history-dropdown-item', visible: false) + items = all('.filtered-search-history-dropdown-item', visible: false, count: 2) - expect(items.count).to eq(2) expect(items[0].text).to eq('bar') expect(items[1].text).to eq('foo') end @@ -38,9 +37,8 @@ describe 'Recent searches', :js do visit project_issues_path(project_1, label_name: 'foo', search: 'bar') visit project_issues_path(project_1, label_name: 'qux', search: 'garply') - items = all('.filtered-search-history-dropdown-item', visible: false) + items = all('.filtered-search-history-dropdown-item', visible: false, count: 2) - expect(items.count).to eq(2) expect(items[0].text).to eq('label:~qux garply') expect(items[1].text).to eq('label:~foo bar') end @@ -50,9 +48,8 @@ describe 'Recent searches', :js do visit project_issues_path(project_1, search: 'foo') - items = all('.filtered-search-history-dropdown-item', visible: false) + items = all('.filtered-search-history-dropdown-item', visible: false, count: 3) - expect(items.count).to eq(3) expect(items[0].text).to eq('foo') expect(items[1].text).to eq('saved1') expect(items[2].text).to eq('saved2') @@ -69,9 +66,8 @@ describe 'Recent searches', :js do input_filtered_search('more', submit: true) input_filtered_search('things', submit: true) - items = all('.filtered-search-history-dropdown-item', visible: false) + items = all('.filtered-search-history-dropdown-item', visible: false, count: 2) - expect(items.count).to eq(2) expect(items[0].text).to eq('things') expect(items[1].text).to eq('more') end @@ -80,7 +76,7 @@ describe 'Recent searches', :js do set_recent_searches(project_1_local_storage_key, '["foo", "bar"]') visit project_issues_path(project_1) - all('.filtered-search-history-dropdown-item', visible: false)[0].trigger('click') + all('.filtered-search-history-dropdown-item', visible: false, count: 2)[0].trigger('click') wait_for_filtered_search('foo') expect(find('.filtered-search').value.strip).to eq('foo') @@ -90,12 +86,10 @@ describe 'Recent searches', :js do set_recent_searches(project_1_local_storage_key, '["foo"]') visit project_issues_path(project_1) - items_before = all('.filtered-search-history-dropdown-item', visible: false) - - expect(items_before.count).to eq(1) + all('.filtered-search-history-dropdown-item', visible: false, count: 1) find('.filtered-search-history-clear-button', visible: false).trigger('click') - items_after = all('.filtered-search-history-dropdown-item', visible: false) + items_after = all('.filtered-search-history-dropdown-item', visible: false, count: 0) expect(items_after.count).to eq(0) end From da4c0be012953928ac4a55f7a243a3765cc67601 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Sat, 14 Oct 2017 01:05:54 -0500 Subject: [PATCH 38/81] remove needlessly complicated, duplicate css class for expanded settings panels --- app/assets/javascripts/settings_panels.js | 45 +++++++++++----------- app/assets/stylesheets/pages/settings.scss | 9 ++--- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/assets/javascripts/settings_panels.js b/app/assets/javascripts/settings_panels.js index 8635ccece6e..d34a21b37e1 100644 --- a/app/assets/javascripts/settings_panels.js +++ b/app/assets/javascripts/settings_panels.js @@ -1,34 +1,26 @@ -function expandSectionParent($section, $content) { - $section.addClass('expanded'); - $content.off('animationend.expandSectionParent'); -} - function expandSection($section) { $section.find('.js-settings-toggle').text('Collapse'); - - const $content = $section.find('.settings-content'); - $content.addClass('expanded').off('scroll.expandSection').scrollTop(0); - - if ($content.hasClass('no-animate')) { - expandSectionParent($section, $content); - } else { - $content.on('animationend.expandSectionParent', () => expandSectionParent($section, $content)); + $section.find('.settings-content').off('scroll.expandSection').scrollTop(0); + $section.addClass('expanded'); + if (!$section.hasClass('no-animate')) { + $section.addClass('animating') + .one('animationend.animateSection', () => $section.removeClass('animating')); } } function closeSection($section) { $section.find('.js-settings-toggle').text('Expand'); - - const $content = $section.find('.settings-content'); - $content.removeClass('expanded').on('scroll.expandSection', () => expandSection($section)); - + $section.find('.settings-content').on('scroll.expandSection', () => expandSection($section)); $section.removeClass('expanded'); + if (!$section.hasClass('no-animate')) { + $section.addClass('animating') + .one('animationend.animateSection', () => $section.removeClass('animating')); + } } function toggleSection($section) { - const $content = $section.find('.settings-content'); - $content.removeClass('no-animate'); - if ($content.hasClass('expanded')) { + $section.removeClass('no-animate'); + if ($section.hasClass('expanded')) { closeSection($section); } else { expandSection($section); @@ -39,10 +31,19 @@ export default function initSettingsPanels() { $('.settings').each((i, elm) => { const $section = $(elm); $section.on('click.toggleSection', '.js-settings-toggle', () => toggleSection($section)); - $section.find('.settings-content:not(.expanded)').on('scroll.expandSection', () => expandSection($section)); + + if (!$section.hasClass('expanded')) { + $section.find('.settings-content').on('scroll.expandSection', () => { + $section.removeClass('no-animate'); + expandSection($section); + }); + } }); if (location.hash) { - expandSection($(location.hash)); + const $target = $(location.hash); + if ($target.length && $target.hasClass('.settings')) { + expandSection($target); + } } } diff --git a/app/assets/stylesheets/pages/settings.scss b/app/assets/stylesheets/pages/settings.scss index 41a6ba2023a..91ad7f2151b 100644 --- a/app/assets/stylesheets/pages/settings.scss +++ b/app/assets/stylesheets/pages/settings.scss @@ -23,15 +23,14 @@ } .settings { - overflow: hidden; border-bottom: 1px solid $gray-darker; &:first-of-type { margin-top: 10px; } - &.expanded { - overflow: visible; + &.animating { + overflow: hidden; } } @@ -57,13 +56,13 @@ padding-right: 110px; animation: collapseMaxHeight 300ms ease-out; - &.expanded { + .settings.expanded & { max-height: none; overflow-y: visible; animation: expandMaxHeight 300ms ease-in; } - &.no-animate { + .settings.no-animate & { animation: none; } From 2888e48b27eee4937d61c212be668f5339c4236e Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Sat, 14 Oct 2017 01:10:37 -0500 Subject: [PATCH 39/81] update settings panels to place "expanded" class on the correct element --- app/views/projects/_export.html.haml | 4 ++-- app/views/projects/deploy_keys/_index.html.haml | 4 ++-- app/views/projects/edit.html.haml | 16 ++++++++-------- .../protected_branches/shared/_index.html.haml | 4 ++-- .../protected_tags/shared/_index.html.haml | 4 ++-- app/views/projects/settings/ci_cd/show.html.haml | 16 ++++++++-------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/views/projects/_export.html.haml b/app/views/projects/_export.html.haml index 623d3bc91c6..c5b1897c492 100644 --- a/app/views/projects/_export.html.haml +++ b/app/views/projects/_export.html.haml @@ -3,7 +3,7 @@ - project = local_assigns.fetch(:project) - expanded = Rails.env.test? -%section.settings +%section.settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Export project @@ -11,7 +11,7 @@ = expanded ? 'Collapse' : 'Expand' %p Export this project with all its related data in order to move your project to a new GitLab instance. Once the export is finished, you can import the file from the "New Project" page. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content .bs-callout.bs-callout-info %p.append-bottom-0 %p diff --git a/app/views/projects/deploy_keys/_index.html.haml b/app/views/projects/deploy_keys/_index.html.haml index 45985a5ecef..e75ae87e771 100644 --- a/app/views/projects/deploy_keys/_index.html.haml +++ b/app/views/projects/deploy_keys/_index.html.haml @@ -1,5 +1,5 @@ - expanded = Rails.env.test? -%section.settings +%section.settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Deploy Keys @@ -7,7 +7,7 @@ = expanded ? 'Collapse' : 'Expand' %p Deploy keys allow read-only or read-write (if enabled) access to your repository. Deploy keys can be used for CI, staging or production servers. You can create a deploy key or add an existing one. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content %h5.prepend-top-0 Create a new deploy key for this project = render @deploy_keys.form_partial_path diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 893e536e289..5703ef1d4bb 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -4,7 +4,7 @@ - expanded = Rails.env.test? .project-edit-container - %section.settings.general-settings + %section.settings.general-settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 General project settings @@ -12,7 +12,7 @@ = expanded ? 'Collapse' : 'Expand' %p Update your project name, description, avatar, and other general settings. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content .project-edit-errors = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit-project" }, authenticity_token: true do |f| %fieldset @@ -61,7 +61,7 @@ = link_to 'Remove avatar', project_avatar_path(@project), data: { confirm: "Project avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-sm remove-avatar" = f.submit 'Save changes', class: "btn btn-save" - %section.settings.sharing-permissions + %section.settings.sharing-permissions.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Permissions @@ -69,13 +69,13 @@ = expanded ? 'Collapse' : 'Expand' %p Enable or disable certain project features and choose access levels. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "sharing-permissions-form" }, authenticity_token: true do |f| %script.js-project-permissions-form-data{ type: "application/json" }= project_permissions_panel_data(@project) .js-project-permissions-form = f.submit 'Save changes', class: "btn btn-save" - %section.settings.merge-requests-feature{ class: ("hidden" if @project.project_feature.send(:merge_requests_access_level) == 0) } + %section.settings.merge-requests-feature.no-animate{ class: [('expanded' if expanded), ('hidden' if @project.project_feature.send(:merge_requests_access_level) == 0)] } .settings-header %h4 Merge request settings @@ -83,14 +83,14 @@ = expanded ? 'Collapse' : 'Expand' %p Customize your merge request restrictions. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "merge-request-settings-form" }, authenticity_token: true do |f| = render 'merge_request_settings', form: f = f.submit 'Save changes', class: "btn btn-save" = render 'export', project: @project - %section.settings.advanced-settings + %section.settings.advanced-settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Advanced settings @@ -98,7 +98,7 @@ = expanded ? 'Collapse' : 'Expand' %p Perform advanced options such as housekeeping, archiving, renaming, transferring, or removing your project. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content .sub-section %h4 Housekeeping %p diff --git a/app/views/projects/protected_branches/shared/_index.html.haml b/app/views/projects/protected_branches/shared/_index.html.haml index 6a47cbdf724..ba7d98228c3 100644 --- a/app/views/projects/protected_branches/shared/_index.html.haml +++ b/app/views/projects/protected_branches/shared/_index.html.haml @@ -1,6 +1,6 @@ - expanded = Rails.env.test? -%section.settings +%section.settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Protected Branches @@ -8,7 +8,7 @@ = expanded ? 'Collapse' : 'Expand' %p Keep stable branches secure and force developers to use merge requests. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content %p By default, protected branches are designed to: %ul diff --git a/app/views/projects/protected_tags/shared/_index.html.haml b/app/views/projects/protected_tags/shared/_index.html.haml index c07bd454ff6..e764a37bbd7 100644 --- a/app/views/projects/protected_tags/shared/_index.html.haml +++ b/app/views/projects/protected_tags/shared/_index.html.haml @@ -1,6 +1,6 @@ - expanded = Rails.env.test? -%section.settings +%section.settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Protected Tags @@ -8,7 +8,7 @@ = expanded ? 'Collapse' : 'Expand' %p Limit access to creating and updating tags. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content %p By default, protected tags are designed to: %ul diff --git a/app/views/projects/settings/ci_cd/show.html.haml b/app/views/projects/settings/ci_cd/show.html.haml index 62455d0d40d..664a4554692 100644 --- a/app/views/projects/settings/ci_cd/show.html.haml +++ b/app/views/projects/settings/ci_cd/show.html.haml @@ -4,7 +4,7 @@ - expanded = Rails.env.test? -%section.settings#js-general-pipeline-settings +%section.settings#js-general-pipeline-settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 General pipelines settings @@ -12,10 +12,10 @@ = expanded ? 'Collapse' : 'Expand' %p Update your CI/CD configuration, like job timeout or Auto DevOps. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content = render 'projects/pipelines_settings/show' -%section.settings +%section.settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Runners settings @@ -23,10 +23,10 @@ = expanded ? 'Collapse' : 'Expand' %p Register and see your runners for this project. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content = render 'projects/runners/index' -%section.settings +%section.settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Secret variables @@ -35,10 +35,10 @@ = expanded ? 'Collapse' : 'Expand' %p = render "ci/variables/content" - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content = render 'ci/variables/index' -%section.settings +%section.settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 Pipeline triggers @@ -48,5 +48,5 @@ Triggers can force a specific branch or tag to get rebuilt with an API call. These tokens will impersonate their associated user including their access to projects and their project permissions. - .settings-content.no-animate{ class: ('expanded' if expanded) } + .settings-content = render 'projects/triggers/index' From 734faae6e6dc0b64ead4f8e6d14db1d61b27e267 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 17 Oct 2017 10:43:03 -0500 Subject: [PATCH 40/81] Stop sections from expanding when scrolling over the 1px section See https://gitlab.slack.com/archives/C0GQHHPGW/p1508253662000271 --- app/assets/stylesheets/pages/settings.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/pages/settings.scss b/app/assets/stylesheets/pages/settings.scss index 91ad7f2151b..968a94c68cf 100644 --- a/app/assets/stylesheets/pages/settings.scss +++ b/app/assets/stylesheets/pages/settings.scss @@ -55,11 +55,15 @@ overflow-y: scroll; padding-right: 110px; animation: collapseMaxHeight 300ms ease-out; + // Keep the section from expanding when we scroll over it + pointer-events: none; .settings.expanded & { max-height: none; overflow-y: visible; animation: expandMaxHeight 300ms ease-in; + // Reset and allow clicks again when expanded + pointer-events: auto; } .settings.no-animate & { From 7c331ac9518c68aadc9bba0bbd1d50854699a573 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 13 Oct 2017 16:14:11 +0100 Subject: [PATCH 41/81] Updated Vue to 2.5.1 --- package.json | 4 ++-- yarn.lock | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 376c47ba796..f3cef00b5df 100644 --- a/package.json +++ b/package.json @@ -63,10 +63,10 @@ "underscore": "^1.8.3", "url-loader": "^0.5.8", "visibilityjs": "^1.2.4", - "vue": "^2.2.6", + "vue": "^2.5.2", "vue-loader": "^11.3.4", "vue-resource": "^1.3.4", - "vue-template-compiler": "^2.2.6", + "vue-template-compiler": "^2.5.2", "vuex": "^3.0.0", "webpack": "^3.5.5", "webpack-bundle-analyzer": "^2.8.2", diff --git a/yarn.lock b/yarn.lock index 1d4538b0b94..96cf9bec2bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6394,9 +6394,9 @@ vue-style-loader@^2.0.0: hash-sum "^1.0.2" loader-utils "^1.0.2" -vue-template-compiler@^2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.2.6.tgz#2e2928daf0cd0feca9dfc35a9729adeae173ec68" +vue-template-compiler@^2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.2.tgz#6f198ebc677b8f804315cd33b91e849315ae7177" dependencies: de-indent "^1.0.2" he "^1.1.0" @@ -6405,9 +6405,9 @@ vue-template-es2015-compiler@^1.2.2: version "1.5.1" resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.5.1.tgz#0c36cc57aa3a9ec13e846342cb14a72fcac8bd93" -vue@^2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/vue/-/vue-2.2.6.tgz#451714b394dd6d4eae7b773c40c2034a59621aed" +vue@^2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.2.tgz#fd367a87bae7535e47f9dc5c9ec3b496e5feb5a4" vuex@^3.0.0: version "3.0.0" From 37cc50f843c5dbd4c7fb3126f9730024c89849d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Rodr=C3=ADguez?= Date: Wed, 25 Oct 2017 19:00:19 -0300 Subject: [PATCH 42/81] Incorporate Gitaly's OperationService.UserFFBranch RPC --- lib/gitlab/git/commit.rb | 2 +- lib/gitlab/git/repository.rb | 32 +++++++--- lib/gitlab/gitaly_client/operation_service.rb | 17 +++++ spec/lib/gitlab/git/repository_spec.rb | 62 ++++++++++++------- .../gitaly_client/operation_service_spec.rb | 34 ++++++++++ 5 files changed, 116 insertions(+), 31 deletions(-) diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index 23ae37ff71e..d5518814483 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -73,7 +73,7 @@ module Gitlab decorate(repo, commit) if commit rescue Rugged::ReferenceError, Rugged::InvalidError, Rugged::ObjectError, Gitlab::Git::CommandError, Gitlab::Git::Repository::NoRepository, - Rugged::OdbError, Rugged::TreeError + Rugged::OdbError, Rugged::TreeError, ArgumentError nil end diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index fc8af38d4d9..6e57061b856 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -750,13 +750,13 @@ module Gitlab end def ff_merge(user, source_sha, target_branch) - OperationService.new(user, self).with_branch(target_branch) do |our_commit| - raise ArgumentError, 'Invalid merge target' unless our_commit - - source_sha + gitaly_migrate(:operation_user_ff_branch) do |is_enabled| + if is_enabled + gitaly_ff_merge(user, source_sha, target_branch) + else + rugged_ff_merge(user, source_sha, target_branch) + end end - rescue Rugged::ReferenceError - raise ArgumentError, 'Invalid merge source' end def revert(user:, commit:, branch_name:, message:, start_branch_name:, start_repository:) @@ -1169,10 +1169,10 @@ module Gitlab Gitlab::GitalyClient.migrate(method, status: status, &block) rescue GRPC::NotFound => e raise NoRepository.new(e) - rescue GRPC::BadStatus => e - raise CommandError.new(e) rescue GRPC::InvalidArgument => e raise ArgumentError.new(e) + rescue GRPC::BadStatus => e + raise CommandError.new(e) end private @@ -1614,6 +1614,22 @@ module Gitlab run_git(args, env: env) end + + def gitaly_ff_merge(user, source_sha, target_branch) + gitaly_operations_client.user_ff_branch(user, source_sha, target_branch) + rescue GRPC::FailedPrecondition => e + raise CommitError, e + end + + def rugged_ff_merge(user, source_sha, target_branch) + OperationService.new(user, self).with_branch(target_branch) do |our_commit| + raise ArgumentError, 'Invalid merge target' unless our_commit + + source_sha + end + rescue Rugged::ReferenceError + raise ArgumentError, 'Invalid merge source' + end end end end diff --git a/lib/gitlab/gitaly_client/operation_service.rb b/lib/gitlab/gitaly_client/operation_service.rb index adaf255f24b..526d44a8b77 100644 --- a/lib/gitlab/gitaly_client/operation_service.rb +++ b/lib/gitlab/gitaly_client/operation_service.rb @@ -105,6 +105,23 @@ module Gitlab ensure request_enum.close end + + def user_ff_branch(user, source_sha, target_branch) + request = Gitaly::UserFFBranchRequest.new( + repository: @gitaly_repo, + user: Gitlab::Git::User.from_gitlab(user).to_gitaly, + commit_id: source_sha, + branch: GitalyClient.encode(target_branch) + ) + + branch_update = GitalyClient.call( + @repository.storage, + :operation_service, + :user_ff_branch, + request + ).branch_update + Gitlab::Git::OperationService::BranchUpdate.from_gitaly(branch_update) + end end end end diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index b161d25b96c..3218e610ac6 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1609,38 +1609,56 @@ describe Gitlab::Git::Repository, seed_helper: true do subject { repository.ff_merge(user, source_sha, target_branch) } - it 'performs a ff_merge' do - expect(subject.newrev).to eq(source_sha) - expect(subject.repo_created).to be(false) - expect(subject.branch_created).to be(false) + shared_examples '#ff_merge' do + it 'performs a ff_merge' do + expect(subject.newrev).to eq(source_sha) + expect(subject.repo_created).to be(false) + expect(subject.branch_created).to be(false) - expect(repository.commit(target_branch).id).to eq(source_sha) - end + expect(repository.commit(target_branch).id).to eq(source_sha) + end - context 'with a non-existing target branch' do - subject { repository.ff_merge(user, source_sha, 'this-isnt-real') } + context 'with a non-existing target branch' do + subject { repository.ff_merge(user, source_sha, 'this-isnt-real') } - it 'throws an ArgumentError' do - expect { subject }.to raise_error(ArgumentError) + it 'throws an ArgumentError' do + expect { subject }.to raise_error(ArgumentError) + end + end + + context 'with a non-existing source commit' do + let(:source_sha) { 'f001' } + + it 'throws an ArgumentError' do + expect { subject }.to raise_error(ArgumentError) + end + end + + context 'when the source sha is not a descendant of the branch head' do + let(:source_sha) { '1a0b36b3cdad1d2ee32457c102a8c0b7056fa863' } + + it "doesn't perform the ff_merge" do + expect { subject }.to raise_error(Gitlab::Git::CommitError) + + expect(repository.commit(target_branch).id).to eq(branch_head) + end end end - context 'with a non-existing source commit' do - let(:source_sha) { 'f001' } + context 'with gitaly' do + it "calls Gitaly's OperationService" do + expect_any_instance_of(Gitlab::GitalyClient::OperationService) + .to receive(:user_ff_branch).with(user, source_sha, target_branch) + .and_return(nil) - it 'throws an ArgumentError' do - expect { subject }.to raise_error(ArgumentError) + subject end + + it_behaves_like '#ff_merge' end - context 'when the source sha is not a descendant of the branch head' do - let(:source_sha) { '1a0b36b3cdad1d2ee32457c102a8c0b7056fa863' } - - it "doesn't perform the ff_merge" do - expect { subject }.to raise_error(Gitlab::Git::CommitError) - - expect(repository.commit(target_branch).id).to eq(branch_head) - end + context 'without gitaly', :skip_gitaly_mock do + it_behaves_like '#ff_merge' end end diff --git a/spec/lib/gitlab/gitaly_client/operation_service_spec.rb b/spec/lib/gitlab/gitaly_client/operation_service_spec.rb index e144e28b5d8..d9ec28ab02e 100644 --- a/spec/lib/gitlab/gitaly_client/operation_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/operation_service_spec.rb @@ -89,4 +89,38 @@ describe Gitlab::GitalyClient::OperationService do end end end + + describe '#user_ff_branch' do + let(:target_branch) { 'my-branch' } + let(:source_sha) { 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660' } + let(:request) do + Gitaly::UserFFBranchRequest.new( + repository: repository.gitaly_repository, + branch: target_branch, + commit_id: source_sha, + user: gitaly_user + ) + end + let(:branch_update) do + Gitaly::OperationBranchUpdate.new( + commit_id: source_sha, + repo_created: false, + branch_created: false + ) + end + let(:response) { Gitaly::UserFFBranchResponse.new(branch_update: branch_update) } + + subject { client.user_ff_branch(user, source_sha, target_branch) } + + it 'sends a user_ff_branch message and returns a BranchUpdate object' do + expect_any_instance_of(Gitaly::OperationService::Stub) + .to receive(:user_ff_branch).with(request, kind_of(Hash)) + .and_return(response) + + expect(subject).to be_a(Gitlab::Git::OperationService::BranchUpdate) + expect(subject.newrev).to eq(source_sha) + expect(subject.repo_created).to be(false) + expect(subject.branch_created).to be(false) + end + end end From 9936ae26b350d556c01c6d6ffeec70d6068b26a7 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Tue, 31 Oct 2017 23:20:07 +0100 Subject: [PATCH 43/81] Measure Gitaly migration sites against original We were missing data for Gitaly migration call sites against the original implementation. This commit adds a histogram with a flag telling us if gitaly received the call or the original implementation did. --- lib/gitlab/gitaly_client.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index 6868be26758..0b35a787e07 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -34,10 +34,11 @@ module Gitlab private_constant :MUTEX class << self - attr_accessor :query_time + attr_accessor :query_time, :migrate_histogram end self.query_time = 0 + self.migrate_histogram = Gitlab::Metrics.histogram(:gitaly_migrate_call_duration, "Gitaly migration call execution timings") def self.stub(name, storage) MUTEX.synchronize do @@ -171,8 +172,11 @@ module Gitlab feature_stack = Thread.current[:gitaly_feature_stack] ||= [] feature_stack.unshift(feature) begin + start = Process.clock_gettime(Process::CLOCK_MONOTONIC) yield is_enabled ensure + total_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start + migrate_histogram.observe({ gitaly_enabled: is_enabled, feature: feature }, total_time) feature_stack.shift Thread.current[:gitaly_feature_stack] = nil if feature_stack.empty? end From b20381204ad84069677a53bff1cbe728745c38db Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 1 Nov 2017 09:26:16 +0000 Subject: [PATCH 44/81] karma spec updates --- .../javascripts/notes/components/issue_note.vue | 4 +++- .../account/components/delete_account_modal.vue | 2 +- spec/javascripts/groups/components/app_spec.js | 4 ++-- .../vue_shared/components/markdown/field_spec.js | 14 ++++++++------ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue index 0ddbd672bed..40318f9a600 100644 --- a/app/assets/javascripts/notes/components/issue_note.vue +++ b/app/assets/javascripts/notes/components/issue_note.vue @@ -122,7 +122,9 @@ // we need to do this to prevent noteForm inconsistent content warning // this is something we intentionally do so we need to recover the content this.note.note = noteText; - this.$refs.noteBody.$refs.noteForm.note = noteText; // TODO: This could be better + if (this.$refs.noteBody) { + this.$refs.noteBody.$refs.noteForm.note = noteText; // TODO: This could be better + } }, }, created() { diff --git a/app/assets/javascripts/profile/account/components/delete_account_modal.vue b/app/assets/javascripts/profile/account/components/delete_account_modal.vue index b2b34cb83e1..6348a2e331d 100644 --- a/app/assets/javascripts/profile/account/components/delete_account_modal.vue +++ b/app/assets/javascripts/profile/account/components/delete_account_modal.vue @@ -98,7 +98,7 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`), @toggle="toggleOpen" @submit="onSubmit"> -