Commit 058e5957 authored by Shinya Maeda's avatar Shinya Maeda

Delete/Update basic implementation

parent 5fbf4069
......@@ -12,7 +12,7 @@ class Projects::ClustersController < Projects::ApplicationController
def index
if cluster
redirect_to action: 'edit'
redirect_to edit_namespace_project_cluster_path(project.namespace, project, cluster.id)
else
redirect_to action: 'new'
end
......@@ -86,10 +86,16 @@ class Projects::ClustersController < Projects::ApplicationController
end
def update
cluster.update(schedule_params)
cluster.update(enabled: params['enabled'])
cluster.service.update(active: params['enabled'])
render :edit
end
def destroy
cluster.destroy
redirect_to action: 'index'
end
private
def cluster
......
......@@ -2,3 +2,6 @@ edit/show cluster
%br
= @cluster.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
......@@ -183,10 +183,9 @@ constraints(ProjectUrlConstrainer.new) do
end
end
resources :clusters, except: [:edit, :show, :destroy] do
resources :clusters, except: [:show] do
collection do
get :login
get :edit
end
end
......
......@@ -29,7 +29,7 @@ class CreateCiClusters < ActiveRecord::Migration
t.datetime_with_timezone :updated_at, null: false
end
# TODO: fk, index, encypt
# TODO: fk, index, attr_encrypted
add_foreign_key :ci_clusters, :projects
add_foreign_key :ci_clusters, :users, column: :owner_id
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment