fix(ui): grey out disabled Publish and give the reason on hover

This commit is contained in:
sam committed 2026-10-18 23:48:42 +11:00
1 parent 62d28d7f77
commit e5b2d38e10
1 file changed
+7 -2
+7 -2
View File
@@ -297,6 +297,9 @@ const parsed = computed(() => parseWorkflowYaml(yaml.value, vocabulary.value));
const stored = computed(() => collection.value.definitions.find((entry) => entry.id === selected.value)?.yaml);
const dirty = computed(() => yaml.value !== (stored.value ?? ""));
const changes = computed(() => (dirty.value ? workflowChanges(stored.value ?? "", yaml.value) : []));
// Disabled buttons swallow hover, so the reason sits on a wrapper's title.
const publishBlocked = computed(() =>
archieWorking.value ? "Archie is editing" : !parsed.value.ok ? validationLabel(parsed.value) : !changes.value.length ? "No changes" : undefined);
const view = ref("canvas");
// What each step lacks, read the way its editor reads it.
const problems = computed(() =>
@@ -434,8 +437,10 @@ function syncScroll(event: Event): void {
<DropdownMenuItem v-if="view === 'canvas' || view === 'yaml'" variant="destructive" @select="confirmDelete = true"><Trash2 />Delete workflow</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<Button v-if="view === 'canvas' || view === 'yaml'" type="submit" size="sm" :disabled="state.saving || !parsed.ok || !changes.length || archieWorking">
<Spinner v-if="state.saving" data-icon="inline-start" />Publish</Button>
<span v-if="view === 'canvas' || view === 'yaml'" class="shrink-0" :title="publishBlocked">
<Button type="submit" size="sm" class="disabled:bg-muted disabled:text-fg-muted disabled:opacity-100" :disabled="state.saving || !!publishBlocked">
<Spinner v-if="state.saving" data-icon="inline-start" />Publish</Button>
</span>
</div>
</div>
<p v-if="runsLoading && !runs.length" class="text-xs text-fg-muted" role="status">Loading recent runs…</p>