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
3de1ba6c
Commit
3de1ba6c
authored
Nov 28, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move cluster sourcing from before_action to #index
parent
899a8095
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
8 deletions
+2
-8
app/controllers/projects/clusters_controller.rb
app/controllers/projects/clusters_controller.rb
+2
-8
No files found.
app/controllers/projects/clusters_controller.rb
View file @
3de1ba6c
class
Projects::ClustersController
<
Projects
::
ApplicationController
before_action
:cluster
,
except:
[
:login
,
:index
,
:new
,
:new_gcp
,
:create
]
before_action
:clusters
,
only:
[
:index
]
before_action
:authorize_read_cluster!
before_action
:authorize_create_cluster!
,
only:
[
:new
,
:new_gcp
,
:create
]
before_action
:authorize_google_api
,
only:
[
:new_gcp
,
:create
]
...
...
@@ -8,8 +7,9 @@ class Projects::ClustersController < Projects::ApplicationController
before_action
:authorize_admin_cluster!
,
only:
[
:destroy
]
def
index
@clusters
=
Kaminari
.
paginate_array
(
@clusters
).
page
(
params
[
:page
]).
per
(
20
)
@scope
=
params
[
:scope
]
clusters
=
ClustersFinder
.
new
(
project
,
current_user
,
@scope
).
execute
@clusters
=
clusters
.
page
(
params
[
:page
]).
per
(
20
)
@active_count
=
project
.
clusters
.
enabled
.
count
@inactive_count
=
project
.
clusters
.
disabled
.
count
@all_count
=
@active_count
+
@inactive_count
...
...
@@ -102,12 +102,6 @@ class Projects::ClustersController < Projects::ApplicationController
@cluster
||=
project
.
clusters
.
find_by
(
id:
params
[
:id
])
&
.
present
(
current_user:
current_user
)
||
render_404
end
def
clusters
@scope
=
params
[
:scope
]
||
'all'
scope
=
@scope
&
.
to_sym
@clusters
=
ClustersFinder
.
new
(
project
,
current_user
,
scope
).
execute
end
def
create_params
params
.
require
(
:cluster
).
permit
(
: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