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
efc610d3
Commit
efc610d3
authored
Nov 27, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ClustersFinder in ClustersController#clusters
parent
0af5ae90
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
app/controllers/projects/clusters_controller.rb
app/controllers/projects/clusters_controller.rb
+6
-2
No files found.
app/controllers/projects/clusters_controller.rb
View file @
efc610d3
class
Projects::ClustersController
<
Projects
::
ApplicationController
class
Projects::ClustersController
<
Projects
::
ApplicationController
before_action
:cluster
,
except:
[
:login
,
:index
,
:new
,
:new_gcp
,
:create
]
before_action
:cluster
,
except:
[
:login
,
:index
,
:new
,
:new_gcp
,
:create
]
before_action
:clusters
,
only:
[
:index
]
before_action
:authorize_read_cluster!
before_action
:authorize_read_cluster!
before_action
:authorize_create_cluster!
,
only:
[
:new
,
:new_gcp
,
:create
]
before_action
:authorize_create_cluster!
,
only:
[
:new
,
:new_gcp
,
:create
]
before_action
:authorize_google_api
,
only:
[
:new_gcp
,
:create
]
before_action
:authorize_google_api
,
only:
[
:new_gcp
,
:create
]
...
@@ -7,8 +8,6 @@ class Projects::ClustersController < Projects::ApplicationController
...
@@ -7,8 +8,6 @@ class Projects::ClustersController < Projects::ApplicationController
before_action
:authorize_admin_cluster!
,
only:
[
:destroy
]
before_action
:authorize_admin_cluster!
,
only:
[
:destroy
]
def
index
def
index
@clusters
||=
project
.
clusters
.
page
(
params
[
:page
]).
per
(
20
).
map
{
|
cluster
|
cluster
.
present
(
current_user:
current_user
)
}
@active_count
=
project
.
clusters
.
enabled
.
count
@active_count
=
project
.
clusters
.
enabled
.
count
@inactive_count
=
project
.
clusters
.
disabled
.
count
@inactive_count
=
project
.
clusters
.
disabled
.
count
@all_count
=
@active_count
+
@inactive_count
@all_count
=
@active_count
+
@inactive_count
...
@@ -101,6 +100,11 @@ class Projects::ClustersController < Projects::ApplicationController
...
@@ -101,6 +100,11 @@ class Projects::ClustersController < Projects::ApplicationController
@cluster
||=
project
.
clusters
.
find_by
(
id:
params
[
:id
])
&
.
present
(
current_user:
current_user
)
||
render_404
@cluster
||=
project
.
clusters
.
find_by
(
id:
params
[
:id
])
&
.
present
(
current_user:
current_user
)
||
render_404
end
end
def
clusters
scope
=
params
[
:scope
]
||
:all
@clusters
=
ClustersFinder
.
new
(
project
,
user
,
scope
).
execute
end
def
create_params
def
create_params
params
.
require
(
:cluster
).
permit
(
params
.
require
(
:cluster
).
permit
(
:enabled
,
:enabled
,
...
...
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