diff options
Diffstat (limited to 'app/views/admin/background_migrations')
5 files changed, 97 insertions, 12 deletions
diff --git a/app/views/admin/background_migrations/_job.html.haml b/app/views/admin/background_migrations/_job.html.haml new file mode 100644 index 00000000000..e34f73e8b94 --- /dev/null +++ b/app/views/admin/background_migrations/_job.html.haml @@ -0,0 +1,10 @@ +%tr{ role: 'row' } + %td{ role: 'cell', data: { label: _('Id') } } + = link_to admin_background_migration_batched_job_path(job.batched_migration, job, params: { database: params[:database] }) do + = job.id + %td{ role: 'cell', data: { label: s_('BackgroundMigrations|Started at') } } + = job.started_at + %td{ role: 'cell', data: { label: s_('BackgroundMigrations|Finished at') } } + = job.finished_at + %td{ role: 'cell', data: { label: s_('BackgroundMigrations|Batch size') } } + = job.batch_size diff --git a/app/views/admin/background_migrations/_migration.html.haml b/app/views/admin/background_migrations/_migration.html.haml index 9cef8332259..f4906028e39 100644 --- a/app/views/admin/background_migrations/_migration.html.haml +++ b/app/views/admin/background_migrations/_migration.html.haml @@ -1,5 +1,7 @@ %tr{ role: 'row' } - %td{ role: 'cell', data: { label: _('Migration') } }= migration.job_class_name + ': ' + migration.table_name + %td{ role: 'cell', data: { label: _('Migration') } } + = link_to admin_background_migration_path(migration, database: params[:database]) do + = migration.job_class_name + ': ' + migration.table_name %td{ role: 'cell', data: { label: _('Progress') } } - progress = batched_migration_progress(migration, @successful_rows_counts[migration.id]) - if progress @@ -10,14 +12,14 @@ = gl_badge_tag migration.status_name.to_s.humanize, { size: :sm, variant: batched_migration_status_badge_variant(migration) } %td{ role: 'cell', data: { label: _('Action') } } - if migration.active? - = button_to pause_admin_background_migration_path(migration), + = button_to pause_admin_background_migration_path(migration, database: params[:database]), class: 'gl-button btn btn-icon has-tooltip', title: _('Pause'), 'aria-label' => _('Pause') do = sprite_icon('pause', css_class: 'gl-button-icon gl-icon') - elsif migration.paused? - = button_to resume_admin_background_migration_path(migration), + = button_to resume_admin_background_migration_path(migration, database: params[:database]), class: 'gl-button btn btn-icon has-tooltip', title: _('Resume'), 'aria-label' => _('Resume') do = sprite_icon('play', css_class: 'gl-button-icon gl-icon') - elsif migration.failed? - = button_to retry_admin_background_migration_path(migration), + = button_to retry_admin_background_migration_path(migration, database: params[:database]), class: 'gl-button btn btn-icon has-tooltip', title: _('Retry'), 'aria-label' => _('Retry') do = sprite_icon('retry', css_class: 'gl-button-icon gl-icon') diff --git a/app/views/admin/background_migrations/_migration_full_information.html.haml b/app/views/admin/background_migrations/_migration_full_information.html.haml new file mode 100644 index 00000000000..620274c375f --- /dev/null +++ b/app/views/admin/background_migrations/_migration_full_information.html.haml @@ -0,0 +1,21 @@ +%tr{ role: 'row' } + %td{ role: 'cell', data: { label: _('Id') } } + = @migration.id + %td{ role: 'cell', data: { label: _('Min Value') } } + = @migration.min_value + %td{ role: 'cell', data: { label: _('Max Value') } } + = @migration.max_value + %td{ role: 'cell', data: { label: _('Batch size') } } + = @migration.batch_size + %td{ role: 'cell', data: { label: _('Sub-batch size') } } + = @migration.sub_batch_size + %td{ role: 'cell', data: { label: _('Interval') } } + = @migration.interval + %td{ role: 'cell', data: { label: _('Pause time (ms)') } } + = @migration.pause_ms + %td{ role: 'cell', data: { label: _('Created on') } } + = @migration.created_at + %td{ role: 'cell', data: { label: _('Last updated') } } + = @migration.updated_at + %td{ role: 'cell', data: { label: _('Status') } } + = gl_badge_tag @migration.status_name.to_s.humanize, { size: :sm, variant: batched_migration_status_badge_variant(@migration) } diff --git a/app/views/admin/background_migrations/index.html.haml b/app/views/admin/background_migrations/index.html.haml index afceb6427e0..c8b195219ec 100644 --- a/app/views/admin/background_migrations/index.html.haml +++ b/app/views/admin/background_migrations/index.html.haml @@ -1,13 +1,26 @@ -- page_title _('Background Migrations') +- page_title s_('BackgroundMigrations|Background Migrations') +- @breadcrumb_link = admin_background_migrations_path(database: params[:database]) + +.gl-display-flex.gl-sm-flex-direction-column.gl-sm-align-items-flex-end.gl-pb-5.gl-border-b-1.gl-border-b-solid.gl-border-b-gray-100 + .gl-flex-grow-1 + %h3= s_('BackgroundMigrations|Background Migrations') + %p.light.gl-mb-0 + - learnmore_link = help_page_path('development/database/batched_background_migrations') + - learnmore_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: learnmore_link } + = html_escape(s_('BackgroundMigrations|Background migrations are used to perform data migrations whenever a migration exceeds the time limits in our guidelines. %{linkStart}Learn more%{linkEnd}')) % { linkStart: learnmore_link_start, linkEnd: '</a>'.html_safe } + + - if @databases.size > 1 + .gl-display-flex.gl-align-items-center.gl-flex-grow-0.gl-flex-basis-0.gl-sm-mt-0.gl-mt-5.gl-sm-ml-7.gl-ml-0 + #js-database-listbox{ data: { databases: @databases, selected_database: @selected_database } } = gl_tabs_nav do - = gl_tab_link_to admin_background_migrations_path, item_active: @current_tab == 'queued' do + = gl_tab_link_to admin_background_migrations_path({ tab: nil, database: params[:database] }), item_active: @current_tab == 'queued' do = _('Queued') = gl_tab_counter_badge limited_counter_with_delimiter(@relations_by_tab['queued']) - = gl_tab_link_to admin_background_migrations_path(tab: 'failed'), item_active: @current_tab == 'failed' do + = gl_tab_link_to admin_background_migrations_path({ tab: 'failed', database: params[:database] }), item_active: @current_tab == 'failed' do = _('Failed') = gl_tab_counter_badge limited_counter_with_delimiter(@relations_by_tab['failed']) - = gl_tab_link_to admin_background_migrations_path(tab: 'finished'), item_active: @current_tab == 'finished' do + = gl_tab_link_to admin_background_migrations_path({ tab: 'finished', database: params[:database] }), item_active: @current_tab == 'finished' do = _('Finished') = gl_tab_counter_badge limited_counter_with_delimiter(@relations_by_tab['finished']) @@ -16,10 +29,10 @@ %table.table.b-table.gl-table.b-table-stacked-md{ role: 'table' } %thead{ role: 'rowgroup' } %tr{ role: 'row' } - %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Migration') - %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Progress') - %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Status') - %th.table-th-transparent.border-bottom{ role: 'cell' } + %th.border-bottom{ role: 'cell' }= _('Migration') + %th.border-bottom{ role: 'cell' }= _('Progress') + %th.border-bottom{ role: 'cell' }= _('Status') + %th.border-bottom{ role: 'cell' } %tbody{ role: 'rowgroup' } = render partial: 'migration', collection: @migrations diff --git a/app/views/admin/background_migrations/show.html.haml b/app/views/admin/background_migrations/show.html.haml new file mode 100644 index 00000000000..7915a9d36dc --- /dev/null +++ b/app/views/admin/background_migrations/show.html.haml @@ -0,0 +1,39 @@ +- add_to_breadcrumbs s_('BackgroundMigrations|Background Migrations'), admin_background_migrations_path(database: params[:database]) +- breadcrumb_title @migration.id +- page_title @migration.job_class_name , s_('BackgroundMigrations|Background Migrations') +- @breadcrumb_link = admin_background_migration_path(@migration, database: params[:database]) + +%h3= @migration.job_class_name + ': ' + @migration.table_name + +.tab-content.gl-tab-content + .tab-pane.active{ role: 'tabpanel' } + %table.table.b-table.gl-table.b-table-stacked-md{ role: 'table' } + %thead{ role: 'rowgroup' } + %tr{ role: 'row' } + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Id') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Min Value') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Max Value') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Batch size') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Sub-batch size') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Interval') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Pause time (ms)') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Created on') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Last updated') + %th.table-th-transparent.border-bottom{ role: 'cell' }= _('Status') + %tbody{ role: 'rowgroup' } + = render partial: 'migration_full_information', migration: @migration + +- if @migration.batched_jobs.with_status(:failed).any? + %h5= s_('BackgroundMigrations|Failed jobs:') + + %table.table.b-table.gl-table.b-table-stacked-md{ role: 'table' } + %thead{ role: 'rowgroup' } + %tr{ role: 'row' } + %th{ role: 'cell' }= _('Id') + %th{ role: 'cell' }= s_('BackgroundMigrations|Started at') + %th{ role: 'cell' }= s_('BackgroundMigrations|Finished at') + %th{ role: 'cell' }= s_('BackgroundMigrations|Batch size') + %tbody{ role: 'rowgroup' } + = render partial: 'job', collection: @failed_jobs + + = paginate_collection @failed_jobs |