fix(ui): plus-only new workflow; restore default workflows moves to task settings

This commit is contained in:
sam committed 2026-10-18 13:18:21 +11:00
1 parent e3147801b0
commit a9cc2c07de
3 files changed
+113 -119

No files matched your search

+36 -2
View File
@@ -1,6 +1,7 @@
<script setup lang="ts">
import ApplyStatusRows from "./ApplyStatusRows.vue";
import { computed, onMounted } from "vue";
import { computed, onMounted, ref } from "vue";
import { RotateCcw } from "@lucide/vue";
import { storeToRefs } from "pinia";
import { Button } from "@/components/ui/button";
@@ -16,7 +17,18 @@ import {
NumberFieldInput,
} from "@/components/ui/number-field";
import { SettingRow } from "@/components/ui/setting-row";
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
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 DraftHint from "./DraftHint.vue";
import HistoryLink from "./HistoryLink.vue";
import SecretRefField from "./SecretRefField.vue";
@@ -52,6 +64,12 @@ function seconds(key: "max_runtime_seconds" | "max_task_runtime_seconds") {
}
const callRuntime = seconds("max_runtime_seconds");
const taskRuntime = seconds("max_task_runtime_seconds");
const workflows = useWorkflowsStore();
const confirmRestore = ref(false);
async function restoreWorkflows(): Promise<void> {
await workflows.save(cloneControlPlaneValue(restoreShippedDefinitions(workflows.collection, workflows.shipped)));
}
</script>
<template>
@@ -127,5 +145,21 @@ const taskRuntime = seconds("max_task_runtime_seconds");
</div>
</SettingRow>
</template>
<SettingRow v-if="workflows.shipped.definitions.length" label="Workflows" hint="Resets every shipped workflow. Custom workflows are kept.">
<Button variant="outline" size="sm" :disabled="workflows.state.saving" @click="confirmRestore = true"><RotateCcw data-icon="inline-start" />Restore default</Button>
</SettingRow>
<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>
<p v-if="workflows.state.error" class="text-sm text-danger" role="alert">{{ workflows.state.error }}</p>
</div>
</template>