BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d673628d
Commit
d673628d
authored
Dec 12, 2017
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'single-list-multiple-clusters' into 'master'
Use Single list for multiple clusters See merge request gitlab-org/gitlab-ce!15848
parents
51172fdf
5a1ebf1d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
68 deletions
+13
-68
clusters_controller.rb
app/controllers/projects/clusters_controller.rb
+2
-5
_tabs.html.haml
app/views/projects/clusters/_tabs.html.haml
+0
-16
index.html.haml
app/views/projects/clusters/index.html.haml
+6
-8
multiple-clusters-single-list.yml
changelogs/unreleased/multiple-clusters-single-list.yml
+5
-0
clusters_controller_spec.rb
spec/controllers/projects/clusters_controller_spec.rb
+0
-28
clusters_spec.rb
spec/features/projects/clusters_spec.rb
+0
-11
No files found.
app/controllers/projects/clusters_controller.rb
View file @
d673628d
...
...
@@ -8,11 +8,8 @@ class Projects::ClustersController < Projects::ApplicationController
STATUS_POLLING_INTERVAL
=
10_000
def
index
@scope
=
params
[
:scope
]
||
'all'
@clusters
=
ClustersFinder
.
new
(
project
,
current_user
,
@scope
).
execute
.
page
(
params
[
:page
])
@active_count
=
ClustersFinder
.
new
(
project
,
current_user
,
:active
).
execute
.
count
@inactive_count
=
ClustersFinder
.
new
(
project
,
current_user
,
:inactive
).
execute
.
count
@all_count
=
@active_count
+
@inactive_count
clusters
=
ClustersFinder
.
new
(
project
,
current_user
,
:all
).
execute
@clusters
=
clusters
.
page
(
params
[
:page
]).
per
(
20
)
end
def
new
...
...
app/views/projects/clusters/_tabs.html.haml
deleted
100644 → 0
View file @
51172fdf
.top-area.scrolling-tabs-container.inner-page-scroll-tabs
.fade-left
=
icon
(
"angle-left"
)
.fade-right
=
icon
(
"angle-right"
)
%ul
.nav-links.scrolling-tabs
%li
{
class:
(
'active'
if
@scope
==
'active'
)
}
>
=
link_to
project_clusters_path
(
@project
,
scope: :active
),
class:
"js-active-tab"
do
=
s_
(
"ClusterIntegration|Active"
)
%span
.badge
=
@active_count
%li
{
class:
(
'active'
if
@scope
==
'inactive'
)
}
>
=
link_to
project_clusters_path
(
@project
,
scope: :inactive
),
class:
"js-inactive-tab"
do
=
s_
(
"ClusterIntegration|Inactive"
)
%span
.badge
=
@inactive_count
%li
{
class:
(
'active'
if
@scope
.
nil?
||
@scope
==
'all'
)
}
>
=
link_to
project_clusters_path
(
@project
),
class:
"js-all-tab"
do
=
s_
(
"ClusterIntegration|All"
)
%span
.badge
=
@all_count
app/views/projects/clusters/index.html.haml
View file @
d673628d
...
...
@@ -2,8 +2,12 @@
-
page_title
"Clusters"
.clusters-container
-
if
!
@clusters
.
empty?
=
render
"tabs"
-
if
@clusters
.
empty?
=
render
"empty_state"
-
else
.top-area.adjust
.nav-text
=
s_
(
"ClusterIntegration|Clusters can be used to deploy applications and to provide Review Apps for this project"
)
.ci-table.js-clusters-list
.gl-responsive-table-row.table-row-header
{
role:
"row"
}
.table-section.section-30
{
role:
"rowheader"
}
...
...
@@ -16,9 +20,3 @@
-
@clusters
.
each
do
|
cluster
|
=
render
"cluster"
,
cluster:
cluster
.
present
(
current_user:
current_user
)
=
paginate
@clusters
,
theme:
"gitlab"
-
elsif
@scope
==
'all'
=
render
"empty_state"
-
else
=
render
"tabs"
.prepend-top-20.text-center
=
s_
(
"ClusterIntegration|There are no clusters to show"
)
changelogs/unreleased/multiple-clusters-single-list.yml
0 → 100644
View file @
d673628d
---
title
:
Present multiple clusters in a single list instead of a tabbed view
merge_request
:
15669
author
:
type
:
changed
spec/controllers/projects/clusters_controller_spec.rb
View file @
d673628d
...
...
@@ -27,13 +27,6 @@ describe Projects::ClustersController do
expect
(
assigns
(
:clusters
)).
to
match_array
([
enabled_cluster
,
disabled_cluster
])
end
it
'assigns counters to correct values'
do
go
expect
(
assigns
(
:active_count
)).
to
eq
(
1
)
expect
(
assigns
(
:inactive_count
)).
to
eq
(
1
)
end
context
'when page is specified'
do
let
(
:last_page
)
{
project
.
clusters
.
page
.
total_pages
}
...
...
@@ -48,20 +41,6 @@ describe Projects::ClustersController do
expect
(
assigns
(
:clusters
).
current_page
).
to
eq
(
last_page
)
end
end
context
'when only enabled clusters are requested'
do
it
'returns only enabled clusters'
do
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
,
scope:
'active'
expect
(
assigns
(
:clusters
)).
to
all
(
have_attributes
(
enabled:
true
))
end
end
context
'when only disabled clusters are requested'
do
it
'returns only disabled clusters'
do
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
,
scope:
'inactive'
expect
(
assigns
(
:clusters
)).
to
all
(
have_attributes
(
enabled:
false
))
end
end
end
context
'when project does not have a cluster'
do
...
...
@@ -74,13 +53,6 @@ describe Projects::ClustersController do
expect
(
response
).
to
render_template
(
:index
,
partial: :empty_state
)
expect
(
assigns
(
:clusters
)).
to
eq
([])
end
it
'assigns counters to zero'
do
go
expect
(
assigns
(
:active_count
)).
to
eq
(
0
)
expect
(
assigns
(
:inactive_count
)).
to
eq
(
0
)
end
end
end
...
...
spec/features/projects/clusters_spec.rb
View file @
d673628d
...
...
@@ -35,17 +35,6 @@ feature 'Clusters', :js do
expect
(
page
).
to
have_selector
(
'.gl-responsive-table-row'
,
count:
2
)
end
it
'user sees navigation tabs'
do
expect
(
page
.
find
(
'.js-active-tab'
).
text
).
to
include
(
'Active'
)
expect
(
page
.
find
(
'.js-active-tab .badge'
).
text
).
to
include
(
'1'
)
expect
(
page
.
find
(
'.js-inactive-tab'
).
text
).
to
include
(
'Inactive'
)
expect
(
page
.
find
(
'.js-inactive-tab .badge'
).
text
).
to
include
(
'0'
)
expect
(
page
.
find
(
'.js-all-tab'
).
text
).
to
include
(
'All'
)
expect
(
page
.
find
(
'.js-all-tab .badge'
).
text
).
to
include
(
'1'
)
end
context
'inline update of cluster'
do
it
'user can update cluster'
do
expect
(
page
).
to
have_selector
(
'.js-toggle-cluster-list'
)
...
...
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