Commit 1d12b685 authored by Zack Cuddy's avatar Zack Cuddy

Update Geo Uploads Filter Nav

This MR is work towards the final product
proposed here:
https://gitlab.com/gitlab-org/gitlab/-/issues/213219

This MR updates the Geo Uploads
filters and top nav to match the design spec.

To do so only required swapping the old nav for
the new nav that is saved inside a re-usable
partial.

For consistancy purposes until Uploads
are added to Geo Self Service, the
never status was mapped to pending.
parent 4a536b06
......@@ -44,8 +44,11 @@ class Geo::UploadRegistry < Geo::BaseRegistry
def self.with_status(status)
case status
when 'synced', 'never', 'failed'
when 'synced', 'failed'
self.public_send(status) # rubocop: disable GitlabSecurity/PublicSend
# Explained via: https://gitlab.com/gitlab-org/gitlab/-/issues/216049
when 'pending'
self.never
else
all
end
......
- page_title 'Geo Projects'
- 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]
- when 'failed'
= render(partial: 'failed')
......
......@@ -8,7 +8,7 @@
%ul.dropdown-menu
= nav_link(html_options: { class: ('bg-secondary-100' if !params[:sync_status].present?) }) 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
= link_to controller: replicable_controller, sync_status: 'pending' do
= s_('Geo|In progress')
......
- page_title 'Geo Uploads'
- params[:sync_status] ||= []
.top-area.scrolling-tabs-container.inner-page-scroll-tabs
%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)
= render 'admin/geo/shared/filter_nav', replicable_name: _('uploads'), replicable_controller: 'admin/geo/uploads'
- if @registries.any?
- @registries.each do |upload_registry|
= render partial: 'registry', locals: { upload_registry: upload_registry }
......
......@@ -76,8 +76,9 @@ describe Admin::Geo::UploadsController, :geo do
end
end
context 'with sync_status=never' do
subject { get :index, params: { sync_status: 'never' } }
# Explained via: https://gitlab.com/gitlab-org/gitlab/-/issues/216049
context 'with sync_status=pending' do
subject { get :index, params: { sync_status: 'pending' } }
it 'renders only never synced registries' do
expect(subject).to have_gitlab_http_status(:ok)
......
......@@ -55,10 +55,11 @@ describe Geo::UploadRegistry, :geo, :geo_fdw do
described_class.with_status('synced')
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)
described_class.with_status('never')
described_class.with_status('pending')
end
it 'finds the registries with status "failed"' do
expect(described_class).to receive(:failed)
......
......@@ -9793,10 +9793,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."
msgstr ""
msgid "Geo|All"
msgstr ""
msgid "Geo|All %{replicable_type}"
msgid "Geo|All %{replicable_name}"
msgstr ""
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