Refactor frontend overlays
Test and deploy / test (push) Successful in 1m39s
Test and deploy / deploy (push) Successful in 26s

This commit is contained in:
2026-10-15 12:40:56 +01:00
parent ca3cd4db30
commit 3da49f4b24
13 changed files with 528 additions and 129 deletions
+17 -1
View File
@@ -19,12 +19,15 @@ import { ref, reactive, computed, onMounted, onUnmounted } from "vue";
import { api } from "@/api";
import Button from "@/components/input/Button.vue";
import SecretReveal from "@/components/admin/SecretReveal.vue";
import ConfirmDialog from "@/components/util/ConfirmDialog.vue";
import "./env.css";
const groups = ref([]);
const status = ref(null);
const error = ref("");
const loading = ref(true);
const applyConfirmationOpen = ref(false);
const applyConfirmation = ref({ title: "Apply changes", message: "", confirmLabel: "Apply" });
// Staged edits, none of which exist anywhere but this component until Apply.
// drafts: name -> text in the row's input
@@ -127,7 +130,12 @@ async function apply() {
`This recreates: ${affectedServices.value.join(", ")}. The site's API is unavailable for a few seconds.`,
...warnings,
];
if (!confirm(lines.join("\n"))) return;
applyConfirmation.value = { title: "Apply environment changes", message: lines.join("\n"), confirmLabel: "Apply" };
applyConfirmationOpen.value = true;
}
async function confirmApply() {
applyConfirmationOpen.value = false;
const body = { set: {}, generate: [] };
for (const { change } of changes.value) {
@@ -377,6 +385,14 @@ onUnmounted(stopPolling);
<Button class="px-2 env-apply" @click="apply">Apply</Button>
</div>
</footer>
<ConfirmDialog
v-if="applyConfirmationOpen"
v-model="applyConfirmationOpen"
:title="applyConfirmation.title"
:message="applyConfirmation.message"
:confirm-label="applyConfirmation.confirmLabel"
@confirm="confirmApply"
/>
</div>
</template>
+22 -1
View File
@@ -10,12 +10,23 @@
*/
import { usePagesStore } from "@/stores/pages";
import PageForm from "@/views/canvas/PageForm.vue";
import { ref } from "vue";
import ConfirmDialog from "@/components/util/ConfirmDialog.vue";
const pages = usePagesStore();
pages.fetch();
const removeTarget = ref(null);
const confirmationOpen = ref(false);
async function remove(page) {
if (!confirm(`Delete the page “${page.title}” and everything on it?`)) return;
removeTarget.value = page;
confirmationOpen.value = true;
}
async function confirmRemove() {
const page = removeTarget.value;
removeTarget.value = null;
if (!page) return;
try {
await pages.remove(page.id);
} catch (err) {
@@ -61,5 +72,15 @@ async function remove(page) {
<h1>New page</h1>
<PageForm />
</section>
<ConfirmDialog
v-if="removeTarget"
v-model="confirmationOpen"
title="Delete page"
:message="`Delete the page “${removeTarget.title}” and everything on it?`"
confirm-label="Delete"
@confirm="confirmRemove"
@cancel="removeTarget = null"
/>
</div>
</template>