Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fe09fb84
Commit
fe09fb84
authored
Apr 06, 2022
by
Alper Akgun
Committed by
Mayra Cabrera
Apr 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Geo filter nav pajamas compliant
parent
96067b66
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
19 deletions
+47
-19
ee/app/helpers/ee/geo_helper.rb
ee/app/helpers/ee/geo_helper.rb
+25
-0
ee/app/views/admin/geo/shared/_filter_nav.html.haml
ee/app/views/admin/geo/shared/_filter_nav.html.haml
+2
-18
ee/spec/features/admin/geo/admin_geo_projects_spec.rb
ee/spec/features/admin/geo/admin_geo_projects_spec.rb
+1
-1
ee/spec/helpers/ee/geo_helper_spec.rb
ee/spec/helpers/ee/geo_helper_spec.rb
+19
-0
No files found.
ee/app/helpers/ee/geo_helper.rb
View file @
fe09fb84
...
...
@@ -248,5 +248,30 @@ module EE
def
enabled_replicator_classes
::
Gitlab
::
Geo
.
enabled_replicator_classes
end
def
geo_filter_nav_options
(
replicable_controller
,
replicable_name
)
[
{
value:
''
,
text:
sprintf
(
s_
(
'Geo|All %{replicable_name}'
),
{
replicable_name:
replicable_name
}),
href:
url_for
(
controller:
replicable_controller
)
},
{
value:
'pending'
,
text:
s_
(
'Geo|In progress'
),
href:
url_for
(
controller:
replicable_controller
,
sync_status:
'pending'
)
},
{
value:
'failed'
,
text:
s_
(
'Geo|Failed'
),
href:
url_for
(
controller:
replicable_controller
,
sync_status:
'failed'
)
},
{
value:
'synced'
,
text:
s_
(
'Geo|Synced'
),
href:
url_for
(
controller:
replicable_controller
,
sync_status:
'synced'
)
}
]
end
end
end
ee/app/views/admin/geo/shared/_filter_nav.html.haml
View file @
fe09fb84
-
action_buttons
=
local_assigns
[
:action_buttons
]
?
action_buttons
:
[]
-
params
[
:sync_status
]
||=
[]
-
filter_by
=
params
[
:sync_status
]
||
[]
%nav
.bg-secondary.border-bottom.border-secondary-100.p-3
.row.d-flex.flex-column.flex-sm-row
.col
.gl-sm-display-flex.gl-mx-n1
.dropdown.gl-px-2.gl-my-2.my-sm-0.gl-w-full
%a
.gl-button.btn.gl-sm-display-flex.gl-align-items-center.gl-justify-content-space-between.gl-w-full
{
href:
'#'
,
data:
{
toggle:
'dropdown'
},
'aria-haspopup'
=>
'true'
,
'aria-expanded'
=>
'false'
}
=
s_
(
'Geo|Filter by status'
)
=
sprite_icon
(
"chevron-down"
)
%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_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'
)
=
nav_link
(
html_options:
{
class:
(
'bg-secondary-100'
if
params
[
:sync_status
]
==
'failed'
)
})
do
=
link_to
controller:
replicable_controller
,
sync_status:
'failed'
do
=
s_
(
'Geo|Failed'
)
=
nav_link
(
html_options:
{
class:
(
'bg-secondary-100'
if
params
[
:sync_status
]
==
'synced'
)
})
do
=
link_to
controller:
replicable_controller
,
sync_status:
'synced'
do
=
s_
(
'Geo|Synced'
)
=
gl_redirect_listbox_tag
geo_filter_nav_options
(
replicable_controller
,
replicable_name
),
filter_by
,
class:
'gl-px-2 gl-my-2 my-sm-0 gl-w-full'
.replicable-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-5.d-flex.justify-content-end.my-1.my-sm-0.w-100
...
...
ee/spec/features/admin/geo/admin_geo_projects_spec.rb
View file @
fe09fb84
...
...
@@ -81,7 +81,7 @@ RSpec.describe 'admin Geo Projects', :js, :geo do
visit
(
page_url
)
wait_for_requests
click_link_or_button
(
'
Filter by statu
s'
)
click_link_or_button
(
'
All project
s'
)
click_link_or_button
(
'In progress'
)
wait_for_requests
end
...
...
ee/spec/helpers/ee/geo_helper_spec.rb
View file @
fe09fb84
...
...
@@ -58,4 +58,23 @@ RSpec.describe EE::GeoHelper do
expect
(
data_type_titles
).
to
include
(
*
expected_data_type_titles
)
end
end
describe
'#geo_filter_nav_options'
do
let
(
:replicable_controller
)
{
'admin/geo/projects'
}
let
(
:replicable_name
)
{
'projects'
}
let
(
:expected_nav_options
)
do
[
{
value:
""
,
text:
"All projects"
,
href:
"/admin/geo/replication/projects"
},
{
value:
"pending"
,
text:
"In progress"
,
href:
"/admin/geo/replication/projects?sync_status=pending"
},
{
value:
"failed"
,
text:
"Failed"
,
href:
"/admin/geo/replication/projects?sync_status=failed"
},
{
value:
"synced"
,
text:
"Synced"
,
href:
"/admin/geo/replication/projects?sync_status=synced"
}
]
end
subject
(
:geo_filter_nav_options
)
{
helper
.
geo_filter_nav_options
(
replicable_controller
,
replicable_name
)
}
it
'returns correct urls'
do
expect
(
geo_filter_nav_options
).
to
eq
(
expected_nav_options
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment