Repository navigation
Expand file tree
/
Copy pathsystem.datasets.ts
More file actions
72 lines (64 loc) · 2.46 KB
/
Copy pathsystem.datasets.ts
File metadata and controls
72 lines (64 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import { defineDataset } from '@objectstack/spec/ui';
/**
* Datasets backing the System Overview dashboard (ADR-0021). Each is a single-
* object count/breakdown over a platform `sys_*` object. The audit objects live
* in `@objectstack/plugin-audit` and `sys_package_installation` is cloud-only —
* datasets reference objects BY NAME, so co-locating them with the dashboard
* (registered by plugin-auth) is fine; the widgets that target absent objects
* are runtime-gated via `requiresObject`.
*/
export const SysUserDataset = defineDataset({
name: 'sys_user_metrics',
label: 'User Metrics',
object: 'sys_user',
dimensions: [],
measures: [{ name: 'user_count', label: 'Users', aggregate: 'count' }],
});
export const SysOrganizationDataset = defineDataset({
name: 'sys_organization_metrics',
label: 'Organization Metrics',
object: 'sys_organization',
dimensions: [],
measures: [{ name: 'org_count', label: 'Organizations', aggregate: 'count' }],
});
export const SysSessionDataset = defineDataset({
name: 'sys_session_metrics',
label: 'Session Metrics',
object: 'sys_session',
dimensions: [],
measures: [{ name: 'session_count', label: 'Sessions', aggregate: 'count' }],
});
export const SysPackageInstallationDataset = defineDataset({
name: 'sys_package_installation_metrics',
label: 'Package Installation Metrics',
object: 'sys_package_installation',
dimensions: [],
measures: [{ name: 'package_count', label: 'Installations', aggregate: 'count' }],
});
export const SysAuditLogDataset = defineDataset({
name: 'sys_audit_log_metrics',
label: 'Audit Log Metrics',
object: 'sys_audit_log',
dimensions: [
{ name: 'action', label: 'Action', field: 'action', type: 'string' },
// Rows the platform writes itself carry no `user_id`; their bucket reads
// "System", not the renderer's default "(None)". An inline locale map:
// the translation bundles have no slot for a dimension's null label.
{
name: 'user_id',
label: 'User',
field: 'user_id',
type: 'lookup',
nullLabel: { en: 'System', 'zh-CN': '系统', 'ja-JP': 'システム', 'es-ES': 'Sistema', 'zh-Hant': '系統' },
},
],
measures: [{ name: 'event_count', label: 'Events', aggregate: 'count' }],
});
export const SystemOverviewDatasets = [
SysUserDataset,
SysOrganizationDataset,
SysSessionDataset,
SysPackageInstallationDataset,
SysAuditLogDataset,
];