@adminforth/dashboard 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -15
- package/custom/api/dashboardApi.ts +9 -8
- package/custom/model/dashboard.types.ts +63 -270
- package/custom/model/dashboardTopics.ts +5 -0
- package/custom/runtime/DashboardGroup.vue +2 -2
- package/custom/runtime/DashboardPage.vue +17 -7
- package/custom/runtime/DashboardRuntime.vue +20 -8
- package/custom/runtime/WidgetRenderer.vue +1 -2
- package/custom/runtime/WidgetShell.vue +3 -3
- package/custom/skills/adminforth-dashboard/SKILL.md +110 -3
- package/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
- package/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
- package/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
- package/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
- package/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
- package/custom/widgets/chart/ChartWidget.vue +24 -18
- package/{dist/custom/widgets/chart/funnel → custom/widgets/chart}/FunnelChart.vue +80 -78
- package/{dist/custom/widgets/chart/line → custom/widgets/chart}/LineChart.vue +2 -2
- package/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
- package/{dist/custom/widgets/chart/stacked-bar → custom/widgets/chart}/StackedBarChart.vue +97 -95
- package/custom/widgets/chart/chart.types.ts +0 -28
- package/dist/custom/api/dashboardApi.d.ts +4 -7
- package/dist/custom/api/dashboardApi.js +5 -0
- package/dist/custom/api/dashboardApi.ts +9 -8
- package/dist/custom/model/dashboard.types.d.ts +40 -31
- package/dist/custom/model/dashboard.types.js +13 -152
- package/dist/custom/model/dashboard.types.ts +63 -270
- package/dist/custom/model/dashboardTopics.d.ts +2 -0
- package/dist/custom/model/dashboardTopics.js +8 -0
- package/dist/custom/model/dashboardTopics.ts +5 -0
- package/dist/custom/queries/useDashboardConfig.d.ts +116 -96
- package/dist/custom/queries/useWidgetData.d.ts +116 -96
- package/dist/custom/runtime/DashboardGroup.vue +2 -2
- package/dist/custom/runtime/DashboardPage.vue +17 -7
- package/dist/custom/runtime/DashboardRuntime.vue +20 -8
- package/dist/custom/runtime/WidgetRenderer.vue +1 -2
- package/dist/custom/runtime/WidgetShell.vue +3 -3
- package/dist/custom/skills/adminforth-dashboard/SKILL.md +110 -3
- package/dist/custom/widgets/{gauge-card/GaugeCardWidget.vue → GaugeCardWidget.vue} +63 -61
- package/dist/custom/widgets/{kpi-card/KpiCardWidget.vue → KpiCardWidget.vue} +35 -33
- package/dist/custom/widgets/{pivot-table/PivotTableWidget.vue → PivotTableWidget.vue} +71 -68
- package/dist/custom/widgets/{table/TableWidget.vue → TableWidget.vue} +5 -5
- package/dist/custom/widgets/chart/{bar/BarChart.vue → BarChart.vue} +2 -2
- package/dist/custom/widgets/chart/ChartWidget.vue +24 -18
- package/{custom/widgets/chart/funnel → dist/custom/widgets/chart}/FunnelChart.vue +80 -78
- package/{custom/widgets/chart/line → dist/custom/widgets/chart}/LineChart.vue +2 -2
- package/dist/custom/widgets/chart/{pie/PieChart.vue → PieChart.vue} +2 -2
- package/{custom/widgets/chart/stacked-bar → dist/custom/widgets/chart}/StackedBarChart.vue +97 -95
- package/dist/custom/widgets/chart/chart.types.d.ts +0 -2
- package/dist/custom/widgets/chart/chart.types.js +0 -23
- package/dist/custom/widgets/chart/chart.types.ts +0 -28
- package/dist/endpoint/dashboard.d.ts +6 -2
- package/dist/endpoint/dashboard.js +29 -5
- package/dist/endpoint/groups.d.ts +2 -21
- package/dist/endpoint/groups.js +18 -16
- package/dist/endpoint/widgets.d.ts +2 -4
- package/dist/endpoint/widgets.js +28 -74
- package/dist/index.js +1 -3
- package/dist/schema/api.d.ts +2172 -500
- package/dist/schema/api.js +21 -13
- package/dist/schema/widget.d.ts +1076 -263
- package/dist/schema/widget.js +108 -49
- package/dist/services/dashboardConfigService.d.ts +0 -10
- package/dist/services/dashboardConfigService.js +6 -21
- package/dist/services/widgetDataService.d.ts +2 -1
- package/dist/services/widgetDataService.js +266 -206
- package/endpoint/dashboard.ts +47 -7
- package/endpoint/groups.ts +25 -42
- package/endpoint/widgets.ts +41 -96
- package/index.ts +0 -3
- package/package.json +3 -3
- package/schema/api.ts +23 -13
- package/schema/widget.ts +119 -55
- package/services/dashboardConfigService.ts +6 -25
- package/services/widgetDataService.ts +350 -237
- package/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
- package/dist/custom/widgets/chart/histogram/HistogramChart.vue +0 -21
- package/dist/services/widgetConfigValidator.d.ts +0 -8
- package/dist/services/widgetConfigValidator.js +0 -27
- package/services/widgetConfigValidator.ts +0 -61
|
@@ -6,18 +6,34 @@ export type DashboardConfig = {
|
|
|
6
6
|
widgets: DashboardWidgetConfig[]
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
export type JsonValue =
|
|
10
|
+
| string
|
|
11
|
+
| number
|
|
12
|
+
| boolean
|
|
13
|
+
| null
|
|
14
|
+
| JsonValue[]
|
|
15
|
+
| { [key: string]: JsonValue }
|
|
16
|
+
|
|
17
|
+
export type DashboardVariables = Record<string, JsonValue>
|
|
18
|
+
|
|
9
19
|
export type DashboardGroupConfig = {
|
|
10
20
|
id: string
|
|
11
21
|
label: string
|
|
12
22
|
order: number
|
|
13
23
|
}
|
|
14
24
|
|
|
25
|
+
export type EditableDashboardGroupConfig = Pick<DashboardGroupConfig, 'label'>
|
|
26
|
+
|
|
15
27
|
export type DashboardGroupMoveDirection = 'up' | 'down'
|
|
16
28
|
export type DashboardWidgetMoveDirection = 'up' | 'down'
|
|
17
29
|
export type DashboardWidgetTarget = 'empty' | 'table' | 'chart' | 'kpi_card' | 'pivot_table' | 'gauge_card'
|
|
18
30
|
export type DashboardWidgetSize = 'small' | 'medium' | 'large' | 'wide' | 'full'
|
|
31
|
+
export type DashboardWidgetConfigValidationError = {
|
|
32
|
+
field: string
|
|
33
|
+
message: string
|
|
34
|
+
}
|
|
19
35
|
export type QueryAggregateOperation = 'sum' | 'count' | 'count_distinct' | 'avg' | 'min' | 'max' | 'median'
|
|
20
|
-
export type TimeGrain = '
|
|
36
|
+
export type TimeGrain = 'day' | 'week' | 'month' | 'year'
|
|
21
37
|
export type ValueFormat =
|
|
22
38
|
| 'number'
|
|
23
39
|
| 'compact_number'
|
|
@@ -30,8 +46,8 @@ export type ValueFormat =
|
|
|
30
46
|
export type WidgetLayout = {
|
|
31
47
|
size?: DashboardWidgetSize
|
|
32
48
|
width?: number
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
min_width?: number
|
|
50
|
+
max_width?: number | null
|
|
35
51
|
height?: number
|
|
36
52
|
}
|
|
37
53
|
|
|
@@ -39,11 +55,12 @@ export type WidgetBaseConfig = {
|
|
|
39
55
|
id: string
|
|
40
56
|
group_id: string
|
|
41
57
|
label?: string
|
|
58
|
+
variables?: DashboardVariables
|
|
42
59
|
size?: DashboardWidgetSize
|
|
43
60
|
width?: number
|
|
44
61
|
height?: number
|
|
45
|
-
|
|
46
|
-
|
|
62
|
+
min_width?: number
|
|
63
|
+
max_width?: number | null
|
|
47
64
|
order: number
|
|
48
65
|
}
|
|
49
66
|
|
|
@@ -53,16 +70,16 @@ export type FilterExpression =
|
|
|
53
70
|
| Array<FilterExpression>
|
|
54
71
|
| {
|
|
55
72
|
field: string
|
|
56
|
-
eq?:
|
|
57
|
-
neq?:
|
|
58
|
-
gt?:
|
|
59
|
-
gte?:
|
|
60
|
-
lt?:
|
|
61
|
-
lte?:
|
|
62
|
-
in?:
|
|
63
|
-
not_in?:
|
|
64
|
-
like?:
|
|
65
|
-
ilike?:
|
|
73
|
+
eq?: JsonValue
|
|
74
|
+
neq?: JsonValue
|
|
75
|
+
gt?: JsonValue
|
|
76
|
+
gte?: JsonValue
|
|
77
|
+
lt?: JsonValue
|
|
78
|
+
lte?: JsonValue
|
|
79
|
+
in?: JsonValue[]
|
|
80
|
+
not_in?: JsonValue[]
|
|
81
|
+
like?: JsonValue
|
|
82
|
+
ilike?: JsonValue
|
|
66
83
|
}
|
|
67
84
|
|
|
68
85
|
export type QueryFieldSelectItem = {
|
|
@@ -103,30 +120,31 @@ export type QueryConfig = {
|
|
|
103
120
|
resource: string
|
|
104
121
|
select?: QuerySelectItem[]
|
|
105
122
|
filters?: FilterExpression
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
group_by?: QueryGroupByItem[]
|
|
124
|
+
order_by?: QueryOrderByItem[]
|
|
108
125
|
limit?: number
|
|
109
126
|
offset?: number
|
|
110
|
-
|
|
127
|
+
time_series?: {
|
|
111
128
|
field: string
|
|
112
129
|
grain: TimeGrain
|
|
113
130
|
timezone?: string
|
|
114
131
|
}
|
|
115
132
|
period?: {
|
|
116
133
|
field: string
|
|
117
|
-
gte?:
|
|
118
|
-
lt?:
|
|
134
|
+
gte?: JsonValue
|
|
135
|
+
lt?: JsonValue
|
|
119
136
|
}
|
|
120
137
|
bucket?: {
|
|
121
138
|
field: string
|
|
122
139
|
buckets: Array<{ label: string, min?: number, max?: number }>
|
|
123
140
|
}
|
|
124
141
|
calcs?: QueryCalcSelectItem[]
|
|
125
|
-
formatting?: Record<string,
|
|
142
|
+
formatting?: Record<string, JsonValue>
|
|
126
143
|
}
|
|
127
144
|
|
|
128
145
|
export type FunnelQueryConfig = {
|
|
129
146
|
steps: FunnelQueryStep[]
|
|
147
|
+
calcs?: QueryCalcSelectItem[]
|
|
130
148
|
}
|
|
131
149
|
|
|
132
150
|
export type FunnelQueryStep = {
|
|
@@ -145,7 +163,7 @@ export type FieldRef = string | {
|
|
|
145
163
|
export type TableViewConfig = {
|
|
146
164
|
columns?: FieldRef[]
|
|
147
165
|
pagination?: boolean
|
|
148
|
-
|
|
166
|
+
page_size?: number
|
|
149
167
|
}
|
|
150
168
|
|
|
151
169
|
export type KpiCardViewConfig = {
|
|
@@ -160,8 +178,8 @@ export type KpiCardViewConfig = {
|
|
|
160
178
|
text?: string
|
|
161
179
|
field?: string
|
|
162
180
|
}
|
|
163
|
-
comparison?:
|
|
164
|
-
sparkline?:
|
|
181
|
+
comparison?: JsonValue
|
|
182
|
+
sparkline?: JsonValue
|
|
165
183
|
}
|
|
166
184
|
|
|
167
185
|
export type GaugeCardViewConfig = {
|
|
@@ -178,9 +196,9 @@ export type GaugeCardViewConfig = {
|
|
|
178
196
|
label?: string
|
|
179
197
|
}
|
|
180
198
|
progress?: {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
199
|
+
value_field: string
|
|
200
|
+
target_value?: number
|
|
201
|
+
target_field?: string
|
|
184
202
|
format?: ValueFormat
|
|
185
203
|
}
|
|
186
204
|
color?: string
|
|
@@ -239,6 +257,14 @@ export type DashboardWidgetConfig =
|
|
|
239
257
|
| GaugeCardWidgetConfig
|
|
240
258
|
| PivotTableWidgetConfig
|
|
241
259
|
|
|
260
|
+
export type EditableDashboardWidgetConfig =
|
|
261
|
+
| Omit<EmptyWidgetConfig, 'id' | 'group_id' | 'order'>
|
|
262
|
+
| Omit<TableWidgetConfig, 'id' | 'group_id' | 'order'>
|
|
263
|
+
| Omit<ChartDashboardWidgetConfig, 'id' | 'group_id' | 'order'>
|
|
264
|
+
| Omit<KpiCardWidgetConfig, 'id' | 'group_id' | 'order'>
|
|
265
|
+
| Omit<GaugeCardWidgetConfig, 'id' | 'group_id' | 'order'>
|
|
266
|
+
| Omit<PivotTableWidgetConfig, 'id' | 'group_id' | 'order'>
|
|
267
|
+
|
|
242
268
|
export type DashboardWidgetTableData = {
|
|
243
269
|
kind?: 'table'
|
|
244
270
|
columns: string[]
|
|
@@ -266,252 +292,19 @@ export type DashboardWidgetAggregateData = {
|
|
|
266
292
|
|
|
267
293
|
export type DashboardWidgetData = DashboardWidgetTableData | DashboardWidgetAggregateData
|
|
268
294
|
|
|
269
|
-
export function
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
export function normalizeDashboardWidgetConfig(config: unknown) {
|
|
282
|
-
if (!isRecord(config)) {
|
|
283
|
-
return config
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
const normalized: Record<string, unknown> = { ...config }
|
|
287
|
-
normalizeWidgetLayoutConfig(normalized)
|
|
288
|
-
|
|
289
|
-
if (normalized.query !== undefined) {
|
|
290
|
-
normalized.query = normalizeQueryConfig(normalized.query)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (normalized.table !== undefined) {
|
|
294
|
-
normalized.table = normalizeTableConfig(normalized.table)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (normalized.card !== undefined) {
|
|
298
|
-
normalized.card = normalizeCardConfig(normalized.card)
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (normalized.pivot !== undefined) {
|
|
302
|
-
normalized.pivot = normalizePivotConfig(normalized.pivot)
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const target = normalizeDashboardWidgetTarget(normalized.target)
|
|
306
|
-
|
|
307
|
-
if (target !== undefined) {
|
|
308
|
-
normalized.target = target
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return normalized
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
export function serializeDashboardWidgetConfigForEditor(widget: DashboardWidgetConfig) {
|
|
315
|
-
const serialized: Record<string, unknown> = { ...widget }
|
|
316
|
-
|
|
317
|
-
if (Object.prototype.hasOwnProperty.call(serialized, 'minWidth')) {
|
|
318
|
-
serialized.min_width = widget.minWidth
|
|
319
|
-
delete serialized.minWidth
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
if (Object.prototype.hasOwnProperty.call(serialized, 'maxWidth')) {
|
|
323
|
-
serialized.max_width = widget.maxWidth
|
|
324
|
-
delete serialized.maxWidth
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if ('query' in widget) {
|
|
328
|
-
serialized.query = serializeQueryConfigForEditor(widget.query)
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if ('table' in widget && widget.table !== undefined) {
|
|
332
|
-
serialized.table = serializeTableConfigForEditor(widget.table)
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if ('card' in widget && widget.card !== undefined) {
|
|
336
|
-
serialized.card = serializeCardConfigForEditor(widget.card)
|
|
337
|
-
}
|
|
295
|
+
export function serializeDashboardWidgetConfigForEditor(
|
|
296
|
+
widget: DashboardWidgetConfig,
|
|
297
|
+
): unknown {
|
|
298
|
+
const {
|
|
299
|
+
id: _id,
|
|
300
|
+
group_id: _groupId,
|
|
301
|
+
order: _order,
|
|
302
|
+
...editableWidget
|
|
303
|
+
} = widget
|
|
338
304
|
|
|
339
|
-
|
|
340
|
-
serialized.pivot = serializePivotConfigForEditor(widget.pivot)
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
return serialized
|
|
305
|
+
return editableWidget
|
|
344
306
|
}
|
|
345
307
|
|
|
346
308
|
export function getFieldRefField(value: FieldRef | undefined) {
|
|
347
309
|
return typeof value === 'string' ? value : value?.field
|
|
348
310
|
}
|
|
349
|
-
|
|
350
|
-
export function getFieldRefLabel(value: FieldRef | undefined) {
|
|
351
|
-
return typeof value === 'string' ? value : value?.label
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
function normalizeDashboardWidgetTarget(value: unknown): DashboardWidgetTarget | undefined {
|
|
355
|
-
switch (value) {
|
|
356
|
-
case 'empty':
|
|
357
|
-
case 'table':
|
|
358
|
-
case 'chart':
|
|
359
|
-
case 'kpi_card':
|
|
360
|
-
case 'pivot_table':
|
|
361
|
-
case 'gauge_card':
|
|
362
|
-
return value
|
|
363
|
-
default:
|
|
364
|
-
return undefined
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
function normalizeWidgetLayoutConfig(value: Record<string, unknown>) {
|
|
369
|
-
if (value.min_width !== undefined) {
|
|
370
|
-
value.minWidth = value.min_width
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
if (value.max_width !== undefined) {
|
|
374
|
-
value.maxWidth = value.max_width
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
function normalizeQueryConfig(value: unknown): unknown {
|
|
379
|
-
if (!isRecord(value)) {
|
|
380
|
-
return value
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if (Array.isArray(value.steps)) {
|
|
384
|
-
return {
|
|
385
|
-
steps: value.steps.map((step) => normalizeFunnelQueryStep(step)),
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
return {
|
|
390
|
-
...value,
|
|
391
|
-
...(Array.isArray(value.group_by) ? { groupBy: value.group_by } : {}),
|
|
392
|
-
...(Array.isArray(value.order_by) ? { orderBy: value.order_by } : {}),
|
|
393
|
-
...(value.time_series !== undefined ? { timeSeries: value.time_series } : {}),
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function normalizeFunnelQueryStep(value: unknown) {
|
|
398
|
-
if (!isRecord(value)) {
|
|
399
|
-
return value
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
return {
|
|
403
|
-
...value,
|
|
404
|
-
...(typeof value.resource_id === 'string' ? { resource: value.resource_id } : {}),
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
function normalizeTableConfig(value: unknown) {
|
|
409
|
-
if (!isRecord(value)) {
|
|
410
|
-
return value
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
return {
|
|
414
|
-
...value,
|
|
415
|
-
...(value.page_size !== undefined ? { pageSize: value.page_size } : {}),
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function normalizeCardConfig(value: unknown): unknown {
|
|
420
|
-
if (!isRecord(value)) {
|
|
421
|
-
return value
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
const normalized = { ...value }
|
|
425
|
-
|
|
426
|
-
if (isRecord(normalized.progress)) {
|
|
427
|
-
normalized.progress = {
|
|
428
|
-
...normalized.progress,
|
|
429
|
-
...(normalized.progress.value_field !== undefined ? { valueField: normalized.progress.value_field } : {}),
|
|
430
|
-
...(normalized.progress.target_value !== undefined ? { targetValue: normalized.progress.target_value } : {}),
|
|
431
|
-
...(normalized.progress.target_field !== undefined ? { targetField: normalized.progress.target_field } : {}),
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
if (isRecord(normalized.comparison)) {
|
|
436
|
-
normalized.comparison = {
|
|
437
|
-
...normalized.comparison,
|
|
438
|
-
...(normalized.comparison.positive_is_good !== undefined ? { positiveIsGood: normalized.comparison.positive_is_good } : {}),
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return normalized
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function normalizePivotConfig(value: unknown): unknown {
|
|
446
|
-
return value
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function serializeQueryConfigForEditor(value: QueryConfig | FunnelQueryConfig) {
|
|
450
|
-
if ('steps' in value) {
|
|
451
|
-
return {
|
|
452
|
-
steps: value.steps.map((step) => ({
|
|
453
|
-
...step,
|
|
454
|
-
resource_id: step.resource,
|
|
455
|
-
resource: undefined,
|
|
456
|
-
})).map((step) => removeUndefinedFields(step)),
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
return removeUndefinedFields({
|
|
461
|
-
...value,
|
|
462
|
-
group_by: value.groupBy,
|
|
463
|
-
groupBy: undefined,
|
|
464
|
-
order_by: value.orderBy,
|
|
465
|
-
orderBy: undefined,
|
|
466
|
-
time_series: value.timeSeries,
|
|
467
|
-
timeSeries: undefined,
|
|
468
|
-
})
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
function serializeTableConfigForEditor(value: TableViewConfig) {
|
|
472
|
-
return removeUndefinedFields({
|
|
473
|
-
...value,
|
|
474
|
-
page_size: value.pageSize,
|
|
475
|
-
pageSize: undefined,
|
|
476
|
-
})
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
function serializeCardConfigForEditor(value: KpiCardViewConfig | GaugeCardViewConfig) {
|
|
480
|
-
const serialized: Record<string, unknown> = { ...value }
|
|
481
|
-
|
|
482
|
-
if (isRecord(serialized.progress)) {
|
|
483
|
-
serialized.progress = removeUndefinedFields({
|
|
484
|
-
...serialized.progress,
|
|
485
|
-
value_field: serialized.progress.valueField,
|
|
486
|
-
valueField: undefined,
|
|
487
|
-
target_value: serialized.progress.targetValue,
|
|
488
|
-
targetValue: undefined,
|
|
489
|
-
target_field: serialized.progress.targetField,
|
|
490
|
-
targetField: undefined,
|
|
491
|
-
})
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
if (isRecord(serialized.comparison)) {
|
|
495
|
-
serialized.comparison = removeUndefinedFields({
|
|
496
|
-
...serialized.comparison,
|
|
497
|
-
positive_is_good: serialized.comparison.positiveIsGood,
|
|
498
|
-
positiveIsGood: undefined,
|
|
499
|
-
})
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
return removeUndefinedFields(serialized)
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
function serializePivotConfigForEditor(value: PivotTableViewConfig) {
|
|
506
|
-
return value
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
function removeUndefinedFields<T extends Record<string, unknown>>(value: T) {
|
|
510
|
-
return Object.fromEntries(
|
|
511
|
-
Object.entries(value).filter(([, item]) => item !== undefined),
|
|
512
|
-
)
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
function isRecord(value: unknown): value is Record<string, any> {
|
|
516
|
-
return typeof value === 'object' && value !== null
|
|
517
|
-
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DASHBOARD_CONFIG_UPDATED_TOPIC_PREFIX = void 0;
|
|
4
|
+
exports.getDashboardConfigUpdatedTopic = getDashboardConfigUpdatedTopic;
|
|
5
|
+
exports.DASHBOARD_CONFIG_UPDATED_TOPIC_PREFIX = '/opentopic/dashboard-config-updated';
|
|
6
|
+
function getDashboardConfigUpdatedTopic(slug) {
|
|
7
|
+
return `${exports.DASHBOARD_CONFIG_UPDATED_TOPIC_PREFIX}/${slug}`;
|
|
8
|
+
}
|