@perses-dev/plugin-system 0.52.0-rc.1 → 0.53.0-beta.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/cjs/components/{DatasourceSelect.js → DatasourceSelect/DatasourceSelect.js} +4 -3
- package/dist/cjs/components/DatasourceSelect/index.js +30 -0
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +73 -73
- package/dist/cjs/components/PluginEditor/PluginEditor.js +9 -10
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +6 -3
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +25 -34
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +33 -19
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +47 -0
- package/dist/cjs/components/Variables/variable-model.js +3 -3
- package/dist/cjs/components/index.js +0 -1
- package/dist/cjs/context/index.js +0 -1
- package/dist/cjs/remote/remotePluginLoader.js +19 -4
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +27 -27
- package/dist/cjs/runtime/UsageMetricsProvider.js +4 -3
- package/dist/cjs/runtime/time-series-queries.js +4 -4
- package/dist/cjs/test/mock-data.js +158 -0
- package/dist/components/{DatasourceSelect.d.ts → DatasourceSelect/DatasourceSelect.d.ts} +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -0
- package/dist/components/{DatasourceSelect.js → DatasourceSelect/DatasourceSelect.js} +4 -3
- package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -0
- package/dist/components/DatasourceSelect/index.d.ts +2 -0
- package/dist/components/DatasourceSelect/index.d.ts.map +1 -0
- package/dist/components/DatasourceSelect/index.js +15 -0
- package/dist/components/DatasourceSelect/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +75 -75
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +9 -10
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +7 -4
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +25 -34
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -0
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +33 -19
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.d.ts +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +6 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +44 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/variable-model.js +3 -3
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/components/index.js.map +1 -1
- package/dist/context/index.d.ts +0 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +0 -1
- package/dist/context/index.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +1 -1
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/variables.d.ts +1 -1
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/remote/remotePluginLoader.d.ts +18 -1
- package/dist/remote/remotePluginLoader.d.ts.map +1 -1
- package/dist/remote/remotePluginLoader.js +22 -4
- package/dist/remote/remotePluginLoader.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +12 -7
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +23 -20
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.d.ts +3 -1
- package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
- package/dist/runtime/UsageMetricsProvider.js +4 -3
- package/dist/runtime/UsageMetricsProvider.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +4 -4
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/test/mock-data.d.ts +134 -0
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +135 -0
- package/dist/test/mock-data.js.map +1 -1
- package/package.json +5 -5
- package/dist/cjs/components/ProjectSelect.js +0 -96
- package/dist/cjs/context/ProjectStoreProvider.js +0 -81
- package/dist/cjs/context/query-params.js +0 -49
- package/dist/components/DatasourceSelect.d.ts.map +0 -1
- package/dist/components/DatasourceSelect.js.map +0 -1
- package/dist/components/ProjectSelect.d.ts +0 -15
- package/dist/components/ProjectSelect.d.ts.map +0 -1
- package/dist/components/ProjectSelect.js +0 -91
- package/dist/components/ProjectSelect.js.map +0 -1
- package/dist/context/ProjectStoreProvider.d.ts +0 -16
- package/dist/context/ProjectStoreProvider.d.ts.map +0 -1
- package/dist/context/ProjectStoreProvider.js +0 -59
- package/dist/context/ProjectStoreProvider.js.map +0 -1
- package/dist/context/query-params.d.ts +0 -5
- package/dist/context/query-params.d.ts.map +0 -1
- package/dist/context/query-params.js +0 -41
- package/dist/context/query-params.js.map +0 -1
|
@@ -27,10 +27,25 @@ const isPluginMetadata = (plugin)=>{
|
|
|
27
27
|
const isPluginModuleResource = (pluginModule)=>{
|
|
28
28
|
return typeof pluginModule === 'object' && pluginModule !== null && 'metadata' in pluginModule && 'spec' in pluginModule && typeof pluginModule.spec === 'object' && pluginModule.spec !== null && 'plugins' in pluginModule.spec && Array.isArray(pluginModule.spec.plugins) && pluginModule.spec.plugins.every(isPluginMetadata);
|
|
29
29
|
};
|
|
30
|
-
const
|
|
30
|
+
const DEFAULT_PLUGINS_API_PATH = '/api/v1/plugins';
|
|
31
|
+
const DEFAULT_PLUGINS_ASSETS_PATH = '/plugins';
|
|
32
|
+
const paramToOptions = (options)=>{
|
|
33
|
+
if (options === undefined) {
|
|
34
|
+
return {
|
|
35
|
+
pluginsApiPath: DEFAULT_PLUGINS_API_PATH,
|
|
36
|
+
pluginsAssetsPath: DEFAULT_PLUGINS_ASSETS_PATH
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
pluginsApiPath: `${options?.apiPrefix ?? ''}${DEFAULT_PLUGINS_API_PATH}`,
|
|
41
|
+
pluginsAssetsPath: `${options?.baseURL ?? ''}${DEFAULT_PLUGINS_ASSETS_PATH}`
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
function remotePluginLoader(options) {
|
|
45
|
+
const { pluginsApiPath, pluginsAssetsPath } = paramToOptions(options);
|
|
31
46
|
return {
|
|
32
47
|
getInstalledPlugins: async ()=>{
|
|
33
|
-
const pluginsResponse = await fetch(
|
|
48
|
+
const pluginsResponse = await fetch(pluginsApiPath);
|
|
34
49
|
const plugins = await pluginsResponse.json();
|
|
35
50
|
let pluginModules = [];
|
|
36
51
|
if (Array.isArray(plugins)) {
|
|
@@ -47,7 +62,7 @@ const remotePluginLoader = (baseURL)=>{
|
|
|
47
62
|
const pluginModuleName = resource.metadata.name;
|
|
48
63
|
const pluginModule = {};
|
|
49
64
|
for (const plugin of resource.spec.plugins){
|
|
50
|
-
const remotePluginModule = await (0, _PluginRuntime.loadPlugin)(pluginModuleName, plugin.spec.name);
|
|
65
|
+
const remotePluginModule = await (0, _PluginRuntime.loadPlugin)(pluginModuleName, plugin.spec.name, pluginsAssetsPath);
|
|
51
66
|
const remotePlugin = remotePluginModule?.[plugin.spec.name];
|
|
52
67
|
if (remotePlugin) {
|
|
53
68
|
pluginModule[plugin.spec.name] = remotePlugin;
|
|
@@ -58,4 +73,4 @@ const remotePluginLoader = (baseURL)=>{
|
|
|
58
73
|
return pluginModule;
|
|
59
74
|
}
|
|
60
75
|
};
|
|
61
|
-
}
|
|
76
|
+
}
|
|
@@ -21,20 +21,20 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
+
TimeRangeParam: function() {
|
|
25
|
+
return TimeRangeParam;
|
|
26
|
+
},
|
|
24
27
|
decodeTimeRangeValue: function() {
|
|
25
28
|
return decodeTimeRangeValue;
|
|
26
29
|
},
|
|
27
30
|
encodeTimeRangeValue: function() {
|
|
28
31
|
return encodeTimeRangeValue;
|
|
29
32
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
32
|
-
},
|
|
33
|
-
parseAsTimeRange: function() {
|
|
34
|
-
return parseAsTimeRange;
|
|
33
|
+
refreshIntervalQueryConfig: function() {
|
|
34
|
+
return refreshIntervalQueryConfig;
|
|
35
35
|
},
|
|
36
|
-
|
|
37
|
-
return
|
|
36
|
+
timeRangeQueryConfig: function() {
|
|
37
|
+
return timeRangeQueryConfig;
|
|
38
38
|
},
|
|
39
39
|
useInitialRefreshInterval: function() {
|
|
40
40
|
return useInitialRefreshInterval;
|
|
@@ -50,9 +50,9 @@ _export(exports, {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
const _react = require("react");
|
|
53
|
+
const _usequeryparams = require("use-query-params");
|
|
53
54
|
const _datefns = require("date-fns");
|
|
54
55
|
const _core = require("@perses-dev/core");
|
|
55
|
-
const _nuqs = require("nuqs");
|
|
56
56
|
/* Interprets an encoded string and returns either the string or null/undefined if not available */ function getEncodedValue(input, allowEmptyString) {
|
|
57
57
|
// '' or []
|
|
58
58
|
if (!input || input.length === 0 && (!allowEmptyString || allowEmptyString && input !== '')) {
|
|
@@ -69,7 +69,7 @@ const _nuqs = require("nuqs");
|
|
|
69
69
|
}
|
|
70
70
|
function encodeTimeRangeValue(timeOptionValue) {
|
|
71
71
|
if (!timeOptionValue) {
|
|
72
|
-
return
|
|
72
|
+
return timeOptionValue;
|
|
73
73
|
}
|
|
74
74
|
if (typeof timeOptionValue === 'string') {
|
|
75
75
|
if ((0, _core.isDurationString)(timeOptionValue)) {
|
|
@@ -83,25 +83,25 @@ function decodeTimeRangeValue(input) {
|
|
|
83
83
|
if (!paramString) return null;
|
|
84
84
|
return (0, _core.isDurationString)(paramString) ? paramString : new Date(Number(paramString));
|
|
85
85
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
const TimeRangeParam = {
|
|
87
|
+
encode: encodeTimeRangeValue,
|
|
88
|
+
decode: decodeTimeRangeValue,
|
|
89
|
+
equals: (valueA, valueB)=>{
|
|
90
90
|
if (valueA === valueB) return true;
|
|
91
91
|
if (!valueA || !valueB) return valueA === valueB;
|
|
92
92
|
return valueA.valueOf() === valueB.valueOf();
|
|
93
93
|
}
|
|
94
|
-
});
|
|
95
|
-
const parseAsTimeRange = {
|
|
96
|
-
start: parseAsTimeRangeValue,
|
|
97
|
-
end: parseAsTimeRangeValue
|
|
98
94
|
};
|
|
99
|
-
const
|
|
100
|
-
|
|
95
|
+
const timeRangeQueryConfig = {
|
|
96
|
+
start: TimeRangeParam,
|
|
97
|
+
end: TimeRangeParam
|
|
98
|
+
};
|
|
99
|
+
const refreshIntervalQueryConfig = {
|
|
100
|
+
refresh: TimeRangeParam
|
|
101
101
|
};
|
|
102
102
|
function useInitialTimeRange(dashboardDuration) {
|
|
103
|
-
const [query] = (0,
|
|
104
|
-
|
|
103
|
+
const [query] = (0, _usequeryparams.useQueryParams)(timeRangeQueryConfig, {
|
|
104
|
+
updateType: 'replaceIn'
|
|
105
105
|
});
|
|
106
106
|
const { start, end } = query;
|
|
107
107
|
return (0, _react.useMemo)(()=>{
|
|
@@ -130,8 +130,8 @@ function useInitialTimeRange(dashboardDuration) {
|
|
|
130
130
|
]);
|
|
131
131
|
}
|
|
132
132
|
function useTimeRangeParams(initialTimeRange) {
|
|
133
|
-
const [query, setQuery] = (0,
|
|
134
|
-
|
|
133
|
+
const [query, setQuery] = (0, _usequeryparams.useQueryParams)(timeRangeQueryConfig, {
|
|
134
|
+
updateType: 'replaceIn'
|
|
135
135
|
});
|
|
136
136
|
// determine whether initial param had previously been populated to fix back btn
|
|
137
137
|
const [paramsLoaded, setParamsLoaded] = (0, _react.useState)(false);
|
|
@@ -171,8 +171,8 @@ function useTimeRangeParams(initialTimeRange) {
|
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
function useInitialRefreshInterval(dashboardDuration) {
|
|
174
|
-
const [query] = (0,
|
|
175
|
-
|
|
174
|
+
const [query] = (0, _usequeryparams.useQueryParams)(refreshIntervalQueryConfig, {
|
|
175
|
+
updateType: 'replaceIn'
|
|
176
176
|
});
|
|
177
177
|
const { refresh } = query;
|
|
178
178
|
return (0, _react.useMemo)(()=>{
|
|
@@ -191,8 +191,8 @@ function useInitialRefreshInterval(dashboardDuration) {
|
|
|
191
191
|
]);
|
|
192
192
|
}
|
|
193
193
|
function useSetRefreshIntervalParams(initialRefreshInterval) {
|
|
194
|
-
const [query, setQuery] = (0,
|
|
195
|
-
|
|
194
|
+
const [query, setQuery] = (0, _usequeryparams.useQueryParams)(refreshIntervalQueryConfig, {
|
|
195
|
+
updateType: 'replaceIn'
|
|
196
196
|
});
|
|
197
197
|
// determine whether initial param had previously been populated to fix back btn
|
|
198
198
|
const [paramsLoaded, setParamsLoaded] = (0, _react.useState)(false);
|
|
@@ -70,7 +70,7 @@ const useUsageMetrics = ()=>{
|
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
72
|
const submitMetrics = async (stats)=>{
|
|
73
|
-
await (0, _core.fetch)('/api/v1/view
|
|
73
|
+
await (0, _core.fetch)(`${stats.apiPrefix ?? ''}/api/v1/view`, {
|
|
74
74
|
method: 'POST',
|
|
75
75
|
headers: {
|
|
76
76
|
'Content-Type': 'application/json'
|
|
@@ -83,14 +83,15 @@ const submitMetrics = async (stats)=>{
|
|
|
83
83
|
})
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
-
const UsageMetricsProvider = ({ project, dashboard, children })=>{
|
|
86
|
+
const UsageMetricsProvider = ({ apiPrefix, project, dashboard, children })=>{
|
|
87
87
|
const ctx = {
|
|
88
88
|
project: project,
|
|
89
89
|
dashboard: dashboard,
|
|
90
90
|
renderErrorCount: 0,
|
|
91
91
|
startRenderTime: Date.now(),
|
|
92
92
|
renderDurationMs: 0,
|
|
93
|
-
pendingQueries: new Map()
|
|
93
|
+
pendingQueries: new Map(),
|
|
94
|
+
apiPrefix
|
|
94
95
|
};
|
|
95
96
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(UsageMetricsContext.Provider, {
|
|
96
97
|
value: ctx,
|
|
@@ -82,7 +82,7 @@ const useTimeSeriesQuery = (definition, options, queryOptions)=>{
|
|
|
82
82
|
return (0, _reactquery.useQuery)({
|
|
83
83
|
enabled: (queryOptions?.enabled ?? true) || queryEnabled,
|
|
84
84
|
queryKey: queryKey,
|
|
85
|
-
queryFn: ()=>{
|
|
85
|
+
queryFn: ({ signal })=>{
|
|
86
86
|
// The 'enabled' option should prevent this from happening, but make TypeScript happy by checking
|
|
87
87
|
if (plugin === undefined) {
|
|
88
88
|
throw new Error('Expected plugin to be loaded');
|
|
@@ -92,7 +92,7 @@ const useTimeSeriesQuery = (definition, options, queryOptions)=>{
|
|
|
92
92
|
...context,
|
|
93
93
|
suggestedStepMs: options?.suggestedStepMs
|
|
94
94
|
};
|
|
95
|
-
return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);
|
|
95
|
+
return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx, signal);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
};
|
|
@@ -118,14 +118,14 @@ function useTimeSeriesQueries(definitions, options, queryOptions) {
|
|
|
118
118
|
...queryOptions,
|
|
119
119
|
enabled: (queryOptions?.enabled ?? true) && queryEnabled,
|
|
120
120
|
queryKey: queryKey,
|
|
121
|
-
queryFn: async ()=>{
|
|
121
|
+
queryFn: async ({ signal })=>{
|
|
122
122
|
const ctx = {
|
|
123
123
|
...context,
|
|
124
124
|
// Keep suggested step changes out of the query key, so we don´t have to run again query when it changes
|
|
125
125
|
suggestedStepMs: options?.suggestedStepMs
|
|
126
126
|
};
|
|
127
127
|
const plugin = await getPlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);
|
|
128
|
-
const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);
|
|
128
|
+
const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx, signal);
|
|
129
129
|
return data;
|
|
130
130
|
}
|
|
131
131
|
};
|
|
@@ -21,17 +21,41 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
+
MOCK_EMPTY_PLUGIN_MODULE: function() {
|
|
25
|
+
return MOCK_EMPTY_PLUGIN_MODULE;
|
|
26
|
+
},
|
|
27
|
+
MOCK_INVALID_PLUGIN_MODULE: function() {
|
|
28
|
+
return MOCK_INVALID_PLUGIN_MODULE;
|
|
29
|
+
},
|
|
24
30
|
MOCK_LOG_DATA: function() {
|
|
25
31
|
return MOCK_LOG_DATA;
|
|
26
32
|
},
|
|
33
|
+
MOCK_MIXED_VALIDITY_PLUGIN_MODULES: function() {
|
|
34
|
+
return MOCK_MIXED_VALIDITY_PLUGIN_MODULES;
|
|
35
|
+
},
|
|
36
|
+
MOCK_MULTI_PLUGIN_MODULE: function() {
|
|
37
|
+
return MOCK_MULTI_PLUGIN_MODULE;
|
|
38
|
+
},
|
|
39
|
+
MOCK_PARTIAL_FAILURE_MODULE: function() {
|
|
40
|
+
return MOCK_PARTIAL_FAILURE_MODULE;
|
|
41
|
+
},
|
|
27
42
|
MOCK_PROFILE_DATA: function() {
|
|
28
43
|
return MOCK_PROFILE_DATA;
|
|
29
44
|
},
|
|
45
|
+
MOCK_REMOTE_PLUGIN_MODULE: function() {
|
|
46
|
+
return MOCK_REMOTE_PLUGIN_MODULE;
|
|
47
|
+
},
|
|
30
48
|
MOCK_TIME_SERIES_DATA: function() {
|
|
31
49
|
return MOCK_TIME_SERIES_DATA;
|
|
32
50
|
},
|
|
33
51
|
MOCK_TRACE_DATA: function() {
|
|
34
52
|
return MOCK_TRACE_DATA;
|
|
53
|
+
},
|
|
54
|
+
MOCK_VALID_PLUGIN_METADATA: function() {
|
|
55
|
+
return MOCK_VALID_PLUGIN_METADATA;
|
|
56
|
+
},
|
|
57
|
+
MOCK_VALID_PLUGIN_MODULE_RESOURCE: function() {
|
|
58
|
+
return MOCK_VALID_PLUGIN_MODULE_RESOURCE;
|
|
35
59
|
}
|
|
36
60
|
});
|
|
37
61
|
const MOCK_TIME_SERIES_DATA = {
|
|
@@ -146,3 +170,137 @@ const MOCK_PROFILE_DATA = {
|
|
|
146
170
|
name: 'cpu'
|
|
147
171
|
}
|
|
148
172
|
};
|
|
173
|
+
const MOCK_VALID_PLUGIN_METADATA = {
|
|
174
|
+
kind: 'Panel',
|
|
175
|
+
spec: {
|
|
176
|
+
name: 'testPlugin',
|
|
177
|
+
display: {
|
|
178
|
+
name: 'Test Plugin',
|
|
179
|
+
description: 'A test plugin for unit testing'
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const MOCK_VALID_PLUGIN_MODULE_RESOURCE = {
|
|
184
|
+
kind: 'PluginModule',
|
|
185
|
+
metadata: {
|
|
186
|
+
name: 'test-module',
|
|
187
|
+
version: '1.0.0'
|
|
188
|
+
},
|
|
189
|
+
spec: {
|
|
190
|
+
plugins: [
|
|
191
|
+
MOCK_VALID_PLUGIN_METADATA
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const MOCK_INVALID_PLUGIN_MODULE = {
|
|
196
|
+
// Missing required fields
|
|
197
|
+
metadata: {
|
|
198
|
+
name: 'invalid-module'
|
|
199
|
+
},
|
|
200
|
+
spec: {
|
|
201
|
+
plugins: [
|
|
202
|
+
{
|
|
203
|
+
// Missing required fields
|
|
204
|
+
kind: 'Panel'
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const MOCK_MIXED_VALIDITY_PLUGIN_MODULES = [
|
|
210
|
+
MOCK_VALID_PLUGIN_MODULE_RESOURCE,
|
|
211
|
+
MOCK_INVALID_PLUGIN_MODULE,
|
|
212
|
+
{
|
|
213
|
+
kind: 'PluginModule',
|
|
214
|
+
metadata: {
|
|
215
|
+
name: 'another-valid-module',
|
|
216
|
+
version: '2.0.0'
|
|
217
|
+
},
|
|
218
|
+
spec: {
|
|
219
|
+
plugins: [
|
|
220
|
+
{
|
|
221
|
+
kind: 'Variable',
|
|
222
|
+
spec: {
|
|
223
|
+
name: 'anotherPlugin',
|
|
224
|
+
display: {
|
|
225
|
+
name: 'Another Plugin'
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
];
|
|
233
|
+
const MOCK_REMOTE_PLUGIN_MODULE = {
|
|
234
|
+
testPlugin: {
|
|
235
|
+
component: ()=>null,
|
|
236
|
+
createDefaultOptions: ()=>({})
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const MOCK_MULTI_PLUGIN_MODULE = {
|
|
240
|
+
kind: 'PluginModule',
|
|
241
|
+
metadata: {
|
|
242
|
+
name: 'multi-plugin-module',
|
|
243
|
+
version: '1.0.0'
|
|
244
|
+
},
|
|
245
|
+
spec: {
|
|
246
|
+
plugins: [
|
|
247
|
+
{
|
|
248
|
+
kind: 'Panel',
|
|
249
|
+
spec: {
|
|
250
|
+
name: 'plugin1',
|
|
251
|
+
display: {
|
|
252
|
+
name: 'Plugin 1'
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
kind: 'Variable',
|
|
258
|
+
spec: {
|
|
259
|
+
name: 'plugin2',
|
|
260
|
+
display: {
|
|
261
|
+
name: 'Plugin 2'
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const MOCK_PARTIAL_FAILURE_MODULE = {
|
|
269
|
+
kind: 'PluginModule',
|
|
270
|
+
metadata: {
|
|
271
|
+
name: 'partial-failure-module',
|
|
272
|
+
version: '1.0.0'
|
|
273
|
+
},
|
|
274
|
+
spec: {
|
|
275
|
+
plugins: [
|
|
276
|
+
{
|
|
277
|
+
kind: 'Panel',
|
|
278
|
+
spec: {
|
|
279
|
+
name: 'workingPlugin',
|
|
280
|
+
display: {
|
|
281
|
+
name: 'Working Plugin'
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
kind: 'Variable',
|
|
287
|
+
spec: {
|
|
288
|
+
name: 'failingPlugin',
|
|
289
|
+
display: {
|
|
290
|
+
name: 'Failing Plugin'
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
const MOCK_EMPTY_PLUGIN_MODULE = {
|
|
298
|
+
kind: 'PluginModule',
|
|
299
|
+
metadata: {
|
|
300
|
+
name: 'empty-module',
|
|
301
|
+
version: '1.0.0'
|
|
302
|
+
},
|
|
303
|
+
spec: {
|
|
304
|
+
plugins: []
|
|
305
|
+
}
|
|
306
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OutlinedSelectProps, BaseSelectProps } from '@mui/material';
|
|
2
2
|
import { DatasourceSelector, VariableName } from '@perses-dev/core';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
|
-
import { DatasourceSelectItemGroup, DatasourceSelectItemSelector, VariableStateMap } from '
|
|
4
|
+
import { DatasourceSelectItemGroup, DatasourceSelectItemSelector, VariableStateMap } from '../../runtime';
|
|
5
5
|
type OmittedMuiProps = 'children' | 'value' | 'onChange';
|
|
6
6
|
export type DatasourceSelectValue<T = DatasourceSelector> = T | VariableName;
|
|
7
7
|
export interface DatasourceSelectProps extends Omit<OutlinedSelectProps & BaseSelectProps<string>, OmittedMuiProps> {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatasourceSelect.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceSelect/DatasourceSelect.tsx"],"names":[],"mappings":"AAcA,OAAO,EAML,mBAAmB,EACnB,eAAe,EAGhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAEL,yBAAyB,EACzB,4BAA4B,EAG5B,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAOvB,KAAK,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAWzD,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,kBAAkB,IAAI,CAAC,GAAG,YAAY,CAAC;AAE7E,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,mBAAmB,GAAG,eAAe,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IACjH,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAChD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAkH3E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,YAAY,CAahH;AAKD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,4BAA4B,GAAG,YAAY,GAAG,MAAM,CAKnG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,qBAAqB,CAehF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,GAAG,KAAK,IAAI,YAAY,CAEpG;AAED,eAAO,MAAM,+BAA+B,UACnC,qBAAqB,GAAG,SAAS,aAC7B,gBAAgB,8BACC,yBAAyB,EAAE,GAAG,SAAS,KAClE,kBAAkB,GAAG,SA4BvB,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACtC,qBAAqB,wBACN,MAAM,KAC3B,kBAQF,CAAC"}
|
|
@@ -15,8 +15,8 @@ import { createElement as _createElement } from "react";
|
|
|
15
15
|
import OpenInNewIcon from 'mdi-material-ui/OpenInNew';
|
|
16
16
|
import { Stack, ListItemText, Chip, IconButton, Box, Autocomplete, TextField } from '@mui/material';
|
|
17
17
|
import { useMemo } from 'react';
|
|
18
|
-
import { useListDatasourceSelectItems, useVariableValues } from '
|
|
19
|
-
import { parseVariables } from '
|
|
18
|
+
import { useListDatasourceSelectItems, useVariableValues } from '../../runtime';
|
|
19
|
+
import { parseVariables } from '../../utils';
|
|
20
20
|
const DATASOURCE_VARIABLE_VALUE_PREFIX = '__DATASOURCE_VARIABLE_VALUE__';
|
|
21
21
|
const VARIABLE_IDENTIFIER = '$';
|
|
22
22
|
const emptyDatasourceOption = {
|
|
@@ -27,7 +27,7 @@ const emptyDatasourceOption = {
|
|
|
27
27
|
* Displays a MUI input for selecting a Datasource of a particular kind. Note: The 'value' and `onChange` handler for
|
|
28
28
|
* the input deal with a `DatasourceSelector`.
|
|
29
29
|
*/ export function DatasourceSelect(props) {
|
|
30
|
-
const { datasourcePluginKind, value, project, onChange, ...others } = props;
|
|
30
|
+
const { datasourcePluginKind, value, project, readOnly, onChange, ...others } = props;
|
|
31
31
|
const { data, isLoading } = useListDatasourceSelectItems(datasourcePluginKind, project);
|
|
32
32
|
const variables = useVariableValues();
|
|
33
33
|
const defaultValue = useMemo(()=>{
|
|
@@ -98,6 +98,7 @@ const emptyDatasourceOption = {
|
|
|
98
98
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
99
99
|
const fakeActionEvent = ()=>{};
|
|
100
100
|
return /*#__PURE__*/ _jsx(Autocomplete, {
|
|
101
|
+
readOnly: readOnly,
|
|
101
102
|
options: options,
|
|
102
103
|
renderInput: (params)=>/*#__PURE__*/ _jsx(TextField, {
|
|
103
104
|
...params,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatasourceSelect/DatasourceSelect.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport OpenInNewIcon from 'mdi-material-ui/OpenInNew';\nimport {\n Stack,\n ListItemText,\n Chip,\n IconButton,\n Box,\n OutlinedSelectProps,\n BaseSelectProps,\n Autocomplete,\n TextField,\n} from '@mui/material';\nimport { DatasourceSelector, VariableName } from '@perses-dev/core';\nimport { ReactElement, useMemo } from 'react';\nimport {\n DatasourceSelectItem,\n DatasourceSelectItemGroup,\n DatasourceSelectItemSelector,\n useListDatasourceSelectItems,\n useVariableValues,\n VariableStateMap,\n} from '../../runtime';\nimport { parseVariables } from '../../utils';\n\nconst DATASOURCE_VARIABLE_VALUE_PREFIX = '__DATASOURCE_VARIABLE_VALUE__';\nconst VARIABLE_IDENTIFIER = '$';\n// Props on MUI Select that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\n\ntype DataSourceOption = {\n groupEditLink?: string;\n groupLabel?: string;\n value: string;\n} & Omit<DatasourceSelectItem, 'selector'> &\n Omit<DatasourceSelectItem['selector'], 'kind'>;\n\nconst emptyDatasourceOption: DataSourceOption = { name: '', value: '' };\n\nexport type DatasourceSelectValue<T = DatasourceSelector> = T | VariableName;\n\nexport interface DatasourceSelectProps extends Omit<OutlinedSelectProps & BaseSelectProps<string>, OmittedMuiProps> {\n value: DatasourceSelectValue;\n onChange: (next: DatasourceSelectValue) => void;\n datasourcePluginKind: string;\n project?: string;\n}\n\n/**\n * Displays a MUI input for selecting a Datasource of a particular kind. Note: The 'value' and `onChange` handler for\n * the input deal with a `DatasourceSelector`.\n */\nexport function DatasourceSelect(props: DatasourceSelectProps): ReactElement {\n const { datasourcePluginKind, value, project, readOnly, onChange, ...others } = props;\n const { data, isLoading } = useListDatasourceSelectItems(datasourcePluginKind, project);\n const variables = useVariableValues();\n\n const defaultValue = useMemo<VariableName | DatasourceSelectItemSelector>(() => {\n if (isVariableDatasource(value)) {\n return value;\n }\n\n const group = (data ?? [])\n .flatMap((itemGroup) => itemGroup.items)\n .find((item) => {\n return value.kind === item.selector.kind && value.name === item.selector.name && !item.overridden;\n })?.selector.group;\n return { ...value, group };\n }, [value, data]);\n\n const options = useMemo<DataSourceOption[]>(() => {\n const datasourceOptions = (data || []).flatMap<DataSourceOption>((itemGroup) =>\n itemGroup.items.map<DataSourceOption>((item) => ({\n groupLabel: itemGroup.group,\n groupEditLink: itemGroup.editLink,\n name: item.name,\n overriding: item.overriding,\n overridden: item.overridden,\n saved: item.saved ?? true,\n group: item.selector.group,\n value: selectorToOptionValue(item.selector),\n }))\n );\n\n const datasourceOptionsMap = new Map(datasourceOptions.map((option) => [option.name, option]));\n\n const variableOptions = Object.entries(variables).flatMap<DataSourceOption>(([name, variable]) => {\n if (Array.isArray(variable.value)) return [];\n\n const associatedDatasource = datasourceOptionsMap.get(variable.value ?? '');\n if (!associatedDatasource) return [];\n\n return {\n groupLabel: 'Variables',\n name: `${VARIABLE_IDENTIFIER}${name}`,\n saved: true,\n value: `${DATASOURCE_VARIABLE_VALUE_PREFIX}${VARIABLE_IDENTIFIER}${name}`,\n };\n });\n\n return [...datasourceOptions, ...variableOptions];\n }, [data, variables]);\n\n // While loading available values, just use an empty datasource option so MUI select doesn't warn about values out of range\n const optionValue = isLoading\n ? emptyDatasourceOption\n : options.find((option) => option.value === selectorToOptionValue(defaultValue));\n\n // When the user makes a selection, convert the string option value back to a DatasourceSelector\n const handleChange = (selectedOption: DataSourceOption | null): void => {\n if (selectedOption) {\n const next = optionValueToSelector(selectedOption?.value || '');\n onChange(next);\n } else {\n onChange({ kind: datasourcePluginKind });\n }\n };\n\n // We use a fake action event when we click on the action of the chip (hijack the \"delete\" feature).\n // This is because the href link action is on the `deleteIcon` property already, but the `onDelete` property\n // controls its visibility.\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const fakeActionEvent = (): void => {};\n\n return (\n <Autocomplete<DataSourceOption>\n readOnly={readOnly}\n options={options}\n renderInput={(params) => <TextField {...params} label={others.label} placeholder=\"\" />}\n groupBy={(option) => option.groupLabel || 'No group'}\n getOptionLabel={(option) => {\n return option.name;\n }}\n onChange={(_, v) => handleChange(v)}\n value={optionValue}\n renderOption={(props, option) => {\n return (\n <li {...props} key={option.value}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" width=\"100%\">\n <ListItemText>\n <DatasourceName name={option.name} overridden={option.overridden} overriding={option.overriding} />\n </ListItemText>\n {!option.saved && <ListItemText>Save the dashboard to enable this datasource</ListItemText>}\n <ListItemText style={{ textAlign: 'right' }}>\n {option.groupLabel && option.groupLabel.length > 0 && (\n <Chip\n disabled={false}\n label={option.groupLabel}\n size=\"small\"\n onDelete={option.groupEditLink ? fakeActionEvent : undefined}\n deleteIcon={\n option.groupEditLink ? (\n <IconButton href={option.groupEditLink} target=\"_blank\">\n <OpenInNewIcon fontSize=\"small\" />\n </IconButton>\n ) : undefined\n }\n />\n )}\n </ListItemText>\n </Stack>\n </li>\n );\n }}\n />\n );\n}\n\nexport function DatasourceName(props: { name: string; overridden?: boolean; overriding?: boolean }): ReactElement {\n const { name, overridden, overriding } = props;\n return (\n <>\n {`${name} `}\n {!overridden && overriding && (\n <Box display=\"inline\" fontWeight=\"normal\" color={(theme) => theme.palette.primary.main}>\n (overriding)\n </Box>\n )}\n {overridden && '(overridden)'}\n </>\n );\n}\n\n// Delimiter used to stringify/parse option values\nconst OPTION_VALUE_DELIMITER = '_____';\n\n/**\n * Given a DatasourceSelectItemSelector,\n * returns a string value like `{kind}_____{group}_____{name}` that can be used as a Select input value.\n * @param selector\n */\nexport function selectorToOptionValue(selector: DatasourceSelectItemSelector | VariableName): string {\n if (isVariableDatasource(selector)) {\n return `${DATASOURCE_VARIABLE_VALUE_PREFIX}${selector}`;\n }\n return [selector.kind, selector.group ?? '', selector.name ?? ''].join(OPTION_VALUE_DELIMITER);\n}\n\n/**\n * Given an option value name like `{kind}_____{group}_____{name}`,\n * returns a DatasourceSelector to be used by the query data model.\n * @param optionValue\n */\nexport function optionValueToSelector(optionValue: string): DatasourceSelectValue {\n if (optionValue.startsWith(DATASOURCE_VARIABLE_VALUE_PREFIX)) {\n return optionValue.split(DATASOURCE_VARIABLE_VALUE_PREFIX)[1]!;\n }\n\n const words = optionValue.split(OPTION_VALUE_DELIMITER);\n const kind = words[0];\n const name = words[2];\n if (kind === undefined || name === undefined) {\n throw new Error('Invalid optionValue string');\n }\n return {\n kind,\n name: name === '' ? undefined : name,\n };\n}\n\nexport function isVariableDatasource(value: DatasourceSelectValue | undefined): value is VariableName {\n return typeof value === 'string' && value.startsWith(VARIABLE_IDENTIFIER);\n}\n\nexport const datasourceSelectValueToSelector = (\n value: DatasourceSelectValue | undefined,\n variables: VariableStateMap,\n datasourceSelectItemGroups: DatasourceSelectItemGroup[] | undefined\n): DatasourceSelector | undefined => {\n if (!isVariableDatasource(value)) {\n return value;\n }\n\n const [variableName] = parseVariables(value);\n const variable = variables[variableName ?? ''];\n\n // If the variable is not defined or if its value is an array, we cannot determine a selector and return undefined\n if (!variable || Array.isArray(variable.value)) {\n return undefined;\n }\n\n const associatedDatasource = (datasourceSelectItemGroups || [])\n .flatMap((itemGroup) => itemGroup.items)\n .find((datasource) => datasource.name === variable.value);\n\n // If the variable value is not a datasource, we cannot determine a selector and return undefined\n if (associatedDatasource === undefined) {\n return undefined;\n }\n\n const datasourceSelector: DatasourceSelector = {\n kind: associatedDatasource.selector.kind,\n name: associatedDatasource.selector.name,\n };\n\n return datasourceSelector;\n};\n\nexport const useDatasourceSelectValueToSelector = (\n value: DatasourceSelectValue,\n datasourcePluginKind: string\n): DatasourceSelector => {\n const { data } = useListDatasourceSelectItems(datasourcePluginKind);\n const variables = useVariableValues();\n if (!isVariableDatasource(value)) {\n return value;\n }\n\n return datasourceSelectValueToSelector(value, variables, data) ?? { kind: datasourcePluginKind };\n};\n"],"names":["OpenInNewIcon","Stack","ListItemText","Chip","IconButton","Box","Autocomplete","TextField","useMemo","useListDatasourceSelectItems","useVariableValues","parseVariables","DATASOURCE_VARIABLE_VALUE_PREFIX","VARIABLE_IDENTIFIER","emptyDatasourceOption","name","value","DatasourceSelect","props","datasourcePluginKind","project","readOnly","onChange","others","data","isLoading","variables","defaultValue","isVariableDatasource","group","flatMap","itemGroup","items","find","item","kind","selector","overridden","options","datasourceOptions","map","groupLabel","groupEditLink","editLink","overriding","saved","selectorToOptionValue","datasourceOptionsMap","Map","option","variableOptions","Object","entries","variable","Array","isArray","associatedDatasource","get","optionValue","handleChange","selectedOption","next","optionValueToSelector","fakeActionEvent","renderInput","params","label","placeholder","groupBy","getOptionLabel","_","v","renderOption","li","key","direction","alignItems","justifyContent","width","DatasourceName","style","textAlign","length","disabled","size","onDelete","undefined","deleteIcon","href","target","fontSize","display","fontWeight","color","theme","palette","primary","main","OPTION_VALUE_DELIMITER","join","startsWith","split","words","Error","datasourceSelectValueToSelector","datasourceSelectItemGroups","variableName","datasource","datasourceSelector","useDatasourceSelectValueToSelector"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,OAAOA,mBAAmB,4BAA4B;AACtD,SACEC,KAAK,EACLC,YAAY,EACZC,IAAI,EACJC,UAAU,EACVC,GAAG,EAGHC,YAAY,EACZC,SAAS,QACJ,gBAAgB;AAEvB,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SAIEC,4BAA4B,EAC5BC,iBAAiB,QAEZ,gBAAgB;AACvB,SAASC,cAAc,QAAQ,cAAc;AAE7C,MAAMC,mCAAmC;AACzC,MAAMC,sBAAsB;AAY5B,MAAMC,wBAA0C;IAAEC,MAAM;IAAIC,OAAO;AAAG;AAWtE;;;CAGC,GACD,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,oBAAoB,EAAEH,KAAK,EAAEI,OAAO,EAAEC,QAAQ,EAAEC,QAAQ,EAAE,GAAGC,QAAQ,GAAGL;IAChF,MAAM,EAAEM,IAAI,EAAEC,SAAS,EAAE,GAAGhB,6BAA6BU,sBAAsBC;IAC/E,MAAMM,YAAYhB;I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OAAOwF,gCAAgCxF,OAAOU,WAAWF,SAAS;QAAEW,MAAMhB;IAAqB;AACjG,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceSelect/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './DatasourceSelect';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatasourceSelect/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DatasourceSelect';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendOptionsEditor.d.ts","sourceRoot":"","sources":["../../../src/components/LegendOptionsEditor/LegendOptionsEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAGL,iBAAiB,EAQlB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"LegendOptionsEditor.d.ts","sourceRoot":"","sources":["../../../src/components/LegendOptionsEditor/LegendOptionsEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAGL,iBAAiB,EAQlB,MAAM,aAAa,CAAC;AAsBrB,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;CAC5C;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,QAAQ,EACR,gBAAuB,EACvB,WAA2B,GAC5B,EAAE,wBAAwB,GAAG,YAAY,CAgLzC"}
|