@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
|
@@ -4,34 +4,44 @@ export type DashboardConfig = {
|
|
|
4
4
|
groups: DashboardGroupConfig[];
|
|
5
5
|
widgets: DashboardWidgetConfig[];
|
|
6
6
|
};
|
|
7
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
8
|
+
[key: string]: JsonValue;
|
|
9
|
+
};
|
|
10
|
+
export type DashboardVariables = Record<string, JsonValue>;
|
|
7
11
|
export type DashboardGroupConfig = {
|
|
8
12
|
id: string;
|
|
9
13
|
label: string;
|
|
10
14
|
order: number;
|
|
11
15
|
};
|
|
16
|
+
export type EditableDashboardGroupConfig = Pick<DashboardGroupConfig, 'label'>;
|
|
12
17
|
export type DashboardGroupMoveDirection = 'up' | 'down';
|
|
13
18
|
export type DashboardWidgetMoveDirection = 'up' | 'down';
|
|
14
19
|
export type DashboardWidgetTarget = 'empty' | 'table' | 'chart' | 'kpi_card' | 'pivot_table' | 'gauge_card';
|
|
15
20
|
export type DashboardWidgetSize = 'small' | 'medium' | 'large' | 'wide' | 'full';
|
|
21
|
+
export type DashboardWidgetConfigValidationError = {
|
|
22
|
+
field: string;
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
16
25
|
export type QueryAggregateOperation = 'sum' | 'count' | 'count_distinct' | 'avg' | 'min' | 'max' | 'median';
|
|
17
|
-
export type TimeGrain = '
|
|
26
|
+
export type TimeGrain = 'day' | 'week' | 'month' | 'year';
|
|
18
27
|
export type ValueFormat = 'number' | 'compact_number' | 'currency' | 'percent' | 'percent_delta' | 'number_delta' | 'currency_delta';
|
|
19
28
|
export type WidgetLayout = {
|
|
20
29
|
size?: DashboardWidgetSize;
|
|
21
30
|
width?: number;
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
min_width?: number;
|
|
32
|
+
max_width?: number | null;
|
|
24
33
|
height?: number;
|
|
25
34
|
};
|
|
26
35
|
export type WidgetBaseConfig = {
|
|
27
36
|
id: string;
|
|
28
37
|
group_id: string;
|
|
29
38
|
label?: string;
|
|
39
|
+
variables?: DashboardVariables;
|
|
30
40
|
size?: DashboardWidgetSize;
|
|
31
41
|
width?: number;
|
|
32
42
|
height?: number;
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
min_width?: number;
|
|
44
|
+
max_width?: number | null;
|
|
35
45
|
order: number;
|
|
36
46
|
};
|
|
37
47
|
export type FilterExpression = {
|
|
@@ -40,16 +50,16 @@ export type FilterExpression = {
|
|
|
40
50
|
or: FilterExpression[];
|
|
41
51
|
} | Array<FilterExpression> | {
|
|
42
52
|
field: string;
|
|
43
|
-
eq?:
|
|
44
|
-
neq?:
|
|
45
|
-
gt?:
|
|
46
|
-
gte?:
|
|
47
|
-
lt?:
|
|
48
|
-
lte?:
|
|
49
|
-
in?:
|
|
50
|
-
not_in?:
|
|
51
|
-
like?:
|
|
52
|
-
ilike?:
|
|
53
|
+
eq?: JsonValue;
|
|
54
|
+
neq?: JsonValue;
|
|
55
|
+
gt?: JsonValue;
|
|
56
|
+
gte?: JsonValue;
|
|
57
|
+
lt?: JsonValue;
|
|
58
|
+
lte?: JsonValue;
|
|
59
|
+
in?: JsonValue[];
|
|
60
|
+
not_in?: JsonValue[];
|
|
61
|
+
like?: JsonValue;
|
|
62
|
+
ilike?: JsonValue;
|
|
53
63
|
};
|
|
54
64
|
export type QueryFieldSelectItem = {
|
|
55
65
|
field: string;
|
|
@@ -81,19 +91,19 @@ export type QueryConfig = {
|
|
|
81
91
|
resource: string;
|
|
82
92
|
select?: QuerySelectItem[];
|
|
83
93
|
filters?: FilterExpression;
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
group_by?: QueryGroupByItem[];
|
|
95
|
+
order_by?: QueryOrderByItem[];
|
|
86
96
|
limit?: number;
|
|
87
97
|
offset?: number;
|
|
88
|
-
|
|
98
|
+
time_series?: {
|
|
89
99
|
field: string;
|
|
90
100
|
grain: TimeGrain;
|
|
91
101
|
timezone?: string;
|
|
92
102
|
};
|
|
93
103
|
period?: {
|
|
94
104
|
field: string;
|
|
95
|
-
gte?:
|
|
96
|
-
lt?:
|
|
105
|
+
gte?: JsonValue;
|
|
106
|
+
lt?: JsonValue;
|
|
97
107
|
};
|
|
98
108
|
bucket?: {
|
|
99
109
|
field: string;
|
|
@@ -104,10 +114,11 @@ export type QueryConfig = {
|
|
|
104
114
|
}>;
|
|
105
115
|
};
|
|
106
116
|
calcs?: QueryCalcSelectItem[];
|
|
107
|
-
formatting?: Record<string,
|
|
117
|
+
formatting?: Record<string, JsonValue>;
|
|
108
118
|
};
|
|
109
119
|
export type FunnelQueryConfig = {
|
|
110
120
|
steps: FunnelQueryStep[];
|
|
121
|
+
calcs?: QueryCalcSelectItem[];
|
|
111
122
|
};
|
|
112
123
|
export type FunnelQueryStep = {
|
|
113
124
|
name: string;
|
|
@@ -123,7 +134,7 @@ export type FieldRef = string | {
|
|
|
123
134
|
export type TableViewConfig = {
|
|
124
135
|
columns?: FieldRef[];
|
|
125
136
|
pagination?: boolean;
|
|
126
|
-
|
|
137
|
+
page_size?: number;
|
|
127
138
|
};
|
|
128
139
|
export type KpiCardViewConfig = {
|
|
129
140
|
title?: string;
|
|
@@ -137,8 +148,8 @@ export type KpiCardViewConfig = {
|
|
|
137
148
|
text?: string;
|
|
138
149
|
field?: string;
|
|
139
150
|
};
|
|
140
|
-
comparison?:
|
|
141
|
-
sparkline?:
|
|
151
|
+
comparison?: JsonValue;
|
|
152
|
+
sparkline?: JsonValue;
|
|
142
153
|
};
|
|
143
154
|
export type GaugeCardViewConfig = {
|
|
144
155
|
title?: string;
|
|
@@ -154,9 +165,9 @@ export type GaugeCardViewConfig = {
|
|
|
154
165
|
label?: string;
|
|
155
166
|
};
|
|
156
167
|
progress?: {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
168
|
+
value_field: string;
|
|
169
|
+
target_value?: number;
|
|
170
|
+
target_field?: string;
|
|
160
171
|
format?: ValueFormat;
|
|
161
172
|
};
|
|
162
173
|
color?: string;
|
|
@@ -200,6 +211,7 @@ export type PivotTableWidgetConfig = WidgetBaseConfig & {
|
|
|
200
211
|
query: QueryConfig;
|
|
201
212
|
};
|
|
202
213
|
export type DashboardWidgetConfig = EmptyWidgetConfig | TableWidgetConfig | ChartDashboardWidgetConfig | KpiCardWidgetConfig | GaugeCardWidgetConfig | PivotTableWidgetConfig;
|
|
214
|
+
export type EditableDashboardWidgetConfig = Omit<EmptyWidgetConfig, 'id' | 'group_id' | 'order'> | Omit<TableWidgetConfig, 'id' | 'group_id' | 'order'> | Omit<ChartDashboardWidgetConfig, 'id' | 'group_id' | 'order'> | Omit<KpiCardWidgetConfig, 'id' | 'group_id' | 'order'> | Omit<GaugeCardWidgetConfig, 'id' | 'group_id' | 'order'> | Omit<PivotTableWidgetConfig, 'id' | 'group_id' | 'order'>;
|
|
203
215
|
export type DashboardWidgetTableData = {
|
|
204
216
|
kind?: 'table';
|
|
205
217
|
columns: string[];
|
|
@@ -224,8 +236,5 @@ export type DashboardWidgetAggregateData = {
|
|
|
224
236
|
};
|
|
225
237
|
};
|
|
226
238
|
export type DashboardWidgetData = DashboardWidgetTableData | DashboardWidgetAggregateData;
|
|
227
|
-
export declare function
|
|
228
|
-
export declare function normalizeDashboardWidgetConfig(config: unknown): unknown;
|
|
229
|
-
export declare function serializeDashboardWidgetConfigForEditor(widget: DashboardWidgetConfig): Record<string, unknown>;
|
|
239
|
+
export declare function serializeDashboardWidgetConfigForEditor(widget: DashboardWidgetConfig): unknown;
|
|
230
240
|
export declare function getFieldRefField(value: FieldRef | undefined): string | undefined;
|
|
231
|
-
export declare function getFieldRefLabel(value: FieldRef | undefined): string | undefined;
|
|
@@ -1,161 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeDashboardConfig = normalizeDashboardConfig;
|
|
4
|
-
exports.normalizeDashboardWidgetConfig = normalizeDashboardWidgetConfig;
|
|
5
14
|
exports.serializeDashboardWidgetConfigForEditor = serializeDashboardWidgetConfigForEditor;
|
|
6
15
|
exports.getFieldRefField = getFieldRefField;
|
|
7
|
-
exports.getFieldRefLabel = getFieldRefLabel;
|
|
8
|
-
function normalizeDashboardConfig(config) {
|
|
9
|
-
const value = isRecord(config) ? config : {};
|
|
10
|
-
return {
|
|
11
|
-
version: typeof value.version === 'number' ? value.version : 1,
|
|
12
|
-
groups: Array.isArray(value.groups) ? value.groups : [],
|
|
13
|
-
widgets: Array.isArray(value.widgets)
|
|
14
|
-
? value.widgets.map((widget) => normalizeDashboardWidgetConfig(widget))
|
|
15
|
-
: [],
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function normalizeDashboardWidgetConfig(config) {
|
|
19
|
-
if (!isRecord(config)) {
|
|
20
|
-
return config;
|
|
21
|
-
}
|
|
22
|
-
const normalized = Object.assign({}, config);
|
|
23
|
-
normalizeWidgetLayoutConfig(normalized);
|
|
24
|
-
if (normalized.query !== undefined) {
|
|
25
|
-
normalized.query = normalizeQueryConfig(normalized.query);
|
|
26
|
-
}
|
|
27
|
-
if (normalized.table !== undefined) {
|
|
28
|
-
normalized.table = normalizeTableConfig(normalized.table);
|
|
29
|
-
}
|
|
30
|
-
if (normalized.card !== undefined) {
|
|
31
|
-
normalized.card = normalizeCardConfig(normalized.card);
|
|
32
|
-
}
|
|
33
|
-
if (normalized.pivot !== undefined) {
|
|
34
|
-
normalized.pivot = normalizePivotConfig(normalized.pivot);
|
|
35
|
-
}
|
|
36
|
-
const target = normalizeDashboardWidgetTarget(normalized.target);
|
|
37
|
-
if (target !== undefined) {
|
|
38
|
-
normalized.target = target;
|
|
39
|
-
}
|
|
40
|
-
return normalized;
|
|
41
|
-
}
|
|
42
16
|
function serializeDashboardWidgetConfigForEditor(widget) {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
serialized.min_width = widget.minWidth;
|
|
46
|
-
delete serialized.minWidth;
|
|
47
|
-
}
|
|
48
|
-
if (Object.prototype.hasOwnProperty.call(serialized, 'maxWidth')) {
|
|
49
|
-
serialized.max_width = widget.maxWidth;
|
|
50
|
-
delete serialized.maxWidth;
|
|
51
|
-
}
|
|
52
|
-
if ('query' in widget) {
|
|
53
|
-
serialized.query = serializeQueryConfigForEditor(widget.query);
|
|
54
|
-
}
|
|
55
|
-
if ('table' in widget && widget.table !== undefined) {
|
|
56
|
-
serialized.table = serializeTableConfigForEditor(widget.table);
|
|
57
|
-
}
|
|
58
|
-
if ('card' in widget && widget.card !== undefined) {
|
|
59
|
-
serialized.card = serializeCardConfigForEditor(widget.card);
|
|
60
|
-
}
|
|
61
|
-
if ('pivot' in widget && widget.pivot !== undefined) {
|
|
62
|
-
serialized.pivot = serializePivotConfigForEditor(widget.pivot);
|
|
63
|
-
}
|
|
64
|
-
return serialized;
|
|
17
|
+
const { id: _id, group_id: _groupId, order: _order } = widget, editableWidget = __rest(widget, ["id", "group_id", "order"]);
|
|
18
|
+
return editableWidget;
|
|
65
19
|
}
|
|
66
20
|
function getFieldRefField(value) {
|
|
67
21
|
return typeof value === 'string' ? value : value === null || value === void 0 ? void 0 : value.field;
|
|
68
22
|
}
|
|
69
|
-
function getFieldRefLabel(value) {
|
|
70
|
-
return typeof value === 'string' ? value : value === null || value === void 0 ? void 0 : value.label;
|
|
71
|
-
}
|
|
72
|
-
function normalizeDashboardWidgetTarget(value) {
|
|
73
|
-
switch (value) {
|
|
74
|
-
case 'empty':
|
|
75
|
-
case 'table':
|
|
76
|
-
case 'chart':
|
|
77
|
-
case 'kpi_card':
|
|
78
|
-
case 'pivot_table':
|
|
79
|
-
case 'gauge_card':
|
|
80
|
-
return value;
|
|
81
|
-
default:
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function normalizeWidgetLayoutConfig(value) {
|
|
86
|
-
if (value.min_width !== undefined) {
|
|
87
|
-
value.minWidth = value.min_width;
|
|
88
|
-
}
|
|
89
|
-
if (value.max_width !== undefined) {
|
|
90
|
-
value.maxWidth = value.max_width;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function normalizeQueryConfig(value) {
|
|
94
|
-
if (!isRecord(value)) {
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
if (Array.isArray(value.steps)) {
|
|
98
|
-
return {
|
|
99
|
-
steps: value.steps.map((step) => normalizeFunnelQueryStep(step)),
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, value), (Array.isArray(value.group_by) ? { groupBy: value.group_by } : {})), (Array.isArray(value.order_by) ? { orderBy: value.order_by } : {})), (value.time_series !== undefined ? { timeSeries: value.time_series } : {}));
|
|
103
|
-
}
|
|
104
|
-
function normalizeFunnelQueryStep(value) {
|
|
105
|
-
if (!isRecord(value)) {
|
|
106
|
-
return value;
|
|
107
|
-
}
|
|
108
|
-
return Object.assign(Object.assign({}, value), (typeof value.resource_id === 'string' ? { resource: value.resource_id } : {}));
|
|
109
|
-
}
|
|
110
|
-
function normalizeTableConfig(value) {
|
|
111
|
-
if (!isRecord(value)) {
|
|
112
|
-
return value;
|
|
113
|
-
}
|
|
114
|
-
return Object.assign(Object.assign({}, value), (value.page_size !== undefined ? { pageSize: value.page_size } : {}));
|
|
115
|
-
}
|
|
116
|
-
function normalizeCardConfig(value) {
|
|
117
|
-
if (!isRecord(value)) {
|
|
118
|
-
return value;
|
|
119
|
-
}
|
|
120
|
-
const normalized = Object.assign({}, value);
|
|
121
|
-
if (isRecord(normalized.progress)) {
|
|
122
|
-
normalized.progress = Object.assign(Object.assign(Object.assign(Object.assign({}, normalized.progress), (normalized.progress.value_field !== undefined ? { valueField: normalized.progress.value_field } : {})), (normalized.progress.target_value !== undefined ? { targetValue: normalized.progress.target_value } : {})), (normalized.progress.target_field !== undefined ? { targetField: normalized.progress.target_field } : {}));
|
|
123
|
-
}
|
|
124
|
-
if (isRecord(normalized.comparison)) {
|
|
125
|
-
normalized.comparison = Object.assign(Object.assign({}, normalized.comparison), (normalized.comparison.positive_is_good !== undefined ? { positiveIsGood: normalized.comparison.positive_is_good } : {}));
|
|
126
|
-
}
|
|
127
|
-
return normalized;
|
|
128
|
-
}
|
|
129
|
-
function normalizePivotConfig(value) {
|
|
130
|
-
return value;
|
|
131
|
-
}
|
|
132
|
-
function serializeQueryConfigForEditor(value) {
|
|
133
|
-
if ('steps' in value) {
|
|
134
|
-
return {
|
|
135
|
-
steps: value.steps.map((step) => (Object.assign(Object.assign({}, step), { resource_id: step.resource, resource: undefined }))).map((step) => removeUndefinedFields(step)),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
return removeUndefinedFields(Object.assign(Object.assign({}, value), { group_by: value.groupBy, groupBy: undefined, order_by: value.orderBy, orderBy: undefined, time_series: value.timeSeries, timeSeries: undefined }));
|
|
139
|
-
}
|
|
140
|
-
function serializeTableConfigForEditor(value) {
|
|
141
|
-
return removeUndefinedFields(Object.assign(Object.assign({}, value), { page_size: value.pageSize, pageSize: undefined }));
|
|
142
|
-
}
|
|
143
|
-
function serializeCardConfigForEditor(value) {
|
|
144
|
-
const serialized = Object.assign({}, value);
|
|
145
|
-
if (isRecord(serialized.progress)) {
|
|
146
|
-
serialized.progress = removeUndefinedFields(Object.assign(Object.assign({}, serialized.progress), { value_field: serialized.progress.valueField, valueField: undefined, target_value: serialized.progress.targetValue, targetValue: undefined, target_field: serialized.progress.targetField, targetField: undefined }));
|
|
147
|
-
}
|
|
148
|
-
if (isRecord(serialized.comparison)) {
|
|
149
|
-
serialized.comparison = removeUndefinedFields(Object.assign(Object.assign({}, serialized.comparison), { positive_is_good: serialized.comparison.positiveIsGood, positiveIsGood: undefined }));
|
|
150
|
-
}
|
|
151
|
-
return removeUndefinedFields(serialized);
|
|
152
|
-
}
|
|
153
|
-
function serializePivotConfigForEditor(value) {
|
|
154
|
-
return value;
|
|
155
|
-
}
|
|
156
|
-
function removeUndefinedFields(value) {
|
|
157
|
-
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== undefined));
|
|
158
|
-
}
|
|
159
|
-
function isRecord(value) {
|
|
160
|
-
return typeof value === 'object' && value !== null;
|
|
161
|
-
}
|