@svadmin/ui 0.122.0 → 0.125.0
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/app.css +561 -4
- package/dist/app.theme.css +561 -4
- package/dist/components/AbacPolicyMatrix.svelte +356 -0
- package/dist/components/AbacPolicyMatrix.svelte.d.ts +30 -0
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/ActionPalette.svelte +272 -0
- package/dist/components/ActionPalette.svelte.d.ts +23 -0
- package/dist/components/AdminCopilotWidget.svelte +316 -0
- package/dist/components/AdminCopilotWidget.svelte.d.ts +33 -0
- package/dist/components/AnnouncementBanner.svelte +12 -1
- package/dist/components/AnnouncementBanner.svelte.d.ts +4 -0
- package/dist/components/ApiPlayground.svelte +255 -0
- package/dist/components/ApiPlayground.svelte.d.ts +24 -0
- package/dist/components/ApprovalChainBuilder.svelte +262 -0
- package/dist/components/ApprovalChainBuilder.svelte.d.ts +20 -0
- package/dist/components/ApprovalTimeline.svelte +8 -1
- package/dist/components/AsyncExportModal.svelte +1 -1
- package/dist/components/AudioFeedbackProvider.svelte +1 -1
- package/dist/components/AuditTrailInspector.svelte +448 -0
- package/dist/components/AuditTrailInspector.svelte.d.ts +44 -0
- package/dist/components/BatchEditModal.svelte +266 -0
- package/dist/components/BatchEditModal.svelte.d.ts +27 -0
- package/dist/components/BillingInvoiceDrawer.svelte +206 -0
- package/dist/components/BillingInvoiceDrawer.svelte.d.ts +30 -0
- package/dist/components/ChartAnnotationOverlay.svelte +228 -0
- package/dist/components/ChartAnnotationOverlay.svelte.d.ts +21 -0
- package/dist/components/ClusterTopologyGraph.svelte +317 -0
- package/dist/components/ClusterTopologyGraph.svelte.d.ts +31 -0
- package/dist/components/ColumnMappingTable.svelte +174 -0
- package/dist/components/ColumnMappingTable.svelte.d.ts +23 -0
- package/dist/components/ConversionFunnel.svelte +1 -1
- package/dist/components/CursorListFooter.svelte +67 -0
- package/dist/components/CursorListFooter.svelte.d.ts +17 -0
- package/dist/components/DashboardGridLayout.svelte +309 -0
- package/dist/components/DashboardGridLayout.svelte.d.ts +30 -0
- package/dist/components/DashboardLayoutStorage.svelte +278 -0
- package/dist/components/DashboardLayoutStorage.svelte.d.ts +23 -0
- package/dist/components/DataFreshnessIndicator.svelte +149 -0
- package/dist/components/DataFreshnessIndicator.svelte.d.ts +20 -0
- package/dist/components/DataImportDropzone.svelte +215 -0
- package/dist/components/DataImportDropzone.svelte.d.ts +24 -0
- package/dist/components/DataLineageGraph.svelte +203 -0
- package/dist/components/DataLineageGraph.svelte.d.ts +26 -0
- package/dist/components/DataMaskPolicyEngine.svelte +291 -0
- package/dist/components/DataMaskPolicyEngine.svelte.d.ts +25 -0
- package/dist/components/DataScopeRuleEditor.svelte +142 -0
- package/dist/components/DataScopeRuleEditor.svelte.d.ts +19 -0
- package/dist/components/DataScreenContainer.svelte +160 -0
- package/dist/components/DataScreenContainer.svelte.d.ts +15 -0
- package/dist/components/DevTools.svelte +3 -3
- package/dist/components/DualApprovalGate.svelte +132 -65
- package/dist/components/DualApprovalGate.svelte.d.ts +20 -1
- package/dist/components/ElectronicSealStamp.svelte +102 -0
- package/dist/components/ElectronicSealStamp.svelte.d.ts +14 -0
- package/dist/components/EnvVariableEditor.svelte +284 -0
- package/dist/components/EnvVariableEditor.svelte.d.ts +17 -0
- package/dist/components/FeatureAnnouncementModal.svelte +173 -0
- package/dist/components/FeatureAnnouncementModal.svelte.d.ts +21 -0
- package/dist/components/FilterTagBar.svelte +210 -0
- package/dist/components/FilterTagBar.svelte.d.ts +23 -0
- package/dist/components/FormulaField.svelte +149 -0
- package/dist/components/FormulaField.svelte.d.ts +18 -0
- package/dist/components/GeoScatterMap.svelte +225 -0
- package/dist/components/GeoScatterMap.svelte.d.ts +22 -0
- package/dist/components/HmacSignatureCalculator.svelte +199 -0
- package/dist/components/HmacSignatureCalculator.svelte.d.ts +10 -0
- package/dist/components/I18nLanguagePackEditor.svelte +208 -0
- package/dist/components/I18nLanguagePackEditor.svelte.d.ts +17 -0
- package/dist/components/ImportPreviewValidator.svelte +239 -0
- package/dist/components/ImportPreviewValidator.svelte.d.ts +26 -0
- package/dist/components/IncidentWarRoomDrawer.svelte +194 -0
- package/dist/components/IncidentWarRoomDrawer.svelte.d.ts +24 -0
- package/dist/components/JsonSchemaForm.svelte +4 -4
- package/dist/components/ListPagination.svelte +39 -3
- package/dist/components/LiveStreamLogViewer.svelte +185 -0
- package/dist/components/LiveStreamLogViewer.svelte.d.ts +21 -0
- package/dist/components/MasterSubTableDrawer.svelte +223 -0
- package/dist/components/MasterSubTableDrawer.svelte.d.ts +25 -0
- package/dist/components/MockDataInterceptor.svelte +292 -0
- package/dist/components/MockDataInterceptor.svelte.d.ts +27 -0
- package/dist/components/OmnibarCommandPalette.svelte +320 -0
- package/dist/components/OmnibarCommandPalette.svelte.d.ts +27 -0
- package/dist/components/PageSkeleton.svelte +19 -5
- package/dist/components/PageSkeleton.svelte.d.ts +5 -3
- package/dist/components/PeriodComparisonCard.svelte +142 -0
- package/dist/components/PeriodComparisonCard.svelte.d.ts +16 -0
- package/dist/components/PermissionSimulator.svelte +319 -0
- package/dist/components/PermissionSimulator.svelte.d.ts +34 -0
- package/dist/components/PivotMatrix.svelte +271 -0
- package/dist/components/PivotMatrix.svelte.d.ts +32 -0
- package/dist/components/PlanUsageQuotaBar.svelte +154 -0
- package/dist/components/PlanUsageQuotaBar.svelte.d.ts +26 -0
- package/dist/components/Popconfirm.svelte +20 -8
- package/dist/components/Popconfirm.svelte.d.ts +3 -1
- package/dist/components/ProSkeleton.svelte +4 -0
- package/dist/components/ProSkeleton.svelte.d.ts +2 -0
- package/dist/components/QueryAiExplainer.svelte +148 -0
- package/dist/components/QueryAiExplainer.svelte.d.ts +16 -0
- package/dist/components/QueryBuilder.svelte +456 -0
- package/dist/components/QueryBuilder.svelte.d.ts +33 -0
- package/dist/components/RolePermissionComparator.svelte +273 -0
- package/dist/components/RolePermissionComparator.svelte.d.ts +28 -0
- package/dist/components/RuleExpressionBuilder.svelte +380 -0
- package/dist/components/RuleExpressionBuilder.svelte.d.ts +31 -0
- package/dist/components/ScheduledJobManager.svelte +225 -0
- package/dist/components/ScheduledJobManager.svelte.d.ts +23 -0
- package/dist/components/ScreenAntiLeakGuard.svelte +88 -0
- package/dist/components/ScreenAntiLeakGuard.svelte.d.ts +12 -0
- package/dist/components/SecureDataExporter.svelte +296 -0
- package/dist/components/SecureDataExporter.svelte.d.ts +29 -0
- package/dist/components/ServerStatusGrid.svelte +179 -0
- package/dist/components/ServerStatusGrid.svelte.d.ts +21 -0
- package/dist/components/SnapshotTimelineReplay.svelte +219 -0
- package/dist/components/SnapshotTimelineReplay.svelte.d.ts +19 -0
- package/dist/components/SqlConsole.svelte +247 -0
- package/dist/components/SqlConsole.svelte.d.ts +20 -0
- package/dist/components/StepWizard.svelte +1 -1
- package/dist/components/SystemCapacityForecastCard.svelte +132 -0
- package/dist/components/SystemCapacityForecastCard.svelte.d.ts +19 -0
- package/dist/components/SystemHealthCheckDashboard.svelte +306 -0
- package/dist/components/SystemHealthCheckDashboard.svelte.d.ts +24 -0
- package/dist/components/TableAggregationFooter.svelte +173 -0
- package/dist/components/TableAggregationFooter.svelte.d.ts +22 -0
- package/dist/components/TaskCenter.svelte +37 -29
- package/dist/components/TenantContextSwitcher.svelte +314 -0
- package/dist/components/TenantContextSwitcher.svelte.d.ts +35 -0
- package/dist/components/TenantQuotasMatrix.svelte +229 -0
- package/dist/components/TenantQuotasMatrix.svelte.d.ts +22 -0
- package/dist/components/ThreadedCommentDrawer.svelte +246 -0
- package/dist/components/ThreadedCommentDrawer.svelte.d.ts +26 -0
- package/dist/components/TierFeatureComparison.svelte +147 -0
- package/dist/components/TierFeatureComparison.svelte.d.ts +28 -0
- package/dist/components/TreeTransferSelect.svelte +333 -0
- package/dist/components/TreeTransferSelect.svelte.d.ts +18 -0
- package/dist/components/VirtualCardGrid.svelte +180 -0
- package/dist/components/VirtualCardGrid.svelte.d.ts +65 -0
- package/dist/components/WebhookSimulator.svelte +263 -0
- package/dist/components/WebhookSimulator.svelte.d.ts +26 -0
- package/dist/components/WidgetContainer.svelte +204 -0
- package/dist/components/WidgetContainer.svelte.d.ts +31 -0
- package/dist/components/WorkflowExecutionTracker.svelte +131 -0
- package/dist/components/WorkflowExecutionTracker.svelte.d.ts +19 -0
- package/dist/components/WorkflowGraphDesigner.svelte +202 -0
- package/dist/components/WorkflowGraphDesigner.svelte.d.ts +24 -0
- package/dist/components/WorkflowNodeInspector.svelte +217 -0
- package/dist/components/WorkflowNodeInspector.svelte.d.ts +24 -0
- package/dist/components/WorkflowStepper.svelte +1 -1
- package/dist/components/list-i18n.d.ts +7 -0
- package/dist/components/list-i18n.js +14 -0
- package/dist/components/ui/button/button.svelte +3 -1
- package/dist/components/ui/button/button.svelte.d.ts +1 -0
- package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/components/useDynamicLocale.d.svelte.ts +1 -0
- package/dist/components/useDynamicLocale.svelte.d.ts +10 -0
- package/dist/components/useDynamicLocale.svelte.js +40 -0
- package/dist/components/useFormulaEngine.d.svelte.ts +1 -0
- package/dist/components/useFormulaEngine.svelte.d.ts +9 -0
- package/dist/components/useFormulaEngine.svelte.js +209 -0
- package/dist/components/useStorageCache.d.svelte.ts +1 -0
- package/dist/components/useStorageCache.svelte.d.ts +49 -0
- package/dist/components/useStorageCache.svelte.js +229 -0
- package/dist/components.css +1 -1
- package/dist/index.d.ts +69 -3
- package/dist/index.js +112 -2
- package/package.json +4 -4
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ExportColumnDef {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
isSensitive?: boolean | undefined;
|
|
5
|
+
}
|
|
6
|
+
export interface ExportAuditPayload {
|
|
7
|
+
exportId: string;
|
|
8
|
+
operatorId: string;
|
|
9
|
+
operatorName: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
recordCount: number;
|
|
12
|
+
sensitiveFields: string[];
|
|
13
|
+
format: 'csv' | 'tsv';
|
|
14
|
+
fingerprintHash: string;
|
|
15
|
+
exportedAt: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SecureDataExporterProps {
|
|
18
|
+
data: Record<string, unknown>[];
|
|
19
|
+
columns: ExportColumnDef[];
|
|
20
|
+
fileName?: string | undefined;
|
|
21
|
+
operatorId?: string | undefined;
|
|
22
|
+
operatorName?: string | undefined;
|
|
23
|
+
title?: string | undefined;
|
|
24
|
+
class?: string | undefined;
|
|
25
|
+
onExportAuditRecord?: ((audit: ExportAuditPayload) => void | Promise<void>) | undefined;
|
|
26
|
+
}
|
|
27
|
+
declare const SecureDataExporter: import("svelte").Component<SecureDataExporterProps, {}, "">;
|
|
28
|
+
type SecureDataExporter = ReturnType<typeof SecureDataExporter>;
|
|
29
|
+
export default SecureDataExporter;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Server, Activity, HardDrive, Cpu } from '@lucide/svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
export type NodeHealthStatus = 'healthy' | 'warning' | 'critical' | 'offline';
|
|
6
|
+
|
|
7
|
+
export interface ServerNode {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
region: string;
|
|
11
|
+
status: NodeHealthStatus;
|
|
12
|
+
latencyMs: number;
|
|
13
|
+
cpuPercent: number;
|
|
14
|
+
memoryPercent: number;
|
|
15
|
+
diskPercent?: number | undefined;
|
|
16
|
+
activeConnections?: number | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ServerStatusGridProps {
|
|
20
|
+
title?: string | undefined;
|
|
21
|
+
nodes: ServerNode[];
|
|
22
|
+
onselectnode?: ((node: ServerNode) => void) | undefined;
|
|
23
|
+
class?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
title = '服务集群健康度全景网格',
|
|
28
|
+
nodes = [],
|
|
29
|
+
onselectnode,
|
|
30
|
+
class: className = '',
|
|
31
|
+
}: ServerStatusGridProps = $props();
|
|
32
|
+
|
|
33
|
+
const summary = $derived.by(() => {
|
|
34
|
+
let healthy = 0;
|
|
35
|
+
let warning = 0;
|
|
36
|
+
let critical = 0;
|
|
37
|
+
let offline = 0;
|
|
38
|
+
let totalLatency = 0;
|
|
39
|
+
|
|
40
|
+
for (const n of nodes) {
|
|
41
|
+
if (n.status === 'healthy') healthy++;
|
|
42
|
+
else if (n.status === 'warning') warning++;
|
|
43
|
+
else if (n.status === 'critical') critical++;
|
|
44
|
+
else offline++;
|
|
45
|
+
totalLatency += n.latencyMs;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const avgLatency = nodes.length > 0 ? Math.round(totalLatency / nodes.length) : 0;
|
|
49
|
+
return { healthy, warning, critical, offline, avgLatency, total: nodes.length };
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
function getBarTone(percent: number): string {
|
|
53
|
+
if (percent >= 85) return 'bg-destructive';
|
|
54
|
+
if (percent >= 70) return 'bg-warning';
|
|
55
|
+
return 'bg-primary';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getStatusTone(status: NodeHealthStatus) {
|
|
59
|
+
switch (status) {
|
|
60
|
+
case 'healthy':
|
|
61
|
+
return { dot: 'bg-success', badge: 'bg-success/10 text-success border-success/30' };
|
|
62
|
+
case 'warning':
|
|
63
|
+
return { dot: 'bg-warning', badge: 'bg-warning/10 text-warning border-warning/30' };
|
|
64
|
+
case 'critical':
|
|
65
|
+
return { dot: 'bg-destructive', badge: 'bg-destructive/10 text-destructive border-destructive/30' };
|
|
66
|
+
case 'offline':
|
|
67
|
+
default:
|
|
68
|
+
return { dot: 'bg-muted-foreground', badge: 'bg-muted text-muted-foreground border-border' };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<div
|
|
74
|
+
class={cn('rounded-md border border-border bg-card p-4 text-card-foreground shadow-xs flex flex-col space-y-4', className)}
|
|
75
|
+
data-svadmin-component="ServerStatusGrid"
|
|
76
|
+
>
|
|
77
|
+
<!-- Header & Cluster Aggregation Stats -->
|
|
78
|
+
<header class="flex flex-wrap items-center justify-between gap-3 border-b border-border pb-3">
|
|
79
|
+
<div class="flex items-center gap-2">
|
|
80
|
+
<Server class="h-4 w-4 text-primary" />
|
|
81
|
+
<h3 class="font-bold text-sm text-foreground">{title}</h3>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div class="flex items-center gap-3 text-xs font-mono">
|
|
85
|
+
<span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded bg-success/10 text-success font-medium">
|
|
86
|
+
<span class="h-1.5 w-1.5 rounded-full bg-success"></span>
|
|
87
|
+
{summary.healthy}/{summary.total} 健康在线
|
|
88
|
+
</span>
|
|
89
|
+
|
|
90
|
+
{#if summary.warning > 0}
|
|
91
|
+
<span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded bg-warning/10 text-warning font-medium">
|
|
92
|
+
<span class="h-1.5 w-1.5 rounded-full bg-warning"></span>
|
|
93
|
+
{summary.warning} 节点告警
|
|
94
|
+
</span>
|
|
95
|
+
{/if}
|
|
96
|
+
|
|
97
|
+
{#if summary.critical > 0}
|
|
98
|
+
<span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded bg-destructive/10 text-destructive font-medium">
|
|
99
|
+
<span class="h-1.5 w-1.5 rounded-full bg-destructive"></span>
|
|
100
|
+
{summary.critical} 紧急故障
|
|
101
|
+
</span>
|
|
102
|
+
{/if}
|
|
103
|
+
|
|
104
|
+
<span class="text-muted-foreground flex items-center gap-1">
|
|
105
|
+
<Activity class="h-3 w-3" />
|
|
106
|
+
平均延时: <strong>{summary.avgLatency}ms</strong>
|
|
107
|
+
</span>
|
|
108
|
+
</div>
|
|
109
|
+
</header>
|
|
110
|
+
|
|
111
|
+
<!-- Node Cards Grid -->
|
|
112
|
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
|
|
113
|
+
{#each nodes as node (node.id)}
|
|
114
|
+
{@const tone = getStatusTone(node.status)}
|
|
115
|
+
<button
|
|
116
|
+
type="button"
|
|
117
|
+
class="rounded-lg border border-border bg-background/50 hover:bg-muted/30 p-3.5 text-left transition-all cursor-pointer flex flex-col justify-between space-y-3 group hover:border-primary/40 shadow-2xs"
|
|
118
|
+
onclick={() => onselectnode?.(node)}
|
|
119
|
+
>
|
|
120
|
+
<!-- Card Top Line -->
|
|
121
|
+
<div class="flex items-center justify-between gap-2">
|
|
122
|
+
<div class="flex items-center gap-2 min-w-0">
|
|
123
|
+
<span class={cn('h-2.5 w-2.5 rounded-full shrink-0', tone.dot)}></span>
|
|
124
|
+
<span class="font-bold text-xs text-foreground truncate group-hover:text-primary transition-colors">
|
|
125
|
+
{node.name}
|
|
126
|
+
</span>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div class="flex items-center gap-1.5 font-mono text-xs shrink-0">
|
|
130
|
+
<span class="px-1.5 py-0.5 rounded border border-border bg-muted/30 text-muted-foreground">
|
|
131
|
+
{node.region}
|
|
132
|
+
</span>
|
|
133
|
+
<span class={cn('px-1.5 py-0.5 rounded border font-semibold', tone.badge)}>
|
|
134
|
+
{node.latencyMs}ms
|
|
135
|
+
</span>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<!-- Resource Progress Bars -->
|
|
140
|
+
<div class="space-y-1.5 text-[11px] font-mono">
|
|
141
|
+
<!-- CPU -->
|
|
142
|
+
<div class="space-y-0.5">
|
|
143
|
+
<div class="flex justify-between text-muted-foreground">
|
|
144
|
+
<span class="flex items-center gap-1"><Cpu class="h-2.5 w-2.5" /> CPU</span>
|
|
145
|
+
<span class="font-semibold text-foreground">{node.cpuPercent}%</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="h-1.5 bg-muted rounded-full overflow-hidden">
|
|
148
|
+
<div class={cn('h-full transition-all duration-300', getBarTone(node.cpuPercent))} style="width: {node.cpuPercent}%"></div>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<!-- Memory -->
|
|
153
|
+
<div class="space-y-0.5">
|
|
154
|
+
<div class="flex justify-between text-muted-foreground">
|
|
155
|
+
<span class="flex items-center gap-1"><Activity class="h-2.5 w-2.5" /> 内存</span>
|
|
156
|
+
<span class="font-semibold text-foreground">{node.memoryPercent}%</span>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="h-1.5 bg-muted rounded-full overflow-hidden">
|
|
159
|
+
<div class={cn('h-full transition-all duration-300', getBarTone(node.memoryPercent))} style="width: {node.memoryPercent}%"></div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<!-- Disk -->
|
|
164
|
+
{#if node.diskPercent !== undefined}
|
|
165
|
+
<div class="space-y-0.5">
|
|
166
|
+
<div class="flex justify-between text-muted-foreground">
|
|
167
|
+
<span class="flex items-center gap-1"><HardDrive class="h-2.5 w-2.5" /> 存储</span>
|
|
168
|
+
<span class="font-semibold text-foreground">{node.diskPercent}%</span>
|
|
169
|
+
</div>
|
|
170
|
+
<div class="h-1.5 bg-muted rounded-full overflow-hidden">
|
|
171
|
+
<div class={cn('h-full transition-all duration-300', getBarTone(node.diskPercent))} style="width: {node.diskPercent}%"></div>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
{/if}
|
|
175
|
+
</div>
|
|
176
|
+
</button>
|
|
177
|
+
{/each}
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type NodeHealthStatus = 'healthy' | 'warning' | 'critical' | 'offline';
|
|
2
|
+
export interface ServerNode {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
region: string;
|
|
6
|
+
status: NodeHealthStatus;
|
|
7
|
+
latencyMs: number;
|
|
8
|
+
cpuPercent: number;
|
|
9
|
+
memoryPercent: number;
|
|
10
|
+
diskPercent?: number | undefined;
|
|
11
|
+
activeConnections?: number | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface ServerStatusGridProps {
|
|
14
|
+
title?: string | undefined;
|
|
15
|
+
nodes: ServerNode[];
|
|
16
|
+
onselectnode?: ((node: ServerNode) => void) | undefined;
|
|
17
|
+
class?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
declare const ServerStatusGrid: import("svelte").Component<ServerStatusGridProps, {}, "">;
|
|
20
|
+
type ServerStatusGrid = ReturnType<typeof ServerStatusGrid>;
|
|
21
|
+
export default ServerStatusGrid;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
History,
|
|
4
|
+
Calendar,
|
|
5
|
+
User,
|
|
6
|
+
Hash,
|
|
7
|
+
RotateCcw,
|
|
8
|
+
ArrowRight,
|
|
9
|
+
} from '@lucide/svelte';
|
|
10
|
+
import { useTranslation } from '@svadmin/core/i18n';
|
|
11
|
+
import { cn } from '../utils.js';
|
|
12
|
+
import { Button } from './ui/button/index.js';
|
|
13
|
+
|
|
14
|
+
export interface SnapshotRevision {
|
|
15
|
+
id: string;
|
|
16
|
+
version: string | number;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
author: string;
|
|
19
|
+
comment?: string | undefined;
|
|
20
|
+
auditHash: string;
|
|
21
|
+
snapshot: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface SnapshotTimelineReplayProps {
|
|
25
|
+
revisions: SnapshotRevision[];
|
|
26
|
+
title?: string | undefined;
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
class?: string | undefined;
|
|
29
|
+
onApplyRollback?: ((revision: SnapshotRevision) => void) | undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let {
|
|
33
|
+
revisions = [],
|
|
34
|
+
title,
|
|
35
|
+
description,
|
|
36
|
+
class: className = '',
|
|
37
|
+
onApplyRollback,
|
|
38
|
+
}: SnapshotTimelineReplayProps = $props();
|
|
39
|
+
|
|
40
|
+
const i18n = useTranslation();
|
|
41
|
+
const chinese = $derived(i18n.locale.startsWith('zh'));
|
|
42
|
+
|
|
43
|
+
let activeIndex = $state(0);
|
|
44
|
+
|
|
45
|
+
const currentRevision = $derived(revisions[activeIndex] ?? null);
|
|
46
|
+
const previousRevision = $derived(activeIndex > 0 ? revisions[activeIndex - 1] : null);
|
|
47
|
+
|
|
48
|
+
const diffRows = $derived.by(() => {
|
|
49
|
+
if (!currentRevision) return [];
|
|
50
|
+
const prevData = previousRevision?.snapshot ?? {};
|
|
51
|
+
const curData = currentRevision.snapshot ?? {};
|
|
52
|
+
const allKeys = Array.from(new Set([...Object.keys(prevData), ...Object.keys(curData)]));
|
|
53
|
+
|
|
54
|
+
return allKeys.map((key) => {
|
|
55
|
+
const oldVal = prevData[key];
|
|
56
|
+
const newVal = curData[key];
|
|
57
|
+
const isChanged = JSON.stringify(oldVal) !== JSON.stringify(newVal);
|
|
58
|
+
const isAdded = oldVal === undefined && newVal !== undefined;
|
|
59
|
+
const isRemoved = oldVal !== undefined && newVal === undefined;
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
key,
|
|
63
|
+
oldVal: oldVal !== undefined ? String(oldVal) : '—',
|
|
64
|
+
newVal: newVal !== undefined ? String(newVal) : '—',
|
|
65
|
+
isChanged,
|
|
66
|
+
isAdded,
|
|
67
|
+
isRemoved,
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const resolvedTitle = $derived(title ?? (chinese ? '时空快照审计回放与时间旅行对比器' : 'Snapshot Timeline & Time-Travel Replay'));
|
|
73
|
+
const resolvedDesc = $derived(
|
|
74
|
+
description ?? (chinese ? '任意历史版本时间戳快照回溯、字段级红绿对比与合规回滚申请' : 'Replay historical snapshots, inspect property diffs, and request rollback'),
|
|
75
|
+
);
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<div
|
|
79
|
+
data-svadmin-component="SnapshotTimelineReplay"
|
|
80
|
+
class={cn(
|
|
81
|
+
'w-full rounded-md border border-border bg-card text-card-foreground shadow-xs p-6 space-y-5',
|
|
82
|
+
className,
|
|
83
|
+
)}
|
|
84
|
+
>
|
|
85
|
+
<!-- Header -->
|
|
86
|
+
<div class="flex items-center justify-between border-b border-border/70 pb-4">
|
|
87
|
+
<div class="flex items-center gap-2.5">
|
|
88
|
+
<div class="flex h-9 w-9 items-center justify-center rounded-sm bg-primary/10 text-primary border border-primary/20">
|
|
89
|
+
<History class="h-5 w-5" />
|
|
90
|
+
</div>
|
|
91
|
+
<div>
|
|
92
|
+
<h3 class="text-base font-semibold text-foreground">{resolvedTitle}</h3>
|
|
93
|
+
<p class="text-xs text-muted-foreground">{resolvedDesc}</p>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<!-- Time Travel Slider & Version Pills -->
|
|
99
|
+
<div class="space-y-3 bg-muted/20 p-4 rounded-md border border-border/60">
|
|
100
|
+
<div class="flex items-center justify-between text-xs">
|
|
101
|
+
<span class="font-semibold text-foreground flex items-center gap-1.5">
|
|
102
|
+
<Calendar class="h-3.5 w-3.5 text-primary" />
|
|
103
|
+
{chinese ? '时间旅行轴 (拖动定位历史快照):' : 'Time Travel Timeline:'}
|
|
104
|
+
</span>
|
|
105
|
+
<span class="font-mono text-muted-foreground">
|
|
106
|
+
{chinese ? `版本 ${activeIndex + 1} / 共 ${revisions.length} 版` : `Rev ${activeIndex + 1} of ${revisions.length}`}
|
|
107
|
+
</span>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<!-- Range Slider for scrub timeline -->
|
|
111
|
+
<input
|
|
112
|
+
type="range"
|
|
113
|
+
min="0"
|
|
114
|
+
max={Math.max(0, revisions.length - 1)}
|
|
115
|
+
step="1"
|
|
116
|
+
bind:value={activeIndex}
|
|
117
|
+
class="w-full h-2 cursor-pointer accent-primary"
|
|
118
|
+
aria-label="Time travel revision slider"
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<!-- Quick Version Buttons Strip -->
|
|
122
|
+
<div class="flex gap-2 overflow-x-auto pt-1 pb-1">
|
|
123
|
+
{#each revisions as rev, idx (rev.id)}
|
|
124
|
+
<button
|
|
125
|
+
type="button"
|
|
126
|
+
onclick={() => (activeIndex = idx)}
|
|
127
|
+
class={cn(
|
|
128
|
+
'flex flex-col text-left px-3 py-1.5 rounded-lg border text-xs transition-all shrink-0',
|
|
129
|
+
idx === activeIndex
|
|
130
|
+
? 'border-primary bg-primary/10 text-primary font-bold shadow-2xs'
|
|
131
|
+
: 'border-border/80 bg-background text-muted-foreground hover:bg-muted/40',
|
|
132
|
+
)}
|
|
133
|
+
>
|
|
134
|
+
<span>v{rev.version}</span>
|
|
135
|
+
<span class="text-xs opacity-75 font-mono">{rev.timestamp.slice(5, 16)}</span>
|
|
136
|
+
</button>
|
|
137
|
+
{/each}
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<!-- Active Revision Metadata Strip -->
|
|
142
|
+
{#if currentRevision}
|
|
143
|
+
<div class="flex flex-wrap items-center justify-between gap-4 bg-card p-3 rounded-md border border-border/80 text-xs">
|
|
144
|
+
<div class="flex items-center gap-4">
|
|
145
|
+
<span class="flex items-center gap-1 font-semibold text-foreground">
|
|
146
|
+
<User class="h-3.5 w-3.5 text-primary" />
|
|
147
|
+
<span>{currentRevision.author}</span>
|
|
148
|
+
</span>
|
|
149
|
+
{#if currentRevision.comment}
|
|
150
|
+
<span class="text-muted-foreground">{currentRevision.comment}</span>
|
|
151
|
+
{/if}
|
|
152
|
+
<span class="flex items-center gap-1 font-mono text-muted-foreground text-[11px]">
|
|
153
|
+
<Hash class="h-3 w-3" />
|
|
154
|
+
<span>{currentRevision.auditHash}</span>
|
|
155
|
+
</span>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
{#if onApplyRollback}
|
|
159
|
+
<Button
|
|
160
|
+
type="button"
|
|
161
|
+
variant="outline"
|
|
162
|
+
size="sm"
|
|
163
|
+
class="h-7 text-xs gap-1.5"
|
|
164
|
+
onclick={() => onApplyRollback(currentRevision)}
|
|
165
|
+
>
|
|
166
|
+
<RotateCcw class="h-3.5 w-3.5 text-primary" />
|
|
167
|
+
<span>{chinese ? '申请回滚至此版本' : 'Rollback to this snapshot'}</span>
|
|
168
|
+
</Button>
|
|
169
|
+
{/if}
|
|
170
|
+
</div>
|
|
171
|
+
{/if}
|
|
172
|
+
|
|
173
|
+
<!-- Snapshot Field Differences Table -->
|
|
174
|
+
<div class="space-y-2">
|
|
175
|
+
<div class="flex items-center justify-between text-xs font-semibold text-muted-foreground px-1">
|
|
176
|
+
<span>{chinese ? '字段级快照变更对照 (与上一版本比较)' : 'Field-level diff vs previous snapshot'}</span>
|
|
177
|
+
<span>{diffRows.filter((r) => r.isChanged).length} 项属性变动</span>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<div class="rounded-md border border-border overflow-hidden">
|
|
181
|
+
<table class="w-full text-left text-xs border-collapse">
|
|
182
|
+
<thead class="bg-muted/40 border-b border-border text-muted-foreground font-semibold">
|
|
183
|
+
<tr>
|
|
184
|
+
<th class="p-3 w-48">{chinese ? '属性字段' : 'Property'}</th>
|
|
185
|
+
<th class="p-3">{chinese ? '变更前 (Before)' : 'Before'}</th>
|
|
186
|
+
<th class="p-3 w-8 text-center"></th>
|
|
187
|
+
<th class="p-3">{chinese ? '变更后 (After)' : 'After'}</th>
|
|
188
|
+
</tr>
|
|
189
|
+
</thead>
|
|
190
|
+
<tbody class="divide-y divide-border/60">
|
|
191
|
+
{#each diffRows as row (row.key)}
|
|
192
|
+
<tr class={cn(row.isChanged && 'bg-warning/5')}>
|
|
193
|
+
<td class="p-3 font-mono font-medium text-foreground">{row.key}</td>
|
|
194
|
+
<td class="p-3 text-muted-foreground font-mono">
|
|
195
|
+
{#if row.isChanged}
|
|
196
|
+
<span class="line-through text-destructive/80">{row.oldVal}</span>
|
|
197
|
+
{:else}
|
|
198
|
+
<span>{row.oldVal}</span>
|
|
199
|
+
{/if}
|
|
200
|
+
</td>
|
|
201
|
+
<td class="p-3 text-center text-muted-foreground">
|
|
202
|
+
{#if row.isChanged}
|
|
203
|
+
<ArrowRight class="h-3.5 w-3.5 text-warning mx-auto" />
|
|
204
|
+
{/if}
|
|
205
|
+
</td>
|
|
206
|
+
<td class="p-3 font-mono">
|
|
207
|
+
{#if row.isChanged}
|
|
208
|
+
<span class="font-bold text-success">{row.newVal}</span>
|
|
209
|
+
{:else}
|
|
210
|
+
<span class="text-muted-foreground">{row.newVal}</span>
|
|
211
|
+
{/if}
|
|
212
|
+
</td>
|
|
213
|
+
</tr>
|
|
214
|
+
{/each}
|
|
215
|
+
</tbody>
|
|
216
|
+
</table>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SnapshotRevision {
|
|
2
|
+
id: string;
|
|
3
|
+
version: string | number;
|
|
4
|
+
timestamp: string;
|
|
5
|
+
author: string;
|
|
6
|
+
comment?: string | undefined;
|
|
7
|
+
auditHash: string;
|
|
8
|
+
snapshot: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface SnapshotTimelineReplayProps {
|
|
11
|
+
revisions: SnapshotRevision[];
|
|
12
|
+
title?: string | undefined;
|
|
13
|
+
description?: string | undefined;
|
|
14
|
+
class?: string | undefined;
|
|
15
|
+
onApplyRollback?: ((revision: SnapshotRevision) => void) | undefined;
|
|
16
|
+
}
|
|
17
|
+
declare const SnapshotTimelineReplay: import("svelte").Component<SnapshotTimelineReplayProps, {}, "">;
|
|
18
|
+
type SnapshotTimelineReplay = ReturnType<typeof SnapshotTimelineReplay>;
|
|
19
|
+
export default SnapshotTimelineReplay;
|