refac
This commit is contained in:
1 parent
a3908f1281
commit
3ce3c52936
24 files changed
+210
-177
No files matched your search
@@ -73,16 +73,6 @@
|
||||
href="/admin">{$i18n.t('Users')}</a
|
||||
>
|
||||
|
||||
{#if $config?.features.enable_admin_analytics ?? true}
|
||||
<a
|
||||
draggable="false"
|
||||
class="min-w-fit p-1.5 {$page.url.pathname.includes('/admin/analytics')
|
||||
? ''
|
||||
: 'text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'} transition select-none"
|
||||
href="/admin/analytics">{$i18n.t('Analytics')}</a
|
||||
>
|
||||
{/if}
|
||||
|
||||
<a
|
||||
draggable="false"
|
||||
class="min-w-fit p-1.5 {$page.url.pathname.includes('/admin/evaluations')
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { config } from '$lib/stores';
|
||||
import Analytics from '$lib/components/admin/Analytics.svelte';
|
||||
|
||||
onMount(() => {
|
||||
if (!($config?.features.enable_admin_analytics ?? true)) {
|
||||
goto('/admin');
|
||||
} else {
|
||||
goto('/?settings=admin%3Aanalytics', { replaceState: true });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if $config?.features.enable_admin_analytics ?? true}
|
||||
<Analytics />
|
||||
{/if}
|
||||
@@ -2,15 +2,12 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { config } from '$lib/stores';
|
||||
import Analytics from '$lib/components/admin/Analytics.svelte';
|
||||
|
||||
onMount(() => {
|
||||
if (!($config?.features.enable_admin_analytics ?? true)) {
|
||||
goto('/admin');
|
||||
} else {
|
||||
goto('/?settings=admin%3Aanalytics', { replaceState: true });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if $config?.features.enable_admin_analytics ?? true}
|
||||
<Analytics />
|
||||
{/if}
|
||||
@@ -35,6 +35,7 @@
|
||||
import Check from '$lib/components/icons/Check.svelte';
|
||||
import CheckCircle from '$lib/components/icons/CheckCircle.svelte';
|
||||
import Minus from '$lib/components/icons/Minus.svelte';
|
||||
import { formatNumber } from '$lib/utils';
|
||||
|
||||
const { saveAs } = fileSaver;
|
||||
|
||||
@@ -378,7 +379,7 @@
|
||||
<div class="flex items-center gap-1 py-1 min-w-0">
|
||||
<span class="min-w-fit px-1 text-sm select-none">{$i18n.t('Automations')}</span>
|
||||
<span class="text-sm text-gray-500 dark:text-gray-500">
|
||||
{total ?? ''}
|
||||
{total === null ? '' : formatNumber(total)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
import Sidebar from '$lib/components/icons/Sidebar.svelte';
|
||||
import SplitCreateButton from '$lib/components/common/SplitCreateButton.svelte';
|
||||
import { formatNumber } from '$lib/utils';
|
||||
|
||||
const i18n = getContext<Writable<i18nType>>('i18n');
|
||||
|
||||
@@ -42,6 +43,7 @@
|
||||
$: visibleActions = $workspaceActions.filter((action) => action.visible ?? true);
|
||||
|
||||
const getCount = (res: any) => res?.total ?? (Array.isArray(res) ? res.length : null);
|
||||
const formatCount = (count: number | null) => formatNumber(count ?? 0);
|
||||
|
||||
const loadWorkspaceCounts = async () => {
|
||||
const canViewModels = $user?.role === 'admin' || $user?.permissions?.workspace?.models;
|
||||
@@ -155,7 +157,7 @@
|
||||
>
|
||||
<span>{$i18n.t('Models')}</span>
|
||||
<span class="text-sm text-gray-500 dark:text-gray-500">
|
||||
{$workspaceCounts.models ?? 0}
|
||||
{formatCount($workspaceCounts.models)}
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
@@ -172,7 +174,7 @@
|
||||
>
|
||||
<span>{$i18n.t('Knowledge')}</span>
|
||||
<span class="text-sm text-gray-500 dark:text-gray-500">
|
||||
{$workspaceCounts.knowledge ?? 0}
|
||||
{formatCount($workspaceCounts.knowledge)}
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
@@ -189,7 +191,7 @@
|
||||
>
|
||||
<span>{$i18n.t('Prompts')}</span>
|
||||
<span class="text-sm text-gray-500 dark:text-gray-500">
|
||||
{$workspaceCounts.prompts ?? 0}
|
||||
{formatCount($workspaceCounts.prompts)}
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
@@ -206,7 +208,7 @@
|
||||
>
|
||||
<span>{$i18n.t('Skills')}</span>
|
||||
<span class="text-sm text-gray-500 dark:text-gray-500">
|
||||
{$workspaceCounts.skills ?? 0}
|
||||
{formatCount($workspaceCounts.skills)}
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
@@ -223,7 +225,7 @@
|
||||
>
|
||||
<span>{$i18n.t('Tools')}</span>
|
||||
<span class="text-sm text-gray-500 dark:text-gray-500">
|
||||
{$workspaceCounts.tools ?? 0}
|
||||
{formatCount($workspaceCounts.tools)}
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
Reference in new issue
Block a user