@svadmin/ui 0.40.6 → 0.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AICommandBar.svelte +46 -23
- package/dist/components/AboutSettings.svelte +4 -3
- package/dist/components/AboutSettings.svelte.d.ts +2 -17
- package/dist/components/AdminApp.svelte +92 -20
- package/dist/components/AdminApp.svelte.d.ts +17 -2
- package/dist/components/AuditLogDrawer.svelte +45 -16
- package/dist/components/AuditLogViewer.svelte +32 -14
- package/dist/components/AutoTable.svelte +23 -11
- package/dist/components/CancelTaskButton.svelte +12 -4
- package/dist/components/ChatDialog.svelte +456 -122
- package/dist/components/ChatDialog.svelte.d.ts +9 -1
- package/dist/components/CommandPalette.svelte +2 -2
- package/dist/components/CopilotPanel.svelte +67 -26
- package/dist/components/DevTools.svelte +242 -22
- package/dist/components/InferencerPanel.svelte +25 -5
- package/dist/components/InsightCard.svelte +47 -17
- package/dist/components/Layout.svelte +45 -20
- package/dist/components/LoginPage.svelte +4 -4
- package/dist/components/ProfilePage.svelte +74 -27
- package/dist/components/RetryTaskButton.svelte +12 -4
- package/dist/components/RolesSettings.svelte +50 -21
- package/dist/components/SettingsPage.svelte +4 -4
- package/dist/components/Sidebar.svelte +26 -16
- package/dist/components/SmartSuggest.svelte +71 -32
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +11 -0
- package/package.json +2 -2
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
cell_getValue,
|
|
35
35
|
} from '@tanstack/table-core/static-functions';
|
|
36
36
|
|
|
37
|
-
import { captureAdminContext, useList, useDelete, useDeleteMany, getResource,
|
|
37
|
+
import { captureAdminContext, useList, useDelete, useDeleteMany, getResource, notifyWithProvider } from '@svadmin/core';
|
|
38
38
|
import type {
|
|
39
39
|
BaseRecord,
|
|
40
40
|
FieldDefinition,
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
Pagination as PaginationState,
|
|
44
44
|
Sort,
|
|
45
45
|
} from '@svadmin/core';
|
|
46
|
-
import { useCan
|
|
46
|
+
import { useCan } from '@svadmin/core';
|
|
47
47
|
import { readURLState, writeURLState } from '@svadmin/core';
|
|
48
48
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
49
49
|
|
|
@@ -259,13 +259,15 @@
|
|
|
259
259
|
const deleteManyMutation = deleteManyResult.mutation;
|
|
260
260
|
|
|
261
261
|
// ─── Permissions ──────────────────────────────────────────────
|
|
262
|
-
const acEnabled = $derived(!!
|
|
262
|
+
const acEnabled = $derived(!!adminContext.accessControlProvider);
|
|
263
263
|
const canCreatePerm = useCan(() => ({ resource: resourceName, action: 'create', queryOptions: { enabled: acEnabled } }));
|
|
264
264
|
const canEditPerm = useCan(() => ({ resource: resourceName, action: 'edit', queryOptions: { enabled: acEnabled } }));
|
|
265
|
+
const canShowPerm = useCan(() => ({ resource: resourceName, action: 'show', queryOptions: { enabled: acEnabled } }));
|
|
265
266
|
const canDeletePerm = useCan(() => ({ resource: resourceName, action: 'delete', queryOptions: { enabled: acEnabled } }));
|
|
266
267
|
const canExportPerm = useCan(() => ({ resource: resourceName, action: 'export', queryOptions: { enabled: acEnabled } }));
|
|
267
268
|
const canCreate = $derived(canCreatePerm.allowed && resource.canCreate !== false);
|
|
268
269
|
const canEdit = $derived(canEditPerm.allowed && resource.canEdit !== false);
|
|
270
|
+
const canShow = $derived(canShowPerm.allowed && resource.canShow !== false);
|
|
269
271
|
const canDelete = $derived(canDeletePerm.allowed && resource.canDelete !== false);
|
|
270
272
|
const canExport = $derived(canExportPerm.allowed);
|
|
271
273
|
|
|
@@ -505,9 +507,15 @@
|
|
|
505
507
|
confirmAction = async () => {
|
|
506
508
|
try {
|
|
507
509
|
await deleteManyMutation.mutateAsync({ ids, resource: resourceName });
|
|
508
|
-
|
|
510
|
+
notifyWithProvider(
|
|
511
|
+
{ type: 'success', message: i18n.t('common.batchDeleteSuccess', { count: ids.length }) },
|
|
512
|
+
adminContext.notificationProvider,
|
|
513
|
+
);
|
|
509
514
|
} catch {
|
|
510
|
-
|
|
515
|
+
notifyWithProvider(
|
|
516
|
+
{ type: 'error', message: i18n.t('common.batchDeletePartialFail', { failed: 1, total: ids.length }) },
|
|
517
|
+
adminContext.notificationProvider,
|
|
518
|
+
);
|
|
511
519
|
}
|
|
512
520
|
rowSelectionAtom.set({});
|
|
513
521
|
confirmOpen = false;
|
|
@@ -831,9 +839,11 @@
|
|
|
831
839
|
<Pencil class="h-4 w-4" /> {i18n.t('common.edit')}
|
|
832
840
|
</ContextMenu.Item>
|
|
833
841
|
{/if}
|
|
834
|
-
|
|
835
|
-
<
|
|
836
|
-
|
|
842
|
+
{#if canShow}
|
|
843
|
+
<ContextMenu.Item onclick={() => adminContext.navigate(`/${resourceName}/show/${id}`)} class="gap-2">
|
|
844
|
+
<Eye class="h-4 w-4" /> {i18n.t('common.detail')}
|
|
845
|
+
</ContextMenu.Item>
|
|
846
|
+
{/if}
|
|
837
847
|
<ContextMenu.Item onclick={() => navigator.clipboard?.writeText(String(id))} class="gap-2">
|
|
838
848
|
<Copy class="h-4 w-4" /> {i18n.t('common.copyId')}
|
|
839
849
|
</ContextMenu.Item>
|
|
@@ -907,9 +917,11 @@
|
|
|
907
917
|
<Pencil class="h-4 w-4" />
|
|
908
918
|
</TooltipButton>
|
|
909
919
|
{/if}
|
|
910
|
-
|
|
911
|
-
<
|
|
912
|
-
|
|
920
|
+
{#if canShow}
|
|
921
|
+
<TooltipButton tooltip={i18n.t('common.detail')} variant="ghost" size="icon-sm" onclick={() => adminContext.navigate(`/${resourceName}/show/${id}`)}>
|
|
922
|
+
<Eye class="h-4 w-4" />
|
|
923
|
+
</TooltipButton>
|
|
924
|
+
{/if}
|
|
913
925
|
{#if canDelete}
|
|
914
926
|
<TooltipButton tooltip={i18n.t('common.delete')} variant="ghost" size="icon-sm" onclick={() => confirmDelete(id)} class="hover:text-destructive">
|
|
915
927
|
<Trash2 class="h-4 w-4" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { captureAdminContext } from '@svadmin/core';
|
|
3
3
|
import { useQueryClient } from '@tanstack/svelte-query';
|
|
4
4
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
5
5
|
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
import { Loader2, Ban } from '@lucide/svelte';
|
|
8
8
|
|
|
9
9
|
const i18n = useTranslation();
|
|
10
|
+
const adminContext = captureAdminContext();
|
|
10
11
|
|
|
11
12
|
let {
|
|
12
13
|
taskId,
|
|
13
|
-
taskProvider =
|
|
14
|
+
taskProvider = adminContext.taskProvider ?? undefined,
|
|
14
15
|
onSuccess,
|
|
15
16
|
onError,
|
|
16
17
|
disabled = false,
|
|
@@ -37,8 +38,15 @@
|
|
|
37
38
|
try {
|
|
38
39
|
await taskProvider.cancel(taskId);
|
|
39
40
|
await Promise.all([
|
|
40
|
-
queryClient.invalidateQueries({
|
|
41
|
-
|
|
41
|
+
queryClient.invalidateQueries({
|
|
42
|
+
predicate: (query) => query.queryKey[0] === 'taskList'
|
|
43
|
+
&& adminContext.matchesTenantQuery(query.queryKey),
|
|
44
|
+
}),
|
|
45
|
+
queryClient.invalidateQueries({
|
|
46
|
+
predicate: (query) => query.queryKey[0] === 'task'
|
|
47
|
+
&& query.queryKey[1] === taskId
|
|
48
|
+
&& adminContext.matchesTenantQuery(query.queryKey),
|
|
49
|
+
}),
|
|
42
50
|
]);
|
|
43
51
|
onSuccess?.();
|
|
44
52
|
} catch (error) {
|