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
4882c793
Commit
4882c793
authored
Nov 30, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove cluster scope from ClustersController#index
parent
8ff63039
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
33 deletions
+2
-33
app/controllers/projects/clusters_controller.rb
app/controllers/projects/clusters_controller.rb
+2
-5
spec/controllers/projects/clusters_controller_spec.rb
spec/controllers/projects/clusters_controller_spec.rb
+0
-28
No files found.
app/controllers/projects/clusters_controller.rb
View file @
4882c793
...
@@ -8,11 +8,8 @@ class Projects::ClustersController < Projects::ApplicationController
...
@@ -8,11 +8,8 @@ class Projects::ClustersController < Projects::ApplicationController
STATUS_POLLING_INTERVAL
=
10_000
STATUS_POLLING_INTERVAL
=
10_000
def
index
def
index
@scope
=
params
[
:scope
]
||
'all'
clusters
=
ClustersFinder
.
new
(
project
,
current_user
,
:all
).
execute
@clusters
=
ClustersFinder
.
new
(
project
,
current_user
,
@scope
).
execute
.
page
(
params
[
:page
])
@clusters
=
clusters
.
page
(
params
[
:page
]).
per
(
20
)
@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
end
end
def
new
def
new
...
...
spec/controllers/projects/clusters_controller_spec.rb
View file @
4882c793
...
@@ -27,13 +27,6 @@ describe Projects::ClustersController do
...
@@ -27,13 +27,6 @@ describe Projects::ClustersController do
expect
(
assigns
(
:clusters
)).
to
match_array
([
enabled_cluster
,
disabled_cluster
])
expect
(
assigns
(
:clusters
)).
to
match_array
([
enabled_cluster
,
disabled_cluster
])
end
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
context
'when page is specified'
do
let
(
:last_page
)
{
project
.
clusters
.
page
.
total_pages
}
let
(
:last_page
)
{
project
.
clusters
.
page
.
total_pages
}
...
@@ -48,20 +41,6 @@ describe Projects::ClustersController do
...
@@ -48,20 +41,6 @@ describe Projects::ClustersController do
expect
(
assigns
(
:clusters
).
current_page
).
to
eq
(
last_page
)
expect
(
assigns
(
:clusters
).
current_page
).
to
eq
(
last_page
)
end
end
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
end
context
'when project does not have a cluster'
do
context
'when project does not have a cluster'
do
...
@@ -74,13 +53,6 @@ describe Projects::ClustersController do
...
@@ -74,13 +53,6 @@ describe Projects::ClustersController do
expect
(
response
).
to
render_template
(
:index
,
partial: :empty_state
)
expect
(
response
).
to
render_template
(
:index
,
partial: :empty_state
)
expect
(
assigns
(
:clusters
)).
to
eq
([])
expect
(
assigns
(
:clusters
)).
to
eq
([])
end
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
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