diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-17 06:08:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-17 06:08:05 +0300 |
commit | e6ac8e40c2c0fa317c319469d5102eec8be7becd (patch) | |
tree | 409145db12c32c6d3e342aeada2e3015d631dc07 /app | |
parent | 149436d2a55408accbf67f9301c0bfa3c6706fe6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/pages/dashboard/todos/index/todos.js | 8 | ||||
-rw-r--r-- | app/models/analytics/cycle_analytics/aggregation.rb | 12 | ||||
-rw-r--r-- | app/views/dashboard/todos/_todo.html.haml | 6 | ||||
-rw-r--r-- | app/views/dashboard/todos/index.html.haml | 4 |
4 files changed, 19 insertions, 11 deletions
diff --git a/app/assets/javascripts/pages/dashboard/todos/index/todos.js b/app/assets/javascripts/pages/dashboard/todos/index/todos.js index cabb1b24ae6..c4bbbdcd8ec 100644 --- a/app/assets/javascripts/pages/dashboard/todos/index/todos.js +++ b/app/assets/javascripts/pages/dashboard/todos/index/todos.js @@ -96,6 +96,8 @@ export default class Todos { target.setAttribute('disabled', true); target.classList.add('disabled'); + target.querySelector('.gl-spinner-container').classList.add('gl-mr-2'); + axios[target.dataset.method](target.dataset.href) .then(({ data }) => { this.updateRowState(target); @@ -118,6 +120,8 @@ export default class Todos { target.removeAttribute('disabled'); target.classList.remove('disabled'); + target.querySelector('.gl-spinner-container').classList.remove('gl-mr-2'); + if (isInactive === true) { restoreBtn.classList.add('hidden'); doneBtn.classList.remove('hidden'); @@ -140,6 +144,8 @@ export default class Todos { target.setAttribute('disabled', true); target.classList.add('disabled'); + target.querySelector('.gl-spinner-container').classList.add('gl-mr-2'); + axios[target.dataset.method](target.dataset.href, { ids: this.todo_ids, }) @@ -163,6 +169,8 @@ export default class Todos { target.removeAttribute('disabled'); target.classList.remove('disabled'); + target.querySelector('.gl-spinner-container').classList.remove('gl-mr-2'); + this.todo_ids = target === markAllDoneBtn ? data.updated_ids : []; undoAllBtn.classList.toggle('hidden'); markAllDoneBtn.classList.toggle('hidden'); diff --git a/app/models/analytics/cycle_analytics/aggregation.rb b/app/models/analytics/cycle_analytics/aggregation.rb index 279938511fd..44d2dc369f7 100644 --- a/app/models/analytics/cycle_analytics/aggregation.rb +++ b/app/models/analytics/cycle_analytics/aggregation.rb @@ -7,7 +7,7 @@ class Analytics::CycleAnalytics::Aggregation < ApplicationRecord validates :incremental_runtimes_in_seconds, :incremental_processed_records, :last_full_run_runtimes_in_seconds, :last_full_run_processed_records, presence: true, length: { maximum: 10 }, allow_blank: true - scope :priority_order, -> { order('last_incremental_run_at ASC NULLS FIRST') } + scope :priority_order, -> (column_to_sort = :last_incremental_run_at) { order(arel_table[column_to_sort].asc.nulls_first) } scope :enabled, -> { where('enabled IS TRUE') } def estimated_next_run_at @@ -55,17 +55,17 @@ class Analytics::CycleAnalytics::Aggregation < ApplicationRecord connection.select_value("(#{max})") end - def self.load_batch(last_run_at, batch_size = 100) + def self.load_batch(last_run_at, column_to_query = :last_incremental_run_at, batch_size = 100) last_run_at_not_set = Analytics::CycleAnalytics::Aggregation .enabled - .where(last_incremental_run_at: nil) - .priority_order + .where(column_to_query => nil) + .priority_order(column_to_query) .limit(batch_size) last_run_at_before = Analytics::CycleAnalytics::Aggregation .enabled - .where('last_incremental_run_at < ?', last_run_at) - .priority_order + .where(arel_table[column_to_query].lt(last_run_at)) + .priority_order(column_to_query) .limit(batch_size) Analytics::CycleAnalytics::Aggregation diff --git a/app/views/dashboard/todos/_todo.html.haml b/app/views/dashboard/todos/_todo.html.haml index 766900b7a99..c932b416b66 100644 --- a/app/views/dashboard/todos/_todo.html.haml +++ b/app/views/dashboard/todos/_todo.html.haml @@ -50,12 +50,12 @@ .todo-actions.gl-ml-3 - if todo.pending? = link_to dashboard_todo_path(todo), method: :delete, class: 'gl-button btn btn-default btn-loading d-flex align-items-center js-done-todo', data: { href: dashboard_todo_path(todo) } do - = gl_loading_icon(inline: true, css_class: 'gl-mr-2') + = gl_loading_icon(inline: true) Done = link_to restore_dashboard_todo_path(todo), method: :patch, class: 'gl-button btn btn-default btn-loading d-flex align-items-center js-undo-todo hidden', data: { href: restore_dashboard_todo_path(todo) } do - = gl_loading_icon(inline: true, css_class: 'gl-mr-2') + = gl_loading_icon(inline: true) Undo - else = link_to restore_dashboard_todo_path(todo), method: :patch, class: 'gl-button btn btn-default btn-loading d-flex align-items-center js-add-todo', data: { href: restore_dashboard_todo_path(todo) } do - = gl_loading_icon(inline: true, css_class: 'gl-mr-2') + = gl_loading_icon(inline: true) Add a to do diff --git a/app/views/dashboard/todos/index.html.haml b/app/views/dashboard/todos/index.html.haml index 7a329fb34a9..cd177db3ed0 100644 --- a/app/views/dashboard/todos/index.html.haml +++ b/app/views/dashboard/todos/index.html.haml @@ -22,10 +22,10 @@ - if @allowed_todos.any?(&:pending?) .gl-mr-3 = link_to destroy_all_dashboard_todos_path(todos_filter_params), class: 'gl-button btn btn-default btn-loading align-items-center js-todos-mark-all', method: :delete, data: { href: destroy_all_dashboard_todos_path(todos_filter_params) } do - = gl_loading_icon(inline: true, css_class: 'gl-mr-2') + = gl_loading_icon(inline: true) = s_("Todos|Mark all as done") = link_to bulk_restore_dashboard_todos_path, class: 'gl-button btn btn-default btn-loading align-items-center js-todos-undo-all hidden', method: :patch , data: { href: bulk_restore_dashboard_todos_path(todos_filter_params) } do - = gl_loading_icon(inline: true, css_class: 'gl-mr-2') + = gl_loading_icon(inline: true) = s_("Todos|Undo mark all as done") .todos-filters |