From 7a109402a866db1c84ef9af1c14e148ec944aa22 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 20 Jan 2017 21:57:01 +0800 Subject: Prefer service object over after_save hook Closes #26921 --- app/controllers/admin/runners_controller.rb | 6 +++--- app/controllers/projects/runners_controller.rb | 6 +++--- app/models/ci/runner.rb | 8 -------- app/services/ci/update_runner_service.rb | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 app/services/ci/update_runner_service.rb (limited to 'app') diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 7345c91f67d..348641e5ecb 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -13,7 +13,7 @@ class Admin::RunnersController < Admin::ApplicationController end def update - if @runner.update_attributes(runner_params) + if Ci::UpdateRunnerService.new(@runner).update(runner_params) respond_to do |format| format.js format.html { redirect_to admin_runner_path(@runner) } @@ -31,7 +31,7 @@ class Admin::RunnersController < Admin::ApplicationController end def resume - if @runner.update_attributes(active: true) + if Ci::UpdateRunnerService.new(@runner).update(active: true) redirect_to admin_runners_path, notice: 'Runner was successfully updated.' else redirect_to admin_runners_path, alert: 'Runner was not updated.' @@ -39,7 +39,7 @@ class Admin::RunnersController < Admin::ApplicationController end def pause - if @runner.update_attributes(active: false) + if Ci::UpdateRunnerService.new(@runner).update(active: false) redirect_to admin_runners_path, notice: 'Runner was successfully updated.' else redirect_to admin_runners_path, alert: 'Runner was not updated.' diff --git a/app/controllers/projects/runners_controller.rb b/app/controllers/projects/runners_controller.rb index 53c36635efe..ff75c408beb 100644 --- a/app/controllers/projects/runners_controller.rb +++ b/app/controllers/projects/runners_controller.rb @@ -16,7 +16,7 @@ class Projects::RunnersController < Projects::ApplicationController end def update - if @runner.update_attributes(runner_params) + if Ci::UpdateRunnerService.new(@runner).update(runner_params) redirect_to runner_path(@runner), notice: 'Runner was successfully updated.' else render 'edit' @@ -32,7 +32,7 @@ class Projects::RunnersController < Projects::ApplicationController end def resume - if @runner.update_attributes(active: true) + if Ci::UpdateRunnerService.new(@runner).update(active: true) redirect_to runner_path(@runner), notice: 'Runner was successfully updated.' else redirect_to runner_path(@runner), alert: 'Runner was not updated.' @@ -40,7 +40,7 @@ class Projects::RunnersController < Projects::ApplicationController end def pause - if @runner.update_attributes(active: false) + if Ci::UpdateRunnerService.new(@runner).update(active: false) redirect_to runner_path(@runner), notice: 'Runner was successfully updated.' else redirect_to runner_path(@runner), alert: 'Runner was not updated.' diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 6e58a1878c8..b4760b5baaa 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -22,8 +22,6 @@ module Ci scope :online, ->() { where('contacted_at > ?', LAST_CONTACT_TIME) } scope :ordered, ->() { order(id: :desc) } - after_save :tick_runner_queue, if: :form_editable_changed? - scope :owned_or_shared, ->(project_id) do joins('LEFT JOIN ci_runner_projects ON ci_runner_projects.runner_id = ci_runners.id') .where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id) @@ -149,12 +147,6 @@ module Ci "runner:build_queue:#{self.token}" end - def form_editable_changed? - FORM_EDITABLE.any? do |editable| - public_send("#{editable}_changed?") - end - end - def tag_constraints unless has_tags? || run_untagged? errors.add(:tags_list, diff --git a/app/services/ci/update_runner_service.rb b/app/services/ci/update_runner_service.rb new file mode 100644 index 00000000000..198b29b3a9d --- /dev/null +++ b/app/services/ci/update_runner_service.rb @@ -0,0 +1,15 @@ +module Ci + class UpdateRunnerService + attr_reader :runner + + def initialize(runner) + @runner = runner + end + + def update(params) + runner.update(params).tap do + runner.tick_runner_queue + end + end + end +end -- cgit v1.2.1 From 7a4d723e6ba287fe792dca0a8ddc3d8a77b1876c Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Sat, 21 Jan 2017 02:38:58 +0800 Subject: Remove the key from the queue when runner is deleted --- app/models/ci/runner.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app') diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index b4760b5baaa..f30253eefe3 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -38,6 +38,8 @@ module Ci acts_as_taggable + after_destroy :cleanup_runner_queue + # Searches for runners matching the given query. # # This method uses ILIKE on PostgreSQL and LIKE on MySQL. @@ -143,6 +145,12 @@ module Ci private + def cleanup_runner_queue + Gitlab::Redis.with do |redis| + redis.del(runner_queue_key) + end + end + def runner_queue_key "runner:build_queue:#{self.token}" end -- cgit v1.2.1 From d5fa77d53d73b9d47647443460d2ea95babb52e4 Mon Sep 17 00:00:00 2001 From: Poornima M Date: Wed, 18 Jan 2017 16:08:59 +0530 Subject: Adding links to user & build in Chat Notifications --- .../project_services/chat_message/base_message.rb | 4 ++++ .../project_services/chat_message/build_message.rb | 28 ++++++++++++++++++---- .../project_services/chat_message/issue_message.rb | 4 ++-- .../project_services/chat_message/merge_message.rb | 4 ++-- .../project_services/chat_message/note_message.rb | 9 ++++--- 5 files changed, 36 insertions(+), 13 deletions(-) (limited to 'app') diff --git a/app/models/project_services/chat_message/base_message.rb b/app/models/project_services/chat_message/base_message.rb index a03605d01fb..86d271a3f69 100644 --- a/app/models/project_services/chat_message/base_message.rb +++ b/app/models/project_services/chat_message/base_message.rb @@ -30,5 +30,9 @@ module ChatMessage def attachment_color '#345' end + + def link(text, url) + "[#{text}](#{url})" + end end end diff --git a/app/models/project_services/chat_message/build_message.rb b/app/models/project_services/chat_message/build_message.rb index 53e35cb21bf..c776e0a20c4 100644 --- a/app/models/project_services/chat_message/build_message.rb +++ b/app/models/project_services/chat_message/build_message.rb @@ -7,7 +7,11 @@ module ChatMessage attr_reader :project_name attr_reader :project_url attr_reader :user_name + attr_reader :user_url attr_reader :duration + attr_reader :stage + attr_reader :build_id + attr_reader :build_name def initialize(params) @sha = params[:sha] @@ -17,7 +21,11 @@ module ChatMessage @project_url = params[:project_url] @status = params[:commit][:status] @user_name = params[:commit][:author_name] + @user_url = params[:commit][:author_url] @duration = params[:commit][:duration] + @stage = params[:build_stage] + @build_name = params[:build_name] + @build_id = params[:build_id] end def pretext @@ -35,7 +43,19 @@ module ChatMessage private def message - "#{project_link}: Commit #{commit_link} of #{branch_link} #{ref_type} by #{user_name} #{humanized_status} in #{duration} #{'second'.pluralize(duration)}" + "#{project_link}: Commit #{commit_link} of #{branch_link} #{ref_type} by #{user_link} #{humanized_status} on build #{build_link} of stage #{stage} in #{duration} #{'second'.pluralize(duration)}" + end + + def build_url + "#{project_url}/builds/#{build_id}" + end + + def build_link + link(build_name, build_url) + end + + def user_link + link(user_name, user_url) end def format(string) @@ -64,11 +84,11 @@ module ChatMessage end def branch_link - "[#{ref}](#{branch_url})" + link(ref, branch_url) end def project_link - "[#{project_name}](#{project_url})" + link(project_name, project_url) end def commit_url @@ -76,7 +96,7 @@ module ChatMessage end def commit_link - "[#{Commit.truncate_sha(sha)}](#{commit_url})" + link(Commit.truncate_sha(sha), commit_url) end end end diff --git a/app/models/project_services/chat_message/issue_message.rb b/app/models/project_services/chat_message/issue_message.rb index 14fd64e5332..b96aca47e65 100644 --- a/app/models/project_services/chat_message/issue_message.rb +++ b/app/models/project_services/chat_message/issue_message.rb @@ -55,11 +55,11 @@ module ChatMessage end def project_link - "[#{project_name}](#{project_url})" + link(project_name, project_url) end def issue_link - "[#{issue_title}](#{issue_url})" + link(issue_title, issue_url) end def issue_title diff --git a/app/models/project_services/chat_message/merge_message.rb b/app/models/project_services/chat_message/merge_message.rb index ab5e8b24167..5e5efca7bec 100644 --- a/app/models/project_services/chat_message/merge_message.rb +++ b/app/models/project_services/chat_message/merge_message.rb @@ -42,7 +42,7 @@ module ChatMessage end def project_link - "[#{project_name}](#{project_url})" + link(project_name, project_url) end def merge_request_message @@ -50,7 +50,7 @@ module ChatMessage end def merge_request_link - "[merge request !#{merge_request_id}](#{merge_request_url})" + link("merge request !#{merge_request_id}", merge_request_url) end def merge_request_url diff --git a/app/models/project_services/chat_message/note_message.rb b/app/models/project_services/chat_message/note_message.rb index ca1d7207034..552113bac29 100644 --- a/app/models/project_services/chat_message/note_message.rb +++ b/app/models/project_services/chat_message/note_message.rb @@ -3,10 +3,9 @@ module ChatMessage attr_reader :message attr_reader :user_name attr_reader :project_name - attr_reader :project_link + attr_reader :project_url attr_reader :note attr_reader :note_url - attr_reader :title def initialize(params) params = HashWithIndifferentAccess.new(params) @@ -69,15 +68,15 @@ module ChatMessage end def description_message - [{ text: format(@note), color: attachment_color }] + [{ text: format(note), color: attachment_color }] end def project_link - "[#{@project_name}](#{@project_url})" + link(project_name, project_url) end def commented_on_message(target, title) - @message = "#{@user_name} [commented on #{target}](#{@note_url}) in #{project_link}: *#{title}*" + @message = "#{user_name} #{link('commented on ' + target, note_url)} in #{project_link}: *#{title}*" end end end -- cgit v1.2.1 From 80bc66596adee89b423d4da8cafcddf3b98c9678 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 7 Feb 2017 03:05:19 +0800 Subject: Only tick queue if anything is updated Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8664#note_22853522 --- app/services/ci/update_runner_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/services/ci/update_runner_service.rb b/app/services/ci/update_runner_service.rb index 198b29b3a9d..450ee7da1c9 100644 --- a/app/services/ci/update_runner_service.rb +++ b/app/services/ci/update_runner_service.rb @@ -7,8 +7,8 @@ module Ci end def update(params) - runner.update(params).tap do - runner.tick_runner_queue + runner.update(params).tap do |updated| + runner.tick_runner_queue if updated end end end -- cgit v1.2.1 From 3bb07a88bc297ae848ea4a1c075d37f5c4029e26 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Tue, 7 Feb 2017 17:42:21 +1100 Subject: copypaste task_list setup and events to own class switch issue and merge request to use it --- app/assets/javascripts/issue.js | 38 ++++------------------------- app/assets/javascripts/merge_request.js | 38 ++++------------------------- app/assets/javascripts/task_list.js.es6 | 43 +++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 66 deletions(-) create mode 100644 app/assets/javascripts/task_list.js.es6 (limited to 'app') diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index 6c08b1b8e61..6c6dde1b3f0 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -3,7 +3,7 @@ require('./flash'); require('vendor/jquery.waitforimages'); -require('vendor/task_list'); +require('./task_list'); (function() { var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }; @@ -11,10 +11,11 @@ require('vendor/task_list'); this.Issue = (function() { function Issue() { this.submitNoteForm = bind(this.submitNoteForm, this); - // Prevent duplicate event bindings - this.disableTaskList(); if ($('a.btn-close').length) { - this.initTaskList(); + this.taskList = new gl.TaskList({ + dataType: 'issue', + selector: '.detail-page-description' + }); this.initIssueBtnEventListeners(); } this.initMergeRequests(); @@ -22,11 +23,6 @@ require('vendor/task_list'); this.initCanCreateBranch(); } - Issue.prototype.initTaskList = function() { - $('.detail-page-description .js-task-list-container').taskList('enable'); - return $(document).on('tasklist:changed', '.detail-page-description .js-task-list-container', this.updateTaskList); - }; - Issue.prototype.initIssueBtnEventListeners = function() { var _this, issueFailMessage; _this = this; @@ -82,30 +78,6 @@ require('vendor/task_list'); } }; - Issue.prototype.disableTaskList = function() { - $('.detail-page-description .js-task-list-container').taskList('disable'); - return $(document).off('tasklist:changed', '.detail-page-description .js-task-list-container'); - }; - - Issue.prototype.updateTaskList = function() { - var patchData; - patchData = {}; - patchData['issue'] = { - 'description': $('.js-task-list-field', this).val() - }; - return $.ajax({ - type: 'PATCH', - url: $('form.js-issuable-update').attr('action'), - data: patchData, - success: function(issue) { - document.querySelector('#task_status').innerText = issue.task_status; - document.querySelector('#task_status_short').innerText = issue.task_status_short; - } - }); - // TODO (rspeicher): Make the issue description inline-editable like a note so - // that we can re-use its form here - }; - Issue.prototype.initMergeRequests = function() { var $container; $container = $('#merge-requests'); diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 8762ec35b80..9e6f42beaf2 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -2,7 +2,7 @@ /* global MergeRequestTabs */ require('vendor/jquery.waitforimages'); -require('vendor/task_list'); +require('./task_list'); require('./merge_request_tabs'); (function() { @@ -24,12 +24,13 @@ require('./merge_request_tabs'); }; })(this)); this.initTabs(); - // Prevent duplicate event bindings - this.disableTaskList(); this.initMRBtnListeners(); this.initCommitMessageListeners(); if ($("a.btn-close").length) { - this.initTaskList(); + this.taskList = new gl.TaskList({ + dataType: 'merge_request', + selector: '.detail-page-description' + }); } } @@ -50,11 +51,6 @@ require('./merge_request_tabs'); return this.$('.all-commits').removeClass('hide'); }; - MergeRequest.prototype.initTaskList = function() { - $('.detail-page-description .js-task-list-container').taskList('enable'); - return $(document).on('tasklist:changed', '.detail-page-description .js-task-list-container', this.updateTaskList); - }; - MergeRequest.prototype.initMRBtnListeners = function() { var _this; _this = this; @@ -85,30 +81,6 @@ require('./merge_request_tabs'); } }; - MergeRequest.prototype.disableTaskList = function() { - $('.detail-page-description .js-task-list-container').taskList('disable'); - return $(document).off('tasklist:changed', '.detail-page-description .js-task-list-container'); - }; - - MergeRequest.prototype.updateTaskList = function() { - var patchData; - patchData = {}; - patchData['merge_request'] = { - 'description': $('.js-task-list-field', this).val() - }; - return $.ajax({ - type: 'PATCH', - url: $('form.js-issuable-update').attr('action'), - data: patchData, - success: function(mergeRequest) { - document.querySelector('#task_status').innerText = mergeRequest.task_status; - document.querySelector('#task_status_short').innerText = mergeRequest.task_status_short; - } - }); - // TODO (rspeicher): Make the merge request description inline-editable like a - // note so that we can re-use its form here - }; - MergeRequest.prototype.initCommitMessageListeners = function() { $(document).on('click', 'a.js-with-description-link', function(e) { var textarea = $('textarea.js-commit-message'); diff --git a/app/assets/javascripts/task_list.js.es6 b/app/assets/javascripts/task_list.js.es6 new file mode 100644 index 00000000000..e207bb1d97e --- /dev/null +++ b/app/assets/javascripts/task_list.js.es6 @@ -0,0 +1,43 @@ +require('vendor/task_list'); + +class TaskList { + constructor(options = {}) { + this.selector = options.selector; + this.dataType = options.dataType; + // Prevent duplicate event bindings + this.disable(); + this.init(); + } + + init() { + $(this.selector + ' .js-task-list-container').taskList('enable'); + $(document).on('tasklist:changed', this.selector + ' .js-task-list-container', this.update.bind(this)); + } + + disable() { + $(this.selector + ' .js-task-list-container').taskList('disable'); + return $(document).off('tasklist:changed', this.selector + ' .js-task-list-container'); + } + + update(e) { + var patchData; + patchData = {}; + patchData[this.dataType] = { + 'description': $(e.target).val() + }; + return $.ajax({ + type: 'PATCH', + url: $('form.js-issuable-update').attr('action'), + data: patchData, + success: function(result) { + document.querySelector('#task_status').innerText = result.task_status; + document.querySelector('#task_status_short').innerText = result.task_status_short; + } + }); + // TODO (rspeicher): Make the issue description inline-editable like a note so + // that we can re-use its form here + } +} + +window.gl = window.gl || {}; +window.gl.TaskList = TaskList; -- cgit v1.2.1 From 97ecae00a6a64dadadf60ec6706944f6c9e98de7 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Wed, 8 Feb 2017 17:04:00 +1100 Subject: switch notes to use task_list, but keep its update function for now --- app/assets/javascripts/notes.js | 21 +++++++-------------- app/assets/javascripts/task_list.js.es6 | 12 +++++++----- 2 files changed, 14 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index d108da29af7..d137e327f0e 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -11,7 +11,7 @@ require('./dropzone_input'); require('./gfm_auto_complete'); require('vendor/jquery.caret'); // required by jquery.atwho require('vendor/jquery.atwho'); -require('vendor/task_list'); +require('./task_list'); (function() { var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }; @@ -51,7 +51,11 @@ require('vendor/task_list'); this.addBinding(); this.setPollingInterval(); this.setupMainTargetNoteForm(); - this.initTaskList(); + this.taskList = new gl.TaskList({ + dataType: 'note', + selector: '.notes', + update: this.updateTaskList.bind(this) + }); this.collapseLongCommitList(); // We are in the Merge Requests page so we need another edit form for Changes tab @@ -125,8 +129,6 @@ require('vendor/task_list'); $(document).off("keydown", ".js-note-text"); $(document).off('click', '.js-comment-resolve-button'); $(document).off("click", '.system-note-commit-list-toggler'); - $('.note .js-task-list-container').taskList('disable'); - return $(document).off('tasklist:changed', '.note .js-task-list-container'); }; Notes.prototype.keydownNoteText = function(e) { @@ -286,7 +288,7 @@ require('vendor/task_list'); // Update datetime format on the recent note gl.utils.localTimeAgo($notesList.find("#note_" + note.id + " .js-timeago"), false); this.collapseLongCommitList(); - this.initTaskList(); + this.taskList.init(); this.refresh(); return this.updateNotesCount(1); } @@ -863,15 +865,6 @@ require('vendor/task_list'); } }; - Notes.prototype.initTaskList = function() { - this.enableTaskList(); - return $(document).on('tasklist:changed', '.note .js-task-list-container', this.updateTaskList.bind(this)); - }; - - Notes.prototype.enableTaskList = function() { - return $('.note .js-task-list-container').taskList('enable'); - }; - Notes.prototype.putEditFormInPlace = function($el) { var $editForm = $(this.getEditFormSelector($el)); var $note = $el.closest('.note'); diff --git a/app/assets/javascripts/task_list.js.es6 b/app/assets/javascripts/task_list.js.es6 index e207bb1d97e..daed051c4a5 100644 --- a/app/assets/javascripts/task_list.js.es6 +++ b/app/assets/javascripts/task_list.js.es6 @@ -1,17 +1,21 @@ +/* eslint-disable class-methods-use-this, no-new, func-names, prefer-template, no-unneeded-ternary, object-shorthand, space-before-function-paren, comma-dangle, quote-props, consistent-return, no-else-return, no-param-reassign, max-len */ +/* global UsersSelect */ + require('vendor/task_list'); class TaskList { constructor(options = {}) { this.selector = options.selector; this.dataType = options.dataType; - // Prevent duplicate event bindings - this.disable(); + this.update = options.update || this.update.bind(this); this.init(); } init() { + // Prevent duplicate event bindings + this.disable(); $(this.selector + ' .js-task-list-container').taskList('enable'); - $(document).on('tasklist:changed', this.selector + ' .js-task-list-container', this.update.bind(this)); + $(document).on('tasklist:changed', this.selector + ' .js-task-list-container', this.update); } disable() { @@ -34,8 +38,6 @@ class TaskList { document.querySelector('#task_status_short').innerText = result.task_status_short; } }); - // TODO (rspeicher): Make the issue description inline-editable like a note so - // that we can re-use its form here } } -- cgit v1.2.1 From d3e34cd165fa5a8f534d7acec7df4c8bd6392eae Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Wed, 8 Feb 2017 19:10:04 +1100 Subject: appease lint --- app/assets/javascripts/task_list.js.es6 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/task_list.js.es6 b/app/assets/javascripts/task_list.js.es6 index daed051c4a5..2001803fe13 100644 --- a/app/assets/javascripts/task_list.js.es6 +++ b/app/assets/javascripts/task_list.js.es6 @@ -14,29 +14,28 @@ class TaskList { init() { // Prevent duplicate event bindings this.disable(); - $(this.selector + ' .js-task-list-container').taskList('enable'); - $(document).on('tasklist:changed', this.selector + ' .js-task-list-container', this.update); + $(`${this.selector} .js-task-list-container`).taskList('enable'); + $(document).on('tasklist:changed', `${this.selector} .js-task-list-container`, this.update); } disable() { - $(this.selector + ' .js-task-list-container').taskList('disable'); - return $(document).off('tasklist:changed', this.selector + ' .js-task-list-container'); + $(`${this.selector} .js-task-list-container`).taskList('disable'); + return $(document).off('tasklist:changed', `${this.selector} .js-task-list-container`); } update(e) { - var patchData; - patchData = {}; + const patchData = {}; patchData[this.dataType] = { - 'description': $(e.target).val() + description: $(e.target).val(), }; return $.ajax({ type: 'PATCH', url: $('form.js-issuable-update').attr('action'), data: patchData, - success: function(result) { + success: (result) => { document.querySelector('#task_status').innerText = result.task_status; document.querySelector('#task_status_short').innerText = result.task_status_short; - } + }, }); } } -- cgit v1.2.1 From 766d011b461d11dd0a6fb23b691f6c779a2b0b2f Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Wed, 8 Feb 2017 20:23:45 +1100 Subject: notes use new task_list, and PATCH instead of POST use data attribute for submit url optional onSuccess --- app/assets/javascripts/issue.js | 6 +++++- app/assets/javascripts/merge_request.js | 6 +++++- app/assets/javascripts/notes.js | 14 +------------- app/assets/javascripts/task_list.js.es6 | 14 ++++++-------- app/views/projects/notes/_note.html.haml | 2 +- 5 files changed, 18 insertions(+), 24 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index 6c6dde1b3f0..fd9b3cb833d 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -14,7 +14,11 @@ require('./task_list'); if ($('a.btn-close').length) { this.taskList = new gl.TaskList({ dataType: 'issue', - selector: '.detail-page-description' + selector: '.detail-page-description', + onSuccess: (result) => { + document.querySelector('#task_status').innerText = result.task_status; + document.querySelector('#task_status_short').innerText = result.task_status_short; + } }); this.initIssueBtnEventListeners(); } diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 9e6f42beaf2..14f424b181c 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -29,7 +29,11 @@ require('./merge_request_tabs'); if ($("a.btn-close").length) { this.taskList = new gl.TaskList({ dataType: 'merge_request', - selector: '.detail-page-description' + selector: '.detail-page-description', + onSuccess: (result) => { + document.querySelector('#task_status').innerText = result.task_status; + document.querySelector('#task_status_short').innerText = result.task_status_short; + } }); } } diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index d137e327f0e..599af9312b4 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -53,8 +53,7 @@ require('./task_list'); this.setupMainTargetNoteForm(); this.taskList = new gl.TaskList({ dataType: 'note', - selector: '.notes', - update: this.updateTaskList.bind(this) + selector: '.notes' }); this.collapseLongCommitList(); @@ -889,17 +888,6 @@ require('./task_list'); $editForm.find('.referenced-users').hide(); }; - Notes.prototype.updateTaskList = function(e) { - var $target = $(e.target); - var $list = $target.closest('.js-task-list-container'); - var $editForm = $(this.getEditFormSelector($target)); - var $note = $list.closest('.note'); - - this.putEditFormInPlace($list); - $editForm.find('#note_note').val($note.find('.original-task-list').val()); - $('form', $list).submit(); - }; - Notes.prototype.updateNotesCount = function(updateCount) { return this.notesCountBadge.text(parseInt(this.notesCountBadge.text(), 10) + updateCount); }; diff --git a/app/assets/javascripts/task_list.js.es6 b/app/assets/javascripts/task_list.js.es6 index 2001803fe13..3fa6a36e455 100644 --- a/app/assets/javascripts/task_list.js.es6 +++ b/app/assets/javascripts/task_list.js.es6 @@ -7,7 +7,7 @@ class TaskList { constructor(options = {}) { this.selector = options.selector; this.dataType = options.dataType; - this.update = options.update || this.update.bind(this); + this.onSuccess = options.onSuccess || () => null; this.init(); } @@ -15,7 +15,7 @@ class TaskList { // Prevent duplicate event bindings this.disable(); $(`${this.selector} .js-task-list-container`).taskList('enable'); - $(document).on('tasklist:changed', `${this.selector} .js-task-list-container`, this.update); + $(document).on('tasklist:changed', `${this.selector} .js-task-list-container`, this.update.bind(this)); } disable() { @@ -24,18 +24,16 @@ class TaskList { } update(e) { + const $target = $(e.target); const patchData = {}; patchData[this.dataType] = { - description: $(e.target).val(), + description: $target.val(), }; return $.ajax({ type: 'PATCH', - url: $('form.js-issuable-update').attr('action'), + url: $target.data('update-url') || $('form.js-issuable-update').attr('action'), data: patchData, - success: (result) => { - document.querySelector('#task_status').innerText = result.task_status; - document.querySelector('#task_status_short').innerText = result.task_status_short; - }, + success: this.onSuccess, }); } } diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index 09339e520dd..89c6a65f159 100644 --- a/app/views/projects/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -69,7 +69,7 @@ - if note_editable .original-note-content.hidden{ data: { post_url: namespace_project_note_path(@project.namespace, @project, note), target_id: note.noteable.id, target_type: note.noteable.class.name.underscore } } #{note.note} - %textarea.hidden.js-task-list-field.original-task-list= note.note + %textarea.hidden.js-task-list-field.original-task-list{ data: {update_url: namespace_project_note_path(@project.namespace, @project, note) } }= note.note .note-awards = render 'award_emoji/awards_block', awardable: note, inline: false - if note.system -- cgit v1.2.1 From 4e4639b56eda367a8d5612042fcf1359a8303082 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Wed, 8 Feb 2017 21:54:33 +1100 Subject: forgot to iife --- app/assets/javascripts/task_list.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/javascripts/task_list.js.es6 b/app/assets/javascripts/task_list.js.es6 index 3fa6a36e455..1186a1ecfb9 100644 --- a/app/assets/javascripts/task_list.js.es6 +++ b/app/assets/javascripts/task_list.js.es6 @@ -7,7 +7,7 @@ class TaskList { constructor(options = {}) { this.selector = options.selector; this.dataType = options.dataType; - this.onSuccess = options.onSuccess || () => null; + this.onSuccess = options.onSuccess || (() => {}); this.init(); } -- cgit v1.2.1 From 63440e11d6b763a396e9c59928689e81ceb4e166 Mon Sep 17 00:00:00 2001 From: Kushal Pandya Date: Wed, 8 Feb 2017 19:49:29 +0530 Subject: Set dropdown height fixed to `250px;` and make it scrollable --- app/assets/stylesheets/framework/dropdowns.scss | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index facfb7f9920..8398e9e82a2 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -127,6 +127,7 @@ z-index: 9; max-width: 280px; min-width: 240px; + max-height: 250px; margin-top: 2px; margin-bottom: 0; font-size: 14px; @@ -136,6 +137,7 @@ border: 1px solid $dropdown-border-color; border-radius: $border-radius-base; box-shadow: 0 2px 4px $dropdown-shadow-color; + overflow-y: auto; &.is-loading { .dropdown-content { -- cgit v1.2.1 From fc425be1a453e8281049c7e00884f6427445176e Mon Sep 17 00:00:00 2001 From: Kushal Pandya Date: Thu, 9 Feb 2017 13:36:21 +0530 Subject: Fix dropdown height regression --- app/assets/stylesheets/framework/dropdowns.scss | 2 -- 1 file changed, 2 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index 8398e9e82a2..facfb7f9920 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -127,7 +127,6 @@ z-index: 9; max-width: 280px; min-width: 240px; - max-height: 250px; margin-top: 2px; margin-bottom: 0; font-size: 14px; @@ -137,7 +136,6 @@ border: 1px solid $dropdown-border-color; border-radius: $border-radius-base; box-shadow: 0 2px 4px $dropdown-shadow-color; - overflow-y: auto; &.is-loading { .dropdown-content { -- cgit v1.2.1 From beb56533cb482c3c69cf9d6dcb1c29bb89dcbe6d Mon Sep 17 00:00:00 2001 From: Kushal Pandya Date: Thu, 9 Feb 2017 13:36:51 +0530 Subject: Set dropdown to fixed height of `250px` and make it scrollable --- app/assets/stylesheets/pages/pipelines.scss | 5 +++++ app/assets/stylesheets/pages/projects.scss | 7 +++++++ 2 files changed, 12 insertions(+) (limited to 'app') diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss index 974100bdff0..92e1181bcc0 100644 --- a/app/assets/stylesheets/pages/pipelines.scss +++ b/app/assets/stylesheets/pages/pipelines.scss @@ -218,6 +218,11 @@ } } + .dropdown-menu { + max-height: 250px; + overflow-y: auto; + } + .dropdown-toggle, .dropdown-menu { color: $gl-text-color-secondary; diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index 8b59c20cb65..5a011fdaa8c 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -271,6 +271,13 @@ } } +.project-repo-buttons { + .project-action-button .dropdown-menu { + max-height: 250px; + overflow-y: auto; + } +} + .split-one { display: inline-table; margin-right: 12px; -- cgit v1.2.1 From 2bd1a229060c959a177171ddbb32d1f2202b4801 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 9 Feb 2017 15:51:49 +0000 Subject: Disables add issue button Previously was disabled until any list was present (except for done) this now takes into account the welcome blank state Closes #27931 --- app/assets/javascripts/boards/boards_bundle.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/javascripts/boards/boards_bundle.js.es6 b/app/assets/javascripts/boards/boards_bundle.js.es6 index 8f30900198e..878ad1b6031 100644 --- a/app/assets/javascripts/boards/boards_bundle.js.es6 +++ b/app/assets/javascripts/boards/boards_bundle.js.es6 @@ -95,7 +95,7 @@ $(() => { }, computed: { disabled() { - return Store.shouldAddBlankState(); + return !this.store.lists.filter(list => list.type !== 'blank' && list.type !== 'done').length; }, }, template: ` -- cgit v1.2.1 From 3ee13984ce1157b6362a2c0bcb1c1b3e6c48649d Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Fri, 10 Feb 2017 09:14:21 +1100 Subject: enable lint --- app/assets/javascripts/task_list.js.es6 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/task_list.js.es6 b/app/assets/javascripts/task_list.js.es6 index 1186a1ecfb9..3bbae06cee9 100644 --- a/app/assets/javascripts/task_list.js.es6 +++ b/app/assets/javascripts/task_list.js.es6 @@ -1,6 +1,3 @@ -/* eslint-disable class-methods-use-this, no-new, func-names, prefer-template, no-unneeded-ternary, object-shorthand, space-before-function-paren, comma-dangle, quote-props, consistent-return, no-else-return, no-param-reassign, max-len */ -/* global UsersSelect */ - require('vendor/task_list'); class TaskList { @@ -20,7 +17,7 @@ class TaskList { disable() { $(`${this.selector} .js-task-list-container`).taskList('disable'); - return $(document).off('tasklist:changed', `${this.selector} .js-task-list-container`); + $(document).off('tasklist:changed', `${this.selector} .js-task-list-container`); } update(e) { -- cgit v1.2.1 From d3ff2fa59b68f98d89d77e818e3416646d4ceaa7 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 10 Feb 2017 03:41:39 -0500 Subject: Restore exposure of legend property for events --- app/serializers/analytics_stage_entity.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/serializers/analytics_stage_entity.rb b/app/serializers/analytics_stage_entity.rb index a559d0850c4..69bf693de8d 100644 --- a/app/serializers/analytics_stage_entity.rb +++ b/app/serializers/analytics_stage_entity.rb @@ -2,6 +2,7 @@ class AnalyticsStageEntity < Grape::Entity include EntityDateHelper expose :title + expose :legend expose :description expose :median, as: :value do |stage| -- cgit v1.2.1 From bf30a78064f9d0f73b596efaaf96b197b86bca71 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 10 Feb 2017 03:42:26 -0500 Subject: Make sure events have most properties defined --- .../cycle_analytics/cycle_analytics_bundle.js.es6 | 4 +- .../cycle_analytics/cycle_analytics_store.js.es6 | 47 ++++++----- .../cycle_analytics/default_event_objects.js.es6 | 98 ++++++++++++++++++++++ app/assets/javascripts/lib/utils/text_utility.js | 10 ++- app/assets/javascripts/wikis.js.es6 | 6 +- 5 files changed, 137 insertions(+), 28 deletions(-) create mode 100644 app/assets/javascripts/cycle_analytics/default_event_objects.js.es6 (limited to 'app') diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js.es6 b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js.es6 index c41c57c1dcd..f161eb23795 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js.es6 +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js.es6 @@ -97,7 +97,7 @@ $(() => { } this.isLoadingStage = true; - cycleAnalyticsStore.setStageEvents([]); + cycleAnalyticsStore.setStageEvents([], stage); cycleAnalyticsStore.setActiveStage(stage); cycleAnalyticsService @@ -107,7 +107,7 @@ $(() => { }) .done((response) => { this.isEmptyStage = !response.events.length; - cycleAnalyticsStore.setStageEvents(response.events); + cycleAnalyticsStore.setStageEvents(response.events, stage); }) .error(() => { this.isEmptyStage = true; diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 index be732971c7f..3efeb141008 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 @@ -1,4 +1,8 @@ /* eslint-disable no-param-reassign */ + +require('../lib/utils/text_utility'); +const DEFAULT_EVENT_OBJECTS = require('./default_event_objects'); + ((global) => { global.cycleAnalytics = global.cycleAnalytics || {}; @@ -34,11 +38,12 @@ }); newData.stages.forEach((item) => { - const stageName = item.title.toLowerCase(); + const stageSlug = gl.text.dasherize(item.title.toLowerCase()); item.active = false; - item.isUserAllowed = data.permissions[stageName]; - item.emptyStageText = EMPTY_STAGE_TEXTS[stageName]; - item.component = `stage-${stageName}-component`; + item.isUserAllowed = data.permissions[stageSlug]; + item.emptyStageText = EMPTY_STAGE_TEXTS[stageSlug]; + item.component = `stage-${stageSlug}-component`; + item.slug = stageSlug; }); newData.analytics = data; return newData; @@ -58,31 +63,33 @@ this.deactivateAllStages(); stage.active = true; }, - setStageEvents(events) { - this.state.events = this.decorateEvents(events); + setStageEvents(events, stage) { + this.state.events = this.decorateEvents(events, stage); }, - decorateEvents(events) { + decorateEvents(events, stage) { const newEvents = []; events.forEach((item) => { if (!item) return; - item.totalTime = item.total_time; - item.author.webUrl = item.author.web_url; - item.author.avatarUrl = item.author.avatar_url; + const eventItem = Object.assign({}, DEFAULT_EVENT_OBJECTS[stage.slug], item); + + eventItem.totalTime = eventItem.total_time; + eventItem.author.webUrl = eventItem.author.web_url; + eventItem.author.avatarUrl = eventItem.author.avatar_url; - if (item.created_at) item.createdAt = item.created_at; - if (item.short_sha) item.shortSha = item.short_sha; - if (item.commit_url) item.commitUrl = item.commit_url; + if (eventItem.created_at) eventItem.createdAt = eventItem.created_at; + if (eventItem.short_sha) eventItem.shortSha = eventItem.short_sha; + if (eventItem.commit_url) eventItem.commitUrl = eventItem.commit_url; - delete item.author.web_url; - delete item.author.avatar_url; - delete item.total_time; - delete item.created_at; - delete item.short_sha; - delete item.commit_url; + delete eventItem.author.web_url; + delete eventItem.author.avatar_url; + delete eventItem.total_time; + delete eventItem.created_at; + delete eventItem.short_sha; + delete eventItem.commit_url; - newEvents.push(item); + newEvents.push(eventItem); }); return newEvents; diff --git a/app/assets/javascripts/cycle_analytics/default_event_objects.js.es6 b/app/assets/javascripts/cycle_analytics/default_event_objects.js.es6 new file mode 100644 index 00000000000..cfaf9835bf8 --- /dev/null +++ b/app/assets/javascripts/cycle_analytics/default_event_objects.js.es6 @@ -0,0 +1,98 @@ +module.exports = { + issue: { + created_at: '', + url: '', + iid: '', + title: '', + total_time: {}, + author: { + avatar_url: '', + id: '', + name: '', + web_url: '', + }, + }, + plan: { + title: '', + commit_url: '', + short_sha: '', + total_time: {}, + author: { + name: '', + id: '', + avatar_url: '', + web_url: '', + }, + }, + code: { + title: '', + iid: '', + created_at: '', + url: '', + total_time: {}, + author: { + name: '', + id: '', + avatar_url: '', + web_url: '', + }, + }, + test: { + name: '', + id: '', + date: '', + url: '', + short_sha: '', + commit_url: '', + total_time: {}, + branch: { + name: '', + url: '', + }, + }, + review: { + title: '', + iid: '', + created_at: '', + url: '', + state: '', + total_time: {}, + author: { + name: '', + id: '', + avatar_url: '', + web_url: '', + }, + }, + staging: { + id: '', + short_sha: '', + date: '', + url: '', + commit_url: '', + total_time: {}, + author: { + name: '', + id: '', + avatar_url: '', + web_url: '', + }, + branch: { + name: '', + url: '', + }, + }, + production: { + title: '', + created_at: '', + url: '', + iid: '', + total_time: {}, + author: { + name: '', + id: '', + avatar_url: '', + web_url: '', + }, + }, +}; diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index d9370db0cf2..326b7cb7f57 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -1,5 +1,7 @@ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, quotes, one-var, one-var-declaration-per-line, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, no-empty, max-len, consistent-return, no-unused-vars, no-return-assign, max-len */ +require('vendor/latinise'); + (function() { (function(w) { var base; @@ -164,8 +166,14 @@ gl.text.pluralize = function(str, count) { return str + (count > 1 || count === 0 ? 's' : ''); }; - return gl.text.truncate = function(string, maxLength) { + gl.text.truncate = function(string, maxLength) { return string.substr(0, (maxLength - 3)) + '...'; }; + gl.text.dasherize = function(str) { + return str.replace(/[_\s]+/g, '-'); + }; + gl.text.slugify = function(str) { + return str.trim().toLowerCase().latinise(); + }; })(window); }).call(this); diff --git a/app/assets/javascripts/wikis.js.es6 b/app/assets/javascripts/wikis.js.es6 index ef99b2e92f0..75fd1394a03 100644 --- a/app/assets/javascripts/wikis.js.es6 +++ b/app/assets/javascripts/wikis.js.es6 @@ -1,14 +1,10 @@ /* eslint-disable no-param-reassign */ /* global Breakpoints */ -require('vendor/latinise'); require('./breakpoints'); require('vendor/jquery.nicescroll'); ((global) => { - const dasherize = str => str.replace(/[_\s]+/g, '-'); - const slugify = str => dasherize(str.trim().toLowerCase().latinise()); - class Wikis { constructor() { this.bp = Breakpoints.get(); @@ -34,7 +30,7 @@ require('vendor/jquery.nicescroll'); if (!this.newWikiForm) return; const slugInput = this.newWikiForm.querySelector('#new_wiki_path'); - const slug = slugify(slugInput.value); + const slug = gl.text.slugify(slugInput.value); if (slug.length > 0) { const wikisPath = slugInput.getAttribute('data-wikis-path'); -- cgit v1.2.1 From a70a83cf290d12ec83b79e35fd5e92375216fc43 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 7 Feb 2017 11:43:25 +0100 Subject: Skip buils that were canceled but not started yet --- app/models/commit_status.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 9547c57b2ae..e2ce5062f6f 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -65,7 +65,8 @@ class CommitStatus < ActiveRecord::Base end event :cancel do - transition [:created, :pending, :running] => :canceled + transition [:pending, :running] => :canceled + transition [:created] => :skipped end before_transition created: [:pending, :running] do |commit_status| -- cgit v1.2.1 From 008f22cd820a5bf9e8ff9a68550c9550463d3279 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 9 Feb 2017 11:11:42 +0100 Subject: Fix pipeline specs related to canceling builds --- app/models/commit_status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index e2ce5062f6f..4a064644d64 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -65,8 +65,8 @@ class CommitStatus < ActiveRecord::Base end event :cancel do - transition [:pending, :running] => :canceled transition [:created] => :skipped + transition [:pending, :running] => :canceled end before_transition created: [:pending, :running] do |commit_status| -- cgit v1.2.1 From ffcf3c68586b5e4a977a3c92cd1b3f8b1871c322 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 9 Feb 2017 12:47:11 +0100 Subject: Skip job only when canceling the pipeline it belongs to --- app/models/ci/pipeline.rb | 8 +++++++- app/models/commit_status.rb | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index bbc358adb83..8371c2d8c72 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -214,7 +214,13 @@ module Ci def cancel_running Gitlab::OptimisticLocking.retry_lock( statuses.cancelable) do |cancelable| - cancelable.each(&:cancel) + cancelable.each do |status| + if status.created? + status.skip + elsif status.active? + status.cancel + end + end end end diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 4a064644d64..9547c57b2ae 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -65,8 +65,7 @@ class CommitStatus < ActiveRecord::Base end event :cancel do - transition [:created] => :skipped - transition [:pending, :running] => :canceled + transition [:created, :pending, :running] => :canceled end before_transition created: [:pending, :running] do |commit_status| -- cgit v1.2.1 From 9202b1f4dfc65df9daff3797b3012840f6359f03 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 10 Feb 2017 15:43:15 +0100 Subject: Extract CI/CD build retry code to separate service --- app/models/ci/build.rb | 27 +-------------------- app/services/ci/retry_build_service.rb | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 app/services/ci/retry_build_service.rb (limited to 'app') diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 8c1b076c2d7..db0cf032087 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -63,32 +63,7 @@ module Ci end def retry(build, user = nil) - new_build = Ci::Build.create( - ref: build.ref, - tag: build.tag, - options: build.options, - commands: build.commands, - tag_list: build.tag_list, - project: build.project, - pipeline: build.pipeline, - name: build.name, - allow_failure: build.allow_failure, - stage: build.stage, - stage_idx: build.stage_idx, - trigger_request: build.trigger_request, - yaml_variables: build.yaml_variables, - when: build.when, - user: user, - environment: build.environment, - status_event: 'enqueue' - ) - - MergeRequests::AddTodoWhenBuildFailsService - .new(build.project, nil) - .close(new_build) - - build.pipeline.mark_as_processable_after_stage(build.stage_idx) - new_build + Ci::RetryBuildService.new(build, user).retry! end end diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb new file mode 100644 index 00000000000..92006cb331c --- /dev/null +++ b/app/services/ci/retry_build_service.rb @@ -0,0 +1,43 @@ +module Ci + class RetryBuildService + def initialize(build, user) + @build = build + @user = user + @pipeline = build.pipeline + end + + def retry! + clone_build.tap do |new_build| + new_build.enqueue! + + MergeRequests::AddTodoWhenBuildFailsService + .new(@build.project, @user) + .close(new_build) + + @pipeline.mark_as_processable_after_stage(@build.stage_idx) + end + end + + private + + def clone_build + Ci::Build.create( + ref: @build.ref, + tag: @build.tag, + options: @build.options, + commands: @build.commands, + tag_list: @build.tag_list, + project: @build.project, + pipeline: @build.pipeline, + name: @build.name, + allow_failure: @build.allow_failure, + stage: @build.stage, + stage_idx: @build.stage_idx, + trigger_request: @build.trigger_request, + yaml_variables: @build.yaml_variables, + when: @build.when, + environment: @build.environment, + user: @user) + end + end +end -- cgit v1.2.1 From db09d10599ec92ed558578e5066b1ba695b06cda Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 10 Feb 2017 16:19:29 +0100 Subject: Add specs for build retry service --- app/services/ci/retry_build_service.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app') diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index 92006cb331c..de410be7f14 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -1,5 +1,7 @@ module Ci class RetryBuildService + include Gitlab::Allowable + def initialize(build, user) @build = build @user = user @@ -7,6 +9,10 @@ module Ci end def retry! + unless can?(@user, :update_build, @build) + raise Gitlab::Access::AccessDeniedError + end + clone_build.tap do |new_build| new_build.enqueue! -- cgit v1.2.1 From c5e788084152a110558eca747407129d01c34e94 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 13 Feb 2017 13:01:52 +0100 Subject: Fix CI build specs after adding retry ability check --- app/models/ci/build.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index db0cf032087..0b4b7b33ecd 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -62,8 +62,8 @@ module Ci new_build.save end - def retry(build, user = nil) - Ci::RetryBuildService.new(build, user).retry! + def retry(build, current_user) + Ci::RetryBuildService.new(build, current_user).retry! end end @@ -111,7 +111,7 @@ module Ci project.builds_enabled? && commands.present? && manual? && skipped? end - def play(current_user = nil) + def play(current_user) # Try to queue a current build if self.enqueue self.update(user: current_user) -- cgit v1.2.1 From 19ef4083f373dd5fdc6b4c59325a4cb14179e699 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 13 Feb 2017 15:14:40 +0100 Subject: Add a separate CI/CD pipeline retry service class --- app/models/ci/pipeline.rb | 4 +++- app/services/ci/retry_pipeline_service.rb | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 app/services/ci/retry_pipeline_service.rb (limited to 'app') diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 8371c2d8c72..72b09c12e01 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -234,7 +234,9 @@ module Ci end def mark_as_processable_after_stage(stage_idx) - builds.skipped.where('stage_idx > ?', stage_idx).find_each(&:process) + builds.skipped + .where('stage_idx > ?', stage_idx) + .find_each(&:process) end def latest? diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb new file mode 100644 index 00000000000..f873acc9964 --- /dev/null +++ b/app/services/ci/retry_pipeline_service.rb @@ -0,0 +1,22 @@ +module Ci + class RetryPipelineService + include Gitlab::Allowable + + def initialize(pipeline, user) + @pipeline = pipeline + @user = user + end + + def execute + unless can?(@user, :update_pipeline, @pipeline) + raise Gitlab::Access::AccessDeniedError + end + + @pipeline.stages.each do |stage| + stage.builds.failed_or_canceled.find_each do |build| + Ci::Build.retry(build, @user) + end + end + end + end +end -- cgit v1.2.1 From c65e96061bf2dae9f79ffbbf4b291cb12bf47d90 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 13 Feb 2017 16:38:08 +0100 Subject: Implement new pipeline retry service The new service takes stages order into account. --- app/models/ci/stage.rb | 12 ++++++++++++ app/services/ci/retry_build_service.rb | 12 +++++------- app/services/ci/retry_pipeline_service.rb | 27 ++++++++++++++++++++++++--- 3 files changed, 41 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index ca74c91b062..c6a7984870f 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -19,6 +19,10 @@ module Ci name end + def index + statuses.first.stage_idx + end + def statuses_count @statuses_count ||= statuses.count end @@ -45,6 +49,14 @@ module Ci status.to_s == 'success' end + def failed? + status.to_s == 'failed' + end + + def canceled? + status.to_s == 'canceled' + end + def has_warnings? if @warnings.nil? statuses.latest.failed_but_allowed.any? diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index de410be7f14..b7a9a55dd9e 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -9,11 +9,7 @@ module Ci end def retry! - unless can?(@user, :update_build, @build) - raise Gitlab::Access::AccessDeniedError - end - - clone_build.tap do |new_build| + reprocess!.tap do |new_build| new_build.enqueue! MergeRequests::AddTodoWhenBuildFailsService @@ -24,9 +20,11 @@ module Ci end end - private + def reprocess! + unless can?(@user, :update_build, @build) + raise Gitlab::Access::AccessDeniedError + end - def clone_build Ci::Build.create( ref: @build.ref, tag: @build.tag, diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index f873acc9964..9d8e4d361f4 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -12,10 +12,31 @@ module Ci raise Gitlab::Access::AccessDeniedError end - @pipeline.stages.each do |stage| - stage.builds.failed_or_canceled.find_each do |build| - Ci::Build.retry(build, @user) + ## + # Reprocess builds in subsequent stages if any + # + # TODO, refactor. + # + @pipeline.builds + .where('stage_idx > ?', resume_stage.index) + .failed_or_canceled.find_each do |build| + Ci::RetryBuildService.new(build, @user).reprocess! end + + ## + # Retry builds in the first unsuccessful stage + # + resume_stage.builds.failed_or_canceled.find_each do |build| + Ci::Build.retry(build, @user) + end + + end + + private + + def resume_stage + @resume_stage ||= @pipeline.stages.find do |stage| + stage.failed? || stage.canceled? end end end -- cgit v1.2.1 From 1536109ccd297924474da3e46019b191013c55d4 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Thu, 9 Feb 2017 22:35:32 -0500 Subject: Retrigger at.js for slash commands with autocomplete suffix --- app/assets/javascripts/gfm_auto_complete.js.es6 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6 index 7f1f2a5d278..0f6994dd2d1 100644 --- a/app/assets/javascripts/gfm_auto_complete.js.es6 +++ b/app/assets/javascripts/gfm_auto_complete.js.es6 @@ -103,6 +103,9 @@ this.input.each((i, input) => { const $input = $(input); $input.off('focus.setupAtWho').on('focus.setupAtWho', this.setupAtWho.bind(this, $input)); + // This triggers at.js again + // Needed for slash commands with suffixes (ex: /label ~) + $input.on('inserted-commands.atwho', $input.trigger.bind($input, 'keyup')); }); }, setupAtWho: function($input) { -- cgit v1.2.1 From 21401a39b8d7ef42f71595803a0a82f11f375e71 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 13 Feb 2017 20:03:18 +0100 Subject: Fix Rubocop offense in pipeline retry service --- app/services/ci/retry_pipeline_service.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'app') diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index 9d8e4d361f4..801eaa59cd6 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -29,7 +29,6 @@ module Ci resume_stage.builds.failed_or_canceled.find_each do |build| Ci::Build.retry(build, @user) end - end private -- cgit v1.2.1 From ced971b12a1f6e01bb443b81c90e8691d8cc69b4 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Tue, 14 Feb 2017 13:52:20 +1100 Subject: code style and test fixes fix test following https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9172 --- app/assets/javascripts/task_list.js | 39 +++++++++++++++++++++++++++++++++ app/assets/javascripts/task_list.js.es6 | 39 --------------------------------- 2 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 app/assets/javascripts/task_list.js delete mode 100644 app/assets/javascripts/task_list.js.es6 (limited to 'app') diff --git a/app/assets/javascripts/task_list.js b/app/assets/javascripts/task_list.js new file mode 100644 index 00000000000..3bbae06cee9 --- /dev/null +++ b/app/assets/javascripts/task_list.js @@ -0,0 +1,39 @@ +require('vendor/task_list'); + +class TaskList { + constructor(options = {}) { + this.selector = options.selector; + this.dataType = options.dataType; + this.onSuccess = options.onSuccess || (() => {}); + this.init(); + } + + init() { + // Prevent duplicate event bindings + this.disable(); + $(`${this.selector} .js-task-list-container`).taskList('enable'); + $(document).on('tasklist:changed', `${this.selector} .js-task-list-container`, this.update.bind(this)); + } + + disable() { + $(`${this.selector} .js-task-list-container`).taskList('disable'); + $(document).off('tasklist:changed', `${this.selector} .js-task-list-container`); + } + + update(e) { + const $target = $(e.target); + const patchData = {}; + patchData[this.dataType] = { + description: $target.val(), + }; + return $.ajax({ + type: 'PATCH', + url: $target.data('update-url') || $('form.js-issuable-update').attr('action'), + data: patchData, + success: this.onSuccess, + }); + } +} + +window.gl = window.gl || {}; +window.gl.TaskList = TaskList; diff --git a/app/assets/javascripts/task_list.js.es6 b/app/assets/javascripts/task_list.js.es6 deleted file mode 100644 index 3bbae06cee9..00000000000 --- a/app/assets/javascripts/task_list.js.es6 +++ /dev/null @@ -1,39 +0,0 @@ -require('vendor/task_list'); - -class TaskList { - constructor(options = {}) { - this.selector = options.selector; - this.dataType = options.dataType; - this.onSuccess = options.onSuccess || (() => {}); - this.init(); - } - - init() { - // Prevent duplicate event bindings - this.disable(); - $(`${this.selector} .js-task-list-container`).taskList('enable'); - $(document).on('tasklist:changed', `${this.selector} .js-task-list-container`, this.update.bind(this)); - } - - disable() { - $(`${this.selector} .js-task-list-container`).taskList('disable'); - $(document).off('tasklist:changed', `${this.selector} .js-task-list-container`); - } - - update(e) { - const $target = $(e.target); - const patchData = {}; - patchData[this.dataType] = { - description: $target.val(), - }; - return $.ajax({ - type: 'PATCH', - url: $target.data('update-url') || $('form.js-issuable-update').attr('action'), - data: patchData, - success: this.onSuccess, - }); - } -} - -window.gl = window.gl || {}; -window.gl.TaskList = TaskList; -- cgit v1.2.1 From c0db4400f4d838e496090a6cd52a65bf2cd2051c Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 10:38:17 +0100 Subject: Preserve base service abstraction for retry services --- app/models/ci/build.rb | 4 +- app/services/ci/retry_build_service.rb | 61 +++++++++++++++---------------- app/services/ci/retry_pipeline_service.rb | 30 ++++++++------- 3 files changed, 48 insertions(+), 47 deletions(-) (limited to 'app') diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 0b4b7b33ecd..e018f8e7c4e 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -63,7 +63,9 @@ module Ci end def retry(build, current_user) - Ci::RetryBuildService.new(build, current_user).retry! + Ci::RetryBuildService + .new(build.project, current_user) + .execute(build) end end diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index b7a9a55dd9e..e470bd6ee6a 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -1,47 +1,44 @@ module Ci - class RetryBuildService - include Gitlab::Allowable + class RetryBuildService < ::BaseService + def execute(build) + self.retry(build).tap do |new_build| + MergeRequests::AddTodoWhenBuildFailsService + .new(build.project, current_user) + .close(new_build) - def initialize(build, user) - @build = build - @user = user - @pipeline = build.pipeline + build.pipeline + .mark_as_processable_after_stage(build.stage_idx) + end end - def retry! - reprocess!.tap do |new_build| + def retry(build) + self.reprocess(build).tap do |new_build| new_build.enqueue! - - MergeRequests::AddTodoWhenBuildFailsService - .new(@build.project, @user) - .close(new_build) - - @pipeline.mark_as_processable_after_stage(@build.stage_idx) end end - def reprocess! - unless can?(@user, :update_build, @build) + def reprocess(build) + unless can?(current_user, :update_build, build) raise Gitlab::Access::AccessDeniedError end Ci::Build.create( - ref: @build.ref, - tag: @build.tag, - options: @build.options, - commands: @build.commands, - tag_list: @build.tag_list, - project: @build.project, - pipeline: @build.pipeline, - name: @build.name, - allow_failure: @build.allow_failure, - stage: @build.stage, - stage_idx: @build.stage_idx, - trigger_request: @build.trigger_request, - yaml_variables: @build.yaml_variables, - when: @build.when, - environment: @build.environment, - user: @user) + ref: build.ref, + tag: build.tag, + options: build.options, + commands: build.commands, + tag_list: build.tag_list, + project: build.project, + pipeline: build.pipeline, + name: build.name, + allow_failure: build.allow_failure, + stage: build.stage, + stage_idx: build.stage_idx, + trigger_request: build.trigger_request, + yaml_variables: build.yaml_variables, + when: build.when, + environment: build.environment, + user: current_user) end end end diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index 801eaa59cd6..fd180b2c624 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -1,34 +1,36 @@ module Ci - class RetryPipelineService - include Gitlab::Allowable - - def initialize(pipeline, user) + class RetryPipelineService < ::BaseService + def execute(pipeline) @pipeline = pipeline - @user = user - end - def execute - unless can?(@user, :update_pipeline, @pipeline) + unless can?(current_user, :update_pipeline, pipeline) raise Gitlab::Access::AccessDeniedError end ## - # Reprocess builds in subsequent stages if any - # - # TODO, refactor. + # Reprocess builds in subsequent stages # - @pipeline.builds + pipeline.builds .where('stage_idx > ?', resume_stage.index) .failed_or_canceled.find_each do |build| - Ci::RetryBuildService.new(build, @user).reprocess! + Ci::RetryBuildService + .new(project, current_user) + .reprocess(build) end ## # Retry builds in the first unsuccessful stage # resume_stage.builds.failed_or_canceled.find_each do |build| - Ci::Build.retry(build, @user) + Ci::RetryBuildService + .new(project, current_user) + .retry(build) end + + ## + # Mark skipped builds as processable again + # + pipeline.mark_as_processable_after_stage(resume_stage.index) end private -- cgit v1.2.1 From 3063ab45dd8a49a13ec5f8f091665600ed487bd3 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 11:28:30 +0100 Subject: Reuse `Gitlab::Allowable` mixin in base service --- app/services/base_service.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'app') diff --git a/app/services/base_service.rb b/app/services/base_service.rb index 1a2bad77a02..fa45506317e 100644 --- a/app/services/base_service.rb +++ b/app/services/base_service.rb @@ -1,4 +1,5 @@ class BaseService + include Gitlab::Allowable include Gitlab::CurrentSettings attr_accessor :project, :current_user, :params @@ -7,10 +8,6 @@ class BaseService @project, @current_user, @params = project, user, params.dup end - def can?(object, action, subject) - Ability.allowed?(object, action, subject) - end - def notification_service NotificationService.new end -- cgit v1.2.1 From 346a7c696abcf6d3d3a7e0281d951865c0e75c79 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 11:38:19 +0100 Subject: Add after_stage scope to commit status class --- app/models/ci/pipeline.rb | 4 +--- app/models/commit_status.rb | 6 +++--- app/services/ci/retry_pipeline_service.rb | 12 ++++++------ 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'app') diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 72b09c12e01..8d43f3051ee 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -234,9 +234,7 @@ module Ci end def mark_as_processable_after_stage(stage_idx) - builds.skipped - .where('stage_idx > ?', stage_idx) - .find_each(&:process) + builds.skipped.after_stage(stage_idx).find_each(&:process) end def latest? diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 9547c57b2ae..99a6326309d 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -23,9 +23,6 @@ class CommitStatus < ActiveRecord::Base where(id: max_id.group(:name, :commit_id)) end - scope :retried, -> { where.not(id: latest) } - scope :ordered, -> { order(:name) } - scope :failed_but_allowed, -> do where(allow_failure: true, status: [:failed, :canceled]) end @@ -36,8 +33,11 @@ class CommitStatus < ActiveRecord::Base false, all_state_names - [:failed, :canceled]) end + scope :retried, -> { where.not(id: latest) } + scope :ordered, -> { order(:name) } scope :latest_ordered, -> { latest.ordered.includes(project: :namespace) } scope :retried_ordered, -> { retried.ordered.includes(project: :namespace) } + scope :after_stage, -> (index) { where('stage_idx > ?', index) } state_machine :status do event :enqueue do diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index fd180b2c624..b062c50e82d 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -11,13 +11,18 @@ module Ci # Reprocess builds in subsequent stages # pipeline.builds - .where('stage_idx > ?', resume_stage.index) + .after_stage(resume_stage.index) .failed_or_canceled.find_each do |build| Ci::RetryBuildService .new(project, current_user) .reprocess(build) end + ## + # Mark skipped builds as processable again + # + pipeline.mark_as_processable_after_stage(resume_stage.index) + ## # Retry builds in the first unsuccessful stage # @@ -26,11 +31,6 @@ module Ci .new(project, current_user) .retry(build) end - - ## - # Mark skipped builds as processable again - # - pipeline.mark_as_processable_after_stage(resume_stage.index) end private -- cgit v1.2.1 From 94495f984c0a81d32b6f748fd977848dc5c6721e Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 12:20:02 +0100 Subject: Use new pipeline retry service with optimistic locking --- app/models/ci/pipeline.rb | 10 ++---- app/services/ci/retry_build_service.rb | 2 ++ app/services/ci/retry_pipeline_service.rb | 54 +++++++++++++++++++------------ 3 files changed, 39 insertions(+), 27 deletions(-) (limited to 'app') diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 8d43f3051ee..49bd2e1d7f0 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -224,13 +224,9 @@ module Ci end end - def retry_failed(user) - Gitlab::OptimisticLocking.retry_lock( - builds.latest.failed_or_canceled) do |failed_or_canceled| - failed_or_canceled.select(&:retryable?).each do |build| - Ci::Build.retry(build, user) - end - end + def retry_failed(current_user) + Ci::RetryPipelineService.new(project, current_user) + .execute(self) end def mark_as_processable_after_stage(stage_idx) diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index e470bd6ee6a..009fbeaff20 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -1,6 +1,8 @@ module Ci class RetryBuildService < ::BaseService def execute(build) + # return unless build.retryable? + self.retry(build).tap do |new_build| MergeRequests::AddTodoWhenBuildFailsService .new(build.project, current_user) diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index b062c50e82d..1b931455fb8 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -7,34 +7,48 @@ module Ci raise Gitlab::Access::AccessDeniedError end - ## - # Reprocess builds in subsequent stages - # - pipeline.builds - .after_stage(resume_stage.index) - .failed_or_canceled.find_each do |build| - Ci::RetryBuildService - .new(project, current_user) - .reprocess(build) - end - - ## - # Mark skipped builds as processable again - # pipeline.mark_as_processable_after_stage(resume_stage.index) - ## - # Retry builds in the first unsuccessful stage - # - resume_stage.builds.failed_or_canceled.find_each do |build| - Ci::RetryBuildService - .new(project, current_user) + retryable_builds_in_subsequent_stages do |build| + Ci::RetryBuildService.new(project, current_user) + .reprocess(build) + end + + retryable_builds_in_first_unsuccessful_stage do |build| + Ci::RetryBuildService.new(project, current_user) .retry(build) end end private + def retryable_builds_in_subsequent_stages + relation = @pipeline.builds + .after_stage(resume_stage.index) + .failed_or_canceled + + each_retryable_build_with_locking(relation) do |build| + yield build + end + end + + def retryable_builds_in_first_unsuccessful_stage + relation = resume_stage.builds.failed_or_canceled + + each_retryable_build_with_locking(relation) do |build| + yield build + end + end + + def each_retryable_build_with_locking(relation) + Gitlab::OptimisticLocking.retry_lock(relation) do |builds| + builds.find_each do |build| + next unless build.retryable? + yield build + end + end + end + def resume_stage @resume_stage ||= @pipeline.stages.find do |stage| stage.failed? || stage.canceled? -- cgit v1.2.1 From 056f1b702042382c99dcfdaf1e292bf68b8f55ba Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 13:29:58 +0100 Subject: Simplify implementation of pipeline retry service --- app/models/ci/pipeline.rb | 8 +----- app/services/ci/retry_pipeline_service.rb | 42 ++++--------------------------- 2 files changed, 6 insertions(+), 44 deletions(-) (limited to 'app') diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 49bd2e1d7f0..dc4590a9923 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -214,13 +214,7 @@ module Ci def cancel_running Gitlab::OptimisticLocking.retry_lock( statuses.cancelable) do |cancelable| - cancelable.each do |status| - if status.created? - status.skip - elsif status.active? - status.cancel - end - end + cancelable.find_each(&:cancel) end end diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index 1b931455fb8..8a1a9191478 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -1,57 +1,25 @@ module Ci class RetryPipelineService < ::BaseService def execute(pipeline) - @pipeline = pipeline - unless can?(current_user, :update_pipeline, pipeline) raise Gitlab::Access::AccessDeniedError end - pipeline.mark_as_processable_after_stage(resume_stage.index) + each_build(pipeline.builds.failed_or_canceled) do |build| + next unless build.retryable? - retryable_builds_in_subsequent_stages do |build| Ci::RetryBuildService.new(project, current_user) .reprocess(build) end - retryable_builds_in_first_unsuccessful_stage do |build| - Ci::RetryBuildService.new(project, current_user) - .retry(build) - end + pipeline.process! end private - def retryable_builds_in_subsequent_stages - relation = @pipeline.builds - .after_stage(resume_stage.index) - .failed_or_canceled - - each_retryable_build_with_locking(relation) do |build| - yield build - end - end - - def retryable_builds_in_first_unsuccessful_stage - relation = resume_stage.builds.failed_or_canceled - - each_retryable_build_with_locking(relation) do |build| - yield build - end - end - - def each_retryable_build_with_locking(relation) + def each_build(relation) Gitlab::OptimisticLocking.retry_lock(relation) do |builds| - builds.find_each do |build| - next unless build.retryable? - yield build - end - end - end - - def resume_stage - @resume_stage ||= @pipeline.stages.find do |stage| - stage.failed? || stage.canceled? + builds.find_each { |build| yield build } end end end -- cgit v1.2.1 From d4522de2fd71f2d21118ceec50e8509114c7f64b Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 13:31:59 +0100 Subject: Revert adding new methods in CI/CD stage class --- app/models/ci/stage.rb | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'app') diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index c6a7984870f..ca74c91b062 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -19,10 +19,6 @@ module Ci name end - def index - statuses.first.stage_idx - end - def statuses_count @statuses_count ||= statuses.count end @@ -49,14 +45,6 @@ module Ci status.to_s == 'success' end - def failed? - status.to_s == 'failed' - end - - def canceled? - status.to_s == 'canceled' - end - def has_warnings? if @warnings.nil? statuses.latest.failed_but_allowed.any? -- cgit v1.2.1 From 108d3765abe224b99084e4e01e58d219638757a6 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 13:39:14 +0100 Subject: Simplify implementation of build retry service --- app/services/ci/retry_build_service.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index 009fbeaff20..3ce7a092e72 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -1,9 +1,9 @@ module Ci class RetryBuildService < ::BaseService def execute(build) - # return unless build.retryable? + reprocess(build).tap do |new_build| + new_build.enqueue! - self.retry(build).tap do |new_build| MergeRequests::AddTodoWhenBuildFailsService .new(build.project, current_user) .close(new_build) @@ -13,12 +13,6 @@ module Ci end end - def retry(build) - self.reprocess(build).tap do |new_build| - new_build.enqueue! - end - end - def reprocess(build) unless can?(current_user, :update_build, build) raise Gitlab::Access::AccessDeniedError -- cgit v1.2.1 From 82e6efb8099f2e54c1201dba815d4082f1e01a55 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 13:51:12 +0100 Subject: Avoid race condition in build retry service --- app/services/ci/retry_build_service.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index 3ce7a092e72..ed4694237f6 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -2,14 +2,13 @@ module Ci class RetryBuildService < ::BaseService def execute(build) reprocess(build).tap do |new_build| + build.pipeline.mark_as_processable_after_stage(build.stage_idx) + new_build.enqueue! MergeRequests::AddTodoWhenBuildFailsService .new(build.project, current_user) .close(new_build) - - build.pipeline - .mark_as_processable_after_stage(build.stage_idx) end end -- cgit v1.2.1 From 7460159ec91fc7b1ec840dc0a10aa21b3dbbf070 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 14 Feb 2017 14:56:28 +0100 Subject: Reuse pipeline methods to preserve Law of Demeter --- app/views/projects/pipelines/_info.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/projects/pipelines/_info.html.haml b/app/views/projects/pipelines/_info.html.haml index a6cd2d83bd5..e0c972aa2fb 100644 --- a/app/views/projects/pipelines/_info.html.haml +++ b/app/views/projects/pipelines/_info.html.haml @@ -7,9 +7,9 @@ = commit_author_link(@commit) .header-action-buttons - if can?(current_user, :update_pipeline, @pipeline.project) - - if @pipeline.builds.latest.failed.any?(&:retryable?) + - if @pipeline.retryable? = link_to "Retry failed", retry_namespace_project_pipeline_path(@pipeline.project.namespace, @pipeline.project, @pipeline.id), class: 'btn btn-inverted-secondary', method: :post - - if @pipeline.builds.running_or_pending.any? + - if @pipeline.cancelable? = link_to "Cancel running", cancel_namespace_project_pipeline_path(@pipeline.project.namespace, @pipeline.project, @pipeline.id), data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post - if @commit -- cgit v1.2.1 From 3c4dc4338484acc8736c347b5b64029450836c03 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 14 Feb 2017 13:39:11 -0500 Subject: Dispatch needed JS when creating a new MR in diff view --- app/assets/javascripts/dispatcher.js.es6 | 1 + app/controllers/projects/application_controller.rb | 1 - app/controllers/projects/merge_requests_controller.rb | 3 +++ 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/javascripts/dispatcher.js.es6 b/app/assets/javascripts/dispatcher.js.es6 index 7eec2d39a9c..f06a8848021 100644 --- a/app/assets/javascripts/dispatcher.js.es6 +++ b/app/assets/javascripts/dispatcher.js.es6 @@ -118,6 +118,7 @@ const ShortcutsBlob = require('./shortcuts_blob'); new gl.IssuableTemplateSelectors(); break; case 'projects:merge_requests:new': + case 'projects:merge_requests:new_diffs': case 'projects:merge_requests:edit': new gl.Diff(); shortcut_handler = new ShortcutsNavigation(); diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index db33b60b229..e2f81b09adc 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -83,7 +83,6 @@ class Projects::ApplicationController < ApplicationController end def apply_diff_view_cookie! - @show_changes_tab = params[:view].present? cookies.permanent[:diff_view] = params.delete(:view) if params[:view].present? end diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index c3e1760f168..4c981fe4e7e 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -245,6 +245,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController respond_to do |format| format.html do define_new_vars + @show_changes_tab = true render "new" end format.json do @@ -613,6 +614,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController @labels = LabelsFinder.new(current_user, project_id: @project.id).execute + @show_changes_tab = params[:show_changes].present? + define_pipelines_vars end -- cgit v1.2.1 From fa79fefef8880ac4ba8b4390dd191f8f04171025 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Wed, 30 Nov 2016 23:17:21 +1000 Subject: Fix position of counters within milestone panels --- app/assets/stylesheets/pages/milestone.scss | 20 ++++++++++++++++++++ app/views/shared/milestones/_issuables.html.haml | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/pages/milestone.scss b/app/assets/stylesheets/pages/milestone.scss index 3da1150f89b..27c47d36818 100644 --- a/app/assets/stylesheets/pages/milestone.scss +++ b/app/assets/stylesheets/pages/milestone.scss @@ -30,6 +30,26 @@ word-wrap: break-word; } } + + .panel-heading { + line-height: $line-height-base; + padding: 14px 16px; + display: -webkit-flex; + display: flex; + + .title { + -webkit-flex: 1; + -webkit-flex-grow: 1; + flex: 1; + flex-grow: 2; + } + + .counter { + -webkit-flex: 1; + flex: 0; + padding-left: 16px; + } + } } .milestone-summary { diff --git a/app/views/shared/milestones/_issuables.html.haml b/app/views/shared/milestones/_issuables.html.haml index 31eb07ca666..a93cbd1041f 100644 --- a/app/views/shared/milestones/_issuables.html.haml +++ b/app/views/shared/milestones/_issuables.html.haml @@ -3,11 +3,11 @@ - panel_class = primary ? 'panel-primary' : 'panel-default' .panel{ class: panel_class } - .panel-heading.split - .left + .panel-heading + .title = title - if show_counter - .right + .counter = number_with_delimiter(issuables.size) - class_prefix = dom_class(issuables).pluralize -- cgit v1.2.1 From 3f713db0da2602152aa482b57f84b7418fd20a93 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Wed, 15 Feb 2017 16:53:17 +1100 Subject: update correct field for Notes - it's called note not description --- app/assets/javascripts/issue.js | 1 + app/assets/javascripts/merge_request.js | 1 + app/assets/javascripts/notes.js | 1 + app/assets/javascripts/task_list.js | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index fd9b3cb833d..00d253a964c 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -14,6 +14,7 @@ require('./task_list'); if ($('a.btn-close').length) { this.taskList = new gl.TaskList({ dataType: 'issue', + fieldName: 'description', selector: '.detail-page-description', onSuccess: (result) => { document.querySelector('#task_status').innerText = result.task_status; diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index a72d75379f2..be12d925040 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -29,6 +29,7 @@ require('./merge_request_tabs'); if ($("a.btn-close").length) { this.taskList = new gl.TaskList({ dataType: 'merge_request', + fieldName: 'description', selector: '.detail-page-description', onSuccess: (result) => { document.querySelector('#task_status').innerText = result.task_status; diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index e5892f199cd..e12a45adc9f 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -53,6 +53,7 @@ require('./task_list'); this.setupMainTargetNoteForm(); this.taskList = new gl.TaskList({ dataType: 'note', + fieldName: 'note', selector: '.notes' }); this.collapseLongCommitList(); diff --git a/app/assets/javascripts/task_list.js b/app/assets/javascripts/task_list.js index 3bbae06cee9..dfe24d1fb33 100644 --- a/app/assets/javascripts/task_list.js +++ b/app/assets/javascripts/task_list.js @@ -4,6 +4,7 @@ class TaskList { constructor(options = {}) { this.selector = options.selector; this.dataType = options.dataType; + this.fieldName = options.fieldName; this.onSuccess = options.onSuccess || (() => {}); this.init(); } @@ -24,7 +25,7 @@ class TaskList { const $target = $(e.target); const patchData = {}; patchData[this.dataType] = { - description: $target.val(), + [this.fieldName]: $target.val(), }; return $.ajax({ type: 'PATCH', -- cgit v1.2.1 From 25b3b2e5bc52000ac05efa9e87bff7bd949d8ed9 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 15 Feb 2017 10:54:33 +0100 Subject: Make it possible to resolve all todos for pipeline --- app/services/merge_requests/add_todo_when_build_fails_service.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app') diff --git a/app/services/merge_requests/add_todo_when_build_fails_service.rb b/app/services/merge_requests/add_todo_when_build_fails_service.rb index 12a8415d9a5..727768b1a39 100644 --- a/app/services/merge_requests/add_todo_when_build_fails_service.rb +++ b/app/services/merge_requests/add_todo_when_build_fails_service.rb @@ -18,5 +18,11 @@ module MergeRequests todo_service.merge_request_build_retried(merge_request) end end + + def close_all(pipeline) + pipeline_merge_requests(pipeline) do |merge_request| + todo_service.merge_request_build_retried(merge_request) + end + end end end -- cgit v1.2.1 From 9c37a26cc744ff4479f2b3b62c15d8b0e62f728d Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 15 Feb 2017 11:02:05 +0100 Subject: Close all pipeline todos at once when retrying it --- app/services/ci/retry_build_service.rb | 2 +- app/services/ci/retry_pipeline_service.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index ed4694237f6..a8464cd9922 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -7,7 +7,7 @@ module Ci new_build.enqueue! MergeRequests::AddTodoWhenBuildFailsService - .new(build.project, current_user) + .new(project, current_user) .close(new_build) end end diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index 8a1a9191478..808f29adea2 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -12,6 +12,10 @@ module Ci .reprocess(build) end + MergeRequests::AddTodoWhenBuildFailsService + .new(project, current_user) + .close_all(pipeline) + pipeline.process! end -- cgit v1.2.1 From 7e8a3f7ef7119957cf6b42da189cf9e99abe08fd Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 15 Feb 2017 16:03:24 +0100 Subject: When retrying a build copy a coverage regex setting --- app/services/ci/retry_build_service.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index a8464cd9922..4c4518d8029 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -33,6 +33,7 @@ module Ci yaml_variables: build.yaml_variables, when: build.when, environment: build.environment, + coverage_regex: build.coverage_regex, user: current_user) end end -- cgit v1.2.1 From 407b491e2d994492c097b9c8878f094bb8041576 Mon Sep 17 00:00:00 2001 From: Jan Christophersen Date: Mon, 13 Feb 2017 19:47:41 +0100 Subject: Remove Link from Push Events for deleted branches --- app/views/events/event/_push.html.haml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/views/events/event/_push.html.haml b/app/views/events/event/_push.html.haml index 64ca3c32e01..efd13aabf20 100644 --- a/app/views/events/event/_push.html.haml +++ b/app/views/events/event/_push.html.haml @@ -3,11 +3,9 @@ .event-title %span.author_name= link_to_author event %span.pushed #{event.action_name} #{event.ref_type} - - if event.rm_ref? - %strong= event.ref_name - - else - %strong - = link_to event.ref_name, namespace_project_commits_path(project.namespace, project, event.ref_name), title: h(event.target_title) + %strong + - commits_link = namespace_project_commits_path(project.namespace, project, event.ref_name) + = link_to_if project.repository.branch_exists?(event.ref_name), event.ref_name, commits_link = render "events/event_scope", event: event -- cgit v1.2.1 From b29f6c5176b699de2f6efb012f9646e0d3243727 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Wed, 15 Feb 2017 16:36:13 +0000 Subject: Use `page` query parameter instead of `p` to keep consistency with all URLs Fix rubocop error --- app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 index e47dc6935d6..6bc2d6ec312 100644 --- a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 @@ -28,7 +28,7 @@ require('../vue_shared/components/pipelines_table'); }, props: ['scope', 'store', 'svgs'], created() { - const pagenum = gl.utils.getParameterByName('p'); + const pagenum = gl.utils.getParameterByName('page'); const scope = gl.utils.getParameterByName('scope'); if (pagenum) this.pagenum = pagenum; if (scope) this.apiScope = scope; @@ -36,7 +36,7 @@ require('../vue_shared/components/pipelines_table'); }, methods: { change(pagenum, apiScope) { - gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`); + gl.utils.visitUrl(`?scope=${apiScope}&page=${pagenum}`); }, }, template: ` -- cgit v1.2.1 From a8bc272237590efe43b83d5294f7d572c1b205c0 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 09:21:52 -0600 Subject: Add dropdown toggle button --- app/views/layouts/header/_default.html.haml | 11 +++++ app/views/layouts/nav/_dashboard.html.haml | 77 ++++++++++++++--------------- 2 files changed, 49 insertions(+), 39 deletions(-) (limited to 'app') diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index 59082ce5fd5..14d7a75c34a 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -58,6 +58,17 @@ %h1.title= title + .dropdown + %button.global-dropdown-toggle{ href: '#', 'data-toggle' => 'dropdown' } + %span.sr-only Toggle navigation + = icon('bars') + .dropdown-menu-nav + %ul + - if current_user + = render 'layouts/nav/dashboard' + - else + = render 'layouts/nav/explore' + .header-logo = link_to root_path, class: 'home', title: 'Dashboard', id: 'logo' do = brand_header_logo diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index 205d23178d2..efcb60addc0 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -1,41 +1,40 @@ -.nav-sidebar - %ul.nav - = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: {class: "#{project_tab_class} home"}) do - = link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do - %span - Projects - = nav_link(path: 'dashboard#activity') do - = link_to activity_dashboard_path, class: 'dashboard-shortcuts-activity', title: 'Activity' do - %span - Activity - - if koding_enabled? - = nav_link(controller: :koding) do - = link_to koding_path, title: 'Koding' do - %span - Koding - = nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do - = link_to dashboard_groups_path, title: 'Groups' do - %span - Groups - = nav_link(controller: 'dashboard/milestones') do - = link_to dashboard_milestones_path, title: 'Milestones' do - %span - Milestones - = nav_link(path: 'dashboard#issues') do - = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'dashboard-shortcuts-issues' do - %span - Issues - %span.count= number_with_delimiter(cached_assigned_issuables_count(current_user, :issues, :opened)) - = nav_link(path: 'dashboard#merge_requests') do - = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do - %span - Merge Requests - %span.count= number_with_delimiter(cached_assigned_issuables_count(current_user, :merge_requests, :opened)) - = nav_link(controller: 'dashboard/snippets') do - = link_to dashboard_snippets_path, title: 'Snippets' do +%ul.nav + = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: {class: "#{project_tab_class} home"}) do + = link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do + %span + Projects + = nav_link(path: 'dashboard#activity') do + = link_to activity_dashboard_path, class: 'dashboard-shortcuts-activity', title: 'Activity' do + %span + Activity + - if koding_enabled? + = nav_link(controller: :koding) do + = link_to koding_path, title: 'Koding' do %span - Snippets - - = link_to help_path, title: 'About GitLab CE', class: 'about-gitlab' do + Koding + = nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do + = link_to dashboard_groups_path, title: 'Groups' do + %span + Groups + = nav_link(controller: 'dashboard/milestones') do + = link_to dashboard_milestones_path, title: 'Milestones' do + %span + Milestones + = nav_link(path: 'dashboard#issues') do + = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'dashboard-shortcuts-issues' do %span - About GitLab CE + Issues + %span.count= number_with_delimiter(cached_assigned_issuables_count(current_user, :issues, :opened)) + = nav_link(path: 'dashboard#merge_requests') do + = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do + %span + Merge Requests + %span.count= number_with_delimiter(cached_assigned_issuables_count(current_user, :merge_requests, :opened)) + = nav_link(controller: 'dashboard/snippets') do + = link_to dashboard_snippets_path, title: 'Snippets' do + %span + Snippets + + = link_to help_path, title: 'About GitLab CE', class: 'about-gitlab' do + %span + About GitLab CE -- cgit v1.2.1 From 93c57201b224696f8cd11b6fa2cd85e0c49f92be Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 09:28:15 -0600 Subject: Remove pinned nav functionality and side_navbar_class --- app/helpers/nav_helper.rb | 14 -------------- app/views/layouts/_page.html.haml | 19 +------------------ 2 files changed, 1 insertion(+), 32 deletions(-) (limited to 'app') diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb index e21178c7377..c1523b4dabf 100644 --- a/app/helpers/nav_helper.rb +++ b/app/helpers/nav_helper.rb @@ -1,10 +1,4 @@ module NavHelper - def page_sidebar_class - if pinned_nav? - "page-sidebar-expanded page-sidebar-pinned" - end - end - def page_gutter_class if current_path?('merge_requests#show') || current_path?('merge_requests#diffs') || @@ -32,10 +26,6 @@ module NavHelper class_name = '' class_name << " with-horizontal-nav" if defined?(nav) && nav - if pinned_nav? - class_name << " header-sidebar-expanded header-sidebar-pinned" - end - class_name end @@ -46,8 +36,4 @@ module NavHelper def nav_control_class "nav-control" if current_user end - - def pinned_nav? - cookies[:pin_nav] == 'true' - end end diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index 54d02ee8e4b..5d227d1d52a 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -1,21 +1,4 @@ -.page-with-sidebar{ class: "#{page_sidebar_class} #{page_gutter_class}" } - .sidebar-wrapper.nicescroll - .sidebar-action-buttons - .nav-header-btn.toggle-nav-collapse{ title: "Open/Close" } - %span.sr-only Toggle navigation - = icon('bars') - - %div{ class: "nav-header-btn pin-nav-btn has-tooltip #{'is-active' if pinned_nav?} js-nav-pin", title: pinned_nav? ? "Unpin navigation" : "Pin Navigation", data: { placement: 'right', container: 'body' } } - %span.sr-only Toggle navigation pinning - = icon('fw thumb-tack') - - - if defined?(sidebar) && sidebar - = render "layouts/nav/#{sidebar}" - - elsif current_user - = render 'layouts/nav/dashboard' - - else - = render 'layouts/nav/explore' - +.page-with-sidebar{ class: "#{page_gutter_class}" } - if defined?(nav) && nav .layout-nav .container-fluid -- cgit v1.2.1 From 109953885cdf6686d929623cf8f2fc5b55c90cb4 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 09:48:04 -0600 Subject: Remove all unnecessary sidebar.js --- app/assets/javascripts/sidebar.js.es6 | 91 ----------------------------------- 1 file changed, 91 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/sidebar.js.es6 b/app/assets/javascripts/sidebar.js.es6 index 33e4b7db681..cd0aa9be6e5 100644 --- a/app/assets/javascripts/sidebar.js.es6 +++ b/app/assets/javascripts/sidebar.js.es6 @@ -2,70 +2,7 @@ /* global Cookies */ (() => { - const pinnedStateCookie = 'pin_nav'; - const sidebarBreakpoint = 1024; - - const pageSelector = '.page-with-sidebar'; - const navbarSelector = '.navbar-gitlab'; - const sidebarWrapperSelector = '.sidebar-wrapper'; - const sidebarContentSelector = '.nav-sidebar'; - - const pinnedToggleSelector = '.js-nav-pin'; - const sidebarToggleSelector = '.toggle-nav-collapse, .side-nav-toggle'; - - const pinnedPageClass = 'page-sidebar-pinned'; - const expandedPageClass = 'page-sidebar-expanded'; - - const pinnedNavbarClass = 'header-sidebar-pinned'; - const expandedNavbarClass = 'header-sidebar-expanded'; - class Sidebar { - constructor() { - if (!Sidebar.singleton) { - Sidebar.singleton = this; - Sidebar.singleton.init(); - } - - return Sidebar.singleton; - } - - init() { - this.isPinned = Cookies.get(pinnedStateCookie) === 'true'; - this.isExpanded = ( - window.innerWidth >= sidebarBreakpoint && - $(pageSelector).hasClass(expandedPageClass) - ); - $(window).on('resize', () => this.setSidebarHeight()); - $(document) - .on('click', sidebarToggleSelector, () => this.toggleSidebar()) - .on('click', pinnedToggleSelector, () => this.togglePinnedState()) - .on('click', 'html, body, a, button', (e) => this.handleClickEvent(e)) - .on('DOMContentLoaded', () => this.renderState()) - .on('scroll', () => this.setSidebarHeight()) - .on('todo:toggle', (e, count) => this.updateTodoCount(count)); - this.renderState(); - this.setSidebarHeight(); - } - - handleClickEvent(e) { - if (this.isExpanded && (!this.isPinned || window.innerWidth < sidebarBreakpoint)) { - const $target = $(e.target); - const targetIsToggle = $target.closest(sidebarToggleSelector).length > 0; - const targetIsSidebar = $target.closest(sidebarWrapperSelector).length > 0; - if (!targetIsToggle && (!targetIsSidebar || $target.closest('a'))) { - this.toggleSidebar(); - } - } - } - - updateTodoCount(count) { - $('.js-todos-count').text(gl.text.addDelimiter(count)); - } - - toggleSidebar() { - this.isExpanded = !this.isExpanded; - this.renderState(); - } setSidebarHeight() { const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); @@ -76,34 +13,6 @@ $('.js-right-sidebar').outerHeight('100%'); } } - - togglePinnedState() { - this.isPinned = !this.isPinned; - if (!this.isPinned) { - this.isExpanded = false; - } - Cookies.set(pinnedStateCookie, this.isPinned ? 'true' : 'false', { expires: 3650 }); - this.renderState(); - } - - renderState() { - $(pageSelector) - .toggleClass(pinnedPageClass, this.isPinned && this.isExpanded) - .toggleClass(expandedPageClass, this.isExpanded); - $(navbarSelector) - .toggleClass(pinnedNavbarClass, this.isPinned && this.isExpanded) - .toggleClass(expandedNavbarClass, this.isExpanded); - - const $pinnedToggle = $(pinnedToggleSelector); - const tooltipText = this.isPinned ? 'Unpin navigation' : 'Pin navigation'; - const tooltipState = $pinnedToggle.attr('aria-describedby') && this.isExpanded ? 'show' : 'hide'; - $pinnedToggle.attr('title', tooltipText).tooltip('fixTitle').tooltip(tooltipState); - - if (this.isExpanded) { - const sidebarContent = $(sidebarContentSelector); - setTimeout(() => { sidebarContent.niceScroll().updateScrollBar(); }, 200); - } - } } window.gl = window.gl || {}; -- cgit v1.2.1 From 4b7f0b327cceedf7b107db5fcfa7af75e4eb9e34 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 09:56:27 -0600 Subject: Remove all gitlab theme related code --- app/assets/javascripts/application.js | 5 - app/assets/stylesheets/framework.scss | 1 - app/assets/stylesheets/framework/animations.scss | 1 - app/assets/stylesheets/framework/gitlab-theme.scss | 144 --------------------- app/assets/stylesheets/framework/sidebar.scss | 67 ---------- .../stylesheets/pages/profiles/preferences.scss | 39 ------ app/helpers/preferences_helper.rb | 4 - app/views/layouts/application.html.haml | 2 +- app/views/layouts/nav/_dashboard.html.haml | 2 +- app/views/layouts/nav/_explore.html.haml | 2 +- app/views/profiles/preferences/show.html.haml | 6 - app/views/profiles/preferences/update.js.erb | 4 - 12 files changed, 3 insertions(+), 274 deletions(-) delete mode 100644 app/assets/stylesheets/framework/gitlab-theme.scss (limited to 'app') diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 4b5c9686cab..3c1d65b8e67 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -101,11 +101,6 @@ require('es6-promise').polyfill(); } }); - $('.nav-sidebar').niceScroll({ - cursoropacitymax: '0.4', - cursorcolor: '#FFF', - cursorborder: '1px solid #FFF' - }); $('.js-select-on-focus').on('focusin', function () { return $(this).select().one('mouseup', function (e) { return e.preventDefault(); diff --git a/app/assets/stylesheets/framework.scss b/app/assets/stylesheets/framework.scss index 08f203a1bf6..39cf3b5f8ae 100644 --- a/app/assets/stylesheets/framework.scss +++ b/app/assets/stylesheets/framework.scss @@ -19,7 +19,6 @@ @import "framework/flash.scss"; @import "framework/forms.scss"; @import "framework/gfm.scss"; -@import "framework/gitlab-theme.scss"; @import "framework/header.scss"; @import "framework/highlight.scss"; @import "framework/issue_box.scss"; diff --git a/app/assets/stylesheets/framework/animations.scss b/app/assets/stylesheets/framework/animations.scss index 0ca5a9343f7..49ae84b7a70 100644 --- a/app/assets/stylesheets/framework/animations.scss +++ b/app/assets/stylesheets/framework/animations.scss @@ -140,7 +140,6 @@ a { @include transition(background-color, box-shadow); } -.nav-sidebar a, .dropdown-menu a, .dropdown-menu button, .dropdown-menu-nav a { diff --git a/app/assets/stylesheets/framework/gitlab-theme.scss b/app/assets/stylesheets/framework/gitlab-theme.scss deleted file mode 100644 index d6566dc4ec9..00000000000 --- a/app/assets/stylesheets/framework/gitlab-theme.scss +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Styles the GitLab application with a specific color theme - * - * $color-light - - * $color - - * $color-darker - - * $color-dark - - */ -@mixin gitlab-theme($color-light, $color, $color-darker, $color-dark) { - .page-with-sidebar { - .toggle-nav-collapse, - .pin-nav-btn { - color: $color-light; - - &:hover { - color: $white-light; - } - } - - .sidebar-wrapper { - background: $color-darker; - } - - .sidebar-action-buttons { - color: $color-light; - background-color: lighten($color-darker, 5%); - } - - .nav-sidebar { - li { - a { - color: $color-light; - - &:hover, - &:focus, - &:active { - background: $color-dark; - } - - i { - color: $color-light; - } - - path, - polygon { - fill: $color-light; - } - - .count { - color: $color-light; - background: $color-dark; - } - - svg { - position: relative; - top: 3px; - } - } - - &.separate-item { - border-top: 1px solid $color; - } - - &.active a { - color: $white-light; - background: $color-dark; - - &.no-highlight { - border: none; - } - - i { - color: $white-light; - } - - path, - polygon { - fill: $white-light; - } - } - } - - .about-gitlab { - color: $color-light; - } - } - } -} - -$theme-charcoal-light: #b9bbbe; -$theme-charcoal: #485157; -$theme-charcoal-dark: #3d454d; -$theme-charcoal-darker: #383f45; - -$theme-blue-light: #becde9; -$theme-blue: #2980b9; -$theme-blue-dark: #1970a9; -$theme-blue-darker: #096099; - -$theme-graphite-light: #ccc; -$theme-graphite: #777; -$theme-graphite-dark: #666; -$theme-graphite-darker: #555; - -$theme-black-light: #979797; -$theme-black: #373737; -$theme-black-dark: #272727; -$theme-black-darker: #222; - -$theme-green-light: #adc; -$theme-green: #019875; -$theme-green-dark: #018865; -$theme-green-darker: #017855; - -$theme-violet-light: #98c; -$theme-violet: #548; -$theme-violet-dark: #436; -$theme-violet-darker: #325; - -body { - &.ui_blue { - @include gitlab-theme($theme-blue-light, $theme-blue, $theme-blue-dark, $theme-blue-darker); - } - - &.ui_charcoal { - @include gitlab-theme($theme-charcoal-light, $theme-charcoal, $theme-charcoal-dark, $theme-charcoal-darker); - } - - &.ui_graphite { - @include gitlab-theme($theme-graphite-light, $theme-graphite, $theme-graphite-dark, $theme-graphite-darker); - } - - &.ui_black { - @include gitlab-theme($theme-black-light, $theme-black, $theme-black-dark, $theme-black-darker); - } - - &.ui_green { - @include gitlab-theme($theme-green-light, $theme-green, $theme-green-dark, $theme-green-darker); - } - - &.ui_violet { - @include gitlab-theme($theme-violet-light, $theme-violet, $theme-violet-dark, $theme-violet-darker); - } -} diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index 20bcb1eeb23..390d2589ab2 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -47,73 +47,6 @@ } } -.nav-sidebar { - position: absolute; - top: 50px; - bottom: 0; - width: $sidebar_width; - overflow-y: auto; - overflow-x: hidden; - - &.navbar-collapse { - padding: 0 !important; - } - - li { - &.separate-item { - padding-top: 10px; - margin-top: 10px; - } - - .icon-container { - width: 34px; - display: inline-block; - text-align: center; - } - - a { - padding: 7px $gl-sidebar-padding; - font-size: $gl-font-size; - line-height: 24px; - display: block; - text-decoration: none; - font-weight: normal; - - &:hover, - &:active, - &:focus { - text-decoration: none; - } - - i { - font-size: 16px; - } - - i, - svg { - margin-right: 13px; - } - } - } - - .count { - float: right; - padding: 0 8px; - border-radius: 6px; - } - - .about-gitlab { - padding: 7px $gl-sidebar-padding; - font-size: $gl-font-size; - line-height: 24px; - display: block; - text-decoration: none; - font-weight: normal; - position: absolute; - bottom: 10px; - } -} - .sidebar-action-buttons { width: $sidebar_width; position: absolute; diff --git a/app/assets/stylesheets/pages/profiles/preferences.scss b/app/assets/stylesheets/pages/profiles/preferences.scss index 100ace41f2a..305feaacaa1 100644 --- a/app/assets/stylesheets/pages/profiles/preferences.scss +++ b/app/assets/stylesheets/pages/profiles/preferences.scss @@ -1,42 +1,3 @@ -.application-theme { - label { - margin-right: 20px; - text-align: center; - - .preview { - border-radius: 4px; - - height: 80px; - margin-bottom: 10px; - width: 160px; - - &.ui_blue { - background: $theme-blue; - } - - &.ui_charcoal { - background: $theme-charcoal; - } - - &.ui_graphite { - background: $theme-graphite; - } - - &.ui_black { - background: $theme-black; - } - - &.ui_green { - background: $theme-green; - } - - &.ui_violet { - background: $theme-violet; - } - } - } -} - .syntax-theme { label { margin-right: 20px; diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index dd0a4ea03f0..c3a08d76318 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -41,10 +41,6 @@ module PreferencesHelper ] end - def user_application_theme - Gitlab::Themes.for_user(current_user).css_class - end - def user_color_scheme Gitlab::ColorSchemes.for_user(current_user).css_class end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 248d439cd05..19bd9b6d5c9 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,7 +1,7 @@ !!! 5 %html{ lang: "en", class: "#{page_class}" } = render "layouts/head" - %body{ class: "#{user_application_theme}", data: { page: body_data_page, project: "#{@project.path if @project}", group: "#{@group.path if @group}" } } + %body{ data: { page: body_data_page, project: "#{@project.path if @project}", group: "#{@group.path if @group}" } } = Gon::Base.render_data = render "layouts/header/default", title: header_title diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index efcb60addc0..4f2547d0838 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -1,4 +1,4 @@ -%ul.nav +%ul = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: {class: "#{project_tab_class} home"}) do = link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do %span diff --git a/app/views/layouts/nav/_explore.html.haml b/app/views/layouts/nav/_explore.html.haml index e5bda7b3a6f..3a1fcd00e9c 100644 --- a/app/views/layouts/nav/_explore.html.haml +++ b/app/views/layouts/nav/_explore.html.haml @@ -1,4 +1,4 @@ -%ul.nav.nav-sidebar +%ul = nav_link(path: ['dashboard#show', 'root#show', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do = link_to explore_root_path, title: 'Projects' do %span diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index feadd863b00..787339e0fe2 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -7,12 +7,6 @@ Application theme %p This setting allows you to customize the appearance of the site, e.g. the sidebar. - .col-lg-9.application-theme - - Gitlab::Themes.each do |theme| - = label_tag do - .preview{ class: theme.css_class } - = f.radio_button :theme_id, theme.id - = theme.name .col-sm-12 %hr .col-lg-3.profile-settings-sidebar diff --git a/app/views/profiles/preferences/update.js.erb b/app/views/profiles/preferences/update.js.erb index 8966dd3fd86..431ab9d052b 100644 --- a/app/views/profiles/preferences/update.js.erb +++ b/app/views/profiles/preferences/update.js.erb @@ -1,7 +1,3 @@ -// Remove body class for any previous theme, re-add current one -$('body').removeClass('<%= Gitlab::Themes.body_classes %>') -$('body').addClass('<%= user_application_theme %>') - // Toggle container-fluid class if ('<%= current_user.layout %>' === 'fluid') { $('.content-wrapper .container-fluid').removeClass('container-limited') -- cgit v1.2.1 From 572bc7bc3771d76afe5b7524369ed069b66fa1f2 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 10:34:01 -0600 Subject: Remove global sidebar styles --- app/assets/stylesheets/framework/animations.scss | 2 +- app/assets/stylesheets/framework/header.scss | 2 +- app/assets/stylesheets/framework/sidebar.scss | 118 +---------------------- app/assets/stylesheets/framework/variables.scss | 4 +- app/assets/stylesheets/pages/issuable.scss | 4 +- app/assets/stylesheets/print.scss | 1 - 6 files changed, 10 insertions(+), 121 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/animations.scss b/app/assets/stylesheets/framework/animations.scss index 49ae84b7a70..90935b9616b 100644 --- a/app/assets/stylesheets/framework/animations.scss +++ b/app/assets/stylesheets/framework/animations.scss @@ -116,7 +116,7 @@ } .btn, -.side-nav-toggle { +.global-dropdown-toggle { @include transition(background-color, border-color, color, box-shadow); } diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 34e010e0e8a..be689bd252b 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -101,7 +101,7 @@ header { } } - .side-nav-toggle { + .global-dropdown-toggle { position: absolute; left: -10px; margin: 7px 0; diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index 390d2589ab2..d09b1c9d7f5 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -1,36 +1,3 @@ -.page-with-sidebar { - padding-bottom: 25px; - transition: padding $sidebar-transition-duration; - - &.page-sidebar-pinned { - .sidebar-wrapper { - box-shadow: none; - } - } - - .sidebar-wrapper { - position: fixed; - top: 0; - bottom: 0; - left: 0; - height: 100%; - width: 0; - overflow: hidden; - transition: width $sidebar-transition-duration; - box-shadow: 2px 0 16px 0 $black-transparent; - } -} - -.sidebar-wrapper { - z-index: 1000; - background: $gray-light; - - .nicescroll-rails-hr { - // TODO: Figure out why nicescroll doesn't hide horizontal bar - display: none!important; - } -} - .content-wrapper { width: 100%; transition: padding $sidebar-transition-duration; @@ -47,38 +14,6 @@ } } -.sidebar-action-buttons { - width: $sidebar_width; - position: absolute; - top: 0; - left: 0; - min-height: 50px; - padding: 5px 0; - font-size: 18px; - line-height: 30px; - - .toggle-nav-collapse { - left: 0; - } - - .pin-nav-btn { - right: 0; - display: none; - - @media (min-width: $sidebar-breakpoint) { - display: block; - } - - .fa { - transition: transform .15s; - - .page-sidebar-pinned & { - transform: rotate(90deg); - } - } - } -} - .nav-header-btn { padding: 10px $gl-sidebar-padding; color: inherit; @@ -94,59 +29,16 @@ } } -.page-sidebar-expanded { - .sidebar-wrapper { - width: $sidebar_width; - } -} - -.page-sidebar-pinned { - .content-wrapper, - .layout-nav { - @media (min-width: $sidebar-breakpoint) { - padding-left: $sidebar_width; - } - } - - .merge-request-tabs-holder.affix { - @media (min-width: $sidebar-breakpoint) { - left: $sidebar_width; - } - } - - &.right-sidebar-expanded { - .line-resolve-all-container { - @media (min-width: $sidebar-breakpoint) { - display: none; - } - } - } -} - -header.header-sidebar-pinned { - @media (min-width: $sidebar-breakpoint) { - padding-left: ($sidebar_width + $gl-padding); - - .side-nav-toggle { - display: none; - } - - .header-content { - padding-left: 0; - } - } -} - .right-sidebar-collapsed { padding-right: 0; @media (min-width: $screen-sm-min) { .content-wrapper { - padding-right: $sidebar_collapsed_width; + padding-right: $gutter_collapsed_width; } .merge-request-tabs-holder.affix { - right: $sidebar_collapsed_width; + right: $gutter_collapsed_width; } } @@ -164,7 +56,7 @@ header.header-sidebar-pinned { @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) { &:not(.build-sidebar):not(.wiki-sidebar) { - padding-right: $sidebar_collapsed_width; + padding-right: $gutter_collapsed_width; } } @@ -178,12 +70,12 @@ header.header-sidebar-pinned { } &.with-overlay .merge-request-tabs-holder.affix { - right: $sidebar_collapsed_width; + right: $gutter_collapsed_width; } } &.with-overlay { - padding-right: $sidebar_collapsed_width; + padding-right: $gutter_collapsed_width; } } diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 7809d4866f1..ba0af072716 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -1,8 +1,6 @@ /* * Layout */ -$sidebar_collapsed_width: 62px; -$sidebar_width: 220px; $gutter_collapsed_width: 62px; $gutter_width: 290px; $gutter_inner_width: 250px; @@ -541,4 +539,4 @@ Pipeline Graph */ $stage-hover-bg: #eaf3fc; $stage-hover-border: #d1e7fc; -$action-icon-color: #d6d6d6; \ No newline at end of file +$action-icon-color: #d6d6d6; diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index a53cc27fac9..4426169ef5a 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -253,11 +253,11 @@ display: block; } - width: $sidebar_collapsed_width; + width: $gutter_collapsed_width; padding-top: 0; .block { - width: $sidebar_collapsed_width - 2px; + width: $gutter_collapsed_width - 2px; margin-left: -19px; padding: 15px 0 0; border-bottom: none; diff --git a/app/assets/stylesheets/print.scss b/app/assets/stylesheets/print.scss index 0ff3c3f5472..6cc1cc8e263 100644 --- a/app/assets/stylesheets/print.scss +++ b/app/assets/stylesheets/print.scss @@ -31,7 +31,6 @@ nav.navbar-collapse.collapse, .blob-commit-info, .file-title, .file-holder, -.sidebar-wrapper, .nav, .btn, ul.notes-form, -- cgit v1.2.1 From a1a0a0350747d656281564ae1cee157171668516 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 10:57:15 -0600 Subject: Remove sidebar toggle button; replace with dropdown --- app/assets/stylesheets/framework/header.scss | 5 ++++- app/views/layouts/header/_default.html.haml | 25 ++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index be689bd252b..2a6273f1301 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -101,9 +101,12 @@ header { } } - .global-dropdown-toggle { + .global-dropdown { position: absolute; left: -10px; + } + + .global-dropdown-toggle { margin: 7px 0; font-size: 18px; padding: 6px 10px; diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index 14d7a75c34a..ea56d92cf34 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -2,9 +2,16 @@ %a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content .container-fluid .header-content - %button.side-nav-toggle{ type: 'button', "aria-label" => "Toggle global navigation" } - %span.sr-only Toggle navigation - = icon('bars') + .dropdown.global-dropdown + %button.global-dropdown-toggle{ type: 'button', 'data-toggle' => 'dropdown' } + %span.sr-only Toggle navigation + = icon('bars') + .dropdown-menu-nav + %ul + - if current_user + = render 'layouts/nav/dashboard' + - else + = render 'layouts/nav/explore' %button.navbar-toggle{ type: 'button' } %span.sr-only Toggle navigation = icon('ellipsis-v') @@ -55,20 +62,8 @@ %div = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-success' - %h1.title= title - .dropdown - %button.global-dropdown-toggle{ href: '#', 'data-toggle' => 'dropdown' } - %span.sr-only Toggle navigation - = icon('bars') - .dropdown-menu-nav - %ul - - if current_user - = render 'layouts/nav/dashboard' - - else - = render 'layouts/nav/explore' - .header-logo = link_to root_path, class: 'home', title: 'Dashboard', id: 'logo' do = brand_header_logo -- cgit v1.2.1 From b0dff3c83edcc2b48a0457ad93da4e8d4324ed06 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 11:11:31 -0600 Subject: Fix dropdown alignment --- app/views/layouts/nav/_dashboard.html.haml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index 4f2547d0838..bb611d39be5 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -24,17 +24,16 @@ = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'dashboard-shortcuts-issues' do %span Issues - %span.count= number_with_delimiter(cached_assigned_issuables_count(current_user, :issues, :opened)) + %span.badge= number_with_delimiter(cached_assigned_issuables_count(current_user, :issues, :opened)) = nav_link(path: 'dashboard#merge_requests') do = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do %span Merge Requests - %span.count= number_with_delimiter(cached_assigned_issuables_count(current_user, :merge_requests, :opened)) + %span.badge= number_with_delimiter(cached_assigned_issuables_count(current_user, :merge_requests, :opened)) = nav_link(controller: 'dashboard/snippets') do = link_to dashboard_snippets_path, title: 'Snippets' do %span Snippets - - = link_to help_path, title: 'About GitLab CE', class: 'about-gitlab' do - %span - About GitLab CE + %li.divider + %li + = link_to "About GitLab CE", help_path, title: 'About GitLab CE', class: 'about-gitlab' -- cgit v1.2.1 From 0667d1aa7f251f5bf11dd121fe2f696107d8103e Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 11:38:53 -0600 Subject: Drop theme ID from users table --- app/controllers/admin/users_controller.rb | 1 - app/controllers/profiles/preferences_controller.rb | 1 - app/models/user.rb | 1 - 3 files changed, 3 deletions(-) (limited to 'app') diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 1cd50852e89..7ffde71c3b1 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -194,7 +194,6 @@ class Admin::UsersController < Admin::ApplicationController :provider, :remember_me, :skype, - :theme_id, :twitter, :username, :website_url diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index a9a06ecc808..0d891ef4004 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -34,7 +34,6 @@ class Profiles::PreferencesController < Profiles::ApplicationController :layout, :dashboard, :project_view, - :theme_id ) end end diff --git a/app/models/user.rb b/app/models/user.rb index ad997ce2b13..f614eb66e1f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,7 +21,6 @@ class User < ActiveRecord::Base default_value_for :can_create_team, false default_value_for :hide_no_ssh_key, false default_value_for :hide_no_password, false - default_value_for :theme_id, gitlab_config.default_theme attr_encrypted :otp_secret, key: Gitlab::Application.secrets.otp_key_base, -- cgit v1.2.1 From 23035d90b708216e75fb993a1e48a0426ddacb89 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 13 Feb 2017 16:16:03 -0600 Subject: Make active links bold; fix badge styling --- app/assets/stylesheets/framework/header.scss | 40 +++++++++++++++++++--------- app/views/layouts/header/_default.html.haml | 11 ++++---- 2 files changed, 33 insertions(+), 18 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 2a6273f1301..044d3517650 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -100,26 +100,42 @@ header { } } } + } - .global-dropdown { - position: absolute; - left: -10px; + .global-dropdown { + position: absolute; + left: -10px; + + .badge { + font-size: 11px; } - .global-dropdown-toggle { - margin: 7px 0; - font-size: 18px; - padding: 6px 10px; - border: none; - background-color: $gray-light; + li.active { + a { + font-weight: bold; + } + } - &:hover { - background-color: $white-normal; - color: $gl-header-nav-hover-color; + li:hover { + .badge { + background-color: $white-light; } } } + .global-dropdown-toggle { + margin: 7px 0; + font-size: 18px; + padding: 6px 10px; + border: none; + background-color: $gray-light; + + &:hover { + background-color: $white-normal; + color: $gl-header-nav-hover-color; + } + } + .header-content { position: relative; height: $header-height; diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index ea56d92cf34..ddf50d6667f 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -6,12 +6,11 @@ %button.global-dropdown-toggle{ type: 'button', 'data-toggle' => 'dropdown' } %span.sr-only Toggle navigation = icon('bars') - .dropdown-menu-nav - %ul - - if current_user - = render 'layouts/nav/dashboard' - - else - = render 'layouts/nav/explore' + .dropdown-menu-nav.global-dropdown-menu + - if current_user + = render 'layouts/nav/dashboard' + - else + = render 'layouts/nav/explore' %button.navbar-toggle{ type: 'button' } %span.sr-only Toggle navigation = icon('ellipsis-v') -- cgit v1.2.1 From fd6e36e95b27a250407f93d09ad894a72c248bb7 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Wed, 15 Feb 2017 15:15:44 -0500 Subject: Change iteration strategy to make PhantomJS happy --- app/assets/javascripts/project_label_subscription.js.es6 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/project_label_subscription.js.es6 b/app/assets/javascripts/project_label_subscription.js.es6 index 8365f7118d5..0a811627600 100644 --- a/app/assets/javascripts/project_label_subscription.js.es6 +++ b/app/assets/javascripts/project_label_subscription.js.es6 @@ -38,13 +38,15 @@ this.$buttons.attr('data-status', newStatus); this.$buttons.find('> span').text(newAction); - for (const button of this.$buttons) { + this.$buttons.map((button) => { const $button = $(button); if ($button.attr('data-original-title')) { $button.tooltip('hide').attr('data-original-title', newAction).tooltip('fixTitle'); } - } + + return button; + }); }); } } -- cgit v1.2.1 From 06239e13e580e0a3e6020f2e3b4e8d5d03d7ab92 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 15 Feb 2017 15:56:02 -0600 Subject: Move necessary sidebar code to right_sidebar.js; delete sidebar.js --- app/assets/javascripts/application.js | 2 -- app/assets/javascripts/right_sidebar.js | 12 ++++++++++++ app/assets/javascripts/sidebar.js.es6 | 20 -------------------- 3 files changed, 12 insertions(+), 22 deletions(-) delete mode 100644 app/assets/javascripts/sidebar.js.es6 (limited to 'app') diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 3c1d65b8e67..5d7350ad7be 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -240,8 +240,6 @@ require('es6-promise').polyfill(); }); gl.awardsHandler = new AwardsHandler(); new Aside(); - // bind sidebar events - new gl.Sidebar(); gl.utils.initTimeagoTimeout(); }); diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 76a0f993ea0..82c17956f06 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -25,6 +25,8 @@ $('.dropdown').on('hidden.gl.dropdown', this, this.onSidebarDropdownHidden); $('.dropdown').on('loading.gl.dropdown', this.sidebarDropdownLoading); $('.dropdown').on('loaded.gl.dropdown', this.sidebarDropdownLoaded); + $(window).on('resize', () => this.setSidebarHeight()); + $(document).on('scroll', () => this.setSidebarHeight()); $(document).on('click', '.js-sidebar-toggle', function(e, triggered) { var $allGutterToggleIcons, $this, $thisIcon; e.preventDefault(); @@ -191,6 +193,16 @@ } }; + Sidebar.prototype.setSidebarHeight = function() { + const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); + const diff = $navHeight - $('body').scrollTop(); + if (diff > 0) { + $('.js-right-sidebar').outerHeight($(window).height() - diff); + } else { + $('.js-right-sidebar').outerHeight('100%'); + } + }; + Sidebar.prototype.isOpen = function() { return this.sidebar.is('.right-sidebar-expanded'); }; diff --git a/app/assets/javascripts/sidebar.js.es6 b/app/assets/javascripts/sidebar.js.es6 deleted file mode 100644 index cd0aa9be6e5..00000000000 --- a/app/assets/javascripts/sidebar.js.es6 +++ /dev/null @@ -1,20 +0,0 @@ -/* eslint-disable arrow-parens, class-methods-use-this, no-param-reassign */ -/* global Cookies */ - -(() => { - class Sidebar { - - setSidebarHeight() { - const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); - const diff = $navHeight - $('body').scrollTop(); - if (diff > 0) { - $('.js-right-sidebar').outerHeight($(window).height() - diff); - } else { - $('.js-right-sidebar').outerHeight('100%'); - } - } - } - - window.gl = window.gl || {}; - gl.Sidebar = Sidebar; -})(); -- cgit v1.2.1 From 953e590b18289005c69b72575ae6f38161ffa11b Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 16 Feb 2017 13:13:10 +0100 Subject: Make build clone/retry implementation more robust --- app/services/ci/retry_build_service.rb | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'app') diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index 4c4518d8029..4b47ee489cf 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -1,5 +1,18 @@ module Ci class RetryBuildService < ::BaseService + CLONE_ATTRIBUTES = %i[pipeline ref tag options commands tag_list name + allow_failure stage stage_idx trigger_request + yaml_variables when environment coverage_regex] + .freeze + + REJECT_ATTRIBUTES = %i[id status user token coverage trace runner + artifacts_file artifacts_metadata artifacts_size + created_at updated_at started_at finished_at + queued_at erased_by erased_at].freeze + + IGNORE_ATTRIBUTES = %i[trace type lock_version project target_url + deploy job_id description].freeze + def execute(build) reprocess(build).tap do |new_build| build.pipeline.mark_as_processable_after_stage(build.stage_idx) @@ -17,24 +30,13 @@ module Ci raise Gitlab::Access::AccessDeniedError end - Ci::Build.create( - ref: build.ref, - tag: build.tag, - options: build.options, - commands: build.commands, - tag_list: build.tag_list, - project: build.project, - pipeline: build.pipeline, - name: build.name, - allow_failure: build.allow_failure, - stage: build.stage, - stage_idx: build.stage_idx, - trigger_request: build.trigger_request, - yaml_variables: build.yaml_variables, - when: build.when, - environment: build.environment, - coverage_regex: build.coverage_regex, - user: current_user) + attributes = CLONE_ATTRIBUTES.map do |attribute| + [attribute, build.send(attribute)] + end + + attributes.push([:user, current_user]) + + project.builds.create(Hash[attributes]) end end end -- cgit v1.2.1 From 7203826b54bb3944736057436fe8a13011801ecf Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 16 Feb 2017 13:17:27 -0600 Subject: Cache js selectors; fix css --- app/assets/javascripts/right_sidebar.js | 14 +++++++++----- app/assets/stylesheets/framework/header.scss | 12 ++++++------ app/views/layouts/_page.html.haml | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 82c17956f06..f8e42e7a350 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -21,13 +21,16 @@ }; Sidebar.prototype.addEventListeners = function() { + const $document = $(document); + const throttledSetSidebarHeight = _.throttle(this.setSidebarHeight, 10); + this.sidebar.on('click', '.sidebar-collapsed-icon', this, this.sidebarCollapseClicked); $('.dropdown').on('hidden.gl.dropdown', this, this.onSidebarDropdownHidden); $('.dropdown').on('loading.gl.dropdown', this.sidebarDropdownLoading); $('.dropdown').on('loaded.gl.dropdown', this.sidebarDropdownLoaded); - $(window).on('resize', () => this.setSidebarHeight()); - $(document).on('scroll', () => this.setSidebarHeight()); - $(document).on('click', '.js-sidebar-toggle', function(e, triggered) { + $(window).on('resize', () => throttledSetSidebarHeight()); + $document.on('scroll', () => throttledSetSidebarHeight()); + $document.on('click', '.js-sidebar-toggle', function(e, triggered) { var $allGutterToggleIcons, $this, $thisIcon; e.preventDefault(); $this = $(this); @@ -195,11 +198,12 @@ Sidebar.prototype.setSidebarHeight = function() { const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); + const $rightSidebar = $('.js-right-sidebar'); const diff = $navHeight - $('body').scrollTop(); if (diff > 0) { - $('.js-right-sidebar').outerHeight($(window).height() - diff); + $rightSidebar.outerHeight($(window).height() - diff); } else { - $('.js-right-sidebar').outerHeight('100%'); + $rightSidebar.outerHeight('100%'); } }; diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 044d3517650..367289968c9 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -110,15 +110,15 @@ header { font-size: 11px; } - li.active { - a { + li { + .active a { font-weight: bold; } - } - li:hover { - .badge { - background-color: $white-light; + &:hover { + .badge { + background-color: $white-light; + } } } } diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index 5d227d1d52a..a35a918d501 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -1,4 +1,4 @@ -.page-with-sidebar{ class: "#{page_gutter_class}" } +.page-with-sidebar{ class: page_gutter_class } - if defined?(nav) && nav .layout-nav .container-fluid -- cgit v1.2.1 From c89d9e741ce793245427b2b21d58f9df75fe10cd Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Jan 2017 17:53:25 -0600 Subject: only show diff unfolding link if there are more lines to show --- app/views/projects/blob/diff.html.haml | 2 +- app/views/projects/diffs/_content.html.haml | 5 +++-- app/views/projects/diffs/_parallel_view.html.haml | 5 +++-- app/views/projects/diffs/_text_file.html.haml | 5 +++-- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/views/projects/blob/diff.html.haml b/app/views/projects/blob/diff.html.haml index 3b1a2e54ec2..d1f7f65bf53 100644 --- a/app/views/projects/blob/diff.html.haml +++ b/app/views/projects/blob/diff.html.haml @@ -25,6 +25,6 @@ = link_to raw(line_new), "##{line_new}" = line_content - - if @form.unfold? && @form.bottom? && @form.to < @blob.loc + - if @form.unfold? && @form.bottom? && @form.to < @blob.lines.size %tr.line_holder{ id: @form.to, class: line_class } = diff_match_line @form.to - @form.offset, @form.to, text: @match_line, view: diff_view, bottom: true diff --git a/app/views/projects/diffs/_content.html.haml b/app/views/projects/diffs/_content.html.haml index b87b79b170e..f805bfdcaa2 100644 --- a/app/views/projects/diffs/_content.html.haml +++ b/app/views/projects/diffs/_content.html.haml @@ -15,10 +15,11 @@ %a.click-to-expand Click to expand it. - elsif diff_file.diff_lines.length > 0 + - total_lines = blob.lines.last.chomp == '' ? blob.lines.size - 1 : blob.lines.size - if diff_view == :parallel - = render "projects/diffs/parallel_view", diff_file: diff_file, project: project, blob: blob + = render "projects/diffs/parallel_view", diff_file: diff_file, total_lines: total_lines - else - = render "projects/diffs/text_file", diff_file: diff_file + = render "projects/diffs/text_file", diff_file: diff_file, total_lines: total_lines - else - if diff_file.mode_changed? .nothing-here-block File mode changed diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index 074f1f634ae..7240b4945df 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -45,5 +45,6 @@ = render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right - if !diff_file.new_file && diff_file.diff_lines.any? - last_line = diff_file.diff_lines.last - %tr.line_holder.parallel - = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true, view: :parallel + - if last_line.new_pos < total_lines + %tr.line_holder.parallel + = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true, view: :parallel diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml index 2eea1db169a..40b3f2510e5 100644 --- a/app/views/projects/diffs/_text_file.html.haml +++ b/app/views/projects/diffs/_text_file.html.haml @@ -12,5 +12,6 @@ - if !diff_file.new_file && diff_file.highlighted_diff_lines.any? - last_line = diff_file.highlighted_diff_lines.last - %tr.line_holder - = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true + - if last_line.new_pos < total_lines + %tr.line_holder + = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true -- cgit v1.2.1 From 3b67af697ce246d1938c571090342c9aa0d9c247 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 25 Jan 2017 14:22:29 -0600 Subject: fix build failures --- app/views/projects/diffs/_content.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/projects/diffs/_content.html.haml b/app/views/projects/diffs/_content.html.haml index f805bfdcaa2..5c38b5ad9c0 100644 --- a/app/views/projects/diffs/_content.html.haml +++ b/app/views/projects/diffs/_content.html.haml @@ -15,7 +15,9 @@ %a.click-to-expand Click to expand it. - elsif diff_file.diff_lines.length > 0 - - total_lines = blob.lines.last.chomp == '' ? blob.lines.size - 1 : blob.lines.size + - total_lines = 0 + - if blob.lines.any? + - total_lines = blob.lines.last.chomp == '' ? blob.lines.size - 1 : blob.lines.size - if diff_view == :parallel = render "projects/diffs/parallel_view", diff_file: diff_file, total_lines: total_lines - else -- cgit v1.2.1 From 2d0c0308d55fffd18e7b04c0d038ff5a8f194c56 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 16 Feb 2017 15:38:10 -0600 Subject: prevent diff unfolding link from appearing for deleted files --- app/views/projects/diffs/_parallel_view.html.haml | 2 +- app/views/projects/diffs/_text_file.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index 7240b4945df..997bf0fc560 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -43,7 +43,7 @@ - discussion_left, discussion_right = parallel_diff_discussions(left, right, diff_file) - if discussion_left || discussion_right = render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right - - if !diff_file.new_file && diff_file.diff_lines.any? + - if !diff_file.new_file && !diff_file.deleted_file && diff_file.diff_lines.any? - last_line = diff_file.diff_lines.last - if last_line.new_pos < total_lines %tr.line_holder.parallel diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml index 40b3f2510e5..ebd1a914ee7 100644 --- a/app/views/projects/diffs/_text_file.html.haml +++ b/app/views/projects/diffs/_text_file.html.haml @@ -10,7 +10,7 @@ as: :line, locals: { diff_file: diff_file, discussions: discussions } - - if !diff_file.new_file && diff_file.highlighted_diff_lines.any? + - if !diff_file.new_file && !diff_file.deleted_file && diff_file.highlighted_diff_lines.any? - last_line = diff_file.highlighted_diff_lines.last - if last_line.new_pos < total_lines %tr.line_holder -- cgit v1.2.1 From cec1483675041476e1c564a1cf73e3168bfaf684 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 16 Feb 2017 16:27:15 -0600 Subject: Increase right side of file header to accommodate browse files button --- app/assets/stylesheets/pages/tree.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/stylesheets/pages/tree.scss b/app/assets/stylesheets/pages/tree.scss index 948921efc0b..e4487dbcb87 100644 --- a/app/assets/stylesheets/pages/tree.scss +++ b/app/assets/stylesheets/pages/tree.scss @@ -149,7 +149,7 @@ } .commit-actions { - width: 200px; + width: 260px; } } -- cgit v1.2.1 From 9f00c2b0d2362232b49ef260e0500b14b975e574 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 16 Feb 2017 20:17:12 +0000 Subject: Reduce number of pipelines created to test pagination stub pagination in tests --- app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 index d39a7a9aaa3..0265c00a414 100644 --- a/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/pipelines.js.es6 @@ -56,7 +56,7 @@ const CommitPipelinesStoreWithTimeAgo = require('../commit/pipelines/pipelines_s */ change(pagenum, apiScope) { if (!apiScope) apiScope = 'all'; - gl.utils.visitUrl(`?scope=${apiScope}&p=${pagenum}`); + gl.utils.visitUrl(`?scope=${apiScope}&page=${pagenum}`); }, }, template: ` -- cgit v1.2.1 From ae69e8764c273029ed944e98842a21a4aab0f4af Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 14 Feb 2017 10:16:24 -0600 Subject: Restore pagination to admin abuse reports --- app/views/admin/abuse_reports/index.html.haml | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/views/admin/abuse_reports/index.html.haml b/app/views/admin/abuse_reports/index.html.haml index c4b748d0ab8..6c48328da4f 100644 --- a/app/views/admin/abuse_reports/index.html.haml +++ b/app/views/admin/abuse_reports/index.html.haml @@ -12,6 +12,7 @@ %th.wide Message %th Action = render @abuse_reports + = paginate @abuse_reports, theme: 'gitlab' - else .empty-state .text-center -- cgit v1.2.1 From 95954be6704cf13891b9cf4d0409ee19fdcdd145 Mon Sep 17 00:00:00 2001 From: dimitrieh Date: Fri, 17 Feb 2017 11:19:01 +0100 Subject: Change development tanuki favicon colors to match logo color order --- app/assets/images/favicon-blue.ico | Bin 5430 -> 5430 bytes 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 app/assets/images/favicon-blue.ico (limited to 'app') diff --git a/app/assets/images/favicon-blue.ico b/app/assets/images/favicon-blue.ico old mode 100644 new mode 100755 index 71acdf670ab..156fcf07588 Binary files a/app/assets/images/favicon-blue.ico and b/app/assets/images/favicon-blue.ico differ -- cgit v1.2.1 From f0e5938018962609e2ee84f0a4348f309f8ec94d Mon Sep 17 00:00:00 2001 From: YarNayar Date: Fri, 3 Feb 2017 12:58:45 +0300 Subject: Fixes errors in GFM slash commands matcher and add tests for default matcher See !8975 --- app/assets/javascripts/gfm_auto_complete.js.es6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6 index 7f1f2a5d278..e180886c2ca 100644 --- a/app/assets/javascripts/gfm_auto_complete.js.es6 +++ b/app/assets/javascripts/gfm_auto_complete.js.es6 @@ -83,12 +83,12 @@ _a = decodeURI("%C3%80"); _y = decodeURI("%C3%BF"); - regexp = new RegExp("^(?:\\B|[^a-zA-Z0-9_" + atSymbolsWithoutBar + "]|\\s)" + flag + "(?![" + atSymbolsWithBar + "])(([A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]|[^\\x00-\\x7a])*)$", 'gi'); + regexp = new RegExp("^(?:\\B|[^a-zA-Z0-9_" + atSymbolsWithoutBar + "]|\\s)" + flag + "(?!" + atSymbolsWithBar + ")((?:[A-Za-z" + _a + "-" + _y + "0-9_\'\.\+\-]|[^\\x00-\\x7a])*)$", 'gi'); match = regexp.exec(subtext); if (match) { - return (match[1] || match[1] === "") ? match[1] : match[2]; + return match[1]; } else { return null; } -- cgit v1.2.1 From bf93a9f50c9fa3c1133d24af701829879eba2f44 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 17 Feb 2017 12:28:29 +0000 Subject: Remove issue and MR counts from labels index We were performing two (quite slow, because of the need to do access checks) queries for each label on the page: one to get the count of issues with that label, and one to get the count of merge requests with that label. Until we have a performant way of doing this, remove the counts. --- app/views/shared/_label.html.haml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/views/shared/_label.html.haml b/app/views/shared/_label.html.haml index ead9b84b991..1744a597c51 100644 --- a/app/views/shared/_label.html.haml +++ b/app/views/shared/_label.html.haml @@ -1,6 +1,4 @@ - label_css_id = dom_id(label) -- open_issues_count = label.open_issues_count(current_user) -- open_merge_requests_count = label.open_merge_requests_count(current_user) - status = label_subscription_status(label, @project).inquiry if current_user - subject = local_assigns[:subject] @@ -15,10 +13,10 @@ %ul %li = link_to_label(label, subject: subject, type: :merge_request) do - = pluralize open_merge_requests_count, 'merge request' + view merge requests %li = link_to_label(label, subject: subject) do - = pluralize open_issues_count, 'open issue' + view open issues - if current_user && defined?(@project) %li.label-subscription - if label.is_a?(ProjectLabel) @@ -40,9 +38,9 @@ .pull-right.hidden-xs.hidden-sm.hidden-md = link_to_label(label, subject: subject, type: :merge_request, css_class: 'btn btn-transparent btn-action') do - = pluralize open_merge_requests_count, 'merge request' + view merge requests = link_to_label(label, subject: subject, css_class: 'btn btn-transparent btn-action') do - = pluralize open_issues_count, 'open issue' + view open issues - if current_user && defined?(@project) .label-subscription.inline -- cgit v1.2.1 From c5c46f2e3d53af1adae2eda711ba23a59c882845 Mon Sep 17 00:00:00 2001 From: dimitrieh Date: Fri, 17 Feb 2017 14:08:07 +0100 Subject: changed minor inconsistency in help text --- app/views/admin/application_settings/_form.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index 816035ec442..749c74b8110 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -192,7 +192,7 @@ = f.label :max_pages_size, 'Maximum size of pages (MB)', class: 'control-label col-sm-2' .col-sm-10 = f.number_field :max_pages_size, class: 'form-control' - .help-block Zero for unlimited + .help-block 0 for unlimited %fieldset %legend Continuous Integration @@ -525,7 +525,7 @@ = f.number_field :terminal_max_session_time, class: 'form-control' .help-block Maximum time for web terminal websocket connection (in seconds). - Set to 0 for unlimited time. + 0 for unlimited. .form-actions = f.submit 'Save', class: 'btn btn-save' -- cgit v1.2.1 From b9cc02a68e465f17eb507fd6d1eab7800b382963 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 17 Feb 2017 14:36:43 +0100 Subject: Remove support for locking in pipeline retry service --- app/services/ci/retry_pipeline_service.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'app') diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index 808f29adea2..2c5e130e5aa 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -5,7 +5,7 @@ module Ci raise Gitlab::Access::AccessDeniedError end - each_build(pipeline.builds.failed_or_canceled) do |build| + pipeline.builds.failed_or_canceled.find_each do |build| next unless build.retryable? Ci::RetryBuildService.new(project, current_user) @@ -18,13 +18,5 @@ module Ci pipeline.process! end - - private - - def each_build(relation) - Gitlab::OptimisticLocking.retry_lock(relation) do |builds| - builds.find_each { |build| yield build } - end - end end end -- cgit v1.2.1 From c59750de6f9c4f58b9dec9eea685d8549ce9ef00 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 17 Feb 2017 15:54:54 +0000 Subject: Fix depenendencies loading Vue in EE --- app/assets/javascripts/environments/components/environment.js.es6 | 5 +++-- app/assets/javascripts/environments/environments_bundle.js.es6 | 1 - .../environments/folder/environments_folder_bundle.js.es6 | 1 - .../javascripts/environments/folder/environments_folder_view.js.es6 | 5 +++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/environments/components/environment.js.es6 b/app/assets/javascripts/environments/components/environment.js.es6 index 0cbf952ea5c..4b700a39d44 100644 --- a/app/assets/javascripts/environments/components/environment.js.es6 +++ b/app/assets/javascripts/environments/components/environment.js.es6 @@ -1,13 +1,14 @@ /* eslint-disable no-param-reassign, no-new */ /* global Flash */ -const Vue = require('vue'); -Vue.use(require('vue-resource')); +const Vue = window.Vue = require('vue'); +window.Vue.use(require('vue-resource')); const EnvironmentsService = require('../services/environments_service'); const EnvironmentTable = require('./environments_table'); const EnvironmentsStore = require('../stores/environments_store'); require('../../vue_shared/components/table_pagination'); require('../../lib/utils/common_utils'); +require('../../vue_shared/vue_resource_interceptor'); module.exports = Vue.component('environment-component', { diff --git a/app/assets/javascripts/environments/environments_bundle.js.es6 b/app/assets/javascripts/environments/environments_bundle.js.es6 index 867eba1d384..7bbba91bc10 100644 --- a/app/assets/javascripts/environments/environments_bundle.js.es6 +++ b/app/assets/javascripts/environments/environments_bundle.js.es6 @@ -1,5 +1,4 @@ const EnvironmentsComponent = require('./components/environment'); -require('../vue_shared/vue_resource_interceptor'); $(() => { window.gl = window.gl || {}; diff --git a/app/assets/javascripts/environments/folder/environments_folder_bundle.js.es6 b/app/assets/javascripts/environments/folder/environments_folder_bundle.js.es6 index 29f704c1a37..d2ca465351a 100644 --- a/app/assets/javascripts/environments/folder/environments_folder_bundle.js.es6 +++ b/app/assets/javascripts/environments/folder/environments_folder_bundle.js.es6 @@ -1,5 +1,4 @@ const EnvironmentsFolderComponent = require('./environments_folder_view'); -require('../../vue_shared/vue_resource_interceptor'); $(() => { window.gl = window.gl || {}; diff --git a/app/assets/javascripts/environments/folder/environments_folder_view.js.es6 b/app/assets/javascripts/environments/folder/environments_folder_view.js.es6 index 0b1204559da..53d52965758 100644 --- a/app/assets/javascripts/environments/folder/environments_folder_view.js.es6 +++ b/app/assets/javascripts/environments/folder/environments_folder_view.js.es6 @@ -1,13 +1,14 @@ /* eslint-disable no-param-reassign, no-new */ /* global Flash */ -const Vue = require('vue'); -Vue.use(require('vue-resource')); +const Vue = window.Vue = require('vue'); +window.Vue.use(require('vue-resource')); const EnvironmentsService = require('../services/environments_service'); const EnvironmentTable = require('../components/environments_table'); const EnvironmentsStore = require('../stores/environments_store'); require('../../vue_shared/components/table_pagination'); require('../../lib/utils/common_utils'); +require('../../vue_shared/vue_resource_interceptor'); module.exports = Vue.component('environment-folder-view', { -- cgit v1.2.1 From 40d26e25543cf91d07a64428d9ea6b410d01fa7f Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 17 Feb 2017 17:48:32 +0000 Subject: Fix merge service error with no source This shouldn't be possible in CE, but is needed so that the code is the same in CE and EE. --- app/services/merge_requests/merge_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb index 177b714b734..3da1b657a41 100644 --- a/app/services/merge_requests/merge_service.rb +++ b/app/services/merge_requests/merge_service.rb @@ -18,7 +18,7 @@ module MergeRequests @source = find_merge_source unless @source - log_merge_error('No source for merge', save_message_on_model: true) + return log_merge_error('No source for merge', save_message_on_model: true) end merge_request.in_locked_state do -- cgit v1.2.1 From 60db4d3a512cb87fe137a4333df5d6bfedcaeae5 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 17 Feb 2017 08:57:41 -0600 Subject: Refactor project stats & last_commit CSS; left align main nav items --- app/assets/stylesheets/framework/nav.scss | 1 - app/assets/stylesheets/pages/projects.scss | 30 +++----- app/views/layouts/_page.html.haml | 2 +- app/views/projects/show.html.haml | 113 +++++++++++++++-------------- 4 files changed, 70 insertions(+), 76 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index 674d3bb45aa..6a3481524e9 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -287,7 +287,6 @@ background: $gray-light; border-bottom: 1px solid $border-color; transition: padding $sidebar-transition-duration; - text-align: center; .container-fluid { position: relative; diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index 6b05e5bb4aa..adbdc5214a4 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -645,29 +645,23 @@ pre.light-well { } } -.project-last-commit { - @media (min-width: $screen-sm-min) { - margin-top: $gl-padding; +.container-fluid.project-stats-container { + @media (max-width: $screen-xs-max) { + padding: 12px 0; } +} - &.container-fluid { - padding-top: 12px; - padding-bottom: 12px; - background-color: $gray-light; - border: 1px solid $border-color; - border-right-width: 0; - border-left-width: 0; +.project-last-commit { + background-color: $gray-light; + padding: 12px $gl-padding; + border: 1px solid $border-color; - @media (min-width: $screen-sm-min) { - border-right-width: 1px; - border-left-width: 1px; - } + @media (min-width: $screen-sm-min) { + margin-top: $gl-padding; } - &.container-limited { - @media (min-width: 1281px) { - border-radius: $border-radius-base; - } + @media (min-width: $screen-sm-min) { + border-radius: $border-radius-base; } .ci-status { diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index a35a918d501..1717ed6b365 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -1,7 +1,7 @@ .page-with-sidebar{ class: page_gutter_class } - if defined?(nav) && nav .layout-nav - .container-fluid + %div{ class: container_class } = render "layouts/nav/#{nav}" .content-wrapper{ class: "#{layout_nav_class}" } = yield :sub_nav diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 80d4081dd7b..f7419728719 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -13,69 +13,70 @@ = render "home_panel" - if current_user && can?(current_user, :download_code, @project) - %nav.project-stats{ class: container_class } - %ul.nav - %li - = link_to project_files_path(@project) do - Files (#{storage_counter(@project.statistics.total_repository_size)}) - %li - = link_to namespace_project_commits_path(@project.namespace, @project, current_ref) do - #{'Commit'.pluralize(@project.statistics.commit_count)} (#{number_with_delimiter(@project.statistics.commit_count)}) - %li - = link_to namespace_project_branches_path(@project.namespace, @project) do - #{'Branch'.pluralize(@repository.branch_count)} (#{number_with_delimiter(@repository.branch_count)}) - %li - = link_to namespace_project_tags_path(@project.namespace, @project) do - #{'Tag'.pluralize(@repository.tag_count)} (#{number_with_delimiter(@repository.tag_count)}) - - - if default_project_view != 'readme' && @repository.readme + .project-stats-container{ class: container_class } + %nav.project-stats + %ul.nav %li - = link_to 'Readme', readme_path(@project) - - - if @repository.changelog + = link_to project_files_path(@project) do + Files (#{storage_counter(@project.statistics.total_repository_size)}) %li - = link_to 'Changelog', changelog_path(@project) - - - if @repository.license_blob + = link_to namespace_project_commits_path(@project.namespace, @project, current_ref) do + #{'Commit'.pluralize(@project.statistics.commit_count)} (#{number_with_delimiter(@project.statistics.commit_count)}) %li - = link_to license_short_name(@project), license_path(@project) - - - if @repository.contribution_guide + = link_to namespace_project_branches_path(@project.namespace, @project) do + #{'Branch'.pluralize(@repository.branch_count)} (#{number_with_delimiter(@repository.branch_count)}) %li - = link_to 'Contribution guide', contribution_guide_path(@project) + = link_to namespace_project_tags_path(@project.namespace, @project) do + #{'Tag'.pluralize(@repository.tag_count)} (#{number_with_delimiter(@repository.tag_count)}) - - if @repository.gitlab_ci_yml - %li - = link_to 'CI configuration', ci_configuration_path(@project) + - if default_project_view != 'readme' && @repository.readme + %li + = link_to 'Readme', readme_path(@project) + + - if @repository.changelog + %li + = link_to 'Changelog', changelog_path(@project) + + - if @repository.license_blob + %li + = link_to license_short_name(@project), license_path(@project) + + - if @repository.contribution_guide + %li + = link_to 'Contribution guide', contribution_guide_path(@project) + + - if @repository.gitlab_ci_yml + %li + = link_to 'CI configuration', ci_configuration_path(@project) - - if current_user && can_push_branch?(@project, @project.default_branch) - - unless @repository.changelog - %li.missing - = link_to add_special_file_path(@project, file_name: 'CHANGELOG') do - Add Changelog - - unless @repository.license_blob - %li.missing - = link_to add_special_file_path(@project, file_name: 'LICENSE') do - Add License - - unless @repository.contribution_guide - %li.missing - = link_to add_special_file_path(@project, file_name: 'CONTRIBUTING.md', commit_message: 'Add contribution guide') do - Add Contribution guide - - unless @repository.gitlab_ci_yml - %li.missing - = link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml') do - Set up CI - - if koding_enabled? && @repository.koding_yml.blank? - %li.missing - = link_to 'Set up Koding', add_koding_stack_path(@project) - - if @repository.gitlab_ci_yml.blank? && @project.deployment_service.present? - %li.missing - = link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml', commit_message: 'Set up auto deploy', target_branch: 'auto-deploy', context: 'autodeploy') do - Set up auto deploy + - if current_user && can_push_branch?(@project, @project.default_branch) + - unless @repository.changelog + %li.missing + = link_to add_special_file_path(@project, file_name: 'CHANGELOG') do + Add Changelog + - unless @repository.license_blob + %li.missing + = link_to add_special_file_path(@project, file_name: 'LICENSE') do + Add License + - unless @repository.contribution_guide + %li.missing + = link_to add_special_file_path(@project, file_name: 'CONTRIBUTING.md', commit_message: 'Add contribution guide') do + Add Contribution guide + - unless @repository.gitlab_ci_yml + %li.missing + = link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml') do + Set up CI + - if koding_enabled? && @repository.koding_yml.blank? + %li.missing + = link_to 'Set up Koding', add_koding_stack_path(@project) + - if @repository.gitlab_ci_yml.blank? && @project.deployment_service.present? + %li.missing + = link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml', commit_message: 'Set up auto deploy', target_branch: 'auto-deploy', context: 'autodeploy') do + Set up auto deploy - - if @repository.commit - .project-last-commit{ class: container_class } - = render 'projects/last_commit', commit: @repository.commit, ref: current_ref, project: @project + - if @repository.commit + .project-last-commit + = render 'projects/last_commit', commit: @repository.commit, ref: current_ref, project: @project %div{ class: container_class } - if @project.archived? -- cgit v1.2.1 From 1c6ea479837d2161ed524cc6821e4fc79e7e2fac Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 17 Feb 2017 09:13:48 -0600 Subject: Move tanuki to left of title; increase max-width of title --- app/assets/stylesheets/framework/header.scss | 26 ++++---------------------- app/assets/stylesheets/framework/nav.scss | 1 - app/views/layouts/header/_default.html.haml | 4 ++-- 3 files changed, 6 insertions(+), 25 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 367289968c9..edc86b20fd2 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -150,16 +150,11 @@ header { } .header-logo { - position: absolute; - left: 50%; + display: inline-block; + margin: 0 8px 0 3px; + position: relative; top: 7px; transition-duration: .3s; - z-index: 999; - - #logo { - position: relative; - left: -50%; - } svg, img { @@ -169,15 +164,6 @@ header { &:hover { cursor: pointer; } - - @media (max-width: $screen-xs-max) { - right: 20px; - left: auto; - - #logo { - left: auto; - } - } } .title { @@ -185,7 +171,7 @@ header { padding-right: 20px; margin: 0; font-size: 18px; - max-width: 385px; + max-width: 450px; display: inline-block; line-height: $header-height; font-weight: normal; @@ -195,10 +181,6 @@ header { vertical-align: top; white-space: nowrap; - @media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) { - max-width: 300px; - } - @media (max-width: $screen-xs-max) { max-width: 190px; } diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index 6a3481524e9..4af04423ebb 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -79,7 +79,6 @@ } &.sub-nav { - text-align: center; background-color: $gray-normal; .container-fluid { diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index ddf50d6667f..60b9b8bdbc4 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -61,12 +61,12 @@ %div = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-success' - %h1.title= title - .header-logo = link_to root_path, class: 'home', title: 'Dashboard', id: 'logo' do = brand_header_logo + %h1.title= title + = yield :header_content = render 'shared/outdated_browser' -- cgit v1.2.1 From 7362fd6fdf4704314acbe9760a329ffe23337af0 Mon Sep 17 00:00:00 2001 From: mhasbini Date: Fri, 17 Feb 2017 20:28:32 +0200 Subject: add a :iids param to IssuableFinder --- app/finders/issuable_finder.rb | 15 ++++++--------- app/finders/issues_finder.rb | 4 ---- app/finders/merge_requests_finder.rb | 10 ---------- 3 files changed, 6 insertions(+), 23 deletions(-) (limited to 'app') diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 1576fc80a6b..206c92fe82a 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -16,6 +16,7 @@ # label_name: string # sort: string # non_archived: boolean +# iids: integer[] # class IssuableFinder NONE = '0' @@ -40,6 +41,7 @@ class IssuableFinder items = by_label(items) items = by_due_date(items) items = by_non_archived(items) + items = by_iids(items) sort(items) end @@ -266,16 +268,11 @@ class IssuableFinder end def by_search(items) - if search - items = - if search =~ iid_pattern - items.where(iid: $~[:iid]) - else - items.full_search(search) - end - end + search ? items.full_search(search) : items + end - items + def by_iids(items) + params[:iids].present? ? items.where(iid: params[:iids]) : items end def sort(items) diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index 707eddd4d29..f542f72a386 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -26,10 +26,6 @@ class IssuesFinder < IssuableFinder IssuesFinder.not_restricted_by_confidentiality(current_user) end - def iid_pattern - @iid_pattern ||= %r{\A#{Regexp.escape(Issue.reference_prefix)}(?\d+)\z} - end - def self.not_restricted_by_confidentiality(user) return Issue.where('issues.confidential IS NULL OR issues.confidential IS FALSE') if user.blank? diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb index 8b82255445e..b76ca389f38 100644 --- a/app/finders/merge_requests_finder.rb +++ b/app/finders/merge_requests_finder.rb @@ -20,14 +20,4 @@ class MergeRequestsFinder < IssuableFinder def klass MergeRequest end - - private - - def iid_pattern - @iid_pattern ||= %r{\A[ - #{Regexp.escape(MergeRequest.reference_prefix)} - #{Regexp.escape(Issue.reference_prefix)} - ](?\d+)\z - }x - end end -- cgit v1.2.1 From 05ec7f8a0cb6d705ec2377c7b7d798f5eedea1f5 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 17 Feb 2017 08:08:50 -0600 Subject: Make active links in dropdown bold --- app/assets/stylesheets/framework/header.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 367289968c9..0373bfc4ed5 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -111,7 +111,7 @@ header { } li { - .active a { + &.active a { font-weight: bold; } -- cgit v1.2.1 From 102587972d69ed7e34a1f4d8d8995a008692db90 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 17 Feb 2017 08:20:45 -0600 Subject: Remove badge styling in dropdown; remove blue outline --- app/assets/stylesheets/framework/header.scss | 12 +++++------- app/views/layouts/nav/_dashboard.html.haml | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 0373bfc4ed5..3945a789c82 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -114,12 +114,6 @@ header { &.active a { font-weight: bold; } - - &:hover { - .badge { - background-color: $white-light; - } - } } } @@ -132,7 +126,11 @@ header { &:hover { background-color: $white-normal; - color: $gl-header-nav-hover-color; + } + + &:focus { + outline: none; + background-color: $white-normal; } } diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index bb611d39be5..5d4178f03d7 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -24,12 +24,12 @@ = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'dashboard-shortcuts-issues' do %span Issues - %span.badge= number_with_delimiter(cached_assigned_issuables_count(current_user, :issues, :opened)) + (#{number_with_delimiter(cached_assigned_issuables_count(current_user, :issues, :opened))}) = nav_link(path: 'dashboard#merge_requests') do = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do %span Merge Requests - %span.badge= number_with_delimiter(cached_assigned_issuables_count(current_user, :merge_requests, :opened)) + (#{number_with_delimiter(cached_assigned_issuables_count(current_user, :merge_requests, :opened))}) = nav_link(controller: 'dashboard/snippets') do = link_to dashboard_snippets_path, title: 'Snippets' do %span -- cgit v1.2.1 From 0c6b1ad858270c772efc37f7e721a6825493d9ed Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 17 Feb 2017 10:15:33 -0600 Subject: Remove application theme settings from preferences --- app/views/profiles/preferences/show.html.haml | 7 ------- 1 file changed, 7 deletions(-) (limited to 'app') diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index 787339e0fe2..df0a0212f3d 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -2,13 +2,6 @@ = render 'profiles/head' = form_for @user, url: profile_preferences_path, remote: true, method: :put, html: { class: 'row prepend-top-default js-preferences-form' } do |f| - .col-lg-3.profile-settings-sidebar - %h4.prepend-top-0 - Application theme - %p - This setting allows you to customize the appearance of the site, e.g. the sidebar. - .col-sm-12 - %hr .col-lg-3.profile-settings-sidebar %h4.prepend-top-0 Syntax highlighting theme -- cgit v1.2.1 From 4a8a28eb9e9dffb03a8c8be413aa341f452ce113 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 17 Feb 2017 12:46:21 -0600 Subject: Fix issue where files on a fork could not be edited --- app/controllers/concerns/creates_commit.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'app') diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb index 6286d67d30c..88d180fcc2e 100644 --- a/app/controllers/concerns/creates_commit.rb +++ b/app/controllers/concerns/creates_commit.rb @@ -104,23 +104,15 @@ module CreatesCommit if can?(current_user, :push_code, @project) # Edit file in this project @mr_source_project = @project - - if @project.forked? - # Merge request from this project to fork origin - @mr_target_project = @project.forked_from_project - @mr_target_branch = @mr_target_project.repository.root_ref - else - # Merge request to this project - @mr_target_project = @project - @mr_target_branch = @ref || @target_branch - end else # Merge request from fork to this project @mr_source_project = current_user.fork_of(@project) - @mr_target_project = @project - @mr_target_branch = @ref || @target_branch end + # Merge request to this project + @mr_target_project = @project + @mr_target_branch = @ref || @target_branch + @mr_source_branch = guess_mr_source_branch end -- cgit v1.2.1 From 0d72c8b210f7fd1e5d2878316de2d46d6fa0a611 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 17 Feb 2017 09:27:13 -0600 Subject: Update positioning of nav scroll arrows --- app/assets/stylesheets/framework/nav.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index 4af04423ebb..7d4a814a36c 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -1,7 +1,7 @@ @mixin fade($gradient-direction, $gradient-color) { visibility: hidden; opacity: 0; - z-index: 2; + z-index: 1; position: absolute; bottom: 12px; width: 43px; @@ -18,7 +18,7 @@ .fa { position: relative; - top: 5px; + top: 6px; font-size: 18px; } } @@ -351,7 +351,7 @@ right: -5px; .fa { - right: -7px; + right: -28px; } } @@ -381,7 +381,7 @@ left: 0; .fa { - left: 10px; + left: -4px; } } } -- cgit v1.2.1 From 59010d8f822a1d09660ef78a0ceb7f9cf05dbd63 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Fri, 17 Feb 2017 10:51:01 -0600 Subject: Fix grammer issue in admin/runners --- app/views/admin/runners/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/admin/runners/index.html.haml b/app/views/admin/runners/index.html.haml index 721bc77cc2f..d725e477044 100644 --- a/app/views/admin/runners/index.html.haml +++ b/app/views/admin/runners/index.html.haml @@ -56,7 +56,7 @@ = submit_tag 'Search', class: 'btn' .pull-right.light - Runners with last contact less than a minute ago: #{@active_runners_cnt} + Runners with last contact more than a minute ago: #{@active_runners_cnt} %br -- cgit v1.2.1 From 26160459b56019f445a7d29abc0b72f591e1d2a9 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Mon, 16 Jan 2017 14:11:08 +0100 Subject: Todo done clicking is kind of unusable. The Done button will change to an Undo button and the line item will be greyed out. Bold links will be unbolded. The user can undo the task by clicking the Undo button. --- app/assets/javascripts/todos.js.es6 | 143 +++++++++++--------------- app/assets/stylesheets/pages/todos.scss | 12 +++ app/controllers/dashboard/todos_controller.rb | 6 ++ app/services/todo_service.rb | 25 +++-- app/views/dashboard/todos/_todo.html.haml | 5 +- 5 files changed, 99 insertions(+), 92 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/todos.js.es6 b/app/assets/javascripts/todos.js.es6 index ded683f2ca1..e9513725d9d 100644 --- a/app/assets/javascripts/todos.js.es6 +++ b/app/assets/javascripts/todos.js.es6 @@ -1,28 +1,34 @@ -/* eslint-disable class-methods-use-this, no-new, func-names, prefer-template, no-unneeded-ternary, object-shorthand, space-before-function-paren, comma-dangle, quote-props, consistent-return, no-else-return, no-param-reassign, max-len */ +/* eslint-disable class-methods-use-this, no-new, func-names, no-unneeded-ternary, object-shorthand, quote-props, no-param-reassign, max-len */ /* global UsersSelect */ ((global) => { class Todos { - constructor({ el } = {}) { - this.allDoneClicked = this.allDoneClicked.bind(this); - this.doneClicked = this.doneClicked.bind(this); - this.el = el || $('.js-todos-options'); - this.perPage = this.el.data('perPage'); - this.clearListeners(); - this.initBtnListeners(); + constructor() { this.initFilters(); + this.bindEvents(); + + this.cleanupWrapper = this.cleanup.bind(this); + document.addEventListener('beforeunload', this.cleanupWrapper); } - clearListeners() { - $('.done-todo').off('click'); - $('.js-todos-mark-all').off('click'); - return $('.todo').off('click'); + cleanup() { + this.unbindEvents(); + document.removeEventListener('beforeunload', this.cleanupWrapper); } - initBtnListeners() { - $('.done-todo').on('click', this.doneClicked); - $('.js-todos-mark-all').on('click', this.allDoneClicked); - return $('.todo').on('click', this.goToTodoUrl); + unbindEvents() { + $('.js-done-todo, .js-undo-todo').off('click', this.updateStateClickedWrapper); + $('.js-todos-mark-all').off('click', this.allDoneClickedWrapper); + $('.todo').off('click', this.goToTodoUrl); + } + + bindEvents() { + this.updateStateClickedWrapper = this.updateStateClicked.bind(this); + this.allDoneClickedWrapper = this.allDoneClicked.bind(this); + + $('.js-done-todo, .js-undo-todo').on('click', this.updateStateClickedWrapper); + $('.js-todos-mark-all').on('click', this.allDoneClickedWrapper); + $('.todo').on('click', this.goToTodoUrl); } initFilters() { @@ -33,7 +39,7 @@ $('form.filter-form').on('submit', function (event) { event.preventDefault(); - gl.utils.visitUrl(this.action + '&' + $(this).serialize()); + gl.utils.visitUrl(`${this.action}&${$(this).serialize()}`); }); } @@ -44,105 +50,72 @@ filterable: searchFields ? true : false, search: { fields: searchFields }, data: $dropdown.data('data'), - clicked: function() { + clicked: function () { return $dropdown.closest('form.filter-form').submit(); - } + }, }); } - doneClicked(e) { + updateStateClicked(e) { e.preventDefault(); - e.stopImmediatePropagation(); - const $target = $(e.currentTarget); - $target.disable(); - return $.ajax({ + const target = e.target; + target.setAttribute('disabled', ''); + target.classList.add('disabled'); + $.ajax({ type: 'POST', - url: $target.attr('href'), + url: target.getAttribute('href'), dataType: 'json', data: { - '_method': 'delete' + '_method': target.getAttribute('data-method'), }, success: (data) => { - this.redirectIfNeeded(data.count); - this.clearDone($target.closest('li')); - return this.updateBadges(data); - } + this.updateState(target); + this.updateBadges(data); + }, }); } allDoneClicked(e) { e.preventDefault(); - e.stopImmediatePropagation(); const $target = $(e.currentTarget); $target.disable(); - return $.ajax({ + $.ajax({ type: 'POST', url: $target.attr('href'), dataType: 'json', data: { - '_method': 'delete' + '_method': 'delete', }, success: (data) => { $target.remove(); $('.js-todos-all').html('
You\'re all done!
'); - return this.updateBadges(data); - } + this.updateBadges(data); + }, }); } - clearDone($row) { - const $ul = $row.closest('ul'); - $row.remove(); - if (!$ul.find('li').length) { - return $ul.parents('.panel').remove(); + updateState(target) { + const row = target.closest('li'); + const restoreBtn = row.querySelector('.js-undo-todo'); + const doneBtn = row.querySelector('.js-done-todo'); + + target.removeAttribute('disabled'); + target.classList.remove('disabled'); + target.classList.add('hidden'); + + if (target === doneBtn) { + row.classList.add('done-reversible'); + restoreBtn.classList.remove('hidden'); + } else { + row.classList.remove('done-reversible'); + doneBtn.classList.remove('hidden'); } } updateBadges(data) { $(document).trigger('todo:toggle', data.count); $('.todos-pending .badge').text(data.count); - return $('.todos-done .badge').text(data.done_count); - } - - getTotalPages() { - return this.el.data('totalPages'); - } - - getCurrentPage() { - return this.el.data('currentPage'); - } - - getTodosPerPage() { - return this.el.data('perPage'); - } - - redirectIfNeeded(total) { - const currPages = this.getTotalPages(); - const currPage = this.getCurrentPage(); - - // Refresh if no remaining Todos - if (!total) { - window.location.reload(); - return; - } - // Do nothing if no pagination - if (!currPages) { - return; - } - - const newPages = Math.ceil(total / this.getTodosPerPage()); - let url = location.href; - - if (newPages !== currPages) { - // Redirect to previous page if there's one available - if (currPages > 1 && currPage === currPages) { - const pageParams = { - page: currPages - 1 - }; - url = gl.utils.mergeUrlParams(pageParams, url); - } - return gl.utils.visitUrl(url); - } + $('.todos-done .badge').text(data.done_count); } goToTodoUrl(e) { @@ -159,12 +132,12 @@ if (selected.tagName === 'IMG') { const avatarUrl = selected.parentElement.getAttribute('href'); - return window.open(avatarUrl, windowTarget); + window.open(avatarUrl, windowTarget); } else { - return window.open(todoLink, windowTarget); + window.open(todoLink, windowTarget); } } else { - return gl.utils.visitUrl(todoLink); + gl.utils.visitUrl(todoLink); } } } diff --git a/app/assets/stylesheets/pages/todos.scss b/app/assets/stylesheets/pages/todos.scss index 0d5604aae69..551a66fbf3a 100644 --- a/app/assets/stylesheets/pages/todos.scss +++ b/app/assets/stylesheets/pages/todos.scss @@ -60,6 +60,18 @@ } } +.todos-list > .todo.todo-pending.done-reversible { + background-color: $gray-light; + + &:hover { + border-color: $border-color; + } + + .title { + font-weight: normal; + } +} + .todo-item { .todo-title { @include str-truncated(calc(100% - 174px)); diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index e3933e3d7b1..4e61b0886d8 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -29,6 +29,12 @@ class Dashboard::TodosController < Dashboard::ApplicationController end end + def restore + TodoService.new.mark_todos_as_pending_by_ids([params[:id]], current_user) + + render json: todos_counts + end + private def find_todos diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index 8ab943f4639..ad86b4f9f42 100644 --- a/app/services/todo_service.rb +++ b/app/services/todo_service.rb @@ -170,16 +170,20 @@ class TodoService # When user marks some todos as done def mark_todos_as_done(todos, current_user) - mark_todos_as_done_by_ids(todos.select(&:id), current_user) + update_todos_state_by_ids(todos.select(&:id), current_user, :done) end def mark_todos_as_done_by_ids(ids, current_user) - todos = current_user.todos.where(id: ids) + update_todos_state_by_ids(ids, current_user, :done) + end - # Only return those that are not really on that state - marked_todos = todos.where.not(state: :done).update_all(state: :done) - current_user.update_todos_count_cache - marked_todos + # When user marks some todos as pending + def mark_todos_as_pending(todos, current_user) + update_todos_state_by_ids(todos.select(&:id), current_user, :pending) + end + + def mark_todos_as_pending_by_ids(ids, current_user) + update_todos_state_by_ids(ids, current_user, :pending) end # When user marks an issue as todo @@ -194,6 +198,15 @@ class TodoService private + def update_todos_state_by_ids(ids, current_user, state) + todos = current_user.todos.where(id: ids) + + # Only return those that are not really on that state + marked_todos = todos.where.not(state: state).update_all(state: state) + current_user.update_todos_count_cache + marked_todos + end + def create_todos(users, attributes) Array(users).map do |user| next if pending_todos(user, attributes).exists? diff --git a/app/views/dashboard/todos/_todo.html.haml b/app/views/dashboard/todos/_todo.html.haml index 605bfd0cf8d..dc2d924f212 100644 --- a/app/views/dashboard/todos/_todo.html.haml +++ b/app/views/dashboard/todos/_todo.html.haml @@ -31,6 +31,9 @@ - if todo.pending? .todo-actions - = link_to [:dashboard, todo], method: :delete, class: 'btn btn-loading done-todo' do + = link_to [:dashboard, todo], method: :delete, class: 'btn btn-loading js-done-todo' do Done = icon('spinner spin') + = link_to restore_dashboard_todo_path(todo), method: :patch, class: 'btn btn-loading js-undo-todo hidden' do + Undo + = icon('spinner spin') -- cgit v1.2.1 From 0f31c5a92b314baddd4cad01c328bdf1736fc7b4 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 10 Feb 2017 00:50:50 -0600 Subject: replace implicit this == window with explicit binding --- app/assets/javascripts/admin.js | 2 +- app/assets/javascripts/api.js | 2 +- app/assets/javascripts/application.js | 2 +- app/assets/javascripts/aside.js | 2 +- app/assets/javascripts/autosave.js | 2 +- app/assets/javascripts/awards_handler.js | 2 +- app/assets/javascripts/behaviors/autosize.js | 2 +- app/assets/javascripts/behaviors/details_behavior.js | 2 +- app/assets/javascripts/behaviors/quick_submit.js | 2 +- app/assets/javascripts/behaviors/requires_input.js | 2 +- app/assets/javascripts/blob/blob_file_dropzone.js | 2 +- app/assets/javascripts/blob/blob_gitignore_selector.js | 2 +- app/assets/javascripts/blob/blob_gitignore_selectors.js | 2 +- app/assets/javascripts/blob/blob_license_selector.js | 2 +- app/assets/javascripts/blob_edit/blob_edit_bundle.js | 2 +- app/assets/javascripts/blob_edit/edit_blob.js | 2 +- app/assets/javascripts/breakpoints.js | 2 +- app/assets/javascripts/broadcast_message.js | 2 +- app/assets/javascripts/build.js | 2 +- app/assets/javascripts/build_artifacts.js | 2 +- app/assets/javascripts/commit.js | 2 +- app/assets/javascripts/commit/file.js | 2 +- app/assets/javascripts/commit/image_file.js | 2 +- app/assets/javascripts/commits.js | 2 +- app/assets/javascripts/compare.js | 2 +- app/assets/javascripts/compare_autocomplete.js.es6 | 2 +- app/assets/javascripts/confirm_danger_modal.js | 2 +- app/assets/javascripts/copy_to_clipboard.js | 2 +- app/assets/javascripts/dispatcher.js.es6 | 2 +- app/assets/javascripts/dropzone_input.js | 2 +- app/assets/javascripts/extensions/jquery.js | 2 +- app/assets/javascripts/files_comment_button.js | 2 +- app/assets/javascripts/flash.js | 2 +- app/assets/javascripts/gfm_auto_complete.js.es6 | 2 +- app/assets/javascripts/gl_dropdown.js | 2 +- app/assets/javascripts/graphs/stat_graph.js | 2 +- app/assets/javascripts/graphs/stat_graph_contributors.js | 2 +- app/assets/javascripts/graphs/stat_graph_contributors_graph.js | 2 +- app/assets/javascripts/graphs/stat_graph_contributors_util.js | 2 +- app/assets/javascripts/group_avatar.js | 2 +- app/assets/javascripts/groups_select.js | 2 +- app/assets/javascripts/importer_status.js | 2 +- app/assets/javascripts/issuable_context.js | 2 +- app/assets/javascripts/issuable_form.js | 2 +- app/assets/javascripts/issue.js | 2 +- app/assets/javascripts/issue_status_select.js | 2 +- app/assets/javascripts/labels.js | 2 +- app/assets/javascripts/labels_select.js | 2 +- app/assets/javascripts/layout_nav.js | 2 +- app/assets/javascripts/lib/cropper.js | 2 +- app/assets/javascripts/lib/raphael.js | 2 +- app/assets/javascripts/lib/utils/animate.js | 2 +- app/assets/javascripts/lib/utils/common_utils.js.es6 | 2 +- app/assets/javascripts/lib/utils/datetime_utility.js.es6 | 2 +- app/assets/javascripts/lib/utils/notify.js | 2 +- app/assets/javascripts/lib/utils/text_utility.js | 2 +- app/assets/javascripts/lib/utils/type_utility.js | 2 +- app/assets/javascripts/lib/utils/url_utility.js.es6 | 2 +- app/assets/javascripts/line_highlighter.js | 2 +- app/assets/javascripts/logo.js | 2 +- app/assets/javascripts/member_expiration_date.js.es6 | 2 +- app/assets/javascripts/merge_request.js | 2 +- app/assets/javascripts/merged_buttons.js | 2 +- app/assets/javascripts/milestone.js | 2 +- app/assets/javascripts/milestone_select.js | 2 +- app/assets/javascripts/namespace_select.js | 2 +- app/assets/javascripts/network/branch_graph.js | 2 +- app/assets/javascripts/network/network.js | 2 +- app/assets/javascripts/network/network_bundle.js | 2 +- app/assets/javascripts/new_branch_form.js | 2 +- app/assets/javascripts/new_commit_form.js | 2 +- app/assets/javascripts/notes.js | 2 +- app/assets/javascripts/notifications_dropdown.js | 2 +- app/assets/javascripts/notifications_form.js | 2 +- app/assets/javascripts/project.js | 2 +- app/assets/javascripts/project_avatar.js | 2 +- app/assets/javascripts/project_find_file.js | 2 +- app/assets/javascripts/project_fork.js | 2 +- app/assets/javascripts/project_import.js | 2 +- app/assets/javascripts/project_new.js | 2 +- app/assets/javascripts/project_select.js | 2 +- app/assets/javascripts/project_show.js | 2 +- app/assets/javascripts/projects_list.js | 2 +- app/assets/javascripts/render_gfm.js | 2 +- app/assets/javascripts/render_math.js | 2 +- app/assets/javascripts/right_sidebar.js | 2 +- app/assets/javascripts/search.js | 2 +- app/assets/javascripts/shortcuts.js | 2 +- app/assets/javascripts/shortcuts_dashboard_navigation.js | 2 +- app/assets/javascripts/shortcuts_find_file.js | 2 +- app/assets/javascripts/shortcuts_issuable.js | 2 +- app/assets/javascripts/shortcuts_navigation.js | 2 +- app/assets/javascripts/shortcuts_network.js | 2 +- app/assets/javascripts/single_file_diff.js | 2 +- app/assets/javascripts/snippet/snippet_bundle.js | 2 +- app/assets/javascripts/star.js | 2 +- app/assets/javascripts/subscription_select.js | 2 +- app/assets/javascripts/syntax_highlight.js | 2 +- app/assets/javascripts/tree.js | 2 +- app/assets/javascripts/u2f/error.js | 2 +- app/assets/javascripts/u2f/register.js | 2 +- app/assets/javascripts/u2f/util.js | 2 +- app/assets/javascripts/users/calendar.js | 2 +- app/assets/javascripts/users_select.js | 2 +- app/assets/javascripts/zen_mode.js | 2 +- 105 files changed, 105 insertions(+), 105 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index 424dc719c78..aaed74d6073 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -61,4 +61,4 @@ return Admin; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 84bbe90f3b1..86e0ad89431 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -147,4 +147,4 @@ }; window.Api = Api; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 5d7350ad7be..8e468faedbf 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -243,4 +243,4 @@ require('es6-promise').polyfill(); gl.utils.initTimeagoTimeout(); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/aside.js b/app/assets/javascripts/aside.js index 8438de6cdf1..448e6e2cc78 100644 --- a/app/assets/javascripts/aside.js +++ b/app/assets/javascripts/aside.js @@ -22,4 +22,4 @@ return Aside; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/autosave.js b/app/assets/javascripts/autosave.js index b16a2c0f73a..e55405135fb 100644 --- a/app/assets/javascripts/autosave.js +++ b/app/assets/javascripts/autosave.js @@ -59,4 +59,4 @@ return Autosave; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 9d776b74965..a4ccb30e447 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -377,4 +377,4 @@ var emojiAliases = require('emoji-aliases'); return AwardsHandler; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/behaviors/autosize.js b/app/assets/javascripts/behaviors/autosize.js index a489523b802..f7f41d55b52 100644 --- a/app/assets/javascripts/behaviors/autosize.js +++ b/app/assets/javascripts/behaviors/autosize.js @@ -25,4 +25,4 @@ var autosize = require('vendor/autosize'); autosize.update($fields); return $fields.css('resize', 'vertical'); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/behaviors/details_behavior.js b/app/assets/javascripts/behaviors/details_behavior.js index 6af8f593872..fd0840fa117 100644 --- a/app/assets/javascripts/behaviors/details_behavior.js +++ b/app/assets/javascripts/behaviors/details_behavior.js @@ -23,4 +23,4 @@ return e.preventDefault(); }); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/behaviors/quick_submit.js b/app/assets/javascripts/behaviors/quick_submit.js index 7747306688c..a7e68ae5cb9 100644 --- a/app/assets/javascripts/behaviors/quick_submit.js +++ b/app/assets/javascripts/behaviors/quick_submit.js @@ -74,4 +74,4 @@ require('../extensions/jquery'); return $this.tooltip('hide'); }); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/behaviors/requires_input.js b/app/assets/javascripts/behaviors/requires_input.js index 6276933e93e..6b21695d082 100644 --- a/app/assets/javascripts/behaviors/requires_input.js +++ b/app/assets/javascripts/behaviors/requires_input.js @@ -59,4 +59,4 @@ require('../extensions/jquery'); return hideOrShowHelpBlock($form); }); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/blob/blob_file_dropzone.js b/app/assets/javascripts/blob/blob_file_dropzone.js index 04bfe363929..5f14ff40eee 100644 --- a/app/assets/javascripts/blob/blob_file_dropzone.js +++ b/app/assets/javascripts/blob/blob_file_dropzone.js @@ -63,4 +63,4 @@ return BlobFileDropzone; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/blob/blob_gitignore_selector.js b/app/assets/javascripts/blob/blob_gitignore_selector.js index 1d0bcf6471f..de20eab9cd1 100644 --- a/app/assets/javascripts/blob/blob_gitignore_selector.js +++ b/app/assets/javascripts/blob/blob_gitignore_selector.js @@ -20,4 +20,4 @@ require('./template_selector'); return BlobGitignoreSelector; })(gl.TemplateSelector); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/blob/blob_gitignore_selectors.js b/app/assets/javascripts/blob/blob_gitignore_selectors.js index 8236457f0f1..43e5c0a5641 100644 --- a/app/assets/javascripts/blob/blob_gitignore_selectors.js +++ b/app/assets/javascripts/blob/blob_gitignore_selectors.js @@ -23,4 +23,4 @@ return BlobGitignoreSelectors; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/blob/blob_license_selector.js b/app/assets/javascripts/blob/blob_license_selector.js index 1d5672d4c48..b582052a76e 100644 --- a/app/assets/javascripts/blob/blob_license_selector.js +++ b/app/assets/javascripts/blob/blob_license_selector.js @@ -25,4 +25,4 @@ require('./template_selector'); return BlobLicenseSelector; })(gl.TemplateSelector); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/blob_edit/blob_edit_bundle.js b/app/assets/javascripts/blob_edit/blob_edit_bundle.js index 9e0754819fa..0436bbb0eaf 100644 --- a/app/assets/javascripts/blob_edit/blob_edit_bundle.js +++ b/app/assets/javascripts/blob_edit/blob_edit_bundle.js @@ -12,4 +12,4 @@ require('./edit_blob'); var blob = new EditBlob(url, $('.js-edit-blob-form').data('blob-language')); new NewCommitForm($('.js-edit-blob-form')); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/blob_edit/edit_blob.js b/app/assets/javascripts/blob_edit/edit_blob.js index 079445e8278..a1127b9e30e 100644 --- a/app/assets/javascripts/blob_edit/edit_blob.js +++ b/app/assets/javascripts/blob_edit/edit_blob.js @@ -85,4 +85,4 @@ return EditBlob; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/breakpoints.js b/app/assets/javascripts/breakpoints.js index f8dac1ff56e..22e93328548 100644 --- a/app/assets/javascripts/breakpoints.js +++ b/app/assets/javascripts/breakpoints.js @@ -69,4 +69,4 @@ })(this)); window.Breakpoints = Breakpoints; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/broadcast_message.js b/app/assets/javascripts/broadcast_message.js index dbdadc73c3f..e8531c43b4b 100644 --- a/app/assets/javascripts/broadcast_message.js +++ b/app/assets/javascripts/broadcast_message.js @@ -31,4 +31,4 @@ } }); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js index c5a962dd199..8fa1aceddff 100644 --- a/app/assets/javascripts/build.js +++ b/app/assets/javascripts/build.js @@ -275,4 +275,4 @@ return Build; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/build_artifacts.js b/app/assets/javascripts/build_artifacts.js index 083448552b6..cae9a0ffca4 100644 --- a/app/assets/javascripts/build_artifacts.js +++ b/app/assets/javascripts/build_artifacts.js @@ -23,4 +23,4 @@ return BuildArtifacts; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/commit.js b/app/assets/javascripts/commit.js index c656ae4e241..566b322eb49 100644 --- a/app/assets/javascripts/commit.js +++ b/app/assets/javascripts/commit.js @@ -11,4 +11,4 @@ return Commit; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/commit/file.js b/app/assets/javascripts/commit/file.js index 184b4561d2e..ee087c978dd 100644 --- a/app/assets/javascripts/commit/file.js +++ b/app/assets/javascripts/commit/file.js @@ -11,4 +11,4 @@ return CommitFile; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/commit/image_file.js b/app/assets/javascripts/commit/image_file.js index f09a6b1e676..49bb64a3472 100644 --- a/app/assets/javascripts/commit/image_file.js +++ b/app/assets/javascripts/commit/image_file.js @@ -173,4 +173,4 @@ return ImageFile; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js index c6fdfbcaa10..ccd895f3bf4 100644 --- a/app/assets/javascripts/commits.js +++ b/app/assets/javascripts/commits.js @@ -65,4 +65,4 @@ return CommitsList; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/compare.js b/app/assets/javascripts/compare.js index 9591df70e9c..15df105d4cc 100644 --- a/app/assets/javascripts/compare.js +++ b/app/assets/javascripts/compare.js @@ -88,4 +88,4 @@ return Compare; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/compare_autocomplete.js.es6 b/app/assets/javascripts/compare_autocomplete.js.es6 index 3587431ab69..1eca973e069 100644 --- a/app/assets/javascripts/compare_autocomplete.js.es6 +++ b/app/assets/javascripts/compare_autocomplete.js.es6 @@ -66,4 +66,4 @@ return CompareAutocomplete; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/confirm_danger_modal.js b/app/assets/javascripts/confirm_danger_modal.js index 35d98492012..a1c1b721228 100644 --- a/app/assets/javascripts/confirm_danger_modal.js +++ b/app/assets/javascripts/confirm_danger_modal.js @@ -28,4 +28,4 @@ return ConfirmDangerModal; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/copy_to_clipboard.js b/app/assets/javascripts/copy_to_clipboard.js index 0029c59e550..615f485e18a 100644 --- a/app/assets/javascripts/copy_to_clipboard.js +++ b/app/assets/javascripts/copy_to_clipboard.js @@ -46,4 +46,4 @@ window.Clipboard = require('vendor/clipboard'); clipboard.on('success', genericSuccess); return clipboard.on('error', genericError); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/dispatcher.js.es6 b/app/assets/javascripts/dispatcher.js.es6 index f06a8848021..45aa6050aed 100644 --- a/app/assets/javascripts/dispatcher.js.es6 +++ b/app/assets/javascripts/dispatcher.js.es6 @@ -383,4 +383,4 @@ const ShortcutsBlob = require('./shortcuts_blob'); return Dispatcher; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js index a510eebae1a..64a7a9eaf37 100644 --- a/app/assets/javascripts/dropzone_input.js +++ b/app/assets/javascripts/dropzone_input.js @@ -216,4 +216,4 @@ require('./preview_markdown'); return DropzoneInput; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/extensions/jquery.js b/app/assets/javascripts/extensions/jquery.js index d3b58b2707a..1a489b859e8 100644 --- a/app/assets/javascripts/extensions/jquery.js +++ b/app/assets/javascripts/extensions/jquery.js @@ -13,4 +13,4 @@ return $(this).removeAttr('disabled').removeClass('disabled'); } }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/files_comment_button.js b/app/assets/javascripts/files_comment_button.js index 895a872568d..698870d0ce1 100644 --- a/app/assets/javascripts/files_comment_button.js +++ b/app/assets/javascripts/files_comment_button.js @@ -144,4 +144,4 @@ } }); }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/flash.js index 249fe23d4cb..730104b89f9 100644 --- a/app/assets/javascripts/flash.js +++ b/app/assets/javascripts/flash.js @@ -39,4 +39,4 @@ return Flash; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6 index c295860c334..60d6658dc16 100644 --- a/app/assets/javascripts/gfm_auto_complete.js.es6 +++ b/app/assets/javascripts/gfm_auto_complete.js.es6 @@ -380,4 +380,4 @@ (dataToInspect === loadingState || dataToInspect.name === loadingState); } }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index 0d618caf350..bf3da8528f0 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -846,4 +846,4 @@ } }); }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/graphs/stat_graph.js b/app/assets/javascripts/graphs/stat_graph.js index 2e6da5750de..75a53aae33c 100644 --- a/app/assets/javascripts/graphs/stat_graph.js +++ b/app/assets/javascripts/graphs/stat_graph.js @@ -15,4 +15,4 @@ return StatGraph; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/graphs/stat_graph_contributors.js b/app/assets/javascripts/graphs/stat_graph_contributors.js index d06a1a5dae4..bbfb467ad50 100644 --- a/app/assets/javascripts/graphs/stat_graph_contributors.js +++ b/app/assets/javascripts/graphs/stat_graph_contributors.js @@ -113,4 +113,4 @@ window.d3 = require('d3'); return ContributorsStatGraph; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/graphs/stat_graph_contributors_graph.js b/app/assets/javascripts/graphs/stat_graph_contributors_graph.js index 241249fae63..228771da4ee 100644 --- a/app/assets/javascripts/graphs/stat_graph_contributors_graph.js +++ b/app/assets/javascripts/graphs/stat_graph_contributors_graph.js @@ -273,4 +273,4 @@ window.d3 = require('d3'); return ContributorsAuthorGraph; })(ContributorsGraph); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/graphs/stat_graph_contributors_util.js b/app/assets/javascripts/graphs/stat_graph_contributors_util.js index 29c3163328f..7954c583598 100644 --- a/app/assets/javascripts/graphs/stat_graph_contributors_util.js +++ b/app/assets/javascripts/graphs/stat_graph_contributors_util.js @@ -135,4 +135,4 @@ } } }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/group_avatar.js b/app/assets/javascripts/group_avatar.js index 10dfd05fe3c..c5cb273c5b2 100644 --- a/app/assets/javascripts/group_avatar.js +++ b/app/assets/javascripts/group_avatar.js @@ -17,4 +17,4 @@ return GroupAvatar; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/groups_select.js b/app/assets/javascripts/groups_select.js index bc88dc2d092..6b937e7fa0f 100644 --- a/app/assets/javascripts/groups_select.js +++ b/app/assets/javascripts/groups_select.js @@ -68,4 +68,4 @@ return GroupsSelect; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/importer_status.js b/app/assets/javascripts/importer_status.js index 9390136d3d8..34e4a257ff9 100644 --- a/app/assets/javascripts/importer_status.js +++ b/app/assets/javascripts/importer_status.js @@ -78,4 +78,4 @@ new window.ImporterStatus(jobsImportPath, importPath); } }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/issuable_context.js b/app/assets/javascripts/issuable_context.js index c77fbb6a1c7..115312d4b83 100644 --- a/app/assets/javascripts/issuable_context.js +++ b/app/assets/javascripts/issuable_context.js @@ -76,4 +76,4 @@ return IssuableContext; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/issuable_form.js b/app/assets/javascripts/issuable_form.js index c7c744ef61f..de184ab2675 100644 --- a/app/assets/javascripts/issuable_form.js +++ b/app/assets/javascripts/issuable_form.js @@ -156,4 +156,4 @@ return IssuableForm; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/issue.js b/app/assets/javascripts/issue.js index 00633e812e1..52457f70d90 100644 --- a/app/assets/javascripts/issue.js +++ b/app/assets/javascripts/issue.js @@ -132,4 +132,4 @@ require('./task_list'); return Issue; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/issue_status_select.js b/app/assets/javascripts/issue_status_select.js index 1d6eff11403..b2cfd3ef2a3 100644 --- a/app/assets/javascripts/issue_status_select.js +++ b/app/assets/javascripts/issue_status_select.js @@ -31,4 +31,4 @@ return IssueStatusSelect; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/labels.js b/app/assets/javascripts/labels.js index 40ad6fc348e..17a3fc1b1e4 100644 --- a/app/assets/javascripts/labels.js +++ b/app/assets/javascripts/labels.js @@ -43,4 +43,4 @@ return Labels; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/labels_select.js b/app/assets/javascripts/labels_select.js index e4cf9057e6d..9e2d14c7f87 100644 --- a/app/assets/javascripts/labels_select.js +++ b/app/assets/javascripts/labels_select.js @@ -504,4 +504,4 @@ return LabelsSelect; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/layout_nav.js b/app/assets/javascripts/layout_nav.js index 1c0ea317c1a..08ca9e4fa4d 100644 --- a/app/assets/javascripts/layout_nav.js +++ b/app/assets/javascripts/layout_nav.js @@ -44,4 +44,4 @@ } }); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/cropper.js b/app/assets/javascripts/lib/cropper.js index 5221f85ba7a..7862c6797c3 100644 --- a/app/assets/javascripts/lib/cropper.js +++ b/app/assets/javascripts/lib/cropper.js @@ -4,4 +4,4 @@ (function() { -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/raphael.js b/app/assets/javascripts/lib/raphael.js index 5a9a501efe3..ebe1e2ae98d 100644 --- a/app/assets/javascripts/lib/raphael.js +++ b/app/assets/javascripts/lib/raphael.js @@ -6,4 +6,4 @@ (function() { -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/utils/animate.js b/app/assets/javascripts/lib/utils/animate.js index ce090a2e4fd..d93c1d0da59 100644 --- a/app/assets/javascripts/lib/utils/animate.js +++ b/app/assets/javascripts/lib/utils/animate.js @@ -46,4 +46,4 @@ return dfd.promise(); }; })(window); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index 764aff51fee..45a1d90a9d9 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -297,4 +297,4 @@ */ w.gl.utils.convertPermissionToBoolean = permission => permission === 'true'; })(window); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js.es6 b/app/assets/javascripts/lib/utils/datetime_utility.js.es6 index f41fa15b147..82dcbdc26c8 100644 --- a/app/assets/javascripts/lib/utils/datetime_utility.js.es6 +++ b/app/assets/javascripts/lib/utils/datetime_utility.js.es6 @@ -123,4 +123,4 @@ window.dateFormat = require('vendor/date.format'); return Math.floor((date2 - date1) / millisecondsPerDay); }; })(window); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/utils/notify.js b/app/assets/javascripts/lib/utils/notify.js index 6d5979603b9..66f39122a66 100644 --- a/app/assets/javascripts/lib/utils/notify.js +++ b/app/assets/javascripts/lib/utils/notify.js @@ -44,4 +44,4 @@ w.notify = notifyMe; return w.notifyPermissions = notifyPermissions; })(window); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index d9370db0cf2..fdfe0264764 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -168,4 +168,4 @@ return string.substr(0, (maxLength - 3)) + '...'; }; })(window); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/utils/type_utility.js b/app/assets/javascripts/lib/utils/type_utility.js index 6d813d61601..db62e0be324 100644 --- a/app/assets/javascripts/lib/utils/type_utility.js +++ b/app/assets/javascripts/lib/utils/type_utility.js @@ -12,4 +12,4 @@ return (obj != null) && (obj.constructor === Object); }; })(window); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/lib/utils/url_utility.js.es6 b/app/assets/javascripts/lib/utils/url_utility.js.es6 index a1558b371f0..1bc81d2e4a4 100644 --- a/app/assets/javascripts/lib/utils/url_utility.js.es6 +++ b/app/assets/javascripts/lib/utils/url_utility.js.es6 @@ -83,4 +83,4 @@ document.location.href = url; }; })(window); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/line_highlighter.js b/app/assets/javascripts/line_highlighter.js index d7137ec63e4..966fcd8ec47 100644 --- a/app/assets/javascripts/line_highlighter.js +++ b/app/assets/javascripts/line_highlighter.js @@ -179,4 +179,4 @@ require('vendor/jquery.scrollTo'); return LineHighlighter; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/logo.js b/app/assets/javascripts/logo.js index 1b0d0768db8..729baa2e1a7 100644 --- a/app/assets/javascripts/logo.js +++ b/app/assets/javascripts/logo.js @@ -4,4 +4,4 @@ window.addEventListener('beforeunload', function() { $('.tanuki-logo').addClass('animate'); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/member_expiration_date.js.es6 b/app/assets/javascripts/member_expiration_date.js.es6 index efe7c78a8ec..129d2dc5f0a 100644 --- a/app/assets/javascripts/member_expiration_date.js.es6 +++ b/app/assets/javascripts/member_expiration_date.js.es6 @@ -49,4 +49,4 @@ inputs.each(toggleClearInput); }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index be12d925040..5e01aacf2ba 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -108,4 +108,4 @@ require('./merge_request_tabs'); return MergeRequest; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/merged_buttons.js b/app/assets/javascripts/merged_buttons.js index 527cdc9b698..9548a98f499 100644 --- a/app/assets/javascripts/merged_buttons.js +++ b/app/assets/javascripts/merged_buttons.js @@ -42,4 +42,4 @@ return MergedButtons; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/milestone.js b/app/assets/javascripts/milestone.js index 051cb9fe5c5..7fbaeec7882 100644 --- a/app/assets/javascripts/milestone.js +++ b/app/assets/javascripts/milestone.js @@ -172,4 +172,4 @@ return Milestone; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js index 2f08aa7fe8b..8df1c8e7f94 100644 --- a/app/assets/javascripts/milestone_select.js +++ b/app/assets/javascripts/milestone_select.js @@ -199,4 +199,4 @@ return MilestoneSelect; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/namespace_select.js b/app/assets/javascripts/namespace_select.js index 2ae5617206e..b98e6121967 100644 --- a/app/assets/javascripts/namespace_select.js +++ b/app/assets/javascripts/namespace_select.js @@ -83,4 +83,4 @@ return NamespaceSelects; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/network/branch_graph.js b/app/assets/javascripts/network/branch_graph.js index a7ccd03b60c..43dc9838977 100644 --- a/app/assets/javascripts/network/branch_graph.js +++ b/app/assets/javascripts/network/branch_graph.js @@ -421,4 +421,4 @@ y: h }); }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/network/network.js b/app/assets/javascripts/network/network.js index 37bf6436fd1..8e7027b44e7 100644 --- a/app/assets/javascripts/network/network.js +++ b/app/assets/javascripts/network/network.js @@ -17,4 +17,4 @@ return Network; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/network/network_bundle.js b/app/assets/javascripts/network/network_bundle.js index b4491354472..aae509caa79 100644 --- a/app/assets/javascripts/network/network_bundle.js +++ b/app/assets/javascripts/network/network_bundle.js @@ -19,4 +19,4 @@ requireAll(require.context('.', false, /^\.\/(?!network_bundle).*\.(js|es6)$/)); }); return new ShortcutsNetwork(network_graph.branch_graph); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/new_branch_form.js b/app/assets/javascripts/new_branch_form.js index 7f763c13b50..cb24f212c66 100644 --- a/app/assets/javascripts/new_branch_form.js +++ b/app/assets/javascripts/new_branch_form.js @@ -100,4 +100,4 @@ return NewBranchForm; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/new_commit_form.js b/app/assets/javascripts/new_commit_form.js index 41eea78a3e6..747f693726e 100644 --- a/app/assets/javascripts/new_commit_form.js +++ b/app/assets/javascripts/new_commit_form.js @@ -30,4 +30,4 @@ return NewCommitForm; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 553ced4fa55..03504255bda 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -937,4 +937,4 @@ require('./task_list'); return Notes; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/notifications_dropdown.js b/app/assets/javascripts/notifications_dropdown.js index 926dc35fee8..838356133cd 100644 --- a/app/assets/javascripts/notifications_dropdown.js +++ b/app/assets/javascripts/notifications_dropdown.js @@ -28,4 +28,4 @@ return NotificationsDropdown; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/notifications_form.js b/app/assets/javascripts/notifications_form.js index c3d7cc0adfb..5005af90d48 100644 --- a/app/assets/javascripts/notifications_form.js +++ b/app/assets/javascripts/notifications_form.js @@ -54,4 +54,4 @@ return NotificationsForm; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/project.js b/app/assets/javascripts/project.js index 71719917d0c..7c03c8b72d4 100644 --- a/app/assets/javascripts/project.js +++ b/app/assets/javascripts/project.js @@ -126,4 +126,4 @@ return Project; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/project_avatar.js b/app/assets/javascripts/project_avatar.js index a6d3ba9eb86..aabdfbf65e2 100644 --- a/app/assets/javascripts/project_avatar.js +++ b/app/assets/javascripts/project_avatar.js @@ -17,4 +17,4 @@ return ProjectAvatar; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/project_find_file.js b/app/assets/javascripts/project_find_file.js index 04fe84683f3..e01668eabef 100644 --- a/app/assets/javascripts/project_find_file.js +++ b/app/assets/javascripts/project_find_file.js @@ -168,4 +168,4 @@ return ProjectFindFile; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/project_fork.js b/app/assets/javascripts/project_fork.js index 208f25a0e33..47197db39d3 100644 --- a/app/assets/javascripts/project_fork.js +++ b/app/assets/javascripts/project_fork.js @@ -10,4 +10,4 @@ return ProjectFork; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/project_import.js b/app/assets/javascripts/project_import.js index d7943959238..08334bf1ec5 100644 --- a/app/assets/javascripts/project_import.js +++ b/app/assets/javascripts/project_import.js @@ -10,4 +10,4 @@ return ProjectImport; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/project_new.js b/app/assets/javascripts/project_new.js index 3aa6f6771ce..e9927c1bf51 100644 --- a/app/assets/javascripts/project_new.js +++ b/app/assets/javascripts/project_new.js @@ -101,4 +101,4 @@ return ProjectNew; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/project_select.js b/app/assets/javascripts/project_select.js index 7b5e9953598..f80e765ce30 100644 --- a/app/assets/javascripts/project_select.js +++ b/app/assets/javascripts/project_select.js @@ -101,4 +101,4 @@ return ProjectSelect; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/project_show.js b/app/assets/javascripts/project_show.js index aad130cf267..3a51c1f26ac 100644 --- a/app/assets/javascripts/project_show.js +++ b/app/assets/javascripts/project_show.js @@ -6,6 +6,6 @@ return ProjectShow; })(); -}).call(this); +}).call(window); // I kept class for future diff --git a/app/assets/javascripts/projects_list.js b/app/assets/javascripts/projects_list.js index 69a11dfaf39..acdf9b7eb5a 100644 --- a/app/assets/javascripts/projects_list.js +++ b/app/assets/javascripts/projects_list.js @@ -47,4 +47,4 @@ }); } }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/render_gfm.js b/app/assets/javascripts/render_gfm.js index bdbad93ad04..48cae8a4fa9 100644 --- a/app/assets/javascripts/render_gfm.js +++ b/app/assets/javascripts/render_gfm.js @@ -12,4 +12,4 @@ $(document).on('ready load', function() { return $('body').renderGFM(); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/render_math.js b/app/assets/javascripts/render_math.js index 6cef449babf..76c61c001ba 100644 --- a/app/assets/javascripts/render_math.js +++ b/app/assets/javascripts/render_math.js @@ -51,4 +51,4 @@ }); } }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index f8e42e7a350..903862cac6b 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -217,4 +217,4 @@ return Sidebar; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/search.js b/app/assets/javascripts/search.js index b1c0dc37b4d..e66418beeab 100644 --- a/app/assets/javascripts/search.js +++ b/app/assets/javascripts/search.js @@ -97,4 +97,4 @@ return Search; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/shortcuts.js b/app/assets/javascripts/shortcuts.js index c6d9b007ad1..81766f4bd55 100644 --- a/app/assets/javascripts/shortcuts.js +++ b/app/assets/javascripts/shortcuts.js @@ -97,4 +97,4 @@ } }; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/shortcuts_dashboard_navigation.js b/app/assets/javascripts/shortcuts_dashboard_navigation.js index 7378b322426..e7baea894f6 100644 --- a/app/assets/javascripts/shortcuts_dashboard_navigation.js +++ b/app/assets/javascripts/shortcuts_dashboard_navigation.js @@ -37,4 +37,4 @@ require('./shortcuts'); return ShortcutsDashboardNavigation; })(Shortcuts); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/shortcuts_find_file.js b/app/assets/javascripts/shortcuts_find_file.js index 36e379d634d..a27ac264a5c 100644 --- a/app/assets/javascripts/shortcuts_find_file.js +++ b/app/assets/javascripts/shortcuts_find_file.js @@ -35,4 +35,4 @@ require('./shortcuts_navigation'); return ShortcutsFindFile; })(ShortcutsNavigation); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/shortcuts_issuable.js b/app/assets/javascripts/shortcuts_issuable.js index b841abb754d..fe58e98cee5 100644 --- a/app/assets/javascripts/shortcuts_issuable.js +++ b/app/assets/javascripts/shortcuts_issuable.js @@ -89,4 +89,4 @@ require('./shortcuts_navigation'); return ShortcutsIssuable; })(ShortcutsNavigation); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/shortcuts_navigation.js b/app/assets/javascripts/shortcuts_navigation.js index cb5f2c53ea6..542cd586df0 100644 --- a/app/assets/javascripts/shortcuts_navigation.js +++ b/app/assets/javascripts/shortcuts_navigation.js @@ -65,4 +65,4 @@ require('./shortcuts'); return ShortcutsNavigation; })(Shortcuts); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/shortcuts_network.js b/app/assets/javascripts/shortcuts_network.js index 651957f5325..4c2bf8bf001 100644 --- a/app/assets/javascripts/shortcuts_network.js +++ b/app/assets/javascripts/shortcuts_network.js @@ -25,4 +25,4 @@ require('./shortcuts_navigation'); return ShortcutsNetwork; })(ShortcutsNavigation); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/single_file_diff.js b/app/assets/javascripts/single_file_diff.js index 3ee0c73a8d2..294d087554e 100644 --- a/app/assets/javascripts/single_file_diff.js +++ b/app/assets/javascripts/single_file_diff.js @@ -95,4 +95,4 @@ } }); }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/snippet/snippet_bundle.js b/app/assets/javascripts/snippet/snippet_bundle.js index 64f9065be42..89822246bb8 100644 --- a/app/assets/javascripts/snippet/snippet_bundle.js +++ b/app/assets/javascripts/snippet/snippet_bundle.js @@ -13,4 +13,4 @@ requireAll(require.context('.', false, /^\.\/(?!snippet_bundle).*\.(js|es6)$/)); $(".snippet-file-content").val(editor.getValue()); }); }); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/star.js b/app/assets/javascripts/star.js index 531fd0e9c32..c75b44cc2fd 100644 --- a/app/assets/javascripts/star.js +++ b/app/assets/javascripts/star.js @@ -27,4 +27,4 @@ return Star; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/subscription_select.js b/app/assets/javascripts/subscription_select.js index 187356f0bf9..8b25f43ffc7 100644 --- a/app/assets/javascripts/subscription_select.js +++ b/app/assets/javascripts/subscription_select.js @@ -31,4 +31,4 @@ return SubscriptionSelect; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/syntax_highlight.js b/app/assets/javascripts/syntax_highlight.js index 115716bff6a..7c063fae045 100644 --- a/app/assets/javascripts/syntax_highlight.js +++ b/app/assets/javascripts/syntax_highlight.js @@ -24,4 +24,4 @@ } } }; -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/tree.js b/app/assets/javascripts/tree.js index b1b35fdbd6c..76a821c7a17 100644 --- a/app/assets/javascripts/tree.js +++ b/app/assets/javascripts/tree.js @@ -65,4 +65,4 @@ return TreeView; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/u2f/error.js b/app/assets/javascripts/u2f/error.js index 86b459e1866..fd1829efe18 100644 --- a/app/assets/javascripts/u2f/error.js +++ b/app/assets/javascripts/u2f/error.js @@ -24,4 +24,4 @@ return U2FError; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/u2f/register.js b/app/assets/javascripts/u2f/register.js index 69d1ff3a39e..17631f2908d 100644 --- a/app/assets/javascripts/u2f/register.js +++ b/app/assets/javascripts/u2f/register.js @@ -95,4 +95,4 @@ return U2FRegister; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/u2f/util.js b/app/assets/javascripts/u2f/util.js index 34e88220b12..813d363db00 100644 --- a/app/assets/javascripts/u2f/util.js +++ b/app/assets/javascripts/u2f/util.js @@ -9,4 +9,4 @@ return U2FUtil; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/users/calendar.js b/app/assets/javascripts/users/calendar.js index 6e40dfdf3d8..5111b260e1c 100644 --- a/app/assets/javascripts/users/calendar.js +++ b/app/assets/javascripts/users/calendar.js @@ -221,4 +221,4 @@ return Calendar; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js index d4b24d13299..de33a31b411 100644 --- a/app/assets/javascripts/users_select.js +++ b/app/assets/javascripts/users_select.js @@ -432,4 +432,4 @@ return UsersSelect; })(); -}).call(this); +}).call(window); diff --git a/app/assets/javascripts/zen_mode.js b/app/assets/javascripts/zen_mode.js index d9261cda1b1..ce626cf7b46 100644 --- a/app/assets/javascripts/zen_mode.js +++ b/app/assets/javascripts/zen_mode.js @@ -94,4 +94,4 @@ require('mousetrap/plugins/pause/mousetrap-pause'); return ZenMode; })(); -}).call(this); +}).call(window); -- cgit v1.2.1 From d3afb752385e41bed583391b678cb0e49e5a04cc Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Sat, 18 Feb 2017 09:39:49 +0000 Subject: exclude rpc_pipefs from system disc info --- app/controllers/admin/system_info_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app') diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb index ca04a17caa1..1330399a836 100644 --- a/app/controllers/admin/system_info_controller.rb +++ b/app/controllers/admin/system_info_controller.rb @@ -21,6 +21,7 @@ class Admin::SystemInfoController < Admin::ApplicationController 'mqueue', 'proc', 'pstore', + 'rpc_pipefs', 'securityfs', 'sysfs', 'tmpfs', -- cgit v1.2.1 From a29fbc213ca192af9994f61b67990172b9640855 Mon Sep 17 00:00:00 2001 From: wendy0402 Date: Sun, 19 Feb 2017 15:15:30 +0700 Subject: fix incorrect sidekiq concurrency count in admin background page --- app/controllers/admin/background_jobs_controller.rb | 1 + app/views/admin/background_jobs/show.html.haml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/admin/background_jobs_controller.rb b/app/controllers/admin/background_jobs_controller.rb index 338496013a0..c09095b9849 100644 --- a/app/controllers/admin/background_jobs_controller.rb +++ b/app/controllers/admin/background_jobs_controller.rb @@ -2,5 +2,6 @@ class Admin::BackgroundJobsController < Admin::ApplicationController def show ps_output, _ = Gitlab::Popen.popen(%W(ps -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command)) @sidekiq_processes = ps_output.split("\n").grep(/sidekiq/) + @concurrency = Sidekiq.options[:concurrency] end end diff --git a/app/views/admin/background_jobs/show.html.haml b/app/views/admin/background_jobs/show.html.haml index 4f982a6e369..9f2717cf0e8 100644 --- a/app/views/admin/background_jobs/show.html.haml +++ b/app/views/admin/background_jobs/show.html.haml @@ -35,7 +35,7 @@ .clearfix %p %i.fa.fa-exclamation-circle - If '[25 of 25 busy]' is shown, restart GitLab with 'sudo service gitlab reload'. + = "If '[#{@concurrency} of #{@concurrency} busy]' is shown, restart GitLab with 'sudo service gitlab reload'." %p %i.fa.fa-exclamation-circle If more than one sidekiq process is listed, stop GitLab, kill the remaining sidekiq processes (sudo pkill -u #{gitlab_config.user} -f sidekiq) and restart GitLab. -- cgit v1.2.1 From bfb686bd08a165c0385dbe5f962f532c7ba59b63 Mon Sep 17 00:00:00 2001 From: wendy0402 Date: Sun, 19 Feb 2017 15:44:47 +0700 Subject: fix failed spec because haml_lint --- app/views/admin/background_jobs/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/admin/background_jobs/show.html.haml b/app/views/admin/background_jobs/show.html.haml index 9f2717cf0e8..ac36bb5bb17 100644 --- a/app/views/admin/background_jobs/show.html.haml +++ b/app/views/admin/background_jobs/show.html.haml @@ -35,7 +35,7 @@ .clearfix %p %i.fa.fa-exclamation-circle - = "If '[#{@concurrency} of #{@concurrency} busy]' is shown, restart GitLab with 'sudo service gitlab reload'." + If '[#{@concurrency} of #{@concurrency} busy]' is shown, restart GitLab with 'sudo service gitlab reload'. %p %i.fa.fa-exclamation-circle If more than one sidekiq process is listed, stop GitLab, kill the remaining sidekiq processes (sudo pkill -u #{gitlab_config.user} -f sidekiq) and restart GitLab. -- cgit v1.2.1 From 229f806835bf63f2f68af8740b54399598ae45bc Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Sun, 19 Feb 2017 21:40:39 +1100 Subject: loading icon sometimes toggled alongside MR pipeline contents unbind existing listenerss and remove duplicate MiniPipelineGraph init --- app/assets/javascripts/merge_request_widget.js.es6 | 1 - app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/merge_request_widget.js.es6 b/app/assets/javascripts/merge_request_widget.js.es6 index 4ab33420e59..88f08bbaa34 100644 --- a/app/assets/javascripts/merge_request_widget.js.es6 +++ b/app/assets/javascripts/merge_request_widget.js.es6 @@ -252,7 +252,6 @@ require('./smart_interval'); $('.ci_widget.ci-error').show(); this.setMergeButtonClass('btn-danger'); } - this.initMiniPipelineGraph(); }; MergeRequestWidget.prototype.showCICoverage = function(coverage) { diff --git a/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 b/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 index 919fcd0a07b..2145e531331 100644 --- a/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 +++ b/app/assets/javascripts/mini_pipeline_graph_dropdown.js.es6 @@ -28,7 +28,7 @@ * All dropdown events are fired at the .dropdown-menu's parent element. */ bindEvents() { - $(document).on('shown.bs.dropdown', this.container, this.getBuildsList); + $(document).off('shown.bs.dropdown', this.container).on('shown.bs.dropdown', this.container, this.getBuildsList); } /** -- cgit v1.2.1 From 45f94ea78cf85a58e71e9a8ae62adc7e3f86bc99 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 19 Feb 2017 05:00:27 -0800 Subject: Prevent project team from being truncated too early during project destruction There are two issues with truncating the project team early: 1. `Projects::UnlinkForkService` may not close merge requests properly since permissions may be revoked early. 2. If an error is encountered during flushing of caches, then the user will lose all privileges, possibly causing an issue on deletion on retry. --- app/services/projects/destroy_service.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'app') diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb index a08c6fcd94b..9716a1780a9 100644 --- a/app/services/projects/destroy_service.rb +++ b/app/services/projects/destroy_service.rb @@ -17,8 +17,6 @@ module Projects def execute return false unless can?(current_user, :remove_project, project) - project.team.truncate - repo_path = project.path_with_namespace wiki_path = repo_path + '.wiki' @@ -30,6 +28,7 @@ module Projects Projects::UnlinkForkService.new(project, current_user).execute Project.transaction do + project.team.truncate project.destroy! unless remove_registry_tags -- cgit v1.2.1 From c9d687d6fed8ee9d0b9dfd1ebb55ddbb30b39fe2 Mon Sep 17 00:00:00 2001 From: Jarka Kadlecova Date: Mon, 6 Feb 2017 16:04:00 +0100 Subject: Download snippets with LF line-endings by default --- app/controllers/concerns/snippets_actions.rb | 21 +++++++++++++++++++++ app/controllers/projects/snippets_controller.rb | 13 +------------ app/controllers/snippets_controller.rb | 15 ++------------- 3 files changed, 24 insertions(+), 25 deletions(-) create mode 100644 app/controllers/concerns/snippets_actions.rb (limited to 'app') diff --git a/app/controllers/concerns/snippets_actions.rb b/app/controllers/concerns/snippets_actions.rb new file mode 100644 index 00000000000..ca6dffe1cc5 --- /dev/null +++ b/app/controllers/concerns/snippets_actions.rb @@ -0,0 +1,21 @@ +module SnippetsActions + extend ActiveSupport::Concern + + def edit + end + + def raw + send_data( + convert_line_endings(@snippet.content), + type: 'text/plain; charset=utf-8', + disposition: 'inline', + filename: @snippet.sanitized_file_name + ) + end + + private + + def convert_line_endings(content) + params[:line_ending] == 'raw' ? content : content.gsub(/\r\n/, "\n") + end +end diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 5d193f26a8e..ef5d3d242eb 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -1,6 +1,7 @@ class Projects::SnippetsController < Projects::ApplicationController include ToggleAwardEmoji include SpammableActions + include SnippetsActions before_action :module_enabled before_action :snippet, only: [:show, :edit, :destroy, :update, :raw, :toggle_award_emoji, :mark_as_spam] @@ -49,9 +50,6 @@ class Projects::SnippetsController < Projects::ApplicationController end end - def edit - end - def update UpdateSnippetService.new(project, current_user, @snippet, snippet_params).execute @@ -74,15 +72,6 @@ class Projects::SnippetsController < Projects::ApplicationController redirect_to namespace_project_snippets_path(@project.namespace, @project) end - def raw - send_data( - @snippet.content, - type: 'text/plain; charset=utf-8', - disposition: 'inline', - filename: @snippet.sanitized_file_name - ) - end - protected def snippet diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index b169d993688..366804ab17e 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -1,6 +1,7 @@ class SnippetsController < ApplicationController include ToggleAwardEmoji include SpammableActions + include SnippetsActions before_action :snippet, only: [:show, :edit, :destroy, :update, :raw, :download] @@ -47,9 +48,6 @@ class SnippetsController < ApplicationController respond_with @snippet.becomes(Snippet) end - def edit - end - def update UpdateSnippetService.new(nil, current_user, @snippet, snippet_params).execute @@ -67,18 +65,9 @@ class SnippetsController < ApplicationController redirect_to snippets_path end - def raw - send_data( - @snippet.content, - type: 'text/plain; charset=utf-8', - disposition: 'inline', - filename: @snippet.sanitized_file_name - ) - end - def download send_data( - @snippet.content, + convert_line_endings(@snippet.content), type: 'text/plain; charset=utf-8', filename: @snippet.sanitized_file_name ) -- cgit v1.2.1 From 5be8f03747eff470e3093e6a3f97c475ddba9a90 Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Fri, 10 Feb 2017 11:41:22 +0100 Subject: Improve performance of User Agent Detail --- app/models/concerns/spammable.rb | 4 ++++ app/views/projects/issues/show.html.haml | 4 ++-- app/views/projects/snippets/_actions.html.haml | 4 ++-- app/views/snippets/_actions.html.haml | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb index 423ae98a60e..79adc77c9e4 100644 --- a/app/models/concerns/spammable.rb +++ b/app/models/concerns/spammable.rb @@ -22,6 +22,10 @@ module Spammable delegate :ip_address, :user_agent, to: :user_agent_detail, allow_nil: true end + def submittable_as_spam_by?(current_user) + current_user && current_user.admin? && submittable_as_spam? + end + def submittable_as_spam? if user_agent_detail user_agent_detail.submittable? && current_application_settings.akismet_enabled diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index d3eb3b7055b..069f3d97943 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -40,7 +40,7 @@ = link_to 'Close issue', issue_path(@issue, issue: { state_event: :close }, format: 'json'), data: {no_turbolink: true}, class: "btn-close #{issue_button_visibility(@issue, true)}", title: 'Close issue' %li = link_to 'Edit', edit_namespace_project_issue_path(@project.namespace, @project, @issue) - - if @issue.submittable_as_spam? && current_user.admin? + - if @issue.submittable_as_spam_by?(current_user) %li = link_to 'Submit as spam', mark_as_spam_namespace_project_issue_path(@project.namespace, @project, @issue), method: :post, class: 'btn-spam', title: 'Submit as spam' @@ -50,7 +50,7 @@ - if can?(current_user, :update_issue, @issue) = link_to 'Reopen issue', issue_path(@issue, issue: { state_event: :reopen }, format: 'json'), data: {no_turbolink: true}, class: "hidden-xs hidden-sm btn btn-grouped btn-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue' = link_to 'Close issue', issue_path(@issue, issue: { state_event: :close }, format: 'json'), data: {no_turbolink: true}, class: "hidden-xs hidden-sm btn btn-grouped btn-close #{issue_button_visibility(@issue, true)}", title: 'Close issue' - - if @issue.submittable_as_spam? && current_user.admin? + - if @issue.submittable_as_spam_by?(current_user) = link_to 'Submit as spam', mark_as_spam_namespace_project_issue_path(@project.namespace, @project, @issue), method: :post, class: 'hidden-xs hidden-sm btn btn-grouped btn-spam', title: 'Submit as spam' = link_to 'Edit', edit_namespace_project_issue_path(@project.namespace, @project, @issue), class: 'hidden-xs hidden-sm btn btn-grouped issuable-edit' diff --git a/app/views/projects/snippets/_actions.html.haml b/app/views/projects/snippets/_actions.html.haml index dde2e2b644d..34ee4ff1937 100644 --- a/app/views/projects/snippets/_actions.html.haml +++ b/app/views/projects/snippets/_actions.html.haml @@ -10,7 +10,7 @@ - if can?(current_user, :create_project_snippet, @project) = link_to new_namespace_project_snippet_path(@project.namespace, @project), class: 'btn btn-grouped btn-inverted btn-create', title: "New snippet" do New snippet - - if @snippet.submittable_as_spam? && current_user.admin? + - if @snippet.submittable_as_spam_by?(current_user) = link_to 'Submit as spam', mark_as_spam_namespace_project_snippet_path(@project.namespace, @project, @snippet), method: :post, class: 'btn btn-grouped btn-spam', title: 'Submit as spam' - if can?(current_user, :create_project_snippet, @project) || can?(current_user, :update_project_snippet, @snippet) .visible-xs-block.dropdown @@ -31,6 +31,6 @@ %li = link_to edit_namespace_project_snippet_path(@project.namespace, @project, @snippet) do Edit - - if @snippet.submittable_as_spam? && current_user.admin? + - if @snippet.submittable_as_spam_by?(current_user) %li = link_to 'Submit as spam', mark_as_spam_namespace_project_snippet_path(@project.namespace, @project, @snippet), method: :post diff --git a/app/views/snippets/_actions.html.haml b/app/views/snippets/_actions.html.haml index 855a995afa9..a7f118d3f7d 100644 --- a/app/views/snippets/_actions.html.haml +++ b/app/views/snippets/_actions.html.haml @@ -9,7 +9,7 @@ Delete = link_to new_snippet_path, class: "btn btn-grouped btn-inverted btn-create", title: "New snippet" do New snippet - - if @snippet.submittable_as_spam? && current_user.admin? + - if @snippet.submittable_as_spam_by?(current_user) = link_to 'Submit as spam', mark_as_spam_snippet_path(@snippet), method: :post, class: 'btn btn-grouped btn-spam', title: 'Submit as spam' .visible-xs-block.dropdown %button.btn.btn-default.btn-block.append-bottom-0.prepend-top-5{ data: { toggle: "dropdown" } } @@ -28,6 +28,6 @@ %li = link_to edit_snippet_path(@snippet) do Edit - - if @snippet.submittable_as_spam? && current_user.admin? + - if @snippet.submittable_as_spam_by?(current_user) %li = link_to 'Submit as spam', mark_as_spam_snippet_path(@snippet), method: :post -- cgit v1.2.1 From beb887748e8aa3bc42376656f28b689aad91dab7 Mon Sep 17 00:00:00 2001 From: Alexandros Keramidas Date: Fri, 6 Jan 2017 21:07:27 +0200 Subject: Added support for Authentiq Back-Channel Logout --- app/controllers/omniauth_callbacks_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app') diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index f54c79c2e37..3ab7e6e0658 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -78,6 +78,13 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController handle_omniauth end + def authentiq + if params['sid'] + handle_service_ticket oauth['provider'], params['sid'] + end + handle_omniauth + end + private def handle_omniauth -- cgit v1.2.1