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
6affbcaa
Commit
6affbcaa
authored
Aug 04, 2021
by
David Kim
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '336872-fj-add-kubernetes-menu' into 'master'
Add Kubernetes menu See merge request gitlab-org/gitlab!66834
parents
fd9e67a5
d2da2b6e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
13 deletions
+82
-13
app/views/layouts/nav/sidebar/_group_menus.html.haml
app/views/layouts/nav/sidebar/_group_menus.html.haml
+0
-13
lib/sidebars/groups/menus/kubernetes_menu.rb
lib/sidebars/groups/menus/kubernetes_menu.rb
+41
-0
lib/sidebars/groups/panel.rb
lib/sidebars/groups/panel.rb
+1
-0
spec/lib/sidebars/groups/menus/kubernetes_menu_spec.rb
spec/lib/sidebars/groups/menus/kubernetes_menu_spec.rb
+32
-0
spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
+8
-0
No files found.
app/views/layouts/nav/sidebar/_group_menus.html.haml
View file @
6affbcaa
-
if
group_sidebar_link?
(
:kubernetes
)
=
nav_link
(
controller:
[
:clusters
])
do
=
link_to
group_clusters_path
(
@group
)
do
.nav-icon-container
=
sprite_icon
(
'cloud-gear'
)
%span
.nav-item-name
=
_
(
'Kubernetes'
)
%ul
.sidebar-sub-level-items.is-fly-out-only
=
nav_link
(
controller:
[
:clusters
],
html_options:
{
class:
"fly-out-top-item"
}
)
do
=
link_to
group_clusters_path
(
@group
),
title:
_
(
'Kubernetes'
),
class:
'shortcuts-kubernetes'
do
%strong
.fly-out-top-item-name
=
_
(
'Kubernetes'
)
=
render
'groups/sidebar/packages'
=
render
'layouts/nav/sidebar/analytics_links'
,
links:
group_analytics_navbar_links
(
@group
,
current_user
)
...
...
lib/sidebars/groups/menus/kubernetes_menu.rb
0 → 100644
View file @
6affbcaa
# frozen_string_literal: true
module
Sidebars
module
Groups
module
Menus
class
KubernetesMenu
<
::
Sidebars
::
Menu
override
:link
def
link
group_clusters_path
(
context
.
group
)
end
override
:title
def
title
_
(
'Kubernetes'
)
end
override
:sprite_icon
def
sprite_icon
'cloud-gear'
end
override
:render?
def
render?
can?
(
context
.
current_user
,
:read_cluster
,
context
.
group
)
end
override
:extra_container_html_options
def
extra_container_html_options
{
class:
'shortcuts-kubernetes'
}
end
override
:active_routes
def
active_routes
{
controller: :clusters
}
end
end
end
end
end
lib/sidebars/groups/panel.rb
View file @
6affbcaa
...
...
@@ -11,6 +11,7 @@ module Sidebars
add_menu
(
Sidebars
::
Groups
::
Menus
::
IssuesMenu
.
new
(
context
))
add_menu
(
Sidebars
::
Groups
::
Menus
::
MergeRequestsMenu
.
new
(
context
))
add_menu
(
Sidebars
::
Groups
::
Menus
::
CiCdMenu
.
new
(
context
))
add_menu
(
Sidebars
::
Groups
::
Menus
::
KubernetesMenu
.
new
(
context
))
end
override
:render_raw_menus_partial
...
...
spec/lib/sidebars/groups/menus/kubernetes_menu_spec.rb
0 → 100644
View file @
6affbcaa
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Sidebars
::
Groups
::
Menus
::
KubernetesMenu
do
let_it_be
(
:owner
)
{
create
(
:user
)
}
let_it_be
(
:group
)
do
build
(
:group
,
:private
).
tap
do
|
g
|
g
.
add_owner
(
owner
)
end
end
let
(
:user
)
{
owner
}
let
(
:context
)
{
Sidebars
::
Groups
::
Context
.
new
(
current_user:
user
,
container:
group
)
}
let
(
:menu
)
{
described_class
.
new
(
context
)
}
describe
'#render?'
do
context
'when user can read clusters'
do
it
'returns true'
do
expect
(
menu
.
render?
).
to
eq
true
end
end
context
'when user cannot read clusters rules'
do
let
(
:user
)
{
nil
}
it
'returns false'
do
expect
(
menu
.
render?
).
to
eq
false
end
end
end
end
spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
View file @
6affbcaa
...
...
@@ -100,4 +100,12 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
expect
(
rendered
).
to
have_link
(
'Runners'
,
href:
group_runners_path
(
group
))
end
end
describe
'Kubernetes menu'
do
it
'has a link to the group cluster list path'
do
render
expect
(
rendered
).
to
have_link
(
'Kubernetes'
,
href:
group_clusters_path
(
group
))
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