@svadmin/lite 0.27.0 → 0.31.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/components/LiteAbacPolicyMatrix.svelte +128 -0
- package/dist/components/LiteAbacPolicyMatrix.svelte.d.ts +16 -0
- package/dist/components/LiteApiPlayground.svelte +103 -0
- package/dist/components/LiteApiPlayground.svelte.d.ts +10 -0
- package/dist/components/LiteApprovalChainBuilder.svelte +120 -0
- package/dist/components/LiteApprovalChainBuilder.svelte.d.ts +15 -0
- package/dist/components/LiteAuditTrailInspector.svelte +166 -0
- package/dist/components/LiteAuditTrailInspector.svelte.d.ts +23 -0
- package/dist/components/LiteBillingInvoiceDrawer.svelte +100 -0
- package/dist/components/LiteBillingInvoiceDrawer.svelte.d.ts +16 -0
- package/dist/components/LiteChartAnnotationOverlay.svelte +101 -0
- package/dist/components/LiteChartAnnotationOverlay.svelte.d.ts +16 -0
- package/dist/components/LiteColumnMappingTable.svelte +105 -0
- package/dist/components/LiteColumnMappingTable.svelte.d.ts +14 -0
- package/dist/components/LiteCronExpressionBuilder.svelte +4 -1
- package/dist/components/LiteDashboardGridLayout.svelte +108 -0
- package/dist/components/LiteDashboardGridLayout.svelte.d.ts +16 -0
- package/dist/components/LiteDashboardLayoutStorage.svelte +88 -0
- package/dist/components/LiteDashboardLayoutStorage.svelte.d.ts +16 -0
- package/dist/components/LiteDataImportDropzone.svelte +89 -0
- package/dist/components/LiteDataImportDropzone.svelte.d.ts +10 -0
- package/dist/components/LiteDataLineageGraph.svelte +100 -0
- package/dist/components/LiteDataLineageGraph.svelte.d.ts +15 -0
- package/dist/components/LiteDataMaskPolicyEngine.svelte +131 -0
- package/dist/components/LiteDataMaskPolicyEngine.svelte.d.ts +16 -0
- package/dist/components/LiteDataScreenContainer.svelte +34 -0
- package/dist/components/LiteDataScreenContainer.svelte.d.ts +9 -0
- package/dist/components/LiteElectronicSealStamp.svelte +56 -0
- package/dist/components/LiteElectronicSealStamp.svelte.d.ts +9 -0
- package/dist/components/LiteEnvVariableEditor.svelte +114 -0
- package/dist/components/LiteEnvVariableEditor.svelte.d.ts +15 -0
- package/dist/components/LiteFormulaField.svelte +44 -0
- package/dist/components/LiteFormulaField.svelte.d.ts +11 -0
- package/dist/components/LiteGeoScatterMap.svelte +117 -0
- package/dist/components/LiteGeoScatterMap.svelte.d.ts +16 -0
- package/dist/components/LiteGrid.svelte +10 -10
- package/dist/components/LiteHmacSignatureCalculator.svelte +84 -0
- package/dist/components/LiteHmacSignatureCalculator.svelte.d.ts +10 -0
- package/dist/components/LiteImportPreviewValidator.svelte +136 -0
- package/dist/components/LiteImportPreviewValidator.svelte.d.ts +16 -0
- package/dist/components/LiteLiveStreamLogViewer.svelte +84 -0
- package/dist/components/LiteLiveStreamLogViewer.svelte.d.ts +14 -0
- package/dist/components/LiteMicroAppRouteSync.svelte +72 -0
- package/dist/components/LiteMicroAppRouteSync.svelte.d.ts +9 -0
- package/dist/components/LiteMicroAppSandbox.svelte +74 -0
- package/dist/components/LiteMicroAppSandbox.svelte.d.ts +9 -0
- package/dist/components/LiteMicroAppStateBusIndicator.svelte +70 -0
- package/dist/components/LiteMicroAppStateBusIndicator.svelte.d.ts +7 -0
- package/dist/components/LiteOmnibarCommandPalette.svelte +111 -0
- package/dist/components/LiteOmnibarCommandPalette.svelte.d.ts +15 -0
- package/dist/components/LitePeriodComparisonCard.svelte +60 -0
- package/dist/components/LitePeriodComparisonCard.svelte.d.ts +11 -0
- package/dist/components/LitePermissionSimulator.svelte +90 -0
- package/dist/components/LitePermissionSimulator.svelte.d.ts +14 -0
- package/dist/components/LitePivotMatrix.svelte +138 -0
- package/dist/components/LitePivotMatrix.svelte.d.ts +18 -0
- package/dist/components/LitePlanUsageQuotaBar.svelte +96 -0
- package/dist/components/LitePlanUsageQuotaBar.svelte.d.ts +15 -0
- package/dist/components/LitePopconfirm.svelte +2 -0
- package/dist/components/LiteQueryAiExplainer.svelte +85 -0
- package/dist/components/LiteQueryAiExplainer.svelte.d.ts +10 -0
- package/dist/components/LiteScheduledJobManager.svelte +116 -0
- package/dist/components/LiteScheduledJobManager.svelte.d.ts +16 -0
- package/dist/components/LiteScreenAntiLeakGuard.svelte +56 -0
- package/dist/components/LiteScreenAntiLeakGuard.svelte.d.ts +8 -0
- package/dist/components/LiteSecureDataExporter.svelte +101 -0
- package/dist/components/LiteSecureDataExporter.svelte.d.ts +12 -0
- package/dist/components/LiteSpace.svelte +6 -6
- package/dist/components/LiteSpin.svelte +4 -2
- package/dist/components/LiteSpin.svelte.d.ts +2 -0
- package/dist/components/LiteSqlConsole.svelte +128 -0
- package/dist/components/LiteSqlConsole.svelte.d.ts +16 -0
- package/dist/components/LiteStatusTabs.svelte +1 -1
- package/dist/components/LiteSystemCapacityForecastCard.svelte +88 -0
- package/dist/components/LiteSystemCapacityForecastCard.svelte.d.ts +11 -0
- package/dist/components/LiteSystemHealthCheckDashboard.svelte +142 -0
- package/dist/components/LiteSystemHealthCheckDashboard.svelte.d.ts +18 -0
- package/dist/components/LiteTableAggregationFooter.svelte +76 -0
- package/dist/components/LiteTableAggregationFooter.svelte.d.ts +14 -0
- package/dist/components/LiteTenantContextSwitcher.svelte +173 -0
- package/dist/components/LiteTenantContextSwitcher.svelte.d.ts +27 -0
- package/dist/components/LiteTenantQuotasMatrix.svelte +117 -0
- package/dist/components/LiteTenantQuotasMatrix.svelte.d.ts +17 -0
- package/dist/components/LiteThreadedCommentDrawer.svelte +60 -0
- package/dist/components/LiteThreadedCommentDrawer.svelte.d.ts +15 -0
- package/dist/components/LiteTierFeatureComparison.svelte +97 -0
- package/dist/components/LiteTierFeatureComparison.svelte.d.ts +18 -0
- package/dist/components/LiteTwoFactorStepper.svelte +1 -1
- package/dist/components/LiteVirtualTreeSelect.svelte +4 -1
- package/dist/components/LiteWebhookSimulator.svelte +120 -0
- package/dist/components/LiteWebhookSimulator.svelte.d.ts +11 -0
- package/dist/components/LiteWorkflowNodeInspector.svelte +79 -0
- package/dist/components/LiteWorkflowNodeInspector.svelte.d.ts +11 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +51 -0
- package/package.json +2 -2
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface ServiceItem {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
endpoint: string;
|
|
6
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
7
|
+
latencyMs: number;
|
|
8
|
+
details?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
title?: string;
|
|
13
|
+
environment?: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
services?: ServiceItem[];
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
title = '系统链路健康自检大盘',
|
|
21
|
+
environment = 'production-east-01',
|
|
22
|
+
version = 'v2.8.4-enterprise',
|
|
23
|
+
services = [
|
|
24
|
+
{ id: 's1', name: 'PostgreSQL 主数据库集群', endpoint: 'db.internal.svc:5432', status: 'healthy', latencyMs: 3, details: '连接池活跃度 18/100' },
|
|
25
|
+
{ id: 's2', name: 'Redis 分布式缓存与锁', endpoint: 'redis-master.internal:6379', status: 'healthy', latencyMs: 1, details: '命中率 99.4%' },
|
|
26
|
+
{ id: 's3', name: 'MinIO / S3 企业对象存储', endpoint: 's3.oss-cn-shanghai.internal', status: 'healthy', latencyMs: 18, details: '读写探测成功' },
|
|
27
|
+
{ id: 's4', name: 'SupaAuth / SSO 统一鉴权', endpoint: 'auth.svadmin.internal/v1', status: 'healthy', latencyMs: 12, details: 'JWT 验签通畅' },
|
|
28
|
+
{ id: 's5', name: 'RabbitMQ 异步事件消息队列', endpoint: 'mq-node1.cluster.internal:5672', status: 'degraded', latencyMs: 145, details: '死信队列堆积 42 条' }
|
|
29
|
+
],
|
|
30
|
+
class: className = '',
|
|
31
|
+
}: Props = $props();
|
|
32
|
+
|
|
33
|
+
const healthyCount = $derived(services.filter(s => s.status === 'healthy').length);
|
|
34
|
+
const avgLatency = $derived(
|
|
35
|
+
services.length > 0 ? Math.round(services.reduce((a, b) => a + b.latencyMs, 0) / services.length) : 0
|
|
36
|
+
);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<div
|
|
40
|
+
class="lite-health-dash {className}"
|
|
41
|
+
data-svadmin-component="LiteSystemHealthCheckDashboard"
|
|
42
|
+
role="region"
|
|
43
|
+
aria-label="System Health Dashboard"
|
|
44
|
+
>
|
|
45
|
+
<header class="lite-health-header">
|
|
46
|
+
<div>
|
|
47
|
+
<h4 class="lite-health-title">{title}</h4>
|
|
48
|
+
<span class="lite-health-meta">环境: {environment} · 版本: {version}</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="lite-health-kpi">
|
|
51
|
+
<span class="lite-kpi-pill">健康组件: <strong>{healthyCount}/{services.length}</strong></span>
|
|
52
|
+
<span class="lite-kpi-pill">平均延时: <strong class="font-mono">{avgLatency}ms</strong></span>
|
|
53
|
+
</div>
|
|
54
|
+
</header>
|
|
55
|
+
|
|
56
|
+
<div class="lite-health-table-wrap">
|
|
57
|
+
<table class="lite-health-table">
|
|
58
|
+
<thead>
|
|
59
|
+
<tr>
|
|
60
|
+
<th>服务组件名称</th>
|
|
61
|
+
<th>连接端点</th>
|
|
62
|
+
<th>链路状态</th>
|
|
63
|
+
<th>往返延时</th>
|
|
64
|
+
<th>检测指标详情</th>
|
|
65
|
+
</tr>
|
|
66
|
+
</thead>
|
|
67
|
+
<tbody>
|
|
68
|
+
{#each services as s (s.id)}
|
|
69
|
+
<tr>
|
|
70
|
+
<td class="lite-td-srvname">{s.name}</td>
|
|
71
|
+
<td class="lite-td-endpoint font-mono">{s.endpoint}</td>
|
|
72
|
+
<td>
|
|
73
|
+
<span
|
|
74
|
+
class="lite-status-pill"
|
|
75
|
+
class:lite-pill-healthy={s.status === 'healthy'}
|
|
76
|
+
class:lite-pill-warn={s.status === 'degraded'}
|
|
77
|
+
class:lite-pill-err={s.status === 'unhealthy'}
|
|
78
|
+
>
|
|
79
|
+
{s.status === 'healthy' ? '运行健康' : s.status === 'degraded' ? '性能亚健康' : '链路故障'}
|
|
80
|
+
</span>
|
|
81
|
+
</td>
|
|
82
|
+
<td class="lite-td-latency font-mono">{s.latencyMs} ms</td>
|
|
83
|
+
<td class="lite-td-detail">{s.details ?? '—'}</td>
|
|
84
|
+
</tr>
|
|
85
|
+
{/each}
|
|
86
|
+
</tbody>
|
|
87
|
+
</table>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<style>
|
|
92
|
+
.lite-health-dash {
|
|
93
|
+
border: 1px solid #e5e6eb;
|
|
94
|
+
border-radius: 6px;
|
|
95
|
+
background: #ffffff;
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
}
|
|
99
|
+
.lite-health-header {
|
|
100
|
+
display: flex;
|
|
101
|
+
justify-content: space-between;
|
|
102
|
+
align-items: center;
|
|
103
|
+
padding: 10px 14px;
|
|
104
|
+
background: #f7f8fa;
|
|
105
|
+
border-bottom: 1px solid #e5e6eb;
|
|
106
|
+
}
|
|
107
|
+
.lite-health-title { margin: 0; font-size: 13px; font-weight: 600; color: #1d2129; }
|
|
108
|
+
.lite-health-meta { font-size: 11px; color: #86909c; display: block; margin-top: 2px; }
|
|
109
|
+
.lite-health-kpi { display: flex; }
|
|
110
|
+
.lite-health-kpi > * + * { margin-left: 8px; }
|
|
111
|
+
.lite-kpi-pill { font-size: 11px; background: #ffffff; border: 1px solid #e5e6eb; padding: 2px 8px; border-radius: 4px; color: #4e5969; }
|
|
112
|
+
.lite-kpi-pill strong { color: #165dff; }
|
|
113
|
+
.lite-health-table-wrap { overflow-x: auto; }
|
|
114
|
+
.lite-health-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; }
|
|
115
|
+
.lite-health-table th {
|
|
116
|
+
padding: 8px 12px;
|
|
117
|
+
background: #f2f3f5;
|
|
118
|
+
border-bottom: 1px solid #e5e6eb;
|
|
119
|
+
color: #4e5969;
|
|
120
|
+
font-weight: 600;
|
|
121
|
+
}
|
|
122
|
+
.lite-health-table td {
|
|
123
|
+
padding: 8px 12px;
|
|
124
|
+
border-bottom: 1px solid #f2f3f5;
|
|
125
|
+
color: #1d2129;
|
|
126
|
+
}
|
|
127
|
+
.lite-td-srvname { font-weight: 600; }
|
|
128
|
+
.font-mono { font-family: monospace; }
|
|
129
|
+
.lite-td-endpoint { color: #4e5969; }
|
|
130
|
+
.lite-status-pill {
|
|
131
|
+
display: inline-block;
|
|
132
|
+
padding: 1px 6px;
|
|
133
|
+
border-radius: 3px;
|
|
134
|
+
font-size: 10px;
|
|
135
|
+
font-weight: 600;
|
|
136
|
+
}
|
|
137
|
+
.lite-pill-healthy { background: #e8ffea; color: #00b42a; }
|
|
138
|
+
.lite-pill-warn { background: #fff7e8; color: #ff7d00; }
|
|
139
|
+
.lite-pill-err { background: #ffece8; color: #f53f3f; }
|
|
140
|
+
.lite-td-latency { font-weight: 600; }
|
|
141
|
+
.lite-td-detail { color: #86909c; }
|
|
142
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface ServiceItem {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
endpoint: string;
|
|
5
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
6
|
+
latencyMs: number;
|
|
7
|
+
details?: string;
|
|
8
|
+
}
|
|
9
|
+
interface Props {
|
|
10
|
+
title?: string;
|
|
11
|
+
environment?: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
services?: ServiceItem[];
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const LiteSystemHealthCheckDashboard: import("svelte").Component<Props, {}, "">;
|
|
17
|
+
type LiteSystemHealthCheckDashboard = ReturnType<typeof LiteSystemHealthCheckDashboard>;
|
|
18
|
+
export default LiteSystemHealthCheckDashboard;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface AggItem {
|
|
3
|
+
label: string;
|
|
4
|
+
subtotal: string | number;
|
|
5
|
+
grandTotal: string | number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
|
|
10
|
+
aggregations?: AggItem[];
|
|
11
|
+
selectedCount?: number;
|
|
12
|
+
totalCount?: number;
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
|
|
18
|
+
aggregations = [
|
|
19
|
+
{ label: '订单总金额 (¥)', subtotal: '¥ 128,450.00', grandTotal: '¥ 1,489,200.00' },
|
|
20
|
+
{ label: '已结算税额 (¥)', subtotal: '¥ 11,560.50', grandTotal: '¥ 134,028.00' },
|
|
21
|
+
{ label: '商品总件数', subtotal: '450 件', grandTotal: '5,200 件' }
|
|
22
|
+
],
|
|
23
|
+
selectedCount = 12,
|
|
24
|
+
totalCount = 140,
|
|
25
|
+
class: className = '',
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
class="lite-agg-footer {className}"
|
|
31
|
+
data-svadmin-component="LiteTableAggregationFooter"
|
|
32
|
+
role="region"
|
|
33
|
+
aria-label="Table Aggregation Footer"
|
|
34
|
+
>
|
|
35
|
+
<div class="lite-agg-left">
|
|
36
|
+
<span class="lite-agg-selection">已选 <strong class="lite-count">{selectedCount}</strong> 项 / 共 {totalCount} 条记录</span>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div class="lite-agg-right">
|
|
40
|
+
{#each aggregations as agg (agg.label)}
|
|
41
|
+
<div class="lite-agg-cell">
|
|
42
|
+
<span class="lite-agg-label">{agg.label}</span>
|
|
43
|
+
<div class="lite-agg-vals">
|
|
44
|
+
<span class="lite-val-sub">选中小计: <strong>{agg.subtotal}</strong></span>
|
|
45
|
+
<span class="lite-val-total">全表合计: <strong>{agg.grandTotal}</strong></span>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
{/each}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
.lite-agg-footer {
|
|
54
|
+
border: 1px solid #e5e6eb;
|
|
55
|
+
border-radius: 6px;
|
|
56
|
+
background: #f7f8fa;
|
|
57
|
+
padding: 10px 14px;
|
|
58
|
+
font-size: 11px;
|
|
59
|
+
display: flex;
|
|
60
|
+
justify-content: space-between;
|
|
61
|
+
align-items: center;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
}
|
|
64
|
+
.lite-agg-footer > * + * { margin-left: 12px; }
|
|
65
|
+
.lite-agg-left { color: #4e5969; }
|
|
66
|
+
.lite-count { color: #165dff; }
|
|
67
|
+
.lite-agg-right { display: flex; align-items: center; flex-wrap: wrap; }
|
|
68
|
+
.lite-agg-right > * + * { margin-left: 16px; }
|
|
69
|
+
.lite-agg-cell { display: flex; flex-direction: column; text-align: right; }
|
|
70
|
+
.lite-agg-cell > * + * { margin-top: 2px; }
|
|
71
|
+
.lite-agg-label { font-size: 10px; color: #86909c; font-weight: 500; }
|
|
72
|
+
.lite-agg-vals { display: flex; font-family: monospace; font-size: 11px; }
|
|
73
|
+
.lite-agg-vals > * + * { margin-left: 10px; }
|
|
74
|
+
.lite-val-sub strong { color: #165dff; }
|
|
75
|
+
.lite-val-total strong { color: #1d2129; }
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface AggItem {
|
|
2
|
+
label: string;
|
|
3
|
+
subtotal: string | number;
|
|
4
|
+
grandTotal: string | number;
|
|
5
|
+
}
|
|
6
|
+
interface Props {
|
|
7
|
+
aggregations?: AggItem[];
|
|
8
|
+
selectedCount?: number;
|
|
9
|
+
totalCount?: number;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const LiteTableAggregationFooter: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type LiteTableAggregationFooter = ReturnType<typeof LiteTableAggregationFooter>;
|
|
14
|
+
export default LiteTableAggregationFooter;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface TenantRole {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
isPrimary?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface TenantItem {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
code?: string;
|
|
12
|
+
type?: 'group' | 'subsidiary' | 'division' | 'store' | 'workspace';
|
|
13
|
+
logo?: string;
|
|
14
|
+
tier?: 'free' | 'pro' | 'enterprise';
|
|
15
|
+
roles?: (TenantRole | string)[];
|
|
16
|
+
status?: 'active' | 'suspended' | 'trial';
|
|
17
|
+
memberCount?: number;
|
|
18
|
+
description?: string;
|
|
19
|
+
parentId?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface Props {
|
|
23
|
+
currentTenantId?: string;
|
|
24
|
+
tenants?: TenantItem[];
|
|
25
|
+
userRole?: string;
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let {
|
|
30
|
+
currentTenantId = 'tenant-corp-01',
|
|
31
|
+
tenants = [
|
|
32
|
+
{ id: 'tenant-corp-01', name: '星谷数智总集团', code: 'HQ-GLOBAL', type: 'group', tier: 'enterprise' },
|
|
33
|
+
{ id: 'tenant-east-02', name: '华东大区创新科技中心', code: 'DIV-EAST', type: 'subsidiary', tier: 'enterprise' },
|
|
34
|
+
],
|
|
35
|
+
userRole = '全局系统主管',
|
|
36
|
+
class: className = '',
|
|
37
|
+
}: Props = $props();
|
|
38
|
+
|
|
39
|
+
const currentTenant = $derived(
|
|
40
|
+
tenants.find((t) => t.id === currentTenantId) ?? tenants[0]
|
|
41
|
+
);
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<div
|
|
45
|
+
class="lite-tenant-switcher {className}"
|
|
46
|
+
data-svadmin-component="LiteTenantContextSwitcher"
|
|
47
|
+
role="region"
|
|
48
|
+
aria-label="Tenant Context Switcher"
|
|
49
|
+
>
|
|
50
|
+
<div class="lite-tenant-trigger">
|
|
51
|
+
<div class="lite-tenant-badge">
|
|
52
|
+
<span class="lite-tenant-icon">🏢</span>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="lite-tenant-info">
|
|
55
|
+
<div class="lite-tenant-name-row">
|
|
56
|
+
<span class="lite-tenant-name">{currentTenant?.name ?? '当前租户'}</span>
|
|
57
|
+
{#if currentTenant?.tier}
|
|
58
|
+
<span class="lite-tier-tag">{currentTenant.tier}</span>
|
|
59
|
+
{/if}
|
|
60
|
+
</div>
|
|
61
|
+
<span class="lite-tenant-code">{currentTenant?.code ?? userRole}</span>
|
|
62
|
+
</div>
|
|
63
|
+
<span class="lite-caret">▼</span>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div class="lite-tenant-noscript-list">
|
|
67
|
+
<span class="lite-list-title">可用组织与工作区 (SSR 降级静态展示):</span>
|
|
68
|
+
<ul class="lite-tenants-ul">
|
|
69
|
+
{#each tenants as t (t.id)}
|
|
70
|
+
<li class="lite-tenant-li" class:lite-tenant-active={t.id === currentTenantId}>
|
|
71
|
+
<span class="lite-tenant-bullet">•</span>
|
|
72
|
+
<span class="lite-tenant-li-name">{t.name}</span>
|
|
73
|
+
{#if t.code}<span class="lite-tenant-li-code">({t.code})</span>{/if}
|
|
74
|
+
{#if t.id === currentTenantId}<span class="lite-active-mark">[当前]</span>{/if}
|
|
75
|
+
</li>
|
|
76
|
+
{/each}
|
|
77
|
+
</ul>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<style>
|
|
82
|
+
.lite-tenant-switcher {
|
|
83
|
+
border: 1px solid #e5e6eb;
|
|
84
|
+
border-radius: 6px;
|
|
85
|
+
background: #ffffff;
|
|
86
|
+
font-size: 12px;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
padding: 8px 12px;
|
|
89
|
+
}
|
|
90
|
+
.lite-tenant-trigger {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
padding-bottom: 8px;
|
|
94
|
+
border-bottom: 1px dashed #e5e6eb;
|
|
95
|
+
}
|
|
96
|
+
.lite-tenant-badge {
|
|
97
|
+
width: 28px;
|
|
98
|
+
height: 28px;
|
|
99
|
+
border-radius: 4px;
|
|
100
|
+
background: #f2f3f5;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
font-size: 14px;
|
|
105
|
+
margin-right: 8px;
|
|
106
|
+
}
|
|
107
|
+
.lite-tenant-info {
|
|
108
|
+
flex: 1;
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
}
|
|
112
|
+
.lite-tenant-name-row {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
}
|
|
116
|
+
.lite-tenant-name-row > * + * { margin-left: 6px; }
|
|
117
|
+
.lite-tenant-name {
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
color: #1d2129;
|
|
120
|
+
margin-right: 6px;
|
|
121
|
+
}
|
|
122
|
+
.lite-tier-tag {
|
|
123
|
+
font-size: 9px;
|
|
124
|
+
background: #e8f3ff;
|
|
125
|
+
color: #165dff;
|
|
126
|
+
padding: 1px 4px;
|
|
127
|
+
border-radius: 2px;
|
|
128
|
+
text-transform: uppercase;
|
|
129
|
+
}
|
|
130
|
+
.lite-tenant-code {
|
|
131
|
+
font-size: 10px;
|
|
132
|
+
color: #86909c;
|
|
133
|
+
}
|
|
134
|
+
.lite-caret {
|
|
135
|
+
font-size: 10px;
|
|
136
|
+
color: #86909c;
|
|
137
|
+
margin-left: 8px;
|
|
138
|
+
}
|
|
139
|
+
.lite-tenant-noscript-list {
|
|
140
|
+
margin-top: 6px;
|
|
141
|
+
font-size: 11px;
|
|
142
|
+
color: #4e5969;
|
|
143
|
+
}
|
|
144
|
+
.lite-list-title {
|
|
145
|
+
font-size: 10px;
|
|
146
|
+
color: #86909c;
|
|
147
|
+
}
|
|
148
|
+
.lite-tenants-ul {
|
|
149
|
+
list-style: none;
|
|
150
|
+
padding: 0;
|
|
151
|
+
margin: 4px 0 0;
|
|
152
|
+
}
|
|
153
|
+
.lite-tenant-li {
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
padding: 2px 0;
|
|
157
|
+
}
|
|
158
|
+
.lite-tenant-bullet {
|
|
159
|
+
margin-right: 4px;
|
|
160
|
+
}
|
|
161
|
+
.lite-tenant-li-code {
|
|
162
|
+
margin-left: 4px;
|
|
163
|
+
}
|
|
164
|
+
.lite-active-mark {
|
|
165
|
+
margin-left: 4px;
|
|
166
|
+
font-size: 10px;
|
|
167
|
+
color: #165dff;
|
|
168
|
+
}
|
|
169
|
+
.lite-tenant-active {
|
|
170
|
+
color: #165dff;
|
|
171
|
+
font-weight: 600;
|
|
172
|
+
}
|
|
173
|
+
</style>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface TenantRole {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
isPrimary?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface TenantItem {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
code?: string;
|
|
10
|
+
type?: 'group' | 'subsidiary' | 'division' | 'store' | 'workspace';
|
|
11
|
+
logo?: string;
|
|
12
|
+
tier?: 'free' | 'pro' | 'enterprise';
|
|
13
|
+
roles?: (TenantRole | string)[];
|
|
14
|
+
status?: 'active' | 'suspended' | 'trial';
|
|
15
|
+
memberCount?: number;
|
|
16
|
+
description?: string;
|
|
17
|
+
parentId?: string;
|
|
18
|
+
}
|
|
19
|
+
interface Props {
|
|
20
|
+
currentTenantId?: string;
|
|
21
|
+
tenants?: TenantItem[];
|
|
22
|
+
userRole?: string;
|
|
23
|
+
class?: string;
|
|
24
|
+
}
|
|
25
|
+
declare const LiteTenantContextSwitcher: import("svelte").Component<Props, {}, "">;
|
|
26
|
+
type LiteTenantContextSwitcher = ReturnType<typeof LiteTenantContextSwitcher>;
|
|
27
|
+
export default LiteTenantContextSwitcher;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface QuotaItem {
|
|
3
|
+
id: string;
|
|
4
|
+
resourceName: string;
|
|
5
|
+
used: number;
|
|
6
|
+
limit: number;
|
|
7
|
+
unit: string;
|
|
8
|
+
status?: 'normal' | 'warning' | 'exhausted';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
tenantName?: string;
|
|
13
|
+
tierName?: string;
|
|
14
|
+
quotas?: QuotaItem[];
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
tenantName = '上海创智多租户研发中心',
|
|
20
|
+
tierName = '旗舰尊享版 (Enterprise Tier)',
|
|
21
|
+
quotas = [
|
|
22
|
+
{ id: 'q1', resourceName: 'API 请求吞吐', used: 840000, limit: 1000000, unit: 'req/天', status: 'normal' },
|
|
23
|
+
{ id: 'q2', resourceName: '分布式对象存储', used: 480, limit: 500, unit: 'GB', status: 'warning' },
|
|
24
|
+
{ id: 'q3', resourceName: '组织席位数', used: 120, limit: 120, unit: '席位', status: 'exhausted' },
|
|
25
|
+
{ id: 'q4', resourceName: 'AI 智能算力点', used: 3200, limit: 10000, unit: '点', status: 'normal' }
|
|
26
|
+
],
|
|
27
|
+
class: className = '',
|
|
28
|
+
}: Props = $props();
|
|
29
|
+
|
|
30
|
+
function calcPct(u: number, l: number): number {
|
|
31
|
+
if (l <= 0) return 0;
|
|
32
|
+
return Math.min(100, Math.round((u / l) * 100));
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<div
|
|
37
|
+
class="lite-tenant-quotas {className}"
|
|
38
|
+
data-svadmin-component="LiteTenantQuotasMatrix"
|
|
39
|
+
role="region"
|
|
40
|
+
aria-label="Tenant Quotas Matrix"
|
|
41
|
+
>
|
|
42
|
+
<header class="lite-quotas-header">
|
|
43
|
+
<div>
|
|
44
|
+
<h4 class="lite-quotas-tenant">{tenantName}</h4>
|
|
45
|
+
<span class="lite-quotas-tier">{tierName}</span>
|
|
46
|
+
</div>
|
|
47
|
+
</header>
|
|
48
|
+
|
|
49
|
+
<div class="lite-quotas-grid">
|
|
50
|
+
{#each quotas as q (q.id)}
|
|
51
|
+
{@const pct = calcPct(q.used, q.limit)}
|
|
52
|
+
<div class="lite-quota-card">
|
|
53
|
+
<div class="lite-card-top">
|
|
54
|
+
<span class="lite-card-name">{q.resourceName}</span>
|
|
55
|
+
<span class="lite-card-usage">{q.used.toLocaleString()} / {q.limit.toLocaleString()} {q.unit}</span>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="lite-card-track">
|
|
58
|
+
<div
|
|
59
|
+
class="lite-card-bar"
|
|
60
|
+
class:lite-bar-warn={pct >= 85 && pct < 100}
|
|
61
|
+
class:lite-bar-danger={pct >= 100}
|
|
62
|
+
style="width: {pct}%;"
|
|
63
|
+
></div>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="lite-card-bottom">
|
|
66
|
+
<span class="lite-card-pct">{pct}% 已用</span>
|
|
67
|
+
{#if pct >= 100}
|
|
68
|
+
<span class="lite-card-state text-danger">已达硬配额上限</span>
|
|
69
|
+
{:else if pct >= 85}
|
|
70
|
+
<span class="lite-card-state text-warn">接近用量预警线</span>
|
|
71
|
+
{:else}
|
|
72
|
+
<span class="lite-card-state text-ok">配额容量充裕</span>
|
|
73
|
+
{/if}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
{/each}
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<style>
|
|
81
|
+
.lite-tenant-quotas {
|
|
82
|
+
border: 1px solid #e5e6eb;
|
|
83
|
+
border-radius: 6px;
|
|
84
|
+
background: #ffffff;
|
|
85
|
+
font-size: 12px;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
}
|
|
88
|
+
.lite-quotas-header {
|
|
89
|
+
padding: 10px 14px;
|
|
90
|
+
background: #f7f8fa;
|
|
91
|
+
border-bottom: 1px solid #e5e6eb;
|
|
92
|
+
}
|
|
93
|
+
.lite-quotas-tenant { margin: 0; font-size: 13px; font-weight: 600; color: #1d2129; }
|
|
94
|
+
.lite-quotas-tier { font-size: 11px; color: #165dff; font-weight: 500; display: block; margin-top: 2px; }
|
|
95
|
+
.lite-quotas-grid { padding: 12px 14px; overflow: hidden; }
|
|
96
|
+
.lite-quotas-grid .lite-quota-card { float: left; width: calc(50% - 6px); margin: 0 12px 12px 0; box-sizing: border-box; }
|
|
97
|
+
.lite-quotas-grid .lite-quota-card:nth-child(2n) { margin-right: 0; }
|
|
98
|
+
@media (max-width: 640px) { .lite-quotas-grid .lite-quota-card { float: none; width: 100%; margin-right: 0; } }
|
|
99
|
+
.lite-quota-card {
|
|
100
|
+
border: 1px solid #f2f3f5;
|
|
101
|
+
border-radius: 4px;
|
|
102
|
+
padding: 10px;
|
|
103
|
+
background: #fafbfc;
|
|
104
|
+
}
|
|
105
|
+
.lite-card-top { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 11px; }
|
|
106
|
+
.lite-card-name { font-weight: 600; color: #1d2129; }
|
|
107
|
+
.lite-card-usage { font-family: monospace; color: #4e5969; }
|
|
108
|
+
.lite-card-track { height: 6px; background: #e5e6eb; border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
|
|
109
|
+
.lite-card-bar { height: 100%; background: #165dff; border-radius: 3px; }
|
|
110
|
+
.lite-bar-warn { background: #ff7d00; }
|
|
111
|
+
.lite-bar-danger { background: #f53f3f; }
|
|
112
|
+
.lite-card-bottom { display: flex; justify-content: space-between; font-size: 10px; }
|
|
113
|
+
.lite-card-pct { font-family: monospace; font-weight: 600; color: #1d2129; }
|
|
114
|
+
.text-danger { color: #f53f3f; font-weight: 600; }
|
|
115
|
+
.text-warn { color: #ff7d00; font-weight: 600; }
|
|
116
|
+
.text-ok { color: #00b42a; }
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface QuotaItem {
|
|
2
|
+
id: string;
|
|
3
|
+
resourceName: string;
|
|
4
|
+
used: number;
|
|
5
|
+
limit: number;
|
|
6
|
+
unit: string;
|
|
7
|
+
status?: 'normal' | 'warning' | 'exhausted';
|
|
8
|
+
}
|
|
9
|
+
interface Props {
|
|
10
|
+
tenantName?: string;
|
|
11
|
+
tierName?: string;
|
|
12
|
+
quotas?: QuotaItem[];
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const LiteTenantQuotasMatrix: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type LiteTenantQuotasMatrix = ReturnType<typeof LiteTenantQuotasMatrix>;
|
|
17
|
+
export default LiteTenantQuotasMatrix;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface LiteComment {
|
|
3
|
+
id: string;
|
|
4
|
+
author: string;
|
|
5
|
+
content: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
comments?: LiteComment[];
|
|
11
|
+
title?: string;
|
|
12
|
+
action?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
comments = [],
|
|
18
|
+
title = 'Comments',
|
|
19
|
+
action = '/comments/create',
|
|
20
|
+
class: className = '',
|
|
21
|
+
}: Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class="lite-comment-box {className}"
|
|
26
|
+
data-svadmin-component="LiteThreadedCommentDrawer"
|
|
27
|
+
>
|
|
28
|
+
<h4 class="lite-comment-title">{title}</h4>
|
|
29
|
+
<ul class="lite-comment-list">
|
|
30
|
+
{#each comments as c (c.id)}
|
|
31
|
+
<li class="lite-comment-item">
|
|
32
|
+
<div class="lite-comment-head">
|
|
33
|
+
<span class="lite-comment-author">{c.author}</span>
|
|
34
|
+
<span class="lite-comment-time">{c.createdAt}</span>
|
|
35
|
+
</div>
|
|
36
|
+
<p class="lite-comment-content">{c.content}</p>
|
|
37
|
+
</li>
|
|
38
|
+
{/each}
|
|
39
|
+
</ul>
|
|
40
|
+
|
|
41
|
+
<form {action} method="POST" class="lite-comment-form">
|
|
42
|
+
<textarea name="content" required placeholder="Leave a reply..." class="lite-comment-input"></textarea>
|
|
43
|
+
<button type="submit" class="lite-comment-btn">Submit Reply</button>
|
|
44
|
+
</form>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<style>
|
|
48
|
+
.lite-comment-box { border: 1px solid #e5e6eb; border-radius: 8px; background: #ffffff; padding: 16px; font-size: 12px; }
|
|
49
|
+
.lite-comment-title { font-size: 14px; font-weight: 600; margin: 0 0 12px 0; color: #1d2129; }
|
|
50
|
+
.lite-comment-list { list-style: none; margin: 0 0 16px 0; padding: 0; }
|
|
51
|
+
.lite-comment-item { border-bottom: 1px solid #f2f3f5; padding: 8px 0; }
|
|
52
|
+
.lite-comment-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
|
|
53
|
+
.lite-comment-author { font-weight: 600; color: #1d2129; }
|
|
54
|
+
.lite-comment-time { color: #86909c; font-size: 11px; }
|
|
55
|
+
.lite-comment-content { margin: 0; color: #4e5969; }
|
|
56
|
+
.lite-comment-form { display: flex; flex-direction: column; }
|
|
57
|
+
.lite-comment-form > * + * { margin-top: 8px; }
|
|
58
|
+
.lite-comment-input { height: 60px; border: 1px solid #e5e6eb; border-radius: 4px; padding: 6px 10px; font-size: 12px; }
|
|
59
|
+
.lite-comment-btn { height: 32px; background: #165dff; color: #fff; border: none; border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; }
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LiteComment {
|
|
2
|
+
id: string;
|
|
3
|
+
author: string;
|
|
4
|
+
content: string;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
comments?: LiteComment[];
|
|
9
|
+
title?: string;
|
|
10
|
+
action?: string;
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const LiteThreadedCommentDrawer: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type LiteThreadedCommentDrawer = ReturnType<typeof LiteThreadedCommentDrawer>;
|
|
15
|
+
export default LiteThreadedCommentDrawer;
|