fix(frontend): Improve autodatatable (#3434)

* feat(frontend): Improve autodatable

* feat(frontend): global cache clean up

* feat(frontend): remove useless class
This commit is contained in:
Faton Ramadani
2024-03-19 09:34:34 +01:00
committed by GitHub
parent 4ddbe8b2e1
commit 990cef5461
2 changed files with 17 additions and 18 deletions
@@ -368,8 +368,10 @@
<Cell last={index == Object.values(rowData ?? {}).length - 1}>
{#if hiddenColumns.includes(key)}
...
{:else if Array.isArray(value) && value.length === 0}
<div />
{:else if Array.isArray(value) && typeof value[0] === 'string'}
<div class="flex flex-row gap-1 w-full max-w-80 flex-wrap min-w-80">
<div class="flex flex-row gap-1 w-full max-w-32 flex-wrap min-w-32">
{#each value as item, index}
<Badge
color={darkMode
@@ -380,11 +382,21 @@
</Badge>
{/each}
</div>
{:else if Array.isArray(value)}
<div class="flex flex-row gap-1 w-full max-w-80 flex-wrap min-w-96">
{:else if Array.isArray(value) && typeof value[0] === 'number'}
<div class="flex flex-row gap-1 w-full max-w-32 flex-wrap min-w-32">
{#each value as val}
<div
class="p-2 bg-surface-secondary rounded-md text-2xs max-w-96 text-wrap whitespace-pre-wrap flex flex-grow w-max overflow-hidden"
class="p-2 bg-surface-secondary rounded-md text-2xs text-wrap whitespace-pre-wrap flex flex-grow w-max overflow-hidden"
>
{JSON.stringify(val, null, 2)}
</div>
{/each}
</div>
{:else if Array.isArray(value)}
<div class="flex flex-row gap-1 w-full flex-wrap min-w-96">
{#each value as val}
<div
class="p-2 bg-surface-secondary rounded-md text-2xs text-wrap whitespace-pre-wrap flex flex-grow w-max overflow-hidden"
>
{JSON.stringify(val, null, 2)}
</div>
@@ -10,8 +10,7 @@
import Head from '$lib/components/table/Head.svelte'
import Tooltip from '$lib/components/Tooltip.svelte'
import WorkspaceGroup from '$lib/components/WorkspaceGroup.svelte'
import { WORKER_S3_BUCKET_SYNC_SETTING } from '$lib/consts'
import { WorkerService, type WorkerPing, SettingService, ConfigService } from '$lib/gen'
import { WorkerService, type WorkerPing, ConfigService } from '$lib/gen'
import { enterpriseLicense, superadmin } from '$lib/stores'
import { sendUserToast } from '$lib/toast'
import { displayDate, groupBy, truncate } from '$lib/utils'
@@ -24,7 +23,6 @@
let intervalId: NodeJS.Timeout | undefined
const splitter = '_%%%_'
let globalCache = false
let customTags: string[] | undefined = undefined
$: groupedWorkers = groupBy(
@@ -80,17 +78,6 @@
loadWorkers()
loadWorkerGroups()
loadCustomTags()
$: if ($superadmin) {
loadGlobalCache()
}
async function loadGlobalCache() {
try {
globalCache = (await SettingService.getGlobal({ key: WORKER_S3_BUCKET_SYNC_SETTING })) ?? true
} catch (err) {
sendUserToast(`Could not load global cache: ${err}`, true)
}
}
onDestroy(() => {
if (intervalId) {