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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
45975892
Commit
45975892
authored
Dec 13, 2018
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move description of cluster type to presenter
parent
e7a6b841
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
app/presenters/clusters/cluster_presenter.rb
app/presenters/clusters/cluster_presenter.rb
+8
-0
app/views/clusters/clusters/_cluster.html.haml
app/views/clusters/clusters/_cluster.html.haml
+1
-1
spec/presenters/clusters/cluster_presenter_spec.rb
spec/presenters/clusters/cluster_presenter_spec.rb
+14
-0
No files found.
app/presenters/clusters/cluster_presenter.rb
View file @
45975892
...
@@ -12,6 +12,14 @@ module Clusters
...
@@ -12,6 +12,14 @@ module Clusters
can?
(
current_user
,
:update_cluster
,
cluster
)
&&
created?
can?
(
current_user
,
:update_cluster
,
cluster
)
&&
created?
end
end
def
cluster_type_description
if
cluster
.
project_type?
s_
(
"ClusterIntegration|Project cluster"
)
elsif
cluster
.
group_type?
s_
(
"ClusterIntegration|Group cluster"
)
end
end
def
show_path
def
show_path
if
cluster
.
project_type?
if
cluster
.
project_type?
project_cluster_path
(
project
,
cluster
)
project_cluster_path
(
project
,
cluster
)
...
...
app/views/clusters/clusters/_cluster.html.haml
View file @
45975892
...
@@ -13,4 +13,4 @@
...
@@ -13,4 +13,4 @@
.table-mobile-header
{
role:
"rowheader"
}
.table-mobile-header
{
role:
"rowheader"
}
.table-mobile-content
.table-mobile-content
%span
.badge.badge-light
%span
.badge.badge-light
=
cluster
.
project_type?
?
s_
(
"ClusterIntegration|Project cluster"
)
:
s_
(
"ClusterIntegration|Group cluster"
)
=
cluster
.
cluster_type_description
spec/presenters/clusters/cluster_presenter_spec.rb
View file @
45975892
...
@@ -74,6 +74,20 @@ describe Clusters::ClusterPresenter do
...
@@ -74,6 +74,20 @@ describe Clusters::ClusterPresenter do
end
end
end
end
describe
'#cluster_type_description'
do
subject
{
described_class
.
new
(
cluster
).
cluster_type_description
}
context
'project_type cluster'
do
it
{
is_expected
.
to
eq
(
'Project cluster'
)
}
end
context
'group_type cluster'
do
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:group
)
}
it
{
is_expected
.
to
eq
(
'Group cluster'
)
}
end
end
describe
'#show_path'
do
describe
'#show_path'
do
subject
{
described_class
.
new
(
cluster
).
show_path
}
subject
{
described_class
.
new
(
cluster
).
show_path
}
...
...
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