Commit e2dff578 authored by Nick Thomas's avatar Nick Thomas

Merge branch '213219_04-update-uploads-ui' into 'master'

Update Geo Uploads Filter Nav

See merge request gitlab-org/gitlab!30656
parents 58e05cde 1d12b685
...@@ -44,8 +44,11 @@ class Geo::UploadRegistry < Geo::BaseRegistry ...@@ -44,8 +44,11 @@ class Geo::UploadRegistry < Geo::BaseRegistry
def self.with_status(status) def self.with_status(status)
case status case status
when 'synced', 'never', 'failed' when 'synced', 'failed'
self.public_send(status) # rubocop: disable GitlabSecurity/PublicSend self.public_send(status) # rubocop: disable GitlabSecurity/PublicSend
# Explained via: https://gitlab.com/gitlab-org/gitlab/-/issues/216049
when 'pending'
self.never
else else
all all
end end
......
- page_title 'Geo Projects' - page_title 'Geo Projects'
- params[:sync_status] ||= [] - params[:sync_status] ||= []
= render 'admin/geo/shared/filter_nav', replicable_type: _('projects'), replicable_controller: 'admin/geo/projects', action_buttons: @action_buttons = render 'admin/geo/shared/filter_nav', replicable_name: _('projects'), replicable_controller: 'admin/geo/projects', action_buttons: @action_buttons
- case params[:sync_status] - case params[:sync_status]
- when 'failed' - when 'failed'
= render(partial: 'failed') = render(partial: 'failed')
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
%ul.dropdown-menu %ul.dropdown-menu
= nav_link(html_options: { class: ('bg-secondary-100' if !params[:sync_status].present?) }) do = nav_link(html_options: { class: ('bg-secondary-100' if !params[:sync_status].present?) }) do
= link_to controller: replicable_controller do = link_to controller: replicable_controller do
= sprintf(s_('Geo|All %{replicable_type}'), { replicable_type: replicable_type }) = sprintf(s_('Geo|All %{replicable_name}'), { replicable_name: replicable_name })
= nav_link(html_options: { class: ('bg-secondary-100' if params[:sync_status] == 'pending') }) do = nav_link(html_options: { class: ('bg-secondary-100' if params[:sync_status] == 'pending') }) do
= link_to controller: replicable_controller, sync_status: 'pending' do = link_to controller: replicable_controller, sync_status: 'pending' do
= s_('Geo|In progress') = s_('Geo|In progress')
......
- page_title 'Geo Uploads' - page_title 'Geo Uploads'
- params[:sync_status] ||= [] - params[:sync_status] ||= []
.top-area.scrolling-tabs-container.inner-page-scroll-tabs = render 'admin/geo/shared/filter_nav', replicable_name: _('uploads'), replicable_controller: 'admin/geo/uploads'
%ul.nav-links.nav.nav-tabs
- opts = params[:sync_status].present? ? {} : { page: admin_geo_uploads_path }
= nav_link(opts) do
= link_to admin_geo_uploads_path do
= s_('Geo|All')
= nav_link(html_options: { class: active_when(params[:sync_status] == 'synced') }) do
= link_to admin_geo_uploads_path(sync_status: 'synced') do
= s_('Geo|Synced')
= nav_link(html_options: { class: active_when(params[:sync_status] == 'failed') }) do
= link_to admin_geo_uploads_path(sync_status: 'failed') do
= s_('Geo|Failed')
= nav_link(html_options: { class: active_when(params[:sync_status] == 'never') }) do
= link_to admin_geo_uploads_path(sync_status: 'never') do
= s_('Geo|Never')
.nav-controls
= render(partial: 'shared/projects/search_form', autofocus: true)
- if @registries.any? - if @registries.any?
- @registries.each do |upload_registry| - @registries.each do |upload_registry|
= render partial: 'registry', locals: { upload_registry: upload_registry } = render partial: 'registry', locals: { upload_registry: upload_registry }
......
...@@ -76,8 +76,9 @@ describe Admin::Geo::UploadsController, :geo do ...@@ -76,8 +76,9 @@ describe Admin::Geo::UploadsController, :geo do
end end
end end
context 'with sync_status=never' do # Explained via: https://gitlab.com/gitlab-org/gitlab/-/issues/216049
subject { get :index, params: { sync_status: 'never' } } context 'with sync_status=pending' do
subject { get :index, params: { sync_status: 'pending' } }
it 'renders only never synced registries' do it 'renders only never synced registries' do
expect(subject).to have_gitlab_http_status(:ok) expect(subject).to have_gitlab_http_status(:ok)
......
...@@ -55,10 +55,11 @@ describe Geo::UploadRegistry, :geo, :geo_fdw do ...@@ -55,10 +55,11 @@ describe Geo::UploadRegistry, :geo, :geo_fdw do
described_class.with_status('synced') described_class.with_status('synced')
end end
it 'finds the registries with status "never"' do # Explained via: https://gitlab.com/gitlab-org/gitlab/-/issues/216049
it 'finds the registries with status "never" when filter is set to "pending"' do
expect(described_class).to receive(:never) expect(described_class).to receive(:never)
described_class.with_status('never') described_class.with_status('pending')
end end
it 'finds the registries with status "failed"' do it 'finds the registries with status "failed"' do
expect(described_class).to receive(:failed) expect(described_class).to receive(:failed)
......
...@@ -9778,10 +9778,7 @@ msgstr "" ...@@ -9778,10 +9778,7 @@ msgstr ""
msgid "Geo|Adjust your filters/search criteria above. If you believe this may be an error, please refer to the %{linkStart}Geo Troubleshooting%{linkEnd} documentation for more information." msgid "Geo|Adjust your filters/search criteria above. If you believe this may be an error, please refer to the %{linkStart}Geo Troubleshooting%{linkEnd} documentation for more information."
msgstr "" msgstr ""
msgid "Geo|All" msgid "Geo|All %{replicable_name}"
msgstr ""
msgid "Geo|All %{replicable_type}"
msgstr "" msgstr ""
msgid "Geo|All projects" msgid "Geo|All projects"
......
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