Commit df90f2c1 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch...

Merge branch '344378-make-badges-in-app-views-admin-background_migrations-index-html-haml-pajamas-compliant' into 'master'

Make badges in app/views/admin/background_migrations/ Pajamas-compliant

See merge request gitlab-org/gitlab!76980
parents 30367dc6 de7c91b6
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
module Admin module Admin
module BackgroundMigrationsHelper module BackgroundMigrationsHelper
def batched_migration_status_badge_class_name(migration) def batched_migration_status_badge_variant(migration)
class_names = { variants = {
'active' => 'badge-info', 'active' => :info,
'paused' => 'badge-warning', 'paused' => :warning,
'failed' => 'badge-danger', 'failed' => :danger,
'finished' => 'badge-success' 'finished' => :success
} }
class_names[migration.status] variants[migration.status]
end end
# The extra logic here is needed because total_tuple_count is just # The extra logic here is needed because total_tuple_count is just
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
- else - else
= _('Unknown') = _('Unknown')
%td{ role: 'cell', data: { label: _('Status') } } %td{ role: 'cell', data: { label: _('Status') } }
%span.badge.badge-pill.gl-badge.sm{ class: batched_migration_status_badge_class_name(migration) }= migration.status.humanize = gl_badge_tag migration.status.humanize, { size: :sm, variant: batched_migration_status_badge_variant(migration) }
%td{ role: 'cell', data: { label: _('Action') } } %td{ role: 'cell', data: { label: _('Action') } }
- if migration.active? - if migration.active?
= button_to pause_admin_background_migration_path(migration), = button_to pause_admin_background_migration_path(migration),
......
...@@ -8,18 +8,15 @@ ...@@ -8,18 +8,15 @@
%li.nav-item{ role: 'presentation' } %li.nav-item{ role: 'presentation' }
%a.nav-link.gl-tab-nav-item{ href: admin_background_migrations_path, class: (active_tab_classes if @current_tab == 'queued'), role: 'tab' } %a.nav-link.gl-tab-nav-item{ href: admin_background_migrations_path, class: (active_tab_classes if @current_tab == 'queued'), role: 'tab' }
= _('Queued') = _('Queued')
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm = gl_tab_counter_badge limited_counter_with_delimiter(@relations_by_tab['queued'])
= limited_counter_with_delimiter(@relations_by_tab['queued'])
%li.nav-item{ role: 'presentation' } %li.nav-item{ role: 'presentation' }
%a.nav-link.gl-tab-nav-item{ href: admin_background_migrations_path(tab: 'failed'), class: (active_tab_classes if @current_tab == 'failed'), role: 'tab' } %a.nav-link.gl-tab-nav-item{ href: admin_background_migrations_path(tab: 'failed'), class: (active_tab_classes if @current_tab == 'failed'), role: 'tab' }
= _('Failed') = _('Failed')
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm = gl_tab_counter_badge limited_counter_with_delimiter(@relations_by_tab['failed'])
= limited_counter_with_delimiter(@relations_by_tab['failed'])
%li.nav-item{ role: 'presentation' } %li.nav-item{ role: 'presentation' }
%a.nav-link.gl-tab-nav-item{ href: admin_background_migrations_path(tab: 'finished'), class: (active_tab_classes if @current_tab == 'finished'), role: 'tab' } %a.nav-link.gl-tab-nav-item{ href: admin_background_migrations_path(tab: 'finished'), class: (active_tab_classes if @current_tab == 'finished'), role: 'tab' }
= _('Finished') = _('Finished')
%span.badge.gl-tab-counter-badge.badge-muted.badge-pill.gl-badge.sm = gl_tab_counter_badge limited_counter_with_delimiter(@relations_by_tab['finished'])
= limited_counter_with_delimiter(@relations_by_tab['finished'])
.tab-content.gl-tab-content .tab-content.gl-tab-content
.tab-pane.active{ role: 'tabpanel' } .tab-pane.active{ role: 'tabpanel' }
......
...@@ -3,22 +3,22 @@ ...@@ -3,22 +3,22 @@
require "spec_helper" require "spec_helper"
RSpec.describe Admin::BackgroundMigrationsHelper do RSpec.describe Admin::BackgroundMigrationsHelper do
describe '#batched_migration_status_badge_class_name' do describe '#batched_migration_status_badge_variant' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
where(:status, :class_name) do where(:status, :variant) do
:active | 'badge-info' :active | :info
:paused | 'badge-warning' :paused | :warning
:failed | 'badge-danger' :failed | :danger
:finished | 'badge-success' :finished | :success
end end
subject { helper.batched_migration_status_badge_class_name(migration) } subject { helper.batched_migration_status_badge_variant(migration) }
with_them do with_them do
let(:migration) { build(:batched_background_migration, status: status) } let(:migration) { build(:batched_background_migration, status: status) }
it { is_expected.to eq(class_name) } it { is_expected.to eq(variant) }
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment