@devtable/dashboard 6.4.0 → 6.6.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/dashboard.es.js +3623 -3548
- package/dist/dashboard.umd.js +19 -19
- package/dist/main/use-panel-full-screen.d.ts +1378 -0
- package/dist/model/variables/index.d.ts +141 -0
- package/dist/model/views/view/index.d.ts +6266 -0
- package/dist/model/views/view/panels/index.d.ts +2067 -0
- package/dist/model/views/view/panels/panel.d.ts +200 -1
- package/dist/panel/index.d.ts +1 -1
- package/dist/panel/settings/common/text-array-input.d.ts +4 -0
- package/dist/panel/settings/variable-config/model.d.ts +338 -0
- package/dist/panel/settings/variable-config/styles.d.ts +5 -0
- package/dist/panel/settings/variable-config/variable-config-panel.d.ts +11 -0
- package/dist/panel/settings/variable-config/variable-field.d.ts +10 -0
- package/dist/plugins/instance-migrator/index.d.ts +2 -0
- package/dist/plugins/plugin-context.d.ts +1732 -0
- package/dist/plugins/plugin-data-migrator/plugin-data-migrator.d.ts +8 -5
- package/dist/plugins/plugin-data-migrator/version-based-migrator.d.ts +5 -5
- package/dist/plugins/viz-components/boxplot-chart/index.d.ts +5 -0
- package/dist/plugins/viz-components/boxplot-chart/reference-lines/index.d.ts +3 -1
- package/dist/plugins/viz-components/boxplot-chart/type.d.ts +0 -2
- package/dist/plugins/viz-components/cartesian/index.d.ts +5 -0
- package/dist/plugins/viz-components/cartesian/option/index.d.ts +2 -1
- package/dist/plugins/viz-components/cartesian/option/series.d.ts +2 -1
- package/dist/plugins/viz-components/cartesian/panel/reference-areas/index.d.ts +3 -1
- package/dist/plugins/viz-components/cartesian/panel/reference-lines/index.d.ts +3 -1
- package/dist/plugins/viz-components/cartesian/panel/stats/index.d.ts +1 -1
- package/dist/plugins/viz-components/cartesian/type.d.ts +0 -3
- package/dist/plugins/viz-components/stats/type.d.ts +0 -2
- package/dist/plugins/viz-components/stats/update/index.d.ts +1 -1
- package/dist/plugins/viz-manager/components.d.ts +3 -0
- package/dist/plugins/viz-manager/types.d.ts +1 -1
- package/dist/types/dashboard.d.ts +4 -1
- package/dist/types/plugin/index.d.ts +11 -2
- package/dist/utils/template/render/render-jsx.d.ts +1 -0
- package/package.json +1 -1
- package/dist/model/views/index.d.ts +0 -21911
- package/dist/plugins/viz-components/boxplot-chart/variables/index.d.ts +0 -10
- package/dist/plugins/viz-components/boxplot-chart/variables/variable.d.ts +0 -11
- package/dist/plugins/viz-components/cartesian/panel/stats/variable.d.ts +0 -11
- package/dist/plugins/viz-components/cartesian/panel/variables/index.d.ts +0 -10
- package/dist/plugins/viz-components/cartesian/panel/variables/variable.d.ts +0 -11
- package/dist/plugins/viz-components/stats/panel/variable.d.ts +0 -11
- package/dist/plugins/viz-components/stats/panel/variables.d.ts +0 -10
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { PanelModelInstance } from '~/model/views/view/panels';
|
|
2
|
+
export interface IMigrationEnv {
|
|
3
|
+
panelModel: PanelModelInstance;
|
|
4
|
+
}
|
|
5
|
+
export interface IMigration {
|
|
2
6
|
version: number;
|
|
3
|
-
handler: (data: $TSFixMe) => $TSFixMe;
|
|
7
|
+
handler: (data: $TSFixMe, env: IMigrationEnv) => $TSFixMe;
|
|
4
8
|
}
|
|
5
9
|
export declare class PluginDataMigrator {
|
|
6
10
|
protected migrations: IMigration[];
|
|
7
|
-
version(version: number, handler:
|
|
11
|
+
version(version: number, handler: IMigration['handler']): PluginDataMigrator;
|
|
8
12
|
run(migrationTarget: {
|
|
9
13
|
from: number;
|
|
10
14
|
to: number;
|
|
11
|
-
}, val: $TSFixMe):
|
|
15
|
+
}, val: $TSFixMe, env: IMigrationEnv): $TSFixMe;
|
|
12
16
|
}
|
|
13
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PluginDataMigrator } from './plugin-data-migrator';
|
|
1
|
+
import { IConfigMigrationContext, IConfigMigrationExecContext, IPanelScopeConfigMigrator } from '~/types/plugin';
|
|
2
|
+
import { IMigration, PluginDataMigrator } from './plugin-data-migrator';
|
|
3
3
|
/**
|
|
4
4
|
* Instance version is read from the `instanceData.version` field.
|
|
5
5
|
* Current version is read from the `VERSION` field.
|
|
@@ -8,11 +8,11 @@ import { PluginDataMigrator } from './plugin-data-migrator';
|
|
|
8
8
|
* You can implement the `configVersions` method to
|
|
9
9
|
* specify how migrations are performed.
|
|
10
10
|
*/
|
|
11
|
-
export declare abstract class VersionBasedMigrator extends PluginDataMigrator implements
|
|
11
|
+
export declare abstract class VersionBasedMigrator extends PluginDataMigrator implements IPanelScopeConfigMigrator {
|
|
12
12
|
abstract readonly VERSION: number;
|
|
13
13
|
abstract configVersions(): void;
|
|
14
14
|
constructor();
|
|
15
|
-
version(version: number, handler:
|
|
16
|
-
migrate({ configData }:
|
|
15
|
+
version(version: number, handler: IMigration['handler']): PluginDataMigrator;
|
|
16
|
+
migrate({ configData, panelModel }: IConfigMigrationExecContext): Promise<void>;
|
|
17
17
|
needMigration({ configData }: IConfigMigrationContext): Promise<boolean>;
|
|
18
18
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { VizComponent } from '~/types/plugin';
|
|
2
|
+
import { VersionBasedMigrator } from '~/plugins/plugin-data-migrator';
|
|
3
|
+
export declare class VizBoxplotChartMigrator extends VersionBasedMigrator {
|
|
4
|
+
readonly VERSION = 2;
|
|
5
|
+
configVersions(): void;
|
|
6
|
+
}
|
|
2
7
|
export declare const BoxplotChartVizComponent: VizComponent;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Control, UseFormWatch } from 'react-hook-form';
|
|
3
3
|
import { IBoxplotChartConf } from '../type';
|
|
4
|
+
import { ITemplateVariable } from '~/utils/template';
|
|
4
5
|
interface IReferenceLinesField {
|
|
5
6
|
control: Control<IBoxplotChartConf, $TSFixMe>;
|
|
6
7
|
watch: UseFormWatch<IBoxplotChartConf>;
|
|
8
|
+
variables: ITemplateVariable[];
|
|
7
9
|
}
|
|
8
|
-
export declare function ReferenceLinesField({ control, watch }: IReferenceLinesField): JSX.Element;
|
|
10
|
+
export declare function ReferenceLinesField({ control, watch, variables }: IReferenceLinesField): JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ITemplateVariable } from '~/utils/template';
|
|
2
1
|
export interface IBoxplotReferenceLine {
|
|
3
2
|
name: string;
|
|
4
3
|
template: string;
|
|
@@ -14,7 +13,6 @@ export interface IBoxplotChartConf {
|
|
|
14
13
|
data_key: string;
|
|
15
14
|
};
|
|
16
15
|
color: string;
|
|
17
|
-
variables: ITemplateVariable[];
|
|
18
16
|
reference_lines: IBoxplotReferenceLine[];
|
|
19
17
|
}
|
|
20
18
|
export declare const DEFAULT_CONFIG: IBoxplotChartConf;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { VizComponent } from '~/types/plugin';
|
|
2
|
+
import { VersionBasedMigrator } from '~/plugins/plugin-data-migrator';
|
|
3
|
+
export declare class VizCartesianMigrator extends VersionBasedMigrator {
|
|
4
|
+
readonly VERSION = 2;
|
|
5
|
+
configVersions(): void;
|
|
6
|
+
}
|
|
2
7
|
export declare const CartesianVizComponent: VizComponent;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ICartesianChartConf } from '../type';
|
|
2
|
-
|
|
2
|
+
import { ITemplateVariable } from '~/utils/template';
|
|
3
|
+
export declare function getOption(conf: ICartesianChartConf, data: $TSFixMe[], variables: ITemplateVariable[]): any;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { ITemplateVariable } from '~/utils/template';
|
|
1
2
|
import { ICartesianChartConf } from '../type';
|
|
2
|
-
export declare function getSeries(conf: ICartesianChartConf, xAxisData: $TSFixMe[], data: $TSFixMe[], labelFormatters: Record<string, $TSFixMe
|
|
3
|
+
export declare function getSeries(conf: ICartesianChartConf, xAxisData: $TSFixMe[], data: $TSFixMe[], labelFormatters: Record<string, $TSFixMe>, variables: ITemplateVariable[]): any[];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Control, UseFormWatch } from 'react-hook-form';
|
|
3
3
|
import { ICartesianChartConf } from '../../type';
|
|
4
|
+
import { ITemplateVariable } from '~/utils/template';
|
|
4
5
|
interface IReferenceAreasField {
|
|
5
6
|
control: Control<ICartesianChartConf, $TSFixMe>;
|
|
6
7
|
watch: UseFormWatch<ICartesianChartConf>;
|
|
8
|
+
variables: ITemplateVariable[];
|
|
7
9
|
}
|
|
8
|
-
export declare function ReferenceAreasField({ control, watch }: IReferenceAreasField): JSX.Element;
|
|
10
|
+
export declare function ReferenceAreasField({ control, watch, variables }: IReferenceAreasField): JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Control, UseFormWatch } from 'react-hook-form';
|
|
3
3
|
import { ICartesianChartConf } from '../../type';
|
|
4
|
+
import { ITemplateVariable } from '~/utils/template';
|
|
4
5
|
interface IReferenceLinesField {
|
|
5
6
|
control: Control<ICartesianChartConf, $TSFixMe>;
|
|
6
7
|
watch: UseFormWatch<ICartesianChartConf>;
|
|
8
|
+
variables: ITemplateVariable[];
|
|
7
9
|
}
|
|
8
|
-
export declare function ReferenceLinesField({ control, watch }: IReferenceLinesField): JSX.Element;
|
|
10
|
+
export declare function ReferenceLinesField({ control, watch, variables }: IReferenceLinesField): JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -6,5 +6,5 @@ interface IVariablesField {
|
|
|
6
6
|
watch: UseFormWatch<ICartesianChartConf>;
|
|
7
7
|
data: $TSFixMe[];
|
|
8
8
|
}
|
|
9
|
-
export declare function StatsField({ control
|
|
9
|
+
export declare function StatsField({ control }: IVariablesField): JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TNumbroFormat } from '~/panel/settings/common/numbro-format-selector';
|
|
2
|
-
import { ITemplateVariable } from '~/utils/template';
|
|
3
2
|
export interface ICartesianChartSeriesItem {
|
|
4
3
|
type: 'line' | 'bar' | 'scatter';
|
|
5
4
|
name: string;
|
|
@@ -81,9 +80,7 @@ export interface ICartesianChartConf {
|
|
|
81
80
|
top: string;
|
|
82
81
|
bottom: string;
|
|
83
82
|
};
|
|
84
|
-
variables: ITemplateVariable[];
|
|
85
83
|
};
|
|
86
|
-
variables: ITemplateVariable[];
|
|
87
84
|
reference_lines: ICartesianReferenceLine[];
|
|
88
85
|
reference_areas: ICartesianReferenceArea[];
|
|
89
86
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IPanelInfoEditor } from '~/types/plugin';
|
|
3
3
|
import { IPanelInfo, IVizManager } from './types';
|
|
4
|
+
import { ITemplateVariable } from '~/utils/template';
|
|
4
5
|
export declare type IViewPanelInfo = IPanelInfo & {
|
|
5
6
|
layout: {
|
|
6
7
|
w: number;
|
|
@@ -11,12 +12,14 @@ export declare type IViewComponentProps<TDebug = Record<string, unknown>> = {
|
|
|
11
12
|
panel: IViewPanelInfo;
|
|
12
13
|
data: $TSFixMe;
|
|
13
14
|
vizManager: IVizManager;
|
|
15
|
+
variables: ITemplateVariable[];
|
|
14
16
|
} & TDebug;
|
|
15
17
|
export declare const VizViewComponent: <T>(props: IViewComponentProps<T>) => JSX.Element;
|
|
16
18
|
export declare type IConfigComponentProps<TDebug = Record<string, unknown>> = {
|
|
17
19
|
panel: IPanelInfo;
|
|
18
20
|
panelInfoEditor: IPanelInfoEditor;
|
|
19
21
|
vizManager: IVizManager;
|
|
22
|
+
variables: ITemplateVariable[];
|
|
20
23
|
data: $TSFixMe;
|
|
21
24
|
} & TDebug;
|
|
22
25
|
export declare const VizConfigComponent: <T>(props: IConfigComponentProps<T>) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDashboardPanel } from '~/types';
|
|
2
2
|
import { VizComponent, VizInstance } from '~/types/plugin';
|
|
3
|
-
export declare type IPanelInfo = Omit<IDashboardPanel, 'layout'>;
|
|
3
|
+
export declare type IPanelInfo = Omit<IDashboardPanel, 'layout' | 'variables' | 'style'>;
|
|
4
4
|
export interface IVizManager {
|
|
5
5
|
readonly availableVizList: VizComponent[];
|
|
6
6
|
resolveComponent(type: string): VizComponent;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnyObject } from '~/types/utils';
|
|
2
|
+
import { ITemplateVariable } from '~/utils/template';
|
|
2
3
|
import { FilterModelInstance } from '../model';
|
|
3
4
|
import { QueryModelInstance } from '../model/queries';
|
|
4
5
|
import { SQLSnippetModelInstance } from '../model/sql-snippets';
|
|
@@ -26,6 +27,7 @@ export interface IDashboardPanel {
|
|
|
26
27
|
queryID: string;
|
|
27
28
|
viz: IVizConfig;
|
|
28
29
|
style: IDashboardPanelStyle;
|
|
30
|
+
variables: ITemplateVariable[];
|
|
29
31
|
}
|
|
30
32
|
export declare enum DashboardMode {
|
|
31
33
|
Use = "use",
|
|
@@ -44,7 +46,7 @@ export interface IDashboardView {
|
|
|
44
46
|
id: string;
|
|
45
47
|
name: string;
|
|
46
48
|
type: EViewComponentType;
|
|
47
|
-
config: Record<string,
|
|
49
|
+
config: Record<string, AnyObject>;
|
|
48
50
|
panels: IDashboardPanel[];
|
|
49
51
|
}
|
|
50
52
|
export interface IDashboard {
|
|
@@ -53,6 +55,7 @@ export interface IDashboard {
|
|
|
53
55
|
definition: IDashboardDefinition;
|
|
54
56
|
views: IDashboardView[];
|
|
55
57
|
filters: FilterModelInstance[];
|
|
58
|
+
variables: ITemplateVariable[];
|
|
56
59
|
version: string;
|
|
57
60
|
}
|
|
58
61
|
export {};
|
|
@@ -2,6 +2,8 @@ import { EventEmitter2 } from 'eventemitter2';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IVizManager } from '~/plugins';
|
|
4
4
|
import { AnyObject } from '~/types';
|
|
5
|
+
import { ITemplateVariable } from '~/utils/template';
|
|
6
|
+
import { PanelModelInstance } from '~/model/views/view/panels';
|
|
5
7
|
/**
|
|
6
8
|
* Basic information of a viz component instance
|
|
7
9
|
*/
|
|
@@ -57,6 +59,7 @@ export interface VizContext {
|
|
|
57
59
|
pluginData: PluginStorage;
|
|
58
60
|
instanceData: PluginStorage;
|
|
59
61
|
colorPalette: ColorPalette;
|
|
62
|
+
variables: ITemplateVariable[];
|
|
60
63
|
locale: string;
|
|
61
64
|
msgChannels: IMessageChannels;
|
|
62
65
|
data: unknown;
|
|
@@ -84,17 +87,23 @@ export interface VizConfigProps {
|
|
|
84
87
|
export interface IConfigMigrationContext {
|
|
85
88
|
configData: PluginStorage;
|
|
86
89
|
}
|
|
90
|
+
export interface IConfigMigrationExecContext extends IConfigMigrationContext {
|
|
91
|
+
panelModel: PanelModelInstance;
|
|
92
|
+
}
|
|
87
93
|
export interface VizComponent {
|
|
88
94
|
name: string;
|
|
89
95
|
displayName?: string;
|
|
90
96
|
viewRender: React.ComponentType<VizViewProps>;
|
|
91
97
|
configRender: React.ComponentType<VizConfigProps>;
|
|
92
|
-
migrator:
|
|
98
|
+
migrator: IPanelScopeConfigMigrator;
|
|
93
99
|
createConfig: () => AnyObject;
|
|
94
100
|
triggers?: ITriggerSchema[];
|
|
95
101
|
}
|
|
96
|
-
export interface
|
|
102
|
+
export interface IPanelScopeConfigMigrator {
|
|
97
103
|
needMigration(ctx: IConfigMigrationContext): Promise<boolean>;
|
|
104
|
+
migrate(ctx: IConfigMigrationExecContext): Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
export interface IConfigMigrator extends IPanelScopeConfigMigrator {
|
|
98
107
|
migrate(ctx: IConfigMigrationContext): Promise<void>;
|
|
99
108
|
}
|
|
100
109
|
export interface IPluginManifest {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ITemplateVariable } from '../types';
|
|
3
|
+
export declare function variable2Jsx(variable: ITemplateVariable, data: Record<string, number>[]): JSX.Element;
|
|
3
4
|
export declare function templateToJSX(template: string, variables: ITemplateVariable[], data: Record<string, number>[]): (JSX.Element | React.ReactNode[])[];
|