diff --git a/src/lib/components/workspace/Models.svelte b/src/lib/components/workspace/Models.svelte index c0489ac99a..6a2db9210e 100644 --- a/src/lib/components/workspace/Models.svelte +++ b/src/lib/components/workspace/Models.svelte @@ -709,11 +709,12 @@
-
{model.name} -
+
import { onMount, onDestroy, getContext } from 'svelte'; + import dayjs from '$lib/dayjs'; + import relativeTime from 'dayjs/plugin/relativeTime'; import { toast } from 'svelte-sonner'; import { goto } from '$app/navigation'; import { WEBUI_NAME, user, config } from '$lib/stores'; @@ -37,6 +39,8 @@ import CheckCircle from '$lib/components/icons/CheckCircle.svelte'; import Minus from '$lib/components/icons/Minus.svelte'; + dayjs.extend(relativeTime); + const { saveAs } = fileSaver; const i18n: typeof i18nType = getContext('i18n'); @@ -197,6 +201,12 @@ showCreateModal = true; }; + const formatLastRun = (automation: AutomationResponse): string => { + return automation.last_run_at + ? dayjs(automation.last_run_at / 1000000).fromNow() + : $i18n.t('Never'); + }; + const getAllAutomations = async () => { let currentPage = 1; let allAutomations: AutomationResponse[] = []; @@ -513,7 +523,7 @@ role="button" tabindex="0" aria-label={$i18n.t('Open automation')} - class="group flex min-h-10 w-full cursor-pointer items-center gap-2 rounded-lg px-1.5 py-1 text-left transition" + class="group flex min-h-8 w-full cursor-pointer items-center gap-2 overflow-hidden rounded-xl px-2 py-1 text-left" on:click={() => { goto(`/automations/${automation.id}`); }} @@ -524,17 +534,42 @@ } }} > -
- -
- {automation.name} +
+
+
+
+ +
+ {automation.name} +
+
+ + +
+ {formatLastRun(automation)} +
+
+
+
+
+
+ +