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
058e5957
Commit
058e5957
authored
Sep 27, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete/Update basic implementation
parent
5fbf4069
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
5 deletions
+13
-5
app/controllers/projects/clusters_controller.rb
app/controllers/projects/clusters_controller.rb
+8
-2
app/views/projects/clusters/edit.html.haml
app/views/projects/clusters/edit.html.haml
+3
-0
config/routes/project.rb
config/routes/project.rb
+1
-2
db/migrate/20170924094327_create_ci_clusters.rb
db/migrate/20170924094327_create_ci_clusters.rb
+1
-1
No files found.
app/controllers/projects/clusters_controller.rb
View file @
058e5957
...
@@ -12,7 +12,7 @@ class Projects::ClustersController < Projects::ApplicationController
...
@@ -12,7 +12,7 @@ class Projects::ClustersController < Projects::ApplicationController
def
index
def
index
if
cluster
if
cluster
redirect_to
action:
'edit'
redirect_to
edit_namespace_project_cluster_path
(
project
.
namespace
,
project
,
cluster
.
id
)
else
else
redirect_to
action:
'new'
redirect_to
action:
'new'
end
end
...
@@ -86,10 +86,16 @@ class Projects::ClustersController < Projects::ApplicationController
...
@@ -86,10 +86,16 @@ class Projects::ClustersController < Projects::ApplicationController
end
end
def
update
def
update
cluster
.
update
(
schedule_params
)
cluster
.
update
(
enabled:
params
[
'enabled'
])
cluster
.
service
.
update
(
active:
params
[
'enabled'
])
render
:edit
render
:edit
end
end
def
destroy
cluster
.
destroy
redirect_to
action:
'index'
end
private
private
def
cluster
def
cluster
...
...
app/views/projects/clusters/edit.html.haml
View file @
058e5957
...
@@ -2,3 +2,6 @@ edit/show cluster
...
@@ -2,3 +2,6 @@ edit/show cluster
%br
%br
=
@cluster
.
inspect
=
@cluster
.
inspect
=
@cluster
.
service
.
inspect
=
@cluster
.
service
.
inspect
=
link_to
"Enable"
,
namespace_project_cluster_path
(
@project
.
namespace
,
@project
,
@cluster
.
id
,
enabled:
'true'
),
method: :put
=
link_to
"Disable"
,
namespace_project_cluster_path
(
@project
.
namespace
,
@project
,
@cluster
.
id
,
enabled:
'false'
),
method: :put
=
link_to
"Soft-delete the cluster"
,
namespace_project_cluster_path
(
@project
.
namespace
,
@project
,
@cluster
.
id
),
method: :delete
config/routes/project.rb
View file @
058e5957
...
@@ -183,10 +183,9 @@ constraints(ProjectUrlConstrainer.new) do
...
@@ -183,10 +183,9 @@ constraints(ProjectUrlConstrainer.new) do
end
end
end
end
resources
:clusters
,
except:
[
:
edit
,
:show
,
:destroy
]
do
resources
:clusters
,
except:
[
:
show
]
do
collection
do
collection
do
get
:login
get
:login
get
:edit
end
end
end
end
...
...
db/migrate/20170924094327_create_ci_clusters.rb
View file @
058e5957
...
@@ -29,7 +29,7 @@ class CreateCiClusters < ActiveRecord::Migration
...
@@ -29,7 +29,7 @@ class CreateCiClusters < ActiveRecord::Migration
t
.
datetime_with_timezone
:updated_at
,
null:
false
t
.
datetime_with_timezone
:updated_at
,
null:
false
end
end
# TODO: fk, index,
encypt
# TODO: fk, index,
attr_encrypted
add_foreign_key
:ci_clusters
,
:projects
add_foreign_key
:ci_clusters
,
:projects
add_foreign_key
:ci_clusters
,
:users
,
column: :owner_id
add_foreign_key
:ci_clusters
,
:users
,
column: :owner_id
...
...
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