@devtable/dashboard 2.4.0 → 3.0.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/README.md +25 -1
- package/dist/api-caller/index.d.ts +13 -7
- package/dist/api-caller/types.d.ts +1 -1
- package/dist/contexts/index.d.ts +1 -3
- package/dist/contexts/model-context.d.ts +24165 -0
- package/dist/contexts/panel-context.d.ts +0 -1
- package/dist/dashboard.es.js +9680 -15352
- package/dist/dashboard.umd.js +38 -19
- package/dist/definition-editor/data-editor-modal.d.ts +2 -2
- package/dist/definition-editor/global-variables-guide.d.ts +2 -2
- package/dist/definition-editor/query-editor/data-preview.d.ts +3 -3
- package/dist/definition-editor/query-editor/editor.d.ts +1 -1
- package/dist/definition-editor/query-editor/form.d.ts +4 -5
- package/dist/definition-editor/query-editor/index.d.ts +2 -2
- package/dist/definition-editor/query-editor/select-or-add-query.d.ts +1 -1
- package/dist/definition-editor/sql-snippet-editor/editor.d.ts +2 -2
- package/dist/filter/filter-checkbox/editor.d.ts +1 -1
- package/dist/filter/filter-checkbox/render.d.ts +1 -1
- package/dist/filter/filter-date-range/editor.d.ts +1 -1
- package/dist/filter/filter-date-range/render.d.ts +1 -1
- package/dist/filter/filter-multi-select/editor.d.ts +1 -1
- package/dist/filter/filter-multi-select/render.d.ts +1 -1
- package/dist/filter/filter-query-field/index.d.ts +1 -1
- package/dist/filter/filter-query-field/select-data-source.d.ts +1 -1
- package/dist/filter/filter-query-field/test-query.d.ts +1 -1
- package/dist/filter/filter-select/editor.d.ts +1 -1
- package/dist/filter/filter-select/render.d.ts +1 -1
- package/dist/filter/filter-settings/filter-settings.d.ts +0 -2
- package/dist/filter/filter-settings/index.d.ts +2 -4
- package/dist/filter/filter-text-input/editor.d.ts +1 -1
- package/dist/filter/filter-text-input/render.d.ts +1 -1
- package/dist/filter/index.d.ts +2 -6
- package/dist/index.d.ts +1 -0
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/read-only.d.ts +2 -2
- package/dist/main/actions.d.ts +1 -3
- package/dist/main/full-screen-panel.d.ts +2 -2
- package/dist/main/main.d.ts +2 -2
- package/dist/main/read-only.d.ts +2 -2
- package/dist/main/use-sticky-area-style.d.ts +1 -0
- package/dist/model/context.d.ts +11 -0
- package/dist/model/dashboard.d.ts +8579 -684
- package/dist/model/{filter → filters/filter}/checkbox.d.ts +0 -0
- package/dist/model/{filter → filters/filter}/common.d.ts +0 -0
- package/dist/model/{filter → filters/filter}/date-range.d.ts +0 -0
- package/dist/model/{filter → filters/filter}/index.d.ts +0 -0
- package/dist/model/{filter → filters/filter}/multi-select.d.ts +0 -0
- package/dist/model/{filter → filters/filter}/select.d.ts +0 -0
- package/dist/model/{filter → filters/filter}/text-input.d.ts +0 -0
- package/dist/{main/use-filters.d.ts → model/filters/index.d.ts} +1430 -16
- package/dist/model/index.d.ts +4 -1
- package/dist/model/queries/index.d.ts +116 -0
- package/dist/model/queries/mute-query.d.ts +17 -0
- package/dist/model/queries/query.d.ts +31 -0
- package/dist/model/queries/types.d.ts +5 -0
- package/dist/model/sql-snippets/index.d.ts +26 -0
- package/dist/model/sql-snippets/sql-snippet.d.ts +9 -0
- package/dist/panel/index.d.ts +2 -2
- package/dist/panel/plugin-adaptor.d.ts +7 -0
- package/dist/panel/settings/index.d.ts +2 -2
- package/dist/panel/settings/pick-query/index.d.ts +2 -2
- package/dist/panel/title-bar.d.ts +2 -2
- package/dist/panel/viz/index.d.ts +3 -3
- package/dist/plugins/hooks/index.d.ts +2 -0
- package/dist/plugins/hooks/use-channel-event.d.ts +2 -0
- package/dist/plugins/hooks/use-storage-data.d.ts +6 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/json-plugin-storage.d.ts +12 -0
- package/dist/plugins/message-channels.d.ts +7 -0
- package/dist/plugins/plugin-context.d.ts +12 -0
- package/dist/plugins/plugin-data-migrator/index.d.ts +1 -0
- package/dist/plugins/plugin-data-migrator/plugin-data-migrator.d.ts +13 -0
- package/dist/plugins/plugin-manager.d.ts +18 -0
- package/dist/plugins/viz-components/table/index.d.ts +2 -0
- package/dist/{panel/viz → plugins/viz-components}/table/type.d.ts +1 -0
- package/dist/{panel/viz → plugins/viz-components}/table/value-type-selector.d.ts +0 -0
- package/dist/{panel/viz → plugins/viz-components}/table/value.d.ts +0 -0
- package/dist/plugins/viz-components/table/viz-table-panel.d.ts +3 -0
- package/dist/plugins/viz-components/table/viz-table.d.ts +3 -0
- package/dist/plugins/viz-manager/components.d.ts +22 -0
- package/dist/plugins/viz-manager/impl.d.ts +10 -0
- package/dist/plugins/viz-manager/index.d.ts +4 -0
- package/dist/plugins/viz-manager/types.d.ts +12 -0
- package/dist/style.css +1 -1
- package/dist/types/dashboard.d.ts +4 -12
- package/dist/types/plugin/index.d.ts +101 -0
- package/dist/utils/download.d.ts +6 -0
- package/dist/utils/sql.d.ts +7 -6
- package/package.json +25 -6
- package/dist/contexts/context-info-context.d.ts +0 -5
- package/dist/contexts/definition-context.d.ts +0 -7
- package/dist/contexts/filter-values-context.d.ts +0 -4
- package/dist/panel/viz/table/index.d.ts +0 -10
- package/dist/panel/viz/table/panel.d.ts +0 -3
package/dist/model/index.d.ts
CHANGED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { QueryModelInstance } from './query';
|
|
2
|
+
export declare const QueriesModel: import("mobx-state-tree").IModelType<{
|
|
3
|
+
original: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
4
|
+
id: import("mobx-state-tree").ISimpleType<string>;
|
|
5
|
+
type: import("mobx-state-tree").ISimpleType<import("./types").DataSourceType>;
|
|
6
|
+
key: import("mobx-state-tree").ISimpleType<string>;
|
|
7
|
+
sql: import("mobx-state-tree").ISimpleType<string>;
|
|
8
|
+
}, {
|
|
9
|
+
readonly valid: string;
|
|
10
|
+
readonly configurations: {
|
|
11
|
+
id: string;
|
|
12
|
+
type: import("./types").DataSourceType;
|
|
13
|
+
key: string;
|
|
14
|
+
sql: string;
|
|
15
|
+
};
|
|
16
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
17
|
+
current: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
18
|
+
id: import("mobx-state-tree").ISimpleType<string>;
|
|
19
|
+
type: import("mobx-state-tree").ISimpleType<import("./types").DataSourceType>;
|
|
20
|
+
key: import("mobx-state-tree").ISimpleType<string>;
|
|
21
|
+
sql: import("mobx-state-tree").ISimpleType<string>;
|
|
22
|
+
} & {
|
|
23
|
+
state: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"idle" | "loading" | "error">, [undefined]>;
|
|
24
|
+
data: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<Object, Object, Object>>, [undefined]>;
|
|
25
|
+
error: import("mobx-state-tree").IType<any, any, any>;
|
|
26
|
+
}, {
|
|
27
|
+
readonly valid: string;
|
|
28
|
+
readonly configurations: {
|
|
29
|
+
id: string;
|
|
30
|
+
type: import("./types").DataSourceType;
|
|
31
|
+
key: string;
|
|
32
|
+
sql: string;
|
|
33
|
+
};
|
|
34
|
+
} & {
|
|
35
|
+
readonly formattedSQL: any;
|
|
36
|
+
} & {
|
|
37
|
+
setID(id: string): void;
|
|
38
|
+
setKey(key: string): void;
|
|
39
|
+
setType(type: import("./types").DataSourceType): void;
|
|
40
|
+
setSQL(sql: string): void;
|
|
41
|
+
fetchData: () => Promise<void>;
|
|
42
|
+
} & {
|
|
43
|
+
afterCreate(): void;
|
|
44
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
45
|
+
}, {
|
|
46
|
+
readonly changed: boolean;
|
|
47
|
+
readonly firstID: string | undefined;
|
|
48
|
+
findByID(id: string): ({
|
|
49
|
+
id: string;
|
|
50
|
+
type: import("./types").DataSourceType;
|
|
51
|
+
key: string;
|
|
52
|
+
sql: string;
|
|
53
|
+
state: "idle" | "loading" | "error";
|
|
54
|
+
data: import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IType<Object, Object, Object>> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<Object, Object, Object>>, [undefined]>>;
|
|
55
|
+
error: any;
|
|
56
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
57
|
+
readonly valid: string;
|
|
58
|
+
readonly configurations: {
|
|
59
|
+
id: string;
|
|
60
|
+
type: import("./types").DataSourceType;
|
|
61
|
+
key: string;
|
|
62
|
+
sql: string;
|
|
63
|
+
};
|
|
64
|
+
} & {
|
|
65
|
+
readonly formattedSQL: any;
|
|
66
|
+
} & {
|
|
67
|
+
setID(id: string): void;
|
|
68
|
+
setKey(key: string): void;
|
|
69
|
+
setType(type: import("./types").DataSourceType): void;
|
|
70
|
+
setSQL(sql: string): void;
|
|
71
|
+
fetchData: () => Promise<void>;
|
|
72
|
+
} & {
|
|
73
|
+
afterCreate(): void;
|
|
74
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
75
|
+
id: import("mobx-state-tree").ISimpleType<string>;
|
|
76
|
+
type: import("mobx-state-tree").ISimpleType<import("./types").DataSourceType>;
|
|
77
|
+
key: import("mobx-state-tree").ISimpleType<string>;
|
|
78
|
+
sql: import("mobx-state-tree").ISimpleType<string>;
|
|
79
|
+
} & {
|
|
80
|
+
state: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"idle" | "loading" | "error">, [undefined]>;
|
|
81
|
+
data: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<Object, Object, Object>>, [undefined]>;
|
|
82
|
+
error: import("mobx-state-tree").IType<any, any, any>;
|
|
83
|
+
}, {
|
|
84
|
+
readonly valid: string;
|
|
85
|
+
readonly configurations: {
|
|
86
|
+
id: string;
|
|
87
|
+
type: import("./types").DataSourceType;
|
|
88
|
+
key: string;
|
|
89
|
+
sql: string;
|
|
90
|
+
};
|
|
91
|
+
} & {
|
|
92
|
+
readonly formattedSQL: any;
|
|
93
|
+
} & {
|
|
94
|
+
setID(id: string): void;
|
|
95
|
+
setKey(key: string): void;
|
|
96
|
+
setType(type: import("./types").DataSourceType): void;
|
|
97
|
+
setSQL(sql: string): void;
|
|
98
|
+
fetchData: () => Promise<void>;
|
|
99
|
+
} & {
|
|
100
|
+
afterCreate(): void;
|
|
101
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined;
|
|
102
|
+
readonly options: {
|
|
103
|
+
value: string;
|
|
104
|
+
label: string;
|
|
105
|
+
}[];
|
|
106
|
+
} & {
|
|
107
|
+
reset(): void;
|
|
108
|
+
replace(current: Array<QueryModelInstance>): void;
|
|
109
|
+
append(item: QueryModelInstance): void;
|
|
110
|
+
remove(index: number): void;
|
|
111
|
+
replaceByIndex(index: number, replacement: QueryModelInstance): void;
|
|
112
|
+
downloadAllData(): void;
|
|
113
|
+
downloadDataByQueryID(queryID: string): void;
|
|
114
|
+
refetchDataByQueryID(queryID: string): Promise<void> | undefined;
|
|
115
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
116
|
+
export * from './query';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Instance } from 'mobx-state-tree';
|
|
2
|
+
import { DataSourceType } from './types';
|
|
3
|
+
export declare const MuteQueryModel: import("mobx-state-tree").IModelType<{
|
|
4
|
+
id: import("mobx-state-tree").ISimpleType<string>;
|
|
5
|
+
type: import("mobx-state-tree").ISimpleType<DataSourceType>;
|
|
6
|
+
key: import("mobx-state-tree").ISimpleType<string>;
|
|
7
|
+
sql: import("mobx-state-tree").ISimpleType<string>;
|
|
8
|
+
}, {
|
|
9
|
+
readonly valid: string;
|
|
10
|
+
readonly configurations: {
|
|
11
|
+
id: string;
|
|
12
|
+
type: DataSourceType;
|
|
13
|
+
key: string;
|
|
14
|
+
sql: string;
|
|
15
|
+
};
|
|
16
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
17
|
+
export declare type MuteQueryModelInstance = Instance<typeof MuteQueryModel>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Instance } from 'mobx-state-tree';
|
|
2
|
+
import { DataSourceType } from './types';
|
|
3
|
+
export declare const QueryModel: import("mobx-state-tree").IModelType<{
|
|
4
|
+
id: import("mobx-state-tree").ISimpleType<string>;
|
|
5
|
+
type: import("mobx-state-tree").ISimpleType<DataSourceType>;
|
|
6
|
+
key: import("mobx-state-tree").ISimpleType<string>;
|
|
7
|
+
sql: import("mobx-state-tree").ISimpleType<string>;
|
|
8
|
+
} & {
|
|
9
|
+
state: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<"idle" | "loading" | "error">, [undefined]>;
|
|
10
|
+
data: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<Object, Object, Object>>, [undefined]>;
|
|
11
|
+
error: import("mobx-state-tree").IType<any, any, any>;
|
|
12
|
+
}, {
|
|
13
|
+
readonly valid: string;
|
|
14
|
+
readonly configurations: {
|
|
15
|
+
id: string;
|
|
16
|
+
type: DataSourceType;
|
|
17
|
+
key: string;
|
|
18
|
+
sql: string;
|
|
19
|
+
};
|
|
20
|
+
} & {
|
|
21
|
+
readonly formattedSQL: any;
|
|
22
|
+
} & {
|
|
23
|
+
setID(id: string): void;
|
|
24
|
+
setKey(key: string): void;
|
|
25
|
+
setType(type: DataSourceType): void;
|
|
26
|
+
setSQL(sql: string): void;
|
|
27
|
+
fetchData: () => Promise<void>;
|
|
28
|
+
} & {
|
|
29
|
+
afterCreate(): void;
|
|
30
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
31
|
+
export declare type QueryModelInstance = Instance<typeof QueryModel>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SQLSnippetModelInstance } from './sql-snippet';
|
|
2
|
+
export declare const SQLSnippetsModel: import("mobx-state-tree").IModelType<{
|
|
3
|
+
original: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
4
|
+
key: import("mobx-state-tree").ISimpleType<string>;
|
|
5
|
+
value: import("mobx-state-tree").ISimpleType<string>;
|
|
6
|
+
}, {
|
|
7
|
+
setKey(key: string): void;
|
|
8
|
+
setValue(value: string): void;
|
|
9
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
10
|
+
current: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
11
|
+
key: import("mobx-state-tree").ISimpleType<string>;
|
|
12
|
+
value: import("mobx-state-tree").ISimpleType<string>;
|
|
13
|
+
}, {
|
|
14
|
+
setKey(key: string): void;
|
|
15
|
+
setValue(value: string): void;
|
|
16
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
17
|
+
}, {
|
|
18
|
+
readonly changed: boolean;
|
|
19
|
+
} & {
|
|
20
|
+
reset(): void;
|
|
21
|
+
replace(current: Array<SQLSnippetModelInstance>): void;
|
|
22
|
+
append(item: SQLSnippetModelInstance): void;
|
|
23
|
+
remove(index: number): void;
|
|
24
|
+
replaceByIndex(index: number, replacement: SQLSnippetModelInstance): void;
|
|
25
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
26
|
+
export * from './sql-snippet';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Instance } from 'mobx-state-tree';
|
|
2
|
+
export declare const SQLSnippetModel: import("mobx-state-tree").IModelType<{
|
|
3
|
+
key: import("mobx-state-tree").ISimpleType<string>;
|
|
4
|
+
value: import("mobx-state-tree").ISimpleType<string>;
|
|
5
|
+
}, {
|
|
6
|
+
setKey(key: string): void;
|
|
7
|
+
setValue(value: string): void;
|
|
8
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
9
|
+
export declare type SQLSnippetModelInstance = Instance<typeof SQLSnippetModel>;
|
package/dist/panel/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IDashboardPanel } from '../types/dashboard';
|
|
3
3
|
interface IPanel extends IDashboardPanel {
|
|
4
4
|
update?: (panel: IDashboardPanel) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
6
|
+
export declare const Panel: React.FunctionComponent<IPanel>;
|
|
7
7
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IConfigComponentProps, IViewComponentProps } from '../plugins/viz-manager/components';
|
|
3
|
+
import { IVizConfig } from '../types';
|
|
4
|
+
export declare function PluginVizConfigComponent({ setVizConf, ...props }: IConfigComponentProps & {
|
|
5
|
+
setVizConf: (val: React.SetStateAction<IVizConfig>) => void;
|
|
6
|
+
}): JSX.Element;
|
|
7
|
+
export declare function PluginVizViewComponent(props: IViewComponentProps): JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
interface IPanelSettingsModal {
|
|
3
3
|
opened: boolean;
|
|
4
4
|
close: () => void;
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
6
|
+
export declare const PanelSettingsModal: React.FunctionComponent<IPanelSettingsModal>;
|
|
7
7
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { IVizConfig } from '../../types
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IVizConfig } from '../../types';
|
|
3
3
|
interface IViz {
|
|
4
4
|
viz: IVizConfig;
|
|
5
5
|
data: any;
|
|
6
6
|
loading: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare
|
|
8
|
+
export declare const Viz: React.FunctionComponent<IViz>;
|
|
9
9
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PluginStorage } from '../types/plugin';
|
|
2
|
+
export declare class JsonPluginStorage implements PluginStorage {
|
|
3
|
+
protected rootRef: {
|
|
4
|
+
current: Record<string, any>;
|
|
5
|
+
};
|
|
6
|
+
constructor(initValue: Record<string, any>);
|
|
7
|
+
deleteItem(key: string): Promise<void>;
|
|
8
|
+
getItem<T>(key: string | null): Promise<T>;
|
|
9
|
+
private getValueFromRoot;
|
|
10
|
+
setItem<T>(key: string | null, item: T): Promise<T>;
|
|
11
|
+
watchItem<T>(key: string | null, callback: (value: T, previous?: T) => void): () => void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IPluginManager } from '../types/plugin';
|
|
3
|
+
import { PluginManager } from './plugin-manager';
|
|
4
|
+
import { VizManager } from './viz-manager';
|
|
5
|
+
interface IPluginContextProps {
|
|
6
|
+
pluginManager: IPluginManager;
|
|
7
|
+
vizManager: VizManager;
|
|
8
|
+
}
|
|
9
|
+
export declare const pluginManager: PluginManager;
|
|
10
|
+
export declare const createPluginContext: () => IPluginContextProps;
|
|
11
|
+
export declare const PluginContext: import("react").Context<IPluginContextProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './plugin-data-migrator';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface IMigration {
|
|
2
|
+
version: number;
|
|
3
|
+
handler: (data: any) => any;
|
|
4
|
+
}
|
|
5
|
+
export declare class PluginDataMigrator {
|
|
6
|
+
protected migrations: IMigration[];
|
|
7
|
+
version(version: number, handler: (data: any) => any): PluginDataMigrator;
|
|
8
|
+
run(migrationTarget: {
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
}, val: any): any;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IDashboardPlugin, IPluginManager, VizComponent } from '../types/plugin';
|
|
2
|
+
export declare class PluginManager implements IPluginManager {
|
|
3
|
+
/**
|
|
4
|
+
* Id to plugin map
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
private plugins;
|
|
8
|
+
/**
|
|
9
|
+
* Name to component map
|
|
10
|
+
*/
|
|
11
|
+
private vizComponents;
|
|
12
|
+
constructor();
|
|
13
|
+
factory: {
|
|
14
|
+
viz: (name: string) => VizComponent;
|
|
15
|
+
};
|
|
16
|
+
install(plugin: IDashboardPlugin): void;
|
|
17
|
+
get installedPlugins(): IDashboardPlugin[];
|
|
18
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IPanelInfoEditor } from '../../types/plugin';
|
|
3
|
+
import { IPanelInfo, IVizManager } from './types';
|
|
4
|
+
export declare type IViewPanelInfo = IPanelInfo & {
|
|
5
|
+
layout: {
|
|
6
|
+
w: number;
|
|
7
|
+
h: number;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare type IViewComponentProps<TDebug = {}> = {
|
|
11
|
+
panel: IViewPanelInfo;
|
|
12
|
+
data: any;
|
|
13
|
+
vizManager: IVizManager;
|
|
14
|
+
} & TDebug;
|
|
15
|
+
export declare const VizViewComponent: <T>(props: IViewComponentProps<T>) => JSX.Element;
|
|
16
|
+
export declare type IConfigComponentProps<TDebug = {}> = {
|
|
17
|
+
panel: IPanelInfo;
|
|
18
|
+
panelInfoEditor: IPanelInfoEditor;
|
|
19
|
+
vizManager: IVizManager;
|
|
20
|
+
data: any;
|
|
21
|
+
} & TDebug;
|
|
22
|
+
export declare const VizConfigComponent: <T>(props: IConfigComponentProps<T>) => JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IPluginManager, VizComponent } from '../../types/plugin';
|
|
2
|
+
import { IPanelInfo, IVizManager, VizInstanceInfo } from './types';
|
|
3
|
+
export declare class VizManager implements IVizManager {
|
|
4
|
+
private pluginManager;
|
|
5
|
+
private instances;
|
|
6
|
+
constructor(pluginManager: IPluginManager);
|
|
7
|
+
get availableVizList(): VizComponent[];
|
|
8
|
+
resolveComponent(name: string): VizComponent;
|
|
9
|
+
getOrCreateInstance(panel: IPanelInfo): VizInstanceInfo;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IDashboardPanel } from '../../types';
|
|
2
|
+
import { IMessageChannels, PluginStorage, VizComponent, VizInstance } from '../../types/plugin';
|
|
3
|
+
export declare type IPanelInfo = Omit<IDashboardPanel, 'layout'>;
|
|
4
|
+
export interface IVizManager {
|
|
5
|
+
readonly availableVizList: VizComponent[];
|
|
6
|
+
resolveComponent(type: string): VizComponent;
|
|
7
|
+
getOrCreateInstance(panel: IPanelInfo): VizInstanceInfo;
|
|
8
|
+
}
|
|
9
|
+
export interface VizInstanceInfo extends VizInstance {
|
|
10
|
+
messageChannels: IMessageChannels;
|
|
11
|
+
instanceData: PluginStorage;
|
|
12
|
+
}
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.viz-root{width:100%;overflow:scroll;padding-top:5px;height:calc(100% - 25px);background-color:#fff}.panel-title-wrapper{text-align:center;transition:background-color .3s ease}.panel-title-wrapper:hover{cursor:pointer;background-color:#6464640d}.panel-root{padding:5px;height:100%;width:100%;max-width:100%;background:transparent;border-radius:5px;box-shadow:0 0 10px #0003}.
|
|
1
|
+
.viz-root{width:100%;overflow:scroll;padding-top:5px;height:calc(100% - 25px);background-color:#fff}.panel-title-wrapper{text-align:center;transition:background-color .3s ease}.panel-title-wrapper:hover{cursor:pointer;background-color:#6464640d}.panel-root{padding:5px;height:100%;width:100%;max-width:100%;background:transparent;border-radius:5px;box-shadow:0 0 10px #0003}.panel-settings-tabs{width:100%;height:100%}.panel-settings-tabs .mantine-Tabs-panel{height:calc(100% - 25px)}.panel-settings-tabs .mantine-Tabs-tabsListWrapper{flex:0}.panel-settings-tabs .mantine-Tabs-body{flex:1;overflow:scroll}.dashboard-layout{margin-left:-10px;margin-right:-10px}.react-grid-item{padding:0}.remove-panel{position:absolute;right:2px;top:0;cursor:pointer}.code-textarea textarea{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.filter-settings-tabs{width:100%;height:100%}.filter-settings-tabs .mantine-Tabs-panel{height:calc(100% - 25px)}.filter-settings-tabs .mantine-Tabs-tabsListWrapper{flex:0}.filter-settings-tabs .mantine-Tabs-body{flex:1;overflow:scroll}.dashboard-root{overflow:scroll;padding:0 10px 10px}.dashboard-sticky-area{z-index:100;background:white;margin:0 -10px;padding:0 10px 10px}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { FilterModelInstance } from '../model';
|
|
2
|
+
import { QueryModelInstance } from '../model/queries';
|
|
3
|
+
import { SQLSnippetModelInstance } from '../model/sql-snippets';
|
|
2
4
|
export interface IVizConfig {
|
|
3
5
|
type: string;
|
|
4
6
|
conf: Record<string, any>;
|
|
5
7
|
}
|
|
6
|
-
export interface IQuery {
|
|
7
|
-
type: 'postgresql';
|
|
8
|
-
key: string;
|
|
9
|
-
sql: string;
|
|
10
|
-
id: string;
|
|
11
|
-
}
|
|
12
8
|
export interface IDashboardPanel {
|
|
13
9
|
id: string;
|
|
14
10
|
title: string;
|
|
@@ -29,13 +25,9 @@ export declare enum DashboardMode {
|
|
|
29
25
|
Layout = "layout",
|
|
30
26
|
Edit = "edit"
|
|
31
27
|
}
|
|
32
|
-
export interface ISQLSnippet {
|
|
33
|
-
key: string;
|
|
34
|
-
value: string;
|
|
35
|
-
}
|
|
36
28
|
export interface IDashboardDefinition {
|
|
37
|
-
sqlSnippets:
|
|
38
|
-
queries:
|
|
29
|
+
sqlSnippets: SQLSnippetModelInstance[];
|
|
30
|
+
queries: QueryModelInstance[];
|
|
39
31
|
}
|
|
40
32
|
export interface IDashboard {
|
|
41
33
|
id: string;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import EventEmitter2 from 'eventemitter2';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Basic information of a viz component instance
|
|
5
|
+
*/
|
|
6
|
+
export interface VizInstance {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Props to render the view of viz component
|
|
13
|
+
*/
|
|
14
|
+
export interface VizViewProps {
|
|
15
|
+
instance: VizInstance;
|
|
16
|
+
context: VizViewContext;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginStorage {
|
|
19
|
+
getItem<T>(key: string | null): Promise<T>;
|
|
20
|
+
setItem<T>(key: string | null, item: T): Promise<T>;
|
|
21
|
+
deleteItem(key: string): Promise<void>;
|
|
22
|
+
watchItem<T>(key: string | null, callback: (value: T, previous?: T) => void): () => void;
|
|
23
|
+
}
|
|
24
|
+
export interface ColorPaletteItem {
|
|
25
|
+
name: string;
|
|
26
|
+
type: string;
|
|
27
|
+
category: string;
|
|
28
|
+
}
|
|
29
|
+
export interface SingleColor extends ColorPaletteItem {
|
|
30
|
+
type: 'single';
|
|
31
|
+
value: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ColorInterpolation extends ColorPaletteItem {
|
|
34
|
+
type: 'interpolation';
|
|
35
|
+
interpolation: (value: number) => string;
|
|
36
|
+
}
|
|
37
|
+
export interface ColorPalette {
|
|
38
|
+
getColor(colorInfo: ColorPaletteItem): (value: unknown) => string;
|
|
39
|
+
}
|
|
40
|
+
export interface IMessageChannels {
|
|
41
|
+
globalChannel: EventEmitter2;
|
|
42
|
+
getChannel(name: string): EventEmitter2;
|
|
43
|
+
}
|
|
44
|
+
export interface VizContext {
|
|
45
|
+
pluginData: PluginStorage;
|
|
46
|
+
instanceData: PluginStorage;
|
|
47
|
+
colorPalette: ColorPalette;
|
|
48
|
+
locale: string;
|
|
49
|
+
msgChannels: IMessageChannels;
|
|
50
|
+
data: unknown;
|
|
51
|
+
}
|
|
52
|
+
declare type Setter<T> = (val: string) => void;
|
|
53
|
+
export interface IPanelInfoEditor {
|
|
54
|
+
setTitle: Setter<string>;
|
|
55
|
+
setDescription: Setter<string>;
|
|
56
|
+
setQueryID: Setter<string>;
|
|
57
|
+
}
|
|
58
|
+
export interface VizConfigContext extends VizContext {
|
|
59
|
+
panelInfoEditor: IPanelInfoEditor;
|
|
60
|
+
}
|
|
61
|
+
export interface VizViewContext extends VizContext {
|
|
62
|
+
viewport: {
|
|
63
|
+
width: number;
|
|
64
|
+
height: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface VizConfigProps {
|
|
68
|
+
instance: VizInstance;
|
|
69
|
+
context: VizConfigContext;
|
|
70
|
+
}
|
|
71
|
+
export interface VizComponentMigrationContext {
|
|
72
|
+
instanceData: PluginStorage;
|
|
73
|
+
}
|
|
74
|
+
export interface VizComponent {
|
|
75
|
+
name: string;
|
|
76
|
+
displayName?: string;
|
|
77
|
+
viewRender: React.ComponentType<VizViewProps>;
|
|
78
|
+
configRender: React.ComponentType<VizConfigProps>;
|
|
79
|
+
migrator: IVizComponentMigrator;
|
|
80
|
+
}
|
|
81
|
+
export interface IVizComponentMigrator {
|
|
82
|
+
needMigration(ctx: VizComponentMigrationContext): Promise<boolean>;
|
|
83
|
+
migrate(ctx: VizComponentMigrationContext): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
export interface IPluginManifest {
|
|
86
|
+
viz: VizComponent[];
|
|
87
|
+
color: ColorPaletteItem[];
|
|
88
|
+
}
|
|
89
|
+
export interface IDashboardPlugin {
|
|
90
|
+
id: string;
|
|
91
|
+
version: string;
|
|
92
|
+
manifest: IPluginManifest;
|
|
93
|
+
}
|
|
94
|
+
export interface IPluginManager {
|
|
95
|
+
install(plugin: IDashboardPlugin): void;
|
|
96
|
+
installedPlugins: IDashboardPlugin[];
|
|
97
|
+
factory: {
|
|
98
|
+
viz: (name: string) => VizComponent;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export {};
|
package/dist/utils/sql.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { FilterValuesType } from '../model';
|
|
2
|
+
import { ContextInfoType } from '../model/context';
|
|
3
|
+
import { SQLSnippetModelInstance } from '../model/sql-snippets';
|
|
4
|
+
export declare function explainSQLSnippet(snippet: string, context: ContextInfoType): any;
|
|
4
5
|
export declare function formatSQL(sql: string, params: Record<string, any>): any;
|
|
5
|
-
export declare function getSQLParams(context:
|
|
6
|
-
filters:
|
|
6
|
+
export declare function getSQLParams(context: ContextInfoType, sqlSnippets: SQLSnippetModelInstance[], filterValues: FilterValuesType): Record<string, any> & ContextInfoType & {
|
|
7
|
+
filters: FilterValuesType;
|
|
7
8
|
};
|
|
8
|
-
export declare function explainSQL(sql: string, context:
|
|
9
|
+
export declare function explainSQL(sql: string, context: ContextInfoType, sqlSnippets: SQLSnippetModelInstance[], filterValues: FilterValuesType): any;
|