155 lines
7.1 KiB
Plaintext
155 lines
7.1 KiB
Plaintext
<% if @edit_perm %>
|
|
<div class="p-6">
|
|
<div class="md:flex md:items-center md:justify-between pb-2 lg:pb-4">
|
|
<div class="min-w-0 flex-1">
|
|
<h3 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-2xl sm:tracking-tight">
|
|
Maintenance Window
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
<div class="overflow-hidden rounded-lg shadow ring-1 ring-black ring-opacity-5 bg-white divide-y divide-gray-200">
|
|
<div class="px-4 py-5 sm:p-6">
|
|
<form action="<%= "#{@project_data[:path]}#{@pg.path}/set-maintenance-window" %>" role="form" method="POST">
|
|
<%== csrf_tag("#{@project_data[:path]}#{@pg.path}/set-maintenance-window") %>
|
|
<div class="space-y-4">
|
|
<div class="grid grid-cols-12 gap-6">
|
|
<div class="col-span-12 sm:col-span-7">
|
|
<%== part(
|
|
"components/form/select",
|
|
name: "maintenance_window_start_at",
|
|
placeholder: "No Maintenance Window",
|
|
options:
|
|
(0..23).map do
|
|
[it, "#{"%02d" % it}:00 - #{"%02d" % ((it + PostgresResource::MAINTENANCE_DURATION_IN_HOURS) % 24)}:00 (UTC)"]
|
|
end,
|
|
label: "Maintenance Window:",
|
|
selected: @pg.maintenance_window_start_at
|
|
) %>
|
|
</div>
|
|
<div class="col-span-12 sm:col-span-5 flex justify-end items-end">
|
|
<%== part("components/form/submit_button", text: "Set") %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<!-- Danger Zone -->
|
|
<% if @edit_perm || @delete_perm %>
|
|
<div class="p-6">
|
|
<div class="md:flex md:items-center md:justify-between pb-2 lg:pb-4">
|
|
<div class="min-w-0 flex-1">
|
|
<h3 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-2xl sm:tracking-tight">
|
|
Danger Zone
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
<div class="overflow-hidden rounded-lg shadow ring-1 ring-black ring-opacity-5 bg-white divide-y divide-gray-200">
|
|
<!-- Promote -->
|
|
<% if @edit_perm && @pg.read_replica? %>
|
|
<div class="px-4 py-5 sm:p-6">
|
|
<form action="<%= "#{@project_data[:path]}#{@pg.path}/promote" %>" role="form" method="POST">
|
|
<%== csrf_tag("#{@project_data[:path]}#{@pg.path}/promote") %>
|
|
<div class="sm:flex sm:items-center sm:justify-between">
|
|
<div>
|
|
<h3 class="text-base font-semibold leading-6 text-gray-900">Promote PostgreSQL read replica database</h3>
|
|
<div class="mt-2 text-sm text-gray-500">
|
|
<p>This action will promote and restart the PostgreSQL database. The database will stop replicating
|
|
permanently. It will be offline momentarily, and all connections will be dropped.</p>
|
|
</div>
|
|
</div>
|
|
<div id="postgres-replica-promote-<%=@pg.ubid %>" class="mt-5 sm:ml-6 sm:mt-0 sm:flex sm:flex-shrink-0 sm:items-center">
|
|
<div class="col-span-12 sm:col-span-2 flex justify-end items-end">
|
|
<%== part("components/form/submit_button", text: "Promote", extra_class: "promote-btn") %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<% end %>
|
|
<!-- Reset password -->
|
|
<% if @edit_perm && !@pg.read_replica? %>
|
|
<div class="px-4 py-5 sm:p-6">
|
|
<form action="<%= "#{@project_data[:path]}#{@pg.path}/reset-superuser-password" %>" role="form" method="POST">
|
|
<%== csrf_tag("#{@project_data[:path]}#{@pg.path}/reset-superuser-password") %>
|
|
<div class="space-y-4">
|
|
<div>
|
|
<h3 class="text-base font-semibold leading-6 text-gray-900">Reset superuser password</h3>
|
|
</div>
|
|
<div class="grid grid-cols-12 gap-6">
|
|
<div class="col-span-12 sm:col-span-5">
|
|
<%== part(
|
|
"components/form/text",
|
|
label: "New password",
|
|
name: "password",
|
|
type: "password",
|
|
attributes: {
|
|
required: true
|
|
},
|
|
extra_class: "reset-superuser-password-new-password"
|
|
) %>
|
|
</div>
|
|
<div class="col-span-12 sm:col-span-5">
|
|
<%== part(
|
|
"components/form/text",
|
|
label: "New password (repeat)",
|
|
name: "repeat_password",
|
|
type: "password",
|
|
attributes: {
|
|
required: true
|
|
},
|
|
extra_class: "reset-superuser-password-new-password-repeat"
|
|
) %>
|
|
</div>
|
|
<div class="col-span-12 sm:col-span-2 flex justify-end items-end">
|
|
<%== part("components/form/submit_button", text: "Reset") %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<% end %>
|
|
<!-- Restart Card -->
|
|
<% if @edit_perm %>
|
|
<div class="px-4 py-5 sm:p-6">
|
|
<form action="<%= "#{@project_data[:path]}#{@pg.path}/restart" %>" role="form" method="POST">
|
|
<%== csrf_tag("#{@project_data[:path]}#{@pg.path}/restart") %>
|
|
<div class="sm:flex sm:items-center sm:justify-between">
|
|
<div>
|
|
<h3 class="text-base font-semibold leading-6 text-gray-900">Restart PostgreSQL database</h3>
|
|
<div class="mt-2 text-sm text-gray-500">
|
|
<p>This action will restart the PostgreSQL database. The database will be offline momentarily, and all
|
|
connections will be dropped.</p>
|
|
</div>
|
|
</div>
|
|
<div id="postgres-restart-<%=@pg.ubid %>" class="mt-5 sm:ml-6 sm:mt-0 sm:flex sm:flex-shrink-0 sm:items-center">
|
|
<div class="col-span-12 sm:col-span-2 flex justify-end items-end">
|
|
<%== part("components/form/submit_button", text: "Restart", extra_class: "restart-btn") %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<% end %>
|
|
<!-- Delete Card -->
|
|
<% if @delete_perm %>
|
|
<div class="px-4 py-5 sm:p-6">
|
|
<div class="sm:flex sm:items-center sm:justify-between">
|
|
<div>
|
|
<h3 class="text-base font-semibold leading-6 text-gray-900">Delete PostgreSQL database</h3>
|
|
<div class="mt-2 text-sm text-gray-500">
|
|
<p>This action will permanently delete this PostgreSQL database.</p>
|
|
</div>
|
|
</div>
|
|
<div id="postgres-delete-<%=@pg.ubid %>" class="mt-5 sm:ml-6 sm:mt-0 sm:flex sm:flex-shrink-0 sm:items-center">
|
|
<%== part("components/delete_button", url: "#{@project_data[:path]}#{@pg.path}", confirmation: @pg.name, redirect: "#{@project_data[:path]}/postgres") %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|