@adminforth/dashboard 1.5.0 → 1.7.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.
Files changed (58) hide show
  1. package/custom/api/dashboardApi.ts +137 -1
  2. package/custom/model/dashboard.types.ts +32 -22
  3. package/custom/package.json +1 -0
  4. package/custom/pnpm-lock.yaml +31 -0
  5. package/custom/runtime/DashboardRuntime.vue +9 -15
  6. package/custom/runtime/YamlConfigEditor.vue +109 -0
  7. package/custom/skills/adminforth-dashboard/SKILL.md +66 -10
  8. package/custom/widgets/KpiCardWidget.vue +172 -9
  9. package/custom/widgets/chart/ChartWidget.vue +5 -5
  10. package/custom/widgets/registry.ts +4 -4
  11. package/dist/custom/api/dashboardApi.d.ts +46 -1
  12. package/dist/custom/api/dashboardApi.js +90 -0
  13. package/dist/custom/api/dashboardApi.ts +137 -1
  14. package/dist/custom/model/dashboard.types.d.ts +30 -14
  15. package/dist/custom/model/dashboard.types.js +2 -2
  16. package/dist/custom/model/dashboard.types.ts +32 -22
  17. package/dist/custom/package.json +1 -0
  18. package/dist/custom/pnpm-lock.yaml +31 -0
  19. package/dist/custom/queries/useDashboardConfig.d.ts +106 -104
  20. package/dist/custom/queries/useWidgetData.d.ts +106 -104
  21. package/dist/custom/runtime/DashboardRuntime.vue +9 -15
  22. package/dist/custom/runtime/YamlConfigEditor.vue +109 -0
  23. package/dist/custom/skills/adminforth-dashboard/SKILL.md +66 -10
  24. package/dist/custom/widgets/KpiCardWidget.vue +172 -9
  25. package/dist/custom/widgets/chart/ChartWidget.vue +5 -5
  26. package/dist/custom/widgets/registry.js +4 -4
  27. package/dist/custom/widgets/registry.ts +4 -4
  28. package/dist/endpoint/widgets.js +99 -14
  29. package/dist/schema/api.d.ts +11426 -1634
  30. package/dist/schema/api.js +118 -21
  31. package/dist/schema/widget.d.ts +425 -1980
  32. package/dist/schema/widget.js +13 -374
  33. package/dist/schema/widgets/charts.d.ts +1689 -0
  34. package/dist/schema/widgets/charts.js +92 -0
  35. package/dist/schema/widgets/common.d.ts +275 -0
  36. package/dist/schema/widgets/common.js +171 -0
  37. package/dist/schema/widgets/gauge-card.d.ts +172 -0
  38. package/dist/schema/widgets/gauge-card.js +28 -0
  39. package/dist/schema/widgets/kpi-card.d.ts +212 -0
  40. package/dist/schema/widgets/kpi-card.js +43 -0
  41. package/dist/schema/widgets/pivot-table.d.ts +196 -0
  42. package/dist/schema/widgets/pivot-table.js +17 -0
  43. package/dist/schema/widgets/table.d.ts +130 -0
  44. package/dist/schema/widgets/table.js +12 -0
  45. package/dist/services/widgetDataService.js +96 -2
  46. package/endpoint/widgets.ts +173 -26
  47. package/package.json +1 -1
  48. package/schema/api.ts +148 -22
  49. package/schema/widget.ts +43 -425
  50. package/schema/widgets/charts.ts +113 -0
  51. package/schema/widgets/common.ts +194 -0
  52. package/schema/widgets/gauge-card.ts +34 -0
  53. package/schema/widgets/kpi-card.ts +49 -0
  54. package/schema/widgets/pivot-table.ts +24 -0
  55. package/schema/widgets/table.ts +18 -0
  56. package/services/widgetDataService.ts +129 -3
  57. package/shims-vue.d.ts +11 -0
  58. package/tsconfig.json +3 -1
@@ -36,6 +36,7 @@ export type QueryAggregateOperation = 'sum' | 'count' | 'count_distinct' | 'avg'
36
36
  export type TimeGrain = 'day' | 'week' | 'month' | 'year'
