mirror of
https://github.com/czhu12/canine.git
synced 2025-12-20 10:19:50 -06:00
transfer cluster ownership and make styling consistent
This commit is contained in:
4
TODO.md
4
TODO.md
@@ -9,8 +9,8 @@
|
|||||||
- [ ] Make accidental deletions harder
|
- [ ] Make accidental deletions harder
|
||||||
- [ ] Allow creating a one off pod even if there are no services or deployments yet.
|
- [ ] Allow creating a one off pod even if there are no services or deployments yet.
|
||||||
- [ ] Automatically detect node architecture for build target
|
- [ ] Automatically detect node architecture for build target
|
||||||
- [ ] The IP Address being reported in the DNS mapper is the private, instead of public, IP address.
|
|
||||||
- [ ] Failing to add webhooks to projects in different organizations.
|
- [ ] Failing to add webhooks to projects in different organizations.
|
||||||
- [ ] Github filtering across organizations is not working
|
- [ ] Github filtering across organizations is not working
|
||||||
- [ ] Explore allowing local PC's on DHCP to be a host
|
- [ ] Explore allowing local PC's on DHCP to be a host
|
||||||
- [ ] Button to kill a build
|
- [ ] Button to kill a build
|
||||||
|
- [ ] Deployments API
|
||||||
@@ -2,7 +2,7 @@ class ClustersController < ApplicationController
|
|||||||
before_action :set_cluster, only: [
|
before_action :set_cluster, only: [
|
||||||
:show, :edit, :update, :destroy,
|
:show, :edit, :update, :destroy,
|
||||||
:test_connection, :download_kubeconfig, :logs, :download_yaml,
|
:test_connection, :download_kubeconfig, :logs, :download_yaml,
|
||||||
:retry_install
|
:retry_install, :transfer_ownership
|
||||||
]
|
]
|
||||||
|
|
||||||
# GET /clusters
|
# GET /clusters
|
||||||
@@ -159,6 +159,11 @@ class ClustersController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def transfer_ownership
|
||||||
|
@cluster.update(account_id: params[:cluster][:account_id])
|
||||||
|
redirect_to cluster_url(@cluster), notice: "Cluster ownership transferred successfully"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
|||||||
@@ -29,8 +29,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2 class="text-lg font-bold">Delete Add-on</h2>
|
<h2 class="text-2xl font-bold">Danger zone</h2>
|
||||||
<%= button_to "Uninstall", add_on_path(@add_on), method: :delete, class: "btn btn-error" %>
|
<hr class="mt-3 mb-4 border-t border-base-300" />
|
||||||
|
<div class="mt-6">
|
||||||
|
<%= button_to @add_on, method: :delete, class: "btn btn-error btn-outline group mt-2", form: { data: { turbo_confirm: t("are_you_sure") } } do %>
|
||||||
|
<iconify-icon icon="lucide:trash" height="20" class="text-error group-hover:text-error-content"></iconify-icon>
|
||||||
|
Delete Add-on
|
||||||
|
<% end %>
|
||||||
|
<div class="mt-2 text-sm text-gray-500">
|
||||||
|
This will uninstall the add-on from the cluster (equivalent to `helm uninstall`)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
36
app/views/clusters/_transfer_ownership.html.erb
Normal file
36
app/views/clusters/_transfer_ownership.html.erb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<dialog aria-label="Modal" class="modal" id="transfer_ownership_modal">
|
||||||
|
<div class="modal-box bg-base-300">
|
||||||
|
<form method="dialog">
|
||||||
|
<button aria-label="Close modal" class="btn btn-circle btn-ghost btn-sm absolute right-2 top-2">
|
||||||
|
<iconify-icon icon="lucide:x" height="16"></iconify-icon>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div class="mb-8 w-full text-xl font-bold">Transfer Ownership</div>
|
||||||
|
<div class="my-4">
|
||||||
|
<%= form_with model: cluster, url: transfer_ownership_cluster_path(cluster), method: :post do |f| %>
|
||||||
|
<div class="form-control">
|
||||||
|
<label class="label" for="cluster_account_id">
|
||||||
|
<span class="label-text">Transfer to Account</span>
|
||||||
|
</label>
|
||||||
|
<%= f.select(
|
||||||
|
:account_id,
|
||||||
|
current_user
|
||||||
|
.accounts
|
||||||
|
.select { |account| account.id != cluster.account_id }
|
||||||
|
.map { |account| [account.name, account.id] },
|
||||||
|
{ include_blank: true },
|
||||||
|
required: true,
|
||||||
|
class: "select select-bordered w-full"
|
||||||
|
) %>
|
||||||
|
</div>
|
||||||
|
<div class="form-footer">
|
||||||
|
<%= f.submit "Transfer", class: "btn btn-primary" %>
|
||||||
|
<button class="btn btn-outline" onclick="transfer_ownership_modal.close()">Cancel</button>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form method="dialog" class="modal-backdrop">
|
||||||
|
<button>close</button>
|
||||||
|
</form>
|
||||||
|
</dialog>
|
||||||
@@ -11,10 +11,17 @@
|
|||||||
<div>
|
<div>
|
||||||
<h2 class="text-2xl font-bold">Danger zone</h2>
|
<h2 class="text-2xl font-bold">Danger zone</h2>
|
||||||
<hr class="mt-3 mb-4 border-t border-base-300" />
|
<hr class="mt-3 mb-4 border-t border-base-300" />
|
||||||
|
<div class="mt-6">
|
||||||
|
<%= render "clusters/transfer_ownership", cluster: @cluster %>
|
||||||
|
<button class="btn btn-warning btn-outline mt-2 group" onclick="transfer_ownership_modal.showModal()">
|
||||||
|
<iconify-icon icon="lucide:hand-helping" height="20" class="text-warning group-hover:text-black"></iconify-icon>
|
||||||
|
Transfer Ownership
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<%= button_to @cluster, method: :delete, class: "btn btn-error btn-outline mt-2", form: { data: { turbo_confirm: t("are_you_sure") } } do %>
|
<%= button_to @cluster, method: :delete, class: "btn btn-error btn-outline group mt-2", form: { data: { turbo_confirm: t("are_you_sure") } } do %>
|
||||||
<iconify-icon icon="lucide:trash" height="20" class="text-error-content"></iconify-icon>
|
<iconify-icon icon="lucide:trash" height="20" class="text-error group-hover:text-error-content"></iconify-icon>
|
||||||
Delete Cluster
|
Delete Cluster
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="mt-2 text-sm text-gray-500">
|
<div class="mt-2 text-sm text-gray-500">
|
||||||
|
|||||||
@@ -17,10 +17,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<h2 class="text-2xl font-bold">Danger zone</h2>
|
<h2 class="text-2xl font-bold">Danger zone</h2>
|
||||||
<hr class="mt-3 mb-4 border-t border-base-300" />
|
<hr class="mt-3 mb-4 border-t border-base-300" />
|
||||||
|
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<%= button_to @project, method: :delete, class: "btn btn-error btn-outline mt-2", form: { data: { turbo_confirm: t("are_you_sure") } } do %>
|
<%= button_to @project, method: :delete, class: "btn btn-error btn-outline group mt-2", form: { data: { turbo_confirm: t("are_you_sure") } } do %>
|
||||||
<iconify-icon icon="lucide:trash" height="20" class="text-error-content"></iconify-icon>
|
<iconify-icon icon="lucide:trash" height="20" class="text-error group-hover:text-error-content"></iconify-icon>
|
||||||
Delete Project
|
Delete Project
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
resources :clusters do
|
resources :clusters do
|
||||||
member do
|
member do
|
||||||
|
post :transfer_ownership
|
||||||
get :download_kubeconfig
|
get :download_kubeconfig
|
||||||
get :download_yaml
|
get :download_yaml
|
||||||
get :logs
|
get :logs
|
||||||
|
|||||||
Reference in New Issue
Block a user