Commit 593e74a8 authored by Michael Kozono's avatar Michael Kozono

Merge branch '213219_02-update-projects-ui' into 'master'

Update Geo Projects Filter Nav

See merge request gitlab-org/gitlab!30238
parents fc3ba92d c7c776ed
......@@ -27,3 +27,11 @@
}
}
}
// Overrides for the generalized `shared/projects/search_form` used in Geo
.project-search {
#project-filter-form-field {
width: 100%;
padding-left: 1.75rem;
}
}
......@@ -7,8 +7,6 @@ class Admin::Geo::ProjectsController < Admin::Geo::ApplicationController
def index
@registries = case params[:sync_status]
when 'never'
finder.never_synced_projects.page(params[:page])
when 'failed'
finder.failed_projects.page(params[:page])
when 'pending'
......
- @registries.each do |project_registry|
.card.project-card.prepend-top-15
.card-header{ id: "project-#{project_registry.project_id}-header" }
.d-flex.align-items-center
- if project_registry.project.nil?
= render partial: 'removed', locals: { project_registry: project_registry }
- else
%strong.text-truncate.flex-fill
= link_to project_registry.project.full_name, admin_namespace_project_path(project_registry.project.namespace, project_registry.project)
= render partial: 'registry_never', locals: { project_registry: project_registry }
= paginate @registries, theme: 'gitlab'
- page_title 'Geo Projects'
- 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_projects_path }
= nav_link(opts) do
%nav.row.d-flex.flex-column.flex-sm-row.align-items-center.bg-secondary.border-bottom.border-secondary-100.p-3
.dropdown.col.px-1.my-1.my-sm-0.w-100
%a.btn.d-flex.align-items-center.justify-content-between.w-100{ href: '#', data: { toggle: 'dropdown' }, 'aria-haspopup' => 'true', 'aria-expanded' => 'false' }
= s_('Geo|Filter by status')
= sprite_icon("chevron-down", size: 16)
%ul.dropdown-menu
= nav_link(html_options: { class: ('bg-secondary-100' if !params[:sync_status].present?) }) do
= link_to admin_geo_projects_path do
= s_('Geo|All')
= nav_link(html_options: { class: active_when(params[:sync_status] == 'synced') }) do
= link_to admin_geo_projects_path(sync_status: 'synced') do
= s_('Geo|Synced')
= nav_link(html_options: { class: active_when(params[:sync_status] == 'pending') }) do
= s_('Geo|All projects')
= nav_link(html_options: { class: ('bg-secondary-100' if params[:sync_status] == 'pending') }) do
= link_to admin_geo_projects_path(sync_status: 'pending') do
= s_('Geo|Pending')
= nav_link(html_options: { class: active_when(params[:sync_status] == 'failed') }) do
= s_('Geo|In progress')
= nav_link(html_options: { class: ('bg-secondary-100' if params[:sync_status] == 'failed') }) do
= link_to admin_geo_projects_path(sync_status: 'failed') do
= s_('Geo|Failed')
= nav_link(html_options: { class: active_when(params[:sync_status] == 'never') }) do
= link_to admin_geo_projects_path(sync_status: 'never') do
= s_('Geo|Never')
.nav-controls
= render(partial: 'shared/projects/search_form', autofocus: true)
.dropdown
%a.btn.dropdown-toggle{ href: '#', data: { toggle: 'dropdown' }, 'aria-haspopup' => 'true', 'aria-expanded' => 'false' }
= icon('gears')
= s_('Geo|Batch operations')
= icon("caret-down")
%ul.dropdown-menu.dropdown-menu-right
%li.dropdown-header= s_('Geo|Batch operations')
%li= link_to s_('Geo|Resync all projects'), resync_all_admin_geo_projects_path, method: :post
%li= link_to s_('Geo|Reverify all projects'), reverify_all_admin_geo_projects_path, method: :post
= nav_link(html_options: { class: ('bg-secondary-100' if params[:sync_status] == 'synced') }) do
= link_to admin_geo_projects_path(sync_status: 'synced') do
= s_('Geo|Synced')
.col.project-search.px-1.my-1.my-sm-0.w-100
= render 'shared/projects/search_form', autofocus: true, search_form_placeholder: _("Filter by name"), icon: true
.col.col-sm-6.d-flex.justify-content-end.my-1.my-sm-0.w-100
= button_to s_('Geo|Resync all'), resync_all_admin_geo_projects_path, method: :post, :class => "btn btn-default mr-2"
= button_to s_('Geo|Reverify all'), reverify_all_admin_geo_projects_path, method: :post, :class => "btn btn-default"
- case params[:sync_status]
- when 'never'
= render(partial: 'never')
- when 'failed'
= render(partial: 'failed')
- when 'pending'
......
......@@ -65,16 +65,6 @@ describe Admin::Geo::ProjectsController, :geo do
end
end
context 'with sync_status=never' do
subject { get :index, params: { sync_status: 'never' } }
it 'renders failed template' do
expect(subject).to have_gitlab_http_status(:ok)
expect(subject).to render_template(:index)
expect(subject).to render_template(partial: 'admin/geo/projects/_never')
end
end
context 'with sync_status=synced' do
subject { get :index, params: { sync_status: 'synced' } }
......
......@@ -46,18 +46,19 @@ describe 'admin Geo Projects', :js, :geo do
end
end
describe 'clicking on a specific tab in geo projects page' do
describe 'clicking on a specific dropdown option in geo projects page' do
let(:page_url) { admin_geo_projects_path }
before do
visit(page_url)
wait_for_requests
click_link_or_button('Pending')
click_link_or_button('Filter by status')
click_link_or_button('In progress')
wait_for_requests
end
it 'shows tab specific projects' do
it 'shows filter specific projects' do
page.within(find('#content-body', match: :first)) do
expect(page).not_to have_content(synced_registry.project.full_name)
expect(page).to have_content(sync_pending_registry.project.full_name)
......@@ -81,7 +82,7 @@ describe 'admin Geo Projects', :js, :geo do
end
end
it 'filters out project that matches with search but shouldnt be in the tab' do
it 'filters out project that matches with search but shouldnt be in the view' do
fill_in :name, with: synced_registry.project.name
find('#project-filter-form-field').native.send_keys(:enter)
......@@ -97,13 +98,13 @@ describe 'admin Geo Projects', :js, :geo do
end
end
shared_examples 'shows tab specific projects and correct labels' do
shared_examples 'shows filter specific projects and correct labels' do
before do
visit(admin_geo_projects_path(sync_status: sync_status))
wait_for_requests
end
it 'shows tab specific projects' do
it 'shows filter specific projects' do
page.within(find('#content-body', match: :first)) do
expected_registries.each do |registry|
expect(page).to have_content(registry.project.full_name)
......@@ -128,7 +129,7 @@ describe 'admin Geo Projects', :js, :geo do
let(:unexpected_registries) { [sync_pending_registry, sync_failed_registry, never_synced_registry] }
let(:labels) { ['Status', 'Last successful sync', 'Last time verified', 'Last repository check run'] }
it_behaves_like 'shows tab specific projects and correct labels'
it_behaves_like 'shows filter specific projects and correct labels'
end
describe 'visiting geo pending synced projects page' do
......@@ -137,16 +138,7 @@ describe 'admin Geo Projects', :js, :geo do
let(:unexpected_registries) { [synced_registry, sync_failed_registry, never_synced_registry] }
let(:labels) { ['Status', 'Next sync scheduled at', 'Last sync attempt'] }
it_behaves_like 'shows tab specific projects and correct labels'
end
describe 'visiting geo never synced projects page' do
let(:sync_status) { :never }
let(:labels) { ['Status', 'Next sync scheduled at', 'Last sync attempt'] }
let(:expected_registries) { [never_synced_registry] }
let(:unexpected_registries) { [synced_registry, sync_pending_registry, sync_failed_registry] }
it_behaves_like 'shows tab specific projects and correct labels'
it_behaves_like 'shows filter specific projects and correct labels'
end
describe 'visiting geo failed sync projects page' do
......@@ -155,7 +147,7 @@ describe 'admin Geo Projects', :js, :geo do
let(:unexpected_registries) { [synced_registry, sync_pending_registry, never_synced_registry] }
let(:labels) { ['Status', 'Next sync scheduled at', 'Last sync attempt'] }
it_behaves_like 'shows tab specific projects and correct labels'
it_behaves_like 'shows filter specific projects and correct labels'
end
describe 'remove an orphaned Tracking Entry' do
......
......@@ -9710,9 +9710,6 @@ msgstr ""
msgid "Geo|All projects are being scheduled for re-verify"
msgstr ""
msgid "Geo|Batch operations"
msgstr ""
msgid "Geo|Could not remove tracking entry for an existing project."
msgstr ""
......@@ -9722,9 +9719,15 @@ msgstr ""
msgid "Geo|Failed"
msgstr ""
msgid "Geo|Filter by status"
msgstr ""
msgid "Geo|Geo Status"
msgstr ""
msgid "Geo|In progress"
msgstr ""
msgid "Geo|In sync"
msgstr ""
......@@ -9749,9 +9752,6 @@ msgstr ""
msgid "Geo|Not synced yet"
msgstr ""
msgid "Geo|Pending"
msgstr ""
msgid "Geo|Pending synchronization"
msgstr ""
......@@ -9788,7 +9788,7 @@ msgstr ""
msgid "Geo|Resync"
msgstr ""
msgid "Geo|Resync all projects"
msgid "Geo|Resync all"
msgstr ""
msgid "Geo|Retry count"
......@@ -9797,7 +9797,7 @@ msgstr ""
msgid "Geo|Reverify"
msgstr ""
msgid "Geo|Reverify all projects"
msgid "Geo|Reverify all"
msgstr ""
msgid "Geo|Status"
......
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