fix(ui): trim workflow and log captions, select components for event binding
This commit is contained in:
1 parent
e6e1fe0075
commit
5f19a95a9e
10 files changed
+47
-54
No files matched your search
@@ -4,8 +4,7 @@ import { meta, streamKind, streamState } from "./state";
|
||||
|
||||
/**
|
||||
* What the list is showing, and the state of the stream that is supposed to be
|
||||
* adding to it. The two belong together: "Live only" says nothing on its own
|
||||
* when the stream behind those lines has stopped.
|
||||
* adding to it: the lines mean nothing without it.
|
||||
*/
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
// What the logs list says when it has nothing to show.
|
||||
//
|
||||
// Three different situations produced one message, which is how the page ended
|
||||
// up promising that "live daemon logs will appear here" while the stream that
|
||||
// would deliver them had already given up (archie-core-c5bz).
|
||||
// What the logs list says when it has nothing to show: a dead stream, a
|
||||
// deployment with no durable history, or filters that match nothing.
|
||||
|
||||
/**
|
||||
* logsEmptyTitle names the situation: a dead stream, a deployment with no
|
||||
* durable history, or filters that match nothing.
|
||||
*/
|
||||
/** logsEmptyTitle names the situation. */
|
||||
export function logsEmptyTitle(
|
||||
durableUnavailable: boolean,
|
||||
streamState: string,
|
||||
@@ -17,10 +11,7 @@ export function logsEmptyTitle(
|
||||
return "Nothing matches";
|
||||
}
|
||||
|
||||
/**
|
||||
* logsEmptyDetail says what to expect next, and never promises live logs from
|
||||
* a stream that has stopped.
|
||||
*/
|
||||
/** The line under the title: what to expect next. */
|
||||
export function logsEmptyDetail(
|
||||
durableUnavailable: boolean,
|
||||
streamState: string,
|
||||
@@ -29,7 +20,7 @@ export function logsEmptyDetail(
|
||||
return "This process is not delivering live daemon logs.";
|
||||
}
|
||||
if (durableUnavailable) {
|
||||
return "This deployment keeps no durable history. Live daemon logs appear here while the page is open.";
|
||||
return "This deployment keeps no durable history.";
|
||||
}
|
||||
return "Try a wider level or clear the search.";
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { ArrowLeft, Braces, Type } from "@lucide/vue";
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
type InputRow,
|
||||
type InputSpec,
|
||||
} from "./bind-event";
|
||||
import OptionSelect from "./OptionSelect.vue";
|
||||
import { workflowField } from "./workflow-edit";
|
||||
|
||||
const props = defineProps<{ yaml: string; binding: Binding | null }>();
|
||||
@@ -44,6 +45,13 @@ const repository = computed(() => takesRepository({ id: "", name: "", repository
|
||||
const sources = ref<string[]>([]);
|
||||
// The operator's label for each source path, where one is set.
|
||||
const sourceNames = ref<Record<string, string>>({});
|
||||
// The placeholder travels as an empty option, which a Select cannot hold: it
|
||||
// reserves that value for clearing, so OptionSelect carries it as a sentinel.
|
||||
const sourceOptions = computed(() => [
|
||||
{ value: "", label: "Pick a source", disabled: true },
|
||||
...sources.value.map((path) => ({ value: path, label: sourceNames.value[path] ? `${sourceNames.value[path]} (${path})` : path })),
|
||||
{ value: NEW_SOURCE, label: "New source…" },
|
||||
]);
|
||||
const captures = ref<Capture[]>([]);
|
||||
const eventTypes = ref<EventType[]>([]);
|
||||
const mappings = ref<Mapping[]>([]);
|
||||
@@ -57,7 +65,7 @@ const rows = ref<Record<string, InputRow>>({});
|
||||
const repositoryPath = ref("");
|
||||
const preview = ref<Preview | null>(null);
|
||||
const saving = ref(false);
|
||||
const confirmRemove=ref(false);
|
||||
const confirmRemove = ref(false);
|
||||
const creatingSource = ref(false);
|
||||
const revealed = ref<Source | null>(null);
|
||||
const error = ref("");
|
||||
@@ -223,12 +231,18 @@ async function transition(command: (id: string) => Promise<unknown>, next: strin
|
||||
error.value = err instanceof Error ? err.message : String(err);
|
||||
}
|
||||
}
|
||||
async function removeBinding():Promise<void>{
|
||||
if(!props.binding)return;
|
||||
saving.value=true;error.value="";
|
||||
try{await api.bindingDelete(props.binding.id);emit("saved")}
|
||||
catch(cause){error.value=cause instanceof Error?cause.message:String(cause)}
|
||||
finally{saving.value=false}
|
||||
async function removeBinding(): Promise<void> {
|
||||
if (!props.binding) return;
|
||||
saving.value = true;
|
||||
error.value = "";
|
||||
try {
|
||||
await api.bindingDelete(props.binding.id);
|
||||
emit("saved");
|
||||
} catch (cause) {
|
||||
error.value = cause instanceof Error ? cause.message : String(cause);
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
const approve = () => transition(api.bindingApprove, "armed");
|
||||
const pause = () => transition(api.bindingPause, "paused");
|
||||
@@ -250,11 +264,7 @@ const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
<form v-else class="flex-1 space-y-5 overflow-y-auto px-4 py-4" @submit.prevent="save">
|
||||
<section class="space-y-1.5">
|
||||
<label for="bind-source" class="text-xs font-medium text-muted-foreground">Source</label>
|
||||
<NativeSelect size="sm" id="bind-source" v-model="source" class="w-full" :disabled="!!binding">
|
||||
<NativeSelectOption value="" disabled>Pick a source</NativeSelectOption>
|
||||
<NativeSelectOption v-for="path in sources" :key="path" :value="path">{{ sourceNames[path] ? `${sourceNames[path]} (${path})` : path }}</NativeSelectOption>
|
||||
<NativeSelectOption :value="NEW_SOURCE">New source…</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<OptionSelect id="bind-source" aria-label="Source" :model-value="source" :options="sourceOptions" class="w-full" :disabled="!!binding" @update:model-value="source = $event" />
|
||||
<Input
|
||||
v-if="source === NEW_SOURCE"
|
||||
v-model="newSource"
|
||||
@@ -269,9 +279,12 @@ const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
|
||||
<section v-if="sourcePath" class="space-y-1.5">
|
||||
<label for="bind-capture" class="text-xs font-medium text-muted-foreground">Example event</label>
|
||||
<NativeSelect size="sm" v-if="sourceCaptures.length" id="bind-capture" v-model="captureId" class="w-full">
|
||||
<NativeSelectOption v-for="c in sourceCaptures" :key="c.id" :value="c.id">#{{ c.id }} · {{ when(c.received_at) }}{{ c.event_type ? "" : " · unidentified" }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<Select v-if="sourceCaptures.length" :model-value="captureId ?? undefined" @update:model-value="captureId = String($event)">
|
||||
<SelectTrigger id="bind-capture" size="sm" class="w-full" aria-label="Example event"><SelectValue placeholder="Pick an event" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="c in sourceCaptures" :key="c.id" :value="String(c.id)">#{{ c.id }} · {{ when(c.received_at) }}{{ c.event_type ? "" : " · unidentified" }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<p v-else class="text-xs text-fg-subtle" :title="`Send an event to ${hookURL} and it appears here`">No events</p>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
} from "@/components/ui/card";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
@@ -40,9 +39,6 @@ const rows = computed(() => failingStages(props.stages));
|
||||
<Empty v-if="!rows.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No failures recorded</EmptyTitle>
|
||||
<EmptyDescription
|
||||
>No failures.</EmptyDescription
|
||||
>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<Table v-else>
|
||||
|
||||
@@ -141,7 +141,7 @@ const scopedLogs = computed(() => logs.value ? { ...logs.value, entries: (logs.v
|
||||
<ChangeCapture v-for="(capture, i) in captures" :key="i" :capture="capture" :task="task" />
|
||||
</section>
|
||||
<section class="space-y-2">
|
||||
<h3 class="text-xs font-medium text-muted-foreground">Log <span>· stage-tagged lines</span></h3>
|
||||
<h3 class="text-xs font-medium text-muted-foreground">Log</h3>
|
||||
<TaskLogs :state="scopedLogs" :attempt="attempt" :filterable="false" />
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -404,7 +404,7 @@ function syncScroll(event: Event): void {
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" class="w-48">
|
||||
<DropdownMenuItem v-if="dirty" :disabled="archieWorking" @select="discard"><RotateCcw />Discard draft</DropdownMenuItem>
|
||||
<DropdownMenuItem v-if="shippedEntry" @select="restoreOne"><RotateCcw />Restore Defaults</DropdownMenuItem>
|
||||
<DropdownMenuItem v-if="shippedEntry" @select="restoreOne"><RotateCcw />Restore default</DropdownMenuItem>
|
||||
<DropdownMenuSeparator v-if="dirty || shippedEntry" />
|
||||
<DropdownMenuItem variant="destructive" @select="confirmDelete = true"><Trash2 />Delete workflow</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
|
||||
@@ -169,7 +169,6 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
<Button size="icon-sm" aria-label="New workflow" title="New workflow" @click="create"><Plus /></Button>
|
||||
</PageHeader>
|
||||
|
||||
|
||||
<div v-if="error || store.error" class="mb-4 text-sm text-danger" role="alert">
|
||||
<p>{{ error || store.error }}</p>
|
||||
<Button variant="outline" size="sm" @click="load(); store.load()">Retry</Button>
|
||||
@@ -177,8 +176,8 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
<p v-if="loading || (!store.state.resource && !store.error)" class="text-sm text-fg-muted" role="status">Loading workflows…</p>
|
||||
|
||||
<div class="grid items-start gap-6 lg:grid-cols-[24rem_minmax(0,1fr)]">
|
||||
<ul class="flex gap-1 overflow-x-auto pb-2 max-lg:hidden lg:flex-col lg:gap-0.5 lg:overflow-visible lg:pb-0" aria-label="Workflows">
|
||||
<li v-for="row in rows" :key="row.id" class="shrink-0 lg:min-w-0">
|
||||
<ul class="hidden flex-col gap-0.5 lg:flex" aria-label="Workflows">
|
||||
<li v-for="row in rows" :key="row.id" class="min-w-0">
|
||||
<button
|
||||
type="button"
|
||||
:aria-current="row.id === selected ? 'true' : undefined"
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* and how one field's text becomes the typed value the daemon checks.
|
||||
*
|
||||
* A workflow is startable only by naming what it declares. pr-review requires
|
||||
* pr_number, so a request that does not set it is refused by the handler
|
||||
* (archie-core-06nq) rather than admitted and then parked at dispatch. The
|
||||
* declaration comes from the definitions endpoint, so a workflow that starts
|
||||
* declaring inputs needs no change here.
|
||||
* pr_number, so a request that does not set it is refused by the handler rather
|
||||
* than admitted and then parked at dispatch. The declaration comes from the
|
||||
* definitions endpoint, so a workflow that starts declaring inputs needs no
|
||||
* change here.
|
||||
*/
|
||||
|
||||
import type { WorkflowDefinition } from "./workflow-rows";
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
// Merging workflow definitions with their run statistics.
|
||||
//
|
||||
// The rows used to come from the definition list alone, so a workflow that had
|
||||
// run but was no longer in that list (or a definitions fetch that came back
|
||||
// empty while the stats fetch succeeded) produced no rows at all. The page then
|
||||
// showed "No workflow runs yet" directly above the stage tables listing those
|
||||
// very runs (archie-core-rcbf).
|
||||
//
|
||||
// A run is evidence the workflow exists. Anything with either a definition or
|
||||
// statistics gets a row.
|
||||
// A run is evidence the workflow exists: anything with either a definition or
|
||||
// statistics gets a row, so a workflow that has run but is no longer listed
|
||||
// still appears.
|
||||
|
||||
/** A workflow's run statistics, as the stats endpoint reports them. */
|
||||
export interface WorkflowStats {
|
||||
|
||||
@@ -32,7 +32,7 @@ export interface StepTypeInfo {
|
||||
settings?: SettingsSchema;
|
||||
}
|
||||
|
||||
/** One chip in the read-only Steps preview. */
|
||||
/** One parsed step, for the counts the editor needs. */
|
||||
export interface WorkflowStepChip {
|
||||
/** 1-based, the position the server's own errors use. */
|
||||
index: number;
|
||||
|
||||
Reference in new issue
Block a user