@svadmin/ui 0.122.0 → 0.126.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 +581 -4
- package/dist/app.theme.css +581 -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/ApiSettings.svelte +1 -1
- package/dist/components/AppearanceSettings.svelte +1 -1
- 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/AuditLogDrawer.svelte +2 -2
- package/dist/components/AuditTrailInspector.svelte +448 -0
- package/dist/components/AuditTrailInspector.svelte.d.ts +44 -0
- package/dist/components/AutoTable.svelte +20 -1
- package/dist/components/AutoTable.svelte.d.ts +2 -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/CheckCard.svelte +1 -1
- package/dist/components/ClusterTopologyGraph.svelte +317 -0
- package/dist/components/ClusterTopologyGraph.svelte.d.ts +31 -0
- package/dist/components/ColumnHeaderFilter.svelte +6 -6
- 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/EditableTable.svelte +2 -2
- 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/ExcelImportWizard.svelte +2 -2
- package/dist/components/FeatureAnnouncementModal.svelte +173 -0
- package/dist/components/FeatureAnnouncementModal.svelte.d.ts +21 -0
- package/dist/components/FieldRenderer.svelte +1 -1
- 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/ImportWizard.svelte +2 -2
- package/dist/components/IncidentWarRoomDrawer.svelte +194 -0
- package/dist/components/IncidentWarRoomDrawer.svelte.d.ts +24 -0
- package/dist/components/InputGroup.svelte +133 -0
- package/dist/components/InputGroup.svelte.d.ts +16 -0
- package/dist/components/JsonSchemaForm.svelte +4 -4
- package/dist/components/LightFilter.svelte +2 -2
- 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/MicroAppRouteSync.svelte +185 -0
- package/dist/components/MicroAppRouteSync.svelte.d.ts +12 -0
- package/dist/components/MicroAppSandbox.svelte +200 -0
- package/dist/components/MicroAppSandbox.svelte.d.ts +16 -0
- package/dist/components/MicroAppStateBusIndicator.svelte +159 -0
- package/dist/components/MicroAppStateBusIndicator.svelte.d.ts +12 -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/PermissionMatrix.svelte +1 -1
- 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/Rate.svelte +19 -2
- package/dist/components/Result.svelte +36 -4
- package/dist/components/Result.svelte.d.ts +4 -2
- 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/SchemaVisualModeler.svelte +2 -2
- 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/Spin.svelte +33 -11
- package/dist/components/Spin.svelte.d.ts +7 -4
- 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/Steps.svelte +44 -3
- 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/ThemeSettingsDrawer.svelte +6 -14
- 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/Timeline.svelte +12 -3
- package/dist/components/Timeline.svelte.d.ts +2 -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/badge/badge.svelte +3 -3
- 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/useMicroAppState.d.svelte.ts +1 -0
- package/dist/components/useMicroAppState.svelte.d.ts +17 -0
- package/dist/components/useMicroAppState.svelte.js +38 -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 +5 -1
- package/dist/index.d.ts +75 -3
- package/dist/index.js +118 -2
- package/package.json +4 -4
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
ShieldCheck,
|
|
4
|
+
Download,
|
|
5
|
+
AlertTriangle,
|
|
6
|
+
Check,
|
|
7
|
+
Fingerprint,
|
|
8
|
+
X,
|
|
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 ExportColumnDef {
|
|
15
|
+
key: string;
|
|
16
|
+
label: string;
|
|
17
|
+
isSensitive?: boolean | undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ExportAuditPayload {
|
|
21
|
+
exportId: string;
|
|
22
|
+
operatorId: string;
|
|
23
|
+
operatorName: string;
|
|
24
|
+
reason: string;
|
|
25
|
+
recordCount: number;
|
|
26
|
+
sensitiveFields: string[];
|
|
27
|
+
format: 'csv' | 'tsv';
|
|
28
|
+
fingerprintHash: string;
|
|
29
|
+
exportedAt: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SecureDataExporterProps {
|
|
33
|
+
data: Record<string, unknown>[];
|
|
34
|
+
columns: ExportColumnDef[];
|
|
35
|
+
fileName?: string | undefined;
|
|
36
|
+
operatorId?: string | undefined;
|
|
37
|
+
operatorName?: string | undefined;
|
|
38
|
+
title?: string | undefined;
|
|
39
|
+
class?: string | undefined;
|
|
40
|
+
onExportAuditRecord?: ((audit: ExportAuditPayload) => void | Promise<void>) | undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let {
|
|
44
|
+
data = [],
|
|
45
|
+
columns = [],
|
|
46
|
+
fileName = 'export_records',
|
|
47
|
+
operatorId = 'USER-9527',
|
|
48
|
+
operatorName = '张财务 (Finance Lead)',
|
|
49
|
+
title,
|
|
50
|
+
class: className = '',
|
|
51
|
+
onExportAuditRecord,
|
|
52
|
+
}: SecureDataExporterProps = $props();
|
|
53
|
+
|
|
54
|
+
const i18n = useTranslation();
|
|
55
|
+
const chinese = $derived(i18n.locale.startsWith('zh'));
|
|
56
|
+
|
|
57
|
+
let isModalOpen = $state(false);
|
|
58
|
+
let exportReason = $state('');
|
|
59
|
+
let exportFormat = $state<'csv' | 'tsv'>('csv');
|
|
60
|
+
let isExporting = $state(false);
|
|
61
|
+
let isSuccess = $state(false);
|
|
62
|
+
|
|
63
|
+
const sensitiveColumns = $derived(columns.filter((c) => c.isSensitive));
|
|
64
|
+
|
|
65
|
+
function generateFingerprint(exportId: string, timestamp: string): string {
|
|
66
|
+
const raw = `${exportId}:${operatorId}:${timestamp}:${data.length}`;
|
|
67
|
+
let hash = 0;
|
|
68
|
+
for (let i = 0; i < raw.length; i++) {
|
|
69
|
+
hash = (hash << 5) - hash + raw.charCodeAt(i);
|
|
70
|
+
hash |= 0;
|
|
71
|
+
}
|
|
72
|
+
return `FP-${Math.abs(hash).toString(16).padStart(8, '0').toUpperCase()}`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function formatFileWithFingerprint(format: 'csv' | 'tsv', fingerprint: string, timestamp: string): string {
|
|
76
|
+
const delimiter = format === 'tsv' ? '\t' : ',';
|
|
77
|
+
const commentPrefix = '# ';
|
|
78
|
+
const headerBanner = `${commentPrefix}CONFIDENTIAL EXPORT FINGERPRINT: [${fingerprint}] OPERATOR: [${operatorId}] TIME: [${timestamp}]\n`;
|
|
79
|
+
|
|
80
|
+
const colHeaders = columns.map((c) => c.label).join(delimiter);
|
|
81
|
+
const dataLines = data.map((row) =>
|
|
82
|
+
columns
|
|
83
|
+
.map((col) => {
|
|
84
|
+
const val = row[col.key];
|
|
85
|
+
const str = val === null || val === undefined ? '' : String(val);
|
|
86
|
+
if (str.includes(delimiter) || str.includes('\n') || str.includes('"')) {
|
|
87
|
+
return `"${str.replace(/"/g, '""')}"`;
|
|
88
|
+
}
|
|
89
|
+
return str;
|
|
90
|
+
})
|
|
91
|
+
.join(delimiter),
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return headerBanner + [colHeaders, ...dataLines].join('\n');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function handleConfirmExport() {
|
|
98
|
+
if (!exportReason.trim() || isExporting) return;
|
|
99
|
+
isExporting = true;
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
const exportId = `exp-${Math.random().toString(36).slice(2, 8)}`;
|
|
103
|
+
const timestamp = new Date().toISOString();
|
|
104
|
+
const fingerprintHash = generateFingerprint(exportId, timestamp);
|
|
105
|
+
|
|
106
|
+
const audit: ExportAuditPayload = {
|
|
107
|
+
exportId,
|
|
108
|
+
operatorId,
|
|
109
|
+
operatorName,
|
|
110
|
+
reason: exportReason.trim(),
|
|
111
|
+
recordCount: data.length,
|
|
112
|
+
sensitiveFields: sensitiveColumns.map((c) => c.key),
|
|
113
|
+
format: exportFormat,
|
|
114
|
+
fingerprintHash,
|
|
115
|
+
exportedAt: timestamp,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
await onExportAuditRecord?.(audit);
|
|
119
|
+
|
|
120
|
+
const content = formatFileWithFingerprint(exportFormat, fingerprintHash, timestamp);
|
|
121
|
+
const mime = exportFormat === 'tsv' ? 'text/tab-separated-values;charset=utf-8;' : 'text/csv;charset=utf-8;';
|
|
122
|
+
const blob = new Blob([content], { type: mime });
|
|
123
|
+
|
|
124
|
+
if (typeof window !== 'undefined') {
|
|
125
|
+
const url = URL.createObjectURL(blob);
|
|
126
|
+
const a = document.createElement('a');
|
|
127
|
+
a.href = url;
|
|
128
|
+
a.download = `${fileName}_${fingerprintHash}.${exportFormat}`;
|
|
129
|
+
a.click();
|
|
130
|
+
URL.revokeObjectURL(url);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
isSuccess = true;
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
isModalOpen = false;
|
|
136
|
+
isSuccess = false;
|
|
137
|
+
exportReason = '';
|
|
138
|
+
}, 1200);
|
|
139
|
+
} finally {
|
|
140
|
+
isExporting = false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const resolvedBtnLabel = $derived(
|
|
145
|
+
title ?? (chinese ? '安全溯源导出' : 'Secure Export'),
|
|
146
|
+
);
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
<div
|
|
150
|
+
data-svadmin-component="SecureDataExporter"
|
|
151
|
+
class={cn('inline-flex items-center', className)}
|
|
152
|
+
>
|
|
153
|
+
<Button
|
|
154
|
+
type="button"
|
|
155
|
+
variant="outline"
|
|
156
|
+
size="sm"
|
|
157
|
+
onclick={() => (isModalOpen = true)}
|
|
158
|
+
class="gap-1.5 text-xs font-medium"
|
|
159
|
+
>
|
|
160
|
+
<ShieldCheck class="h-4 w-4 text-primary" />
|
|
161
|
+
<span>{resolvedBtnLabel}</span>
|
|
162
|
+
</Button>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<!-- Security Confirmation & Reason Modal -->
|
|
166
|
+
{#if isModalOpen}
|
|
167
|
+
<div
|
|
168
|
+
role="dialog"
|
|
169
|
+
aria-modal="true"
|
|
170
|
+
aria-label="Secure export confirmation"
|
|
171
|
+
class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm"
|
|
172
|
+
>
|
|
173
|
+
<div
|
|
174
|
+
class="relative z-10 w-full max-w-lg rounded-2xl border border-border bg-card p-6 text-card-foreground shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-150 text-xs"
|
|
175
|
+
>
|
|
176
|
+
<!-- Header -->
|
|
177
|
+
<div class="flex items-start justify-between border-b border-border/70 pb-3">
|
|
178
|
+
<div class="flex items-center gap-2.5">
|
|
179
|
+
<div class="flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10 text-primary border border-primary/20">
|
|
180
|
+
<Fingerprint class="h-5 w-5" />
|
|
181
|
+
</div>
|
|
182
|
+
<div>
|
|
183
|
+
<h3 class="text-base font-bold text-foreground">
|
|
184
|
+
{chinese ? '企业数据安全溯源导出' : 'Secure Traceable Data Export'}
|
|
185
|
+
</h3>
|
|
186
|
+
<p class="text-[11px] text-muted-foreground mt-0.5">
|
|
187
|
+
{chinese ? '本次导出将自动嵌入防篡改数字溯源指纹与操作员工号' : 'Export file will be stamped with operator fingerprint'}
|
|
188
|
+
</p>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
<button
|
|
193
|
+
type="button"
|
|
194
|
+
onclick={() => (isModalOpen = false)}
|
|
195
|
+
class="rounded-lg p-1 text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
196
|
+
aria-label="Close"
|
|
197
|
+
>
|
|
198
|
+
<X class="h-4 w-4" />
|
|
199
|
+
</button>
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<!-- Scope & Security Warning Banner -->
|
|
203
|
+
<div class="rounded-xl border border-warning/30 bg-warning/5 p-3.5 space-y-2">
|
|
204
|
+
<div class="flex items-center justify-between font-medium">
|
|
205
|
+
<span class="flex items-center gap-1.5 text-warning font-bold">
|
|
206
|
+
<AlertTriangle class="h-4 w-4" />
|
|
207
|
+
<span>{chinese ? '导出范围与安全提示' : 'Export Security Notice'}</span>
|
|
208
|
+
</span>
|
|
209
|
+
<span class="font-mono text-foreground font-bold">
|
|
210
|
+
{chinese ? `共 ${data.length} 条记录` : `${data.length} records`}
|
|
211
|
+
</span>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
{#if sensitiveColumns.length > 0}
|
|
215
|
+
<div class="text-[11px] text-muted-foreground">
|
|
216
|
+
{chinese ? '检测到包含隐私/敏感字段:' : 'Contains sensitive fields:'}
|
|
217
|
+
<span class="text-destructive font-mono font-medium ml-1">
|
|
218
|
+
{sensitiveColumns.map((c) => c.label).join(', ')}
|
|
219
|
+
</span>
|
|
220
|
+
</div>
|
|
221
|
+
{/if}
|
|
222
|
+
|
|
223
|
+
<div class="text-[11px] text-muted-foreground">
|
|
224
|
+
{chinese ? `当前操作人: ${operatorName} (${operatorId})` : `Operator: ${operatorName} (${operatorId})`}
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
<!-- Format & Reason Form -->
|
|
229
|
+
<div class="space-y-3">
|
|
230
|
+
<div>
|
|
231
|
+
<div class="block font-semibold text-foreground mb-1">
|
|
232
|
+
{chinese ? '文件导出格式' : 'Export Format'}
|
|
233
|
+
</div>
|
|
234
|
+
<div class="flex gap-4">
|
|
235
|
+
<label class="inline-flex items-center gap-1.5 cursor-pointer font-medium">
|
|
236
|
+
<input type="radio" value="csv" bind:group={exportFormat} class="accent-primary" />
|
|
237
|
+
<span>CSV (.csv)</span>
|
|
238
|
+
</label>
|
|
239
|
+
<label class="inline-flex items-center gap-1.5 cursor-pointer font-medium">
|
|
240
|
+
<input type="radio" value="tsv" bind:group={exportFormat} class="accent-primary" />
|
|
241
|
+
<span>Excel TSV (.tsv)</span>
|
|
242
|
+
</label>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
<div>
|
|
247
|
+
<label for="export-reason-input" class="block font-semibold text-foreground mb-1">
|
|
248
|
+
{chinese ? '合规导出申请事由 (必填) *' : 'Compliance Export Reason (Required) *'}
|
|
249
|
+
</label>
|
|
250
|
+
<textarea
|
|
251
|
+
id="export-reason-input"
|
|
252
|
+
bind:value={exportReason}
|
|
253
|
+
rows="3"
|
|
254
|
+
placeholder={chinese ? '请如实填写导出用途 (如: 2026Q4 财务清算审计)...' : 'State reason for export for compliance audit...'}
|
|
255
|
+
class="w-full rounded-lg border border-input bg-background p-2.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
256
|
+
></textarea>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<!-- Footer Actions -->
|
|
261
|
+
<div class="flex items-center justify-between border-t border-border/70 pt-3">
|
|
262
|
+
<span class="text-[10px] text-muted-foreground font-mono">
|
|
263
|
+
STAMP: SHA256-INJECTED
|
|
264
|
+
</span>
|
|
265
|
+
|
|
266
|
+
<div class="flex items-center gap-2">
|
|
267
|
+
<Button
|
|
268
|
+
type="button"
|
|
269
|
+
variant="ghost"
|
|
270
|
+
size="sm"
|
|
271
|
+
onclick={() => (isModalOpen = false)}
|
|
272
|
+
disabled={isExporting}
|
|
273
|
+
>
|
|
274
|
+
{chinese ? '取消' : 'Cancel'}
|
|
275
|
+
</Button>
|
|
276
|
+
|
|
277
|
+
<Button
|
|
278
|
+
type="button"
|
|
279
|
+
size="sm"
|
|
280
|
+
disabled={!exportReason.trim() || isExporting}
|
|
281
|
+
onclick={handleConfirmExport}
|
|
282
|
+
class="gap-1.5 min-w-28"
|
|
283
|
+
>
|
|
284
|
+
{#if isSuccess}
|
|
285
|
+
<Check class="h-3.5 w-3.5 text-success" />
|
|
286
|
+
<span>{chinese ? '已加签导出' : 'Exported'}</span>
|
|
287
|
+
{:else}
|
|
288
|
+
<Download class="h-3.5 w-3.5" />
|
|
289
|
+
<span>{chinese ? '确认并加签导出' : 'Authorize & Export'}</span>
|
|
290
|
+
{/if}
|
|
291
|
+
</Button>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
{/if}
|
|
@@ -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;
|