37
37
  export type ValueFormat =
38
38
  | 'number'
39
+ | 'integer'
39
40
  | 'compact_number'
40
41
  | 'currency'
41
42
  | 'percent'
@@ -119,21 +120,17 @@ export type QueryOrderByItem = {
119
120
  export type QueryConfig = {
120
121
  resource: string
121
122
  select?: QuerySelectItem[]
123
+ sparkline?: {
124
+ field: string
125
+ grain: TimeGrain
126
+ as: string
127
+ fill_missing?: Record<string, JsonValue>
128
+ }
122
129
  filters?: FilterExpression
123
130
  group_by?: QueryGroupByItem[]
124
131
  order_by?: QueryOrderByItem[]
125
132
  limit?: number
126
133
  offset?: number
127
- time_series?: {
128
- field: string
129
- grain: TimeGrain
130
- timezone?: string
131
- }
132
- period?: {
133
- field: string
134
- gte?: JsonValue
135
- lt?: JsonValue
136
- }
137
134
  bucket?: {
138
135
  field: string
139
136
  buckets: Array<{ label: string, min?: number, max?: number }>
@@ -178,8 +175,29 @@ export type KpiCardViewConfig = {
178
175
  text?: string
179
176
  field?: string
180
177
  }
181
- comparison?: JsonValue
182
- sparkline?: JsonValue
178
+ comparison?: {
179
+ field: string
180
+ format?: ValueFormat
181
+ positive_is_good?: boolean
182
+ compact?: {
183
+ show?: boolean
184
+ template?: string
185
+ }
186
+ tooltip?: {
187
+ label?: string
188
+ template?: string
189
+ }
190
+ }
191
+ sparkline?: {
192
+ type?: 'line'
193
+ field: string
194
+ x: string
195
+ show_axes?: boolean
196
+ show_labels?: boolean
197
+ fill?: {
198
+ type?: 'gradient' | 'solid'
199
+ }
200
+ }
183
201
  }
184
202
 
185
203
  export type GaugeCardViewConfig = {
@@ -257,14 +275,6 @@ export type DashboardWidgetConfig =
257
275
  | GaugeCardWidgetConfig
258
276
  | PivotTableWidgetConfig
259
277
 
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
-
268
278
  export type DashboardWidgetTableData = {
269
279
  kind?: 'table'
270
280
  columns: string[]
@@ -299,10 +309,10 @@ export function serializeDashboardWidgetConfigForEditor(
299
309
  id: _id,
300
310
  group_id: _groupId,
301
311
  order: _order,
302
- ...editableWidget
312
+ ...editableWidgetConfig
303
313
  } = widget
304
314
 
305
- return editableWidget
315
+ return editableWidgetConfig
306
316
  }
307
317
 
308
318
  export function getFieldRefField(value: FieldRef | undefined) {
@@ -5,6 +5,7 @@
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
+ "monaco-editor": "^0.55.1",
8
9
  "yaml": "^2.9.0"
9
10
  }
10
11
  }
@@ -8,12 +8,29 @@ importers:
8
8
 
9
9
  .:
10
10
  dependencies:
11
+ monaco-editor:
12
+ specifier: ^0.55.1
13
+ version: 0.55.1
11
14
  yaml:
12
15
  specifier: ^2.9.0
13
16
  version: 2.9.0
14
17
 
15
18
  packages:
16
19
 
20
+ '@types/trusted-types@2.0.7':
21
+ resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
22
+
23
+ dompurify@3.2.7:
24
+ resolution: {integrity: sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==}
25
+
26
+ marked@14.0.0:
27
+ resolution: {integrity: sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==}
28
+ engines: {node: '>= 18'}
29
+ hasBin: true
30
+
31
+ monaco-editor@0.55.1:
32
+ resolution: {integrity: sha512-jz4x+TJNFHwHtwuV9vA9rMujcZRb0CEilTEwG2rRSpe/A7Jdkuj8xPKttCgOh+v/lkHy7HsZ64oj+q3xoAFl9A==}
33
+
17
34
  yaml@2.9.0:
18
35
  resolution: {integrity: sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==}
19
36
  engines: {node: '>= 14.6'}
@@ -21,4 +38,18 @@ packages:
21
38
 
22
39
  snapshots:
23
40
 
41
+ '@types/trusted-types@2.0.7':
42
+ optional: true
43
+
44
+ dompurify@3.2.7:
45
+ optionalDependencies:
46
+ '@types/trusted-types': 2.0.7
47
+
48
+ marked@14.0.0: {}
49
+
50
+ monaco-editor@0.55.1:
51
+ dependencies:
52
+ dompurify: 3.2.7
53
+ marked: 14.0.0
54
+
24
55
  yaml@2.9.0: {}
@@ -60,6 +60,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
60
60
  calc: string;
61
61
  as: string;
62
62
  })[] | undefined;
