wip(ui/workflows): visual editor on the binary's API (#2061)
This commit is contained in:
27 files changed
+895
-1308
No files matched your search
@@ -3,10 +3,8 @@ import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import ApplyStatusRows from "./ApplyStatusRows.vue";
|
||||
import KindGate from "./KindGate.vue";
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { RotateCcw } from "@lucide/vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { DurationInput, formatGoDuration, parseGoDuration } from "@/components/ui/duration-input";
|
||||
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel } from "@/components/ui/field";
|
||||
@@ -17,18 +15,7 @@ import {
|
||||
NumberFieldIncrement,
|
||||
NumberFieldInput,
|
||||
} from "@/components/ui/number-field";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { cloneControlPlaneValue, resourcesForPage, useSettingsStore } from "@/stores/settings";
|
||||
import { restoreShippedDefinitions, useWorkflowsStore } from "@/stores/workflows";
|
||||
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
|
||||
import DraftHint from "./DraftHint.vue";
|
||||
import HistoryLink from "./HistoryLink.vue";
|
||||
|
||||
@@ -71,12 +58,6 @@ function durationSeconds(text: string): number | undefined {
|
||||
const ms = parseGoDuration(text);
|
||||
return ms === null ? undefined : Math.round(ms / 1000);
|
||||
}
|
||||
|
||||
const workflows = useWorkflowsStore();
|
||||
const confirmRestore = ref(false);
|
||||
async function restoreWorkflows(): Promise<void> {
|
||||
await workflows.save(cloneControlPlaneValue(restoreShippedDefinitions(workflows.collection, workflows.shipped)));
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -170,29 +151,5 @@ async function restoreWorkflows(): Promise<void> {
|
||||
</limitsForm.Field>
|
||||
</FieldGroup>
|
||||
|
||||
<FieldGroup v-if="workflows.shipped.definitions.length" class="@container/field-group">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent>
|
||||
<FieldLabel>Workflows</FieldLabel>
|
||||
<FieldDescription>Resets every shipped workflow. Custom workflows are kept.</FieldDescription>
|
||||
</FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Button variant="outline" size="sm" :disabled="workflows.state.saving" @click="confirmRestore = true"><RotateCcw data-icon="inline-start" />Restore default</Button>
|
||||
</div>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
<AlertDialog v-model:open="confirmRestore">
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Restore default workflows?</AlertDialogTitle>
|
||||
<AlertDialogDescription>Edits to shipped workflows are discarded.</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction @click="restoreWorkflows">Restore</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
<Alert v-if="workflows.state.error" variant="destructive"><AlertDescription>{{ workflows.state.error }}</AlertDescription></Alert>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user