refac
This commit is contained in:
1 parent
6fcb38fe2e
commit
421da67446
2 files changed
+48
-12
No files matched your search
@@ -709,11 +709,12 @@
|
|||||||
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||||
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||||
<Tooltip content={model.name} className="min-w-0" placement="top-start">
|
<Tooltip content={model.name} className="min-w-0" placement="top-start">
|
||||||
<div
|
<a
|
||||||
|
href={`/?model=${encodeURIComponent(model.id)}`}
|
||||||
class="truncate text-[13px] leading-5 text-gray-800 group-hover:underline dark:text-gray-200"
|
class="truncate text-[13px] leading-5 text-gray-800 group-hover:underline dark:text-gray-200"
|
||||||
>
|
>
|
||||||
{model.name}
|
{model.name}
|
||||||
</div>
|
</a>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy, getContext } from 'svelte';
|
import { onMount, onDestroy, getContext } from 'svelte';
|
||||||
|
|
||||||
|
import dayjs from '$lib/dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { WEBUI_NAME, user, config } from '$lib/stores';
|
import { WEBUI_NAME, user, config } from '$lib/stores';
|
||||||
@@ -37,6 +39,8 @@
|
|||||||
import CheckCircle from '$lib/components/icons/CheckCircle.svelte';
|
import CheckCircle from '$lib/components/icons/CheckCircle.svelte';
|
||||||
import Minus from '$lib/components/icons/Minus.svelte';
|
import Minus from '$lib/components/icons/Minus.svelte';
|
||||||
|
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
const { saveAs } = fileSaver;
|
const { saveAs } = fileSaver;
|
||||||
|
|
||||||
const i18n: typeof i18nType = getContext('i18n');
|
const i18n: typeof i18nType = getContext('i18n');
|
||||||
@@ -197,6 +201,12 @@
|
|||||||
showCreateModal = true;
|
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 () => {
|
const getAllAutomations = async () => {
|
||||||
let currentPage = 1;
|
let currentPage = 1;
|
||||||
let allAutomations: AutomationResponse[] = [];
|
let allAutomations: AutomationResponse[] = [];
|
||||||
@@ -513,7 +523,7 @@
|
|||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
aria-label={$i18n.t('Open automation')}
|
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={() => {
|
on:click={() => {
|
||||||
goto(`/automations/${automation.id}`);
|
goto(`/automations/${automation.id}`);
|
||||||
}}
|
}}
|
||||||
@@ -524,17 +534,42 @@
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="min-w-0 flex-1">
|
<div class="flex min-w-0 flex-1 items-center gap-1 overflow-hidden">
|
||||||
<Tooltip content={automation.name} placement="top-start">
|
<div class="flex min-w-0 flex-1 flex-col overflow-hidden">
|
||||||
<div
|
<div class="flex min-w-0 items-center gap-2 overflow-hidden">
|
||||||
class="truncate text-[13px] leading-5 text-gray-800 group-hover:underline dark:text-gray-200"
|
<div class="flex min-w-0 flex-1 items-center gap-2 overflow-hidden">
|
||||||
>
|
<Tooltip content={automation.name} className="min-w-0" placement="top-start">
|
||||||
{automation.name}
|
<div
|
||||||
|
class="truncate text-[13px] leading-5 text-gray-800 group-hover:underline dark:text-gray-200"
|
||||||
|
>
|
||||||
|
{automation.name}
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
|
<Tooltip
|
||||||
|
content={automation.last_run_at
|
||||||
|
? dayjs(automation.last_run_at / 1000000).format('LLLL')
|
||||||
|
: $i18n.t('Never')}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="shrink-0 truncate text-[11px] leading-5 text-gray-400 dark:text-gray-600"
|
||||||
|
>
|
||||||
|
{formatLastRun(automation)}
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="hidden max-w-44 shrink-0 self-center truncate text-right text-[11px] leading-5 text-gray-500 dark:text-gray-500 md:block"
|
||||||
|
>
|
||||||
|
<Tooltip content={formatRRule(automation.data.rrule)} className="min-w-0">
|
||||||
|
<div class="truncate">
|
||||||
|
{formatRRule(automation.data.rrule)}
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<div class="truncate text-[11px] leading-4 text-gray-500 dark:text-gray-500">
|
|
||||||
{formatRRule(automation.data.rrule)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
<div class="flex shrink-0 flex-row items-center gap-1.5 self-center">
|
||||||
|
|||||||
Reference in new issue
Block a user