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
6ab49d29
Commit
6ab49d29
authored
Jul 30, 2021
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '337000-fj-add-runners-menu' into 'master'
Add CI/CD menu See merge request gitlab-org/gitlab!66931
parents
5cec5cfa
331e7be1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
18 deletions
+114
-18
app/views/layouts/nav/sidebar/_group_menus.html.haml
app/views/layouts/nav/sidebar/_group_menus.html.haml
+0
-17
lib/sidebars/groups/menus/ci_cd_menu.rb
lib/sidebars/groups/menus/ci_cd_menu.rb
+51
-0
lib/sidebars/groups/panel.rb
lib/sidebars/groups/panel.rb
+1
-0
spec/lib/sidebars/groups/menus/ci_cd_menu_spec.rb
spec/lib/sidebars/groups/menus/ci_cd_menu_spec.rb
+40
-0
spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
+22
-1
No files found.
app/views/layouts/nav/sidebar/_group_menus.html.haml
View file @
6ab49d29
-
if
group_sidebar_link?
(
:runners
)
=
nav_link
(
path:
'groups/runners#index'
)
do
=
link_to
group_runners_path
(
@group
),
title:
_
(
'CI/CD'
),
class:
'has-sub-items'
do
.nav-icon-container
=
sprite_icon
(
'rocket'
)
%span
.nav-item-name
=
_
(
'CI/CD'
)
%ul
.sidebar-sub-level-items
=
nav_link
(
path:
'groups/runners#index'
,
html_options:
{
class:
"fly-out-top-item"
}
)
do
=
link_to
group_runners_path
(
@group
),
title:
_
(
'CI/CD'
)
do
%strong
.fly-out-top-item-name
=
_
(
'CI/CD'
)
%li
.divider.fly-out-top-item
=
nav_link
(
path:
'groups/runners#index'
)
do
=
link_to
group_runners_path
(
@group
),
title:
s_
(
'Runners|Runners'
)
do
%span
=
s_
(
'Runners|Runners'
)
-
if
group_sidebar_link?
(
:kubernetes
)
=
nav_link
(
controller:
[
:clusters
])
do
=
link_to
group_clusters_path
(
@group
)
do
...
...
lib/sidebars/groups/menus/ci_cd_menu.rb
0 → 100644
View file @
6ab49d29
# frozen_string_literal: true
module
Sidebars
module
Groups
module
Menus
class
CiCdMenu
<
::
Sidebars
::
Menu
override
:configure_menu_items
def
configure_menu_items
add_item
(
runners_menu_item
)
true
end
override
:link
def
link
renderable_items
.
first
.
link
end
override
:title
def
title
_
(
'CI/CD'
)
end
override
:sprite_icon
def
sprite_icon
'rocket'
end
private
def
runners_menu_item
return
::
Sidebars
::
NilMenuItem
.
new
(
item_id: :runners
)
unless
show_runners?
::
Sidebars
::
MenuItem
.
new
(
title:
_
(
'Runners'
),
link:
group_runners_path
(
context
.
group
),
active_routes:
{
path:
'groups/runners#index'
},
item_id: :runners
)
end
# TODO Proper policies, such as `read_group_runners`, should be implemented per
# See https://gitlab.com/gitlab-org/gitlab/-/issues/334802
def
show_runners?
can?
(
context
.
current_user
,
:admin_group
,
context
.
group
)
&&
Feature
.
enabled?
(
:runner_list_group_view_vue_ui
,
context
.
group
,
default_enabled: :yaml
)
end
end
end
end
end
lib/sidebars/groups/panel.rb
View file @
6ab49d29
...
...
@@ -10,6 +10,7 @@ module Sidebars
add_menu
(
Sidebars
::
Groups
::
Menus
::
GroupInformationMenu
.
new
(
context
))
add_menu
(
Sidebars
::
Groups
::
Menus
::
IssuesMenu
.
new
(
context
))
add_menu
(
Sidebars
::
Groups
::
Menus
::
MergeRequestsMenu
.
new
(
context
))
add_menu
(
Sidebars
::
Groups
::
Menus
::
CiCdMenu
.
new
(
context
))
end
override
:render_raw_menus_partial
...
...
spec/lib/sidebars/groups/menus/ci_cd_menu_spec.rb
0 → 100644
View file @
6ab49d29
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Sidebars
::
Groups
::
Menus
::
CiCdMenu
do
let_it_be
(
:owner
)
{
create
(
:user
)
}
let_it_be
(
:root_group
)
do
build
(
:group
,
:private
).
tap
do
|
g
|
g
.
add_owner
(
owner
)
end
end
let
(
:group
)
{
root_group
}
let
(
:user
)
{
owner
}
let
(
:context
)
{
Sidebars
::
Groups
::
Context
.
new
(
current_user:
user
,
container:
group
)
}
describe
'Menu Items'
do
subject
{
described_class
.
new
(
context
).
renderable_items
.
index
{
|
e
|
e
.
item_id
==
item_id
}
}
describe
'Runners'
do
let
(
:item_id
)
{
:runners
}
specify
{
is_expected
.
not_to
be_nil
}
describe
'when feature flag :runner_list_group_view_vue_ui is disabled'
do
before
do
stub_feature_flags
(
runner_list_group_view_vue_ui:
false
)
end
specify
{
is_expected
.
to
be_nil
}
end
describe
'when the user does not have access'
do
let
(
:user
)
{
nil
}
specify
{
is_expected
.
to
be_nil
}
end
end
end
end
spec/views/layouts/nav/sidebar/_group.html.haml_spec.rb
View file @
6ab49d29
...
...
@@ -3,10 +3,17 @@
require
'spec_helper'
RSpec
.
describe
'layouts/nav/sidebar/_group'
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:owner
)
{
create
(
:user
)
}
let_it_be
(
:group
)
do
create
(
:group
).
tap
do
|
g
|
g
.
add_owner
(
owner
)
end
end
before
do
assign
(
:group
,
group
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
owner
)
end
it_behaves_like
'has nav sidebar'
...
...
@@ -79,4 +86,18 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
expect
(
rendered
).
to
have_css
(
'span.badge.badge-pill.merge_counter.js-merge-counter'
)
end
end
describe
'CI/CD'
do
it
'has a default link to the runners list path'
do
render
expect
(
rendered
).
to
have_link
(
'CI/CD'
,
href:
group_runners_path
(
group
))
end
it
'has a link to the runners list page'
do
render
expect
(
rendered
).
to
have_link
(
'Runners'
,
href:
group_runners_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