63
+ sparkline?: {
64
+ field: string;
65
+ grain: import("../model/dashboard.types.js").TimeGrain;
66
+ as: string;
67
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
68
+ } | undefined;
63
69
  filters?: any;
64
70
  group_by?: (string | {
65
71
  field: string;
@@ -73,16 +79,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
73
79
  }[] | undefined;
74
80
  limit?: number | undefined;
75
81
  offset?: number | undefined;
76
- time_series?: {
77
- field: string;
78
- grain: import("../model/dashboard.types.js").TimeGrain;
79
- timezone?: string | undefined;
80
- } | undefined;
81
- period?: {
82
- field: string;
83
- gte?: any;
84
- lt?: any;
85
- } | undefined;
86
82
  bucket?: {
87
83
  field: string;
88
84
  buckets: {
@@ -164,6 +160,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
164
160
  calc: string;
165
161
  as: string;
166
162
  })[] | undefined;
163
+ sparkline?: {
164
+ field: string;
165
+ grain: import("../model/dashboard.types.js").TimeGrain;
166
+ as: string;
167
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
168
+ } | undefined;
167
169
  filters?: any;
168
170
  group_by?: (string | {
169
171
  field: string;
@@ -177,16 +179,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
177
179
  }[] | undefined;
178
180
  limit?: number | undefined;
179
181
  offset?: number | undefined;
180
- time_series?: {
181
- field: string;
182
- grain: import("../model/dashboard.types.js").TimeGrain;
183
- timezone?: string | undefined;
184
- } | undefined;
185
- period?: {
186
- field: string;
187
- gte?: any;
188
- lt?: any;
189
- } | undefined;
190
182
  bucket?: {
191
183
  field: string;
192
184
  buckets: {
@@ -241,8 +233,29 @@ export declare function useDashboardConfig(slug: Ref<string>): {
241
233
  text?: string | undefined;
242
234
  field?: string | undefined;
243
235
  } | undefined;
244
- comparison?: any;
245
- sparkline?: any;
236
+ comparison?: {
237
+ field: string;
238
+ format?: import("../model/dashboard.types.js").ValueFormat | undefined;
239
+ positive_is_good?: boolean | undefined;
240
+ compact?: {
241
+ show?: boolean | undefined;
242
+ template?: string | undefined;
243
+ } | undefined;
244
+ tooltip?: {
245
+ label?: string | undefined;
246
+ template?: string | undefined;
247
+ } | undefined;
248
+ } | undefined;
249
+ sparkline?: {
250
+ type?: "line" | undefined;
251
+ field: string;
252
+ x: string;
253
+ show_axes?: boolean | undefined;
254
+ show_labels?: boolean | undefined;
255
+ fill?: {
256
+ type?: "gradient" | "solid" | undefined;
257
+ } | undefined;
258
+ } | undefined;
246
259
  };
247
260
  query: {
248
261
  resource: string;
@@ -259,6 +272,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
259
272
  calc: string;
260
273
  as: string;
261
274
  })[] | undefined;
275
+ sparkline?: {
276
+ field: string;
277
+ grain: import("../model/dashboard.types.js").TimeGrain;
278
+ as: string;
279
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
280
+ } | undefined;
262
281
  filters?: any;
263
282
  group_by?: (string | {
264
283
  field: string;
@@ -272,16 +291,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
272
291
  }[] | undefined;
273
292
  limit?: number | undefined;
274
293
  offset?: number | undefined;
275
- time_series?: {
276
- field: string;
277
- grain: import("../model/dashboard.types.js").TimeGrain;
278
- timezone?: string | undefined;
279
- } | undefined;
280
- period?: {
281
- field: string;
282
- gte?: any;
283
- lt?: any;
284
- } | undefined;
285
294
  bucket?: {
286
295
  field: string;
287
296
  buckets: {
@@ -344,6 +353,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
344
353
  calc: string;
345
354
  as: string;
346
355
  })[] | undefined;
356
+ sparkline?: {
357
+ field: string;
358
+ grain: import("../model/dashboard.types.js").TimeGrain;
359
+ as: string;
360
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
361
+ } | undefined;
347
362
  filters?: any;
348
363
  group_by?: (string | {
349
364
  field: string;
@@ -357,16 +372,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
357
372
  }[] | undefined;
358
373
  limit?: number | undefined;
359
374
  offset?: number | undefined;
360
- time_series?: {
361
- field: string;
362
- grain: import("../model/dashboard.types.js").TimeGrain;
363
- timezone?: string | undefined;
364
- } | undefined;
365
- period?: {
366
- field: string;
367
- gte?: any;
368
- lt?: any;
369
- } | undefined;
370
375
  bucket?: {
371
376
  field: string;
372
377
  buckets: {
@@ -426,6 +431,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
426
431
  calc: string;
427
432
  as: string;
428
433
  })[] | undefined;
434
+ sparkline?: {
435
+ field: string;
436
+ grain: import("../model/dashboard.types.js").TimeGrain;
437
+ as: string;
438
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
439
+ } | undefined;
429
440
  filters?: any;
430
441
  group_by?: (string | {
431
442
  field: string;
@@ -439,16 +450,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
439
450
  }[] | undefined;
440
451
  limit?: number | undefined;
441
452
  offset?: number | undefined;
442
- time_series?: {
443
- field: string;
444
- grain: import("../model/dashboard.types.js").TimeGrain;
445
- timezone?: string | undefined;
446
- } | undefined;
447
- period?: {
448
- field: string;
449
- gte?: any;
450
- lt?: any;
451
- } | undefined;
452
453
  bucket?: {
453
454
  field: string;
454
455
  buckets: {
@@ -525,6 +526,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
525
526
  calc: string;
526
527
  as: string;
527
528
  })[] | undefined;
529
+ sparkline?: {
530
+ field: string;
531
+ grain: import("../model/dashboard.types.js").TimeGrain;
532
+ as: string;
533
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
534
+ } | undefined;
528
535
  filters?: any;
529
536
  group_by?: (string | {
530
537
  field: string;
@@ -538,16 +545,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
538
545
  }[] | undefined;
539
546
  limit?: number | undefined;
540
547
  offset?: number | undefined;
541
- time_series?: {
542
- field: string;
543
- grain: import("../model/dashboard.types.js").TimeGrain;
544
- timezone?: string | undefined;
545
- } | undefined;
546
- period?: {
547
- field: string;
548
- gte?: any;
549
- lt?: any;
550
- } | undefined;
551
548
  bucket?: {
552
549
  field: string;
553
550
  buckets: {
@@ -629,6 +626,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
629
626
  calc: string;
630
627
  as: string;
631
628
  })[] | undefined;
629
+ sparkline?: {
630
+ field: string;
631
+ grain: import("../model/dashboard.types.js").TimeGrain;
632
+ as: string;
633
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
634
+ } | undefined;
632
635
  filters?: any;
633
636
  group_by?: (string | {
634
637
  field: string;
@@ -642,16 +645,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
642
645
  }[] | undefined;
643
646
  limit?: number | undefined;
644
647
  offset?: number | undefined;
645
- time_series?: {
646
- field: string;
647
- grain: import("../model/dashboard.types.js").TimeGrain;
648
- timezone?: string | undefined;
649
- } | undefined;
650
- period?: {
651
- field: string;
652
- gte?: any;
653
- lt?: any;
654
- } | undefined;
655
648
  bucket?: {
656
649
  field: string;
657
650
  buckets: {
@@ -706,8 +699,29 @@ export declare function useDashboardConfig(slug: Ref<string>): {
706
699
  text?: string | undefined;
707
700
  field?: string | undefined;
708
701
  } | undefined;
709
- comparison?: any;
710
- sparkline?: any;
702
+ comparison?: {
703
+ field: string;
704
+ format?: import("../model/dashboard.types.js").ValueFormat | undefined;
705
+ positive_is_good?: boolean | undefined;
706
+ compact?: {
707
+ show?: boolean | undefined;
708
+ template?: string | undefined;
709
+ } | undefined;
710
+ tooltip?: {
711
+ label?: string | undefined;
712
+ template?: string | undefined;
713
+ } | undefined;
714
+ } | undefined;
715
+ sparkline?: {
716
+ type?: "line" | undefined;
717
+ field: string;
718
+ x: string;
719
+ show_axes?: boolean | undefined;
720
+ show_labels?: boolean | undefined;
721
+ fill?: {
722
+ type?: "gradient" | "solid" | undefined;
723
+ } | undefined;
724
+ } | undefined;
711
725
  };
712
726
  query: {
713
727
  resource: string;
@@ -724,6 +738,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
724
738
  calc: string;
725
739
  as: string;
726
740
  })[] | undefined;
741
+ sparkline?: {
742
+ field: string;
743
+ grain: import("../model/dashboard.types.js").TimeGrain;
744
+ as: string;
745
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
746
+ } | undefined;
727
747
  filters?: any;
728
748
  group_by?: (string | {
729
749
  field: string;
@@ -737,16 +757,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
737
757
  }[] | undefined;
738
758
  limit?: number | undefined;
739
759
  offset?: number | undefined;
740
- time_series?: {
741
- field: string;
742
- grain: import("../model/dashboard.types.js").TimeGrain;
743
- timezone?: string | undefined;
744
- } | undefined;
745
- period?: {
746
- field: string;
747
- gte?: any;
748
- lt?: any;
749
- } | undefined;
750
760
  bucket?: {
751
761
  field: string;
752
762
  buckets: {
@@ -809,6 +819,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
809
819
  calc: string;
810
820
  as: string;
811
821
  })[] | undefined;
822
+ sparkline?: {
823
+ field: string;
824
+ grain: import("../model/dashboard.types.js").TimeGrain;
825
+ as: string;
826
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
827
+ } | undefined;
812
828
  filters?: any;
813
829
  group_by?: (string | {
814
830
  field: string;
@@ -822,16 +838,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
822
838
  }[] | undefined;
823
839
  limit?: number | undefined;
824
840
  offset?: number | undefined;
825
- time_series?: {
826
- field: string;
827
- grain: import("../model/dashboard.types.js").TimeGrain;
828
- timezone?: string | undefined;
829
- } | undefined;
830
- period?: {
831
- field: string;
832
- gte?: any;
833
- lt?: any;
834
- } | undefined;
835
841
  bucket?: {
836
842
  field: string;
837
843
  buckets: {
@@ -891,6 +897,12 @@ export declare function useDashboardConfig(slug: Ref<string>): {
891
897
  calc: string;
892
898
  as: string;
893
899
  })[] | undefined;
900
+ sparkline?: {
901
+ field: string;
902
+ grain: import("../model/dashboard.types.js").TimeGrain;
903
+ as: string;
904
+ fill_missing?: Record<string, import("../model/dashboard.types.js").JsonValue> | undefined;
905
+ } | undefined;
894
906
  filters?: any;
895
907
  group_by?: (string | {
896
908
  field: string;
@@ -904,16 +916,6 @@ export declare function useDashboardConfig(slug: Ref<string>): {
904
916
  }[] | undefined;
905
917
  limit?: number | undefined;
906
918
  offset?: number | undefined;
907
- time_series?: {
908
- field: string;
909
- grain: import("../model/dashboard.types.js").TimeGrain;
910
- timezone?: string | undefined;
911
- } | undefined;
912
- period?: {
913
- field: string;
914
- gte?: any;
915
- lt?: any;
916
- } | undefined;
917
919
  bucket?: {
918
920
  field: string;
919
921
  buckets: {