feat(ui): schedules table, runs page and Schedule trigger
Schedules list as a table with enable, run now, edit, duplicate, delete and view runs; built-ins only enable, retime and run. The runs page links each run's tasks through its capture's dispatches. The Start node gains a Schedule trigger that picks or creates a schedule and binds the schedule source to the workflow. Times show in a per-browser display zone set under Appearance; the cron time zone and run retention are edited on the Schedules page.
This commit is contained in:
52 files changed
+1425
-131
No files matched your search
@@ -1,23 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { ago } from "@/lib/format";
|
||||
import { ago, exactTime } from "@/lib/format";
|
||||
import { useAppearanceStore } from "@/stores/appearance";
|
||||
|
||||
/**
|
||||
* A point in time, shown relative ("5 mins ago") with the exact local date and
|
||||
* time on hover. `absolute` shows the exact time instead, for logs.
|
||||
* A point in time, shown relative ("5 mins ago") with the exact date and time
|
||||
* on hover, in the zone chosen under Appearance. `absolute` shows the exact
|
||||
* time instead, for logs.
|
||||
*/
|
||||
const props = defineProps<{ at: string | number | Date | null | undefined; absolute?: boolean }>();
|
||||
const appearance = useAppearanceStore();
|
||||
|
||||
const date = computed(() => {
|
||||
if (!props.at) return undefined;
|
||||
const value = props.at instanceof Date ? props.at : new Date(props.at);
|
||||
return Number.isNaN(value.getTime()) || value.getFullYear() <= 1 ? undefined : value;
|
||||
});
|
||||
const exact = computed(() => (date.value ? exactTime(date.value, appearance.timeZone) : ""));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<time v-if="date" :datetime="date.toISOString()" :title="date.toLocaleString()" class="tabular-nums">{{
|
||||
absolute ? date.toLocaleString() : ago(date)
|
||||
<time v-if="date" :datetime="date.toISOString()" :title="exact" class="tabular-nums">{{
|
||||
absolute ? exact : ago(date)
|
||||
}}</time>
|
||||
<span v-else aria-label="Unknown">–</span>
|
||||
</template>
|
||||
@@ -0,0 +1,47 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from "vue";
|
||||
import { ChevronsUpDown } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from "@/components/ui/command";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
|
||||
/**
|
||||
* A searchable IANA time zone picker. With `emptyLabel`, the empty value is
|
||||
* offered first under that label.
|
||||
*/
|
||||
const props = defineProps<{ id?: string; emptyLabel?: string; ariaLabel?: string }>();
|
||||
const model = defineModel<string>({ required: true });
|
||||
|
||||
const open = ref(false);
|
||||
const zones = computed(() => {
|
||||
const listed = Intl.supportedValuesOf("timeZone");
|
||||
return listed.includes("UTC") ? listed : ["UTC", ...listed];
|
||||
});
|
||||
const label = computed(() => model.value || props.emptyLabel || "UTC");
|
||||
|
||||
function choose(value: string): void {
|
||||
model.value = value;
|
||||
open.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Popover v-model:open="open">
|
||||
<PopoverTrigger as-child>
|
||||
<Button :id="id" type="button" variant="outline" class="w-64 justify-between font-normal" :aria-label="ariaLabel" role="combobox" :aria-expanded="open">
|
||||
<span class="truncate">{{ label }}</span><ChevronsUpDown data-icon="inline-end" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="start" class="w-64 p-0">
|
||||
<Command>
|
||||
<CommandInput placeholder="Search zones" />
|
||||
<CommandList>
|
||||
<CommandEmpty>No zone matches.</CommandEmpty>
|
||||
<CommandItem v-if="emptyLabel" value="" @select="choose('')">{{ emptyLabel }}</CommandItem>
|
||||
<CommandItem v-for="zone in zones" :key="zone" :value="zone" @select="choose(zone)">{{ zone }}</CommandItem>
|
||||
</CommandList>
|
||||
</Command>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</template>
|
||||
@@ -0,0 +1 @@
|
||||
export { default as ZoneSelect } from "./ZoneSelect.vue";
|
||||
Reference in new issue
Block a user