@perses-dev/plugin-system 0.0.0-snapshot-time-range-height-80d08fc
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/LICENSE +201 -0
- package/dist/cjs/components/CalculationSelector/CalculationSelector.js +52 -0
- package/dist/cjs/components/CalculationSelector/CalculationSelector.test.js +65 -0
- package/dist/cjs/components/CalculationSelector/index.js +28 -0
- package/dist/cjs/components/DatasourceSelect.js +76 -0
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +102 -0
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.test.js +167 -0
- package/dist/cjs/components/OptionsEditorTabs/TabPanel.js +37 -0
- package/dist/cjs/components/OptionsEditorTabs/index.js +28 -0
- package/dist/cjs/components/PluginEditor/PluginEditor.js +67 -0
- package/dist/cjs/components/PluginEditor/PluginEditor.test.js +150 -0
- package/dist/cjs/components/PluginEditor/index.js +29 -0
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +101 -0
- package/dist/cjs/components/PluginKindSelect.js +41 -0
- package/dist/cjs/components/PluginKindSelect.test.js +86 -0
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +85 -0
- package/dist/cjs/components/PluginRegistry/PluginRegistry.test.js +144 -0
- package/dist/cjs/components/PluginRegistry/index.js +28 -0
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +78 -0
- package/dist/cjs/components/PluginSpecEditor.js +43 -0
- package/dist/cjs/components/PluginSpecEditor.test.js +70 -0
- package/dist/cjs/components/TimeSeriesQueryEditor.js +42 -0
- package/dist/cjs/components/index.js +35 -0
- package/dist/cjs/index.js +31 -0
- package/dist/cjs/model/calculations.js +77 -0
- package/dist/cjs/model/datasource.js +16 -0
- package/dist/cjs/model/index.js +35 -0
- package/dist/cjs/model/panels.js +16 -0
- package/dist/cjs/model/plugin-base.js +22 -0
- package/dist/cjs/model/plugin-loading.js +38 -0
- package/dist/cjs/model/plugins.js +16 -0
- package/dist/cjs/model/time-series-queries.js +16 -0
- package/dist/cjs/model/variables.js +16 -0
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +118 -0
- package/dist/cjs/runtime/TimeRangeProvider/index.js +29 -0
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +161 -0
- package/dist/cjs/runtime/datasources.js +44 -0
- package/dist/cjs/runtime/index.js +32 -0
- package/dist/cjs/runtime/plugin-registry.js +75 -0
- package/dist/cjs/runtime/template-variables.js +57 -0
- package/dist/cjs/runtime/time-series-queries.js +140 -0
- package/dist/cjs/test/index.js +28 -0
- package/dist/cjs/test/render.js +52 -0
- package/dist/cjs/test/setup-tests.js +20 -0
- package/dist/cjs/test/test-plugins/bert/index.js +77 -0
- package/dist/cjs/test/test-plugins/ernie/index.js +58 -0
- package/dist/cjs/test/test-plugins/index.js +77 -0
- package/dist/cjs/test-utils/index.js +28 -0
- package/dist/cjs/test-utils/mock-plugin-registry.js +68 -0
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +8 -0
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -0
- package/dist/components/CalculationSelector/CalculationSelector.js +46 -0
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -0
- package/dist/components/CalculationSelector/CalculationSelector.test.d.ts +2 -0
- package/dist/components/CalculationSelector/CalculationSelector.test.d.ts.map +1 -0
- package/dist/components/CalculationSelector/CalculationSelector.test.js +58 -0
- package/dist/components/CalculationSelector/CalculationSelector.test.js.map +1 -0
- package/dist/components/CalculationSelector/index.d.ts +2 -0
- package/dist/components/CalculationSelector/index.d.ts.map +1 -0
- package/dist/components/CalculationSelector/index.js +15 -0
- package/dist/components/CalculationSelector/index.js.map +1 -0
- package/dist/components/DatasourceSelect.d.ts +16 -0
- package/dist/components/DatasourceSelect.d.ts.map +1 -0
- package/dist/components/DatasourceSelect.js +73 -0
- package/dist/components/DatasourceSelect.js.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +34 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +96 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts +2 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js +160 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js.map +1 -0
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts +9 -0
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabs/TabPanel.js +31 -0
- package/dist/components/OptionsEditorTabs/TabPanel.js.map +1 -0
- package/dist/components/OptionsEditorTabs/index.d.ts +2 -0
- package/dist/components/OptionsEditorTabs/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabs/index.js +15 -0
- package/dist/components/OptionsEditorTabs/index.js.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.d.ts +12 -0
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.js +68 -0
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.test.d.ts +2 -0
- package/dist/components/PluginEditor/PluginEditor.test.d.ts.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.test.js +143 -0
- package/dist/components/PluginEditor/PluginEditor.test.js.map +1 -0
- package/dist/components/PluginEditor/index.d.ts +3 -0
- package/dist/components/PluginEditor/index.d.ts.map +1 -0
- package/dist/components/PluginEditor/index.js +16 -0
- package/dist/components/PluginEditor/index.js.map +1 -0
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +30 -0
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -0
- package/dist/components/PluginEditor/plugin-editor-api.js +100 -0
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -0
- package/dist/components/PluginKindSelect.d.ts +12 -0
- package/dist/components/PluginKindSelect.d.ts.map +1 -0
- package/dist/components/PluginKindSelect.js +38 -0
- package/dist/components/PluginKindSelect.js.map +1 -0
- package/dist/components/PluginKindSelect.test.d.ts +2 -0
- package/dist/components/PluginKindSelect.test.d.ts.map +1 -0
- package/dist/components/PluginKindSelect.test.js +79 -0
- package/dist/components/PluginKindSelect.test.js.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.d.ts +13 -0
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.js +82 -0
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.d.ts +2 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.d.ts.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.js +137 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.js.map +1 -0
- package/dist/components/PluginRegistry/index.d.ts +2 -0
- package/dist/components/PluginRegistry/index.d.ts.map +1 -0
- package/dist/components/PluginRegistry/index.js +15 -0
- package/dist/components/PluginRegistry/index.js.map +1 -0
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +14 -0
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -0
- package/dist/components/PluginRegistry/plugin-indexes.js +70 -0
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -0
- package/dist/components/PluginSpecEditor.d.ts +9 -0
- package/dist/components/PluginSpecEditor.d.ts.map +1 -0
- package/dist/components/PluginSpecEditor.js +37 -0
- package/dist/components/PluginSpecEditor.js.map +1 -0
- package/dist/components/PluginSpecEditor.test.d.ts +2 -0
- package/dist/components/PluginSpecEditor.test.d.ts.map +1 -0
- package/dist/components/PluginSpecEditor.test.js +63 -0
- package/dist/components/PluginSpecEditor.test.js.map +1 -0
- package/dist/components/TimeSeriesQueryEditor.d.ts +14 -0
- package/dist/components/TimeSeriesQueryEditor.d.ts.map +1 -0
- package/dist/components/TimeSeriesQueryEditor.js +38 -0
- package/dist/components/TimeSeriesQueryEditor.js.map +1 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +22 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/model/calculations.d.ts +21 -0
- package/dist/model/calculations.d.ts.map +1 -0
- package/dist/model/calculations.js +64 -0
- package/dist/model/calculations.js.map +1 -0
- package/dist/model/datasource.d.ts +12 -0
- package/dist/model/datasource.d.ts.map +1 -0
- package/dist/model/datasource.js +15 -0
- package/dist/model/datasource.js.map +1 -0
- package/dist/model/index.d.ts +9 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +22 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/panels.d.ts +20 -0
- package/dist/model/panels.d.ts.map +1 -0
- package/dist/model/panels.js +15 -0
- package/dist/model/panels.js.map +1 -0
- package/dist/model/plugin-base.d.ts +22 -0
- package/dist/model/plugin-base.d.ts.map +1 -0
- package/dist/model/plugin-base.js +15 -0
- package/dist/model/plugin-base.js.map +1 -0
- package/dist/model/plugin-loading.d.ts +22 -0
- package/dist/model/plugin-loading.d.ts.map +1 -0
- package/dist/model/plugin-loading.js +35 -0
- package/dist/model/plugin-loading.js.map +1 -0
- package/dist/model/plugins.d.ts +54 -0
- package/dist/model/plugins.d.ts.map +1 -0
- package/dist/model/plugins.js +15 -0
- package/dist/model/plugins.js.map +1 -0
- package/dist/model/time-series-queries.d.ts +42 -0
- package/dist/model/time-series-queries.d.ts.map +1 -0
- package/dist/model/time-series-queries.js +15 -0
- package/dist/model/time-series-queries.js.map +1 -0
- package/dist/model/variables.d.ts +35 -0
- package/dist/model/variables.d.ts.map +1 -0
- package/dist/model/variables.js +15 -0
- package/dist/model/variables.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +25 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +69 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts +3 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.js +16 -0
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +25 -0
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/query-params.js +153 -0
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -0
- package/dist/runtime/datasources.d.ts +25 -0
- package/dist/runtime/datasources.d.ts.map +1 -0
- package/dist/runtime/datasources.js +34 -0
- package/dist/runtime/datasources.js.map +1 -0
- package/dist/runtime/index.d.ts +6 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +19 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/plugin-registry.d.ts +32 -0
- package/dist/runtime/plugin-registry.d.ts.map +1 -0
- package/dist/runtime/plugin-registry.js +69 -0
- package/dist/runtime/plugin-registry.js.map +1 -0
- package/dist/runtime/template-variables.d.ts +17 -0
- package/dist/runtime/template-variables.d.ts.map +1 -0
- package/dist/runtime/template-variables.js +44 -0
- package/dist/runtime/template-variables.js.map +1 -0
- package/dist/runtime/time-series-queries.d.ts +13 -0
- package/dist/runtime/time-series-queries.d.ts.map +1 -0
- package/dist/runtime/time-series-queries.js +132 -0
- package/dist/runtime/time-series-queries.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/render.d.ts +13 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +49 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.d.ts +2 -0
- package/dist/test/setup-tests.d.ts.map +1 -0
- package/dist/test/setup-tests.js +18 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/test/test-plugins/bert/index.d.ts +8 -0
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -0
- package/dist/test/test-plugins/bert/index.js +66 -0
- package/dist/test/test-plugins/bert/index.js.map +1 -0
- package/dist/test/test-plugins/ernie/index.d.ts +5 -0
- package/dist/test/test-plugins/ernie/index.d.ts.map +1 -0
- package/dist/test/test-plugins/ernie/index.js +53 -0
- package/dist/test/test-plugins/ernie/index.js.map +1 -0
- package/dist/test/test-plugins/index.d.ts +6 -0
- package/dist/test/test-plugins/index.d.ts.map +1 -0
- package/dist/test/test-plugins/index.js +29 -0
- package/dist/test/test-plugins/index.js.map +1 -0
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +15 -0
- package/dist/test-utils/index.js.map +1 -0
- package/dist/test-utils/mock-plugin-registry.d.ts +20 -0
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -0
- package/dist/test-utils/mock-plugin-registry.js +62 -0
- package/dist/test-utils/mock-plugin-registry.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
import { useEvent } from '@perses-dev/core';
|
|
14
|
+
import { useCallback, useRef } from 'react';
|
|
15
|
+
/**
|
|
16
|
+
* Returns an async callback for getting indexes of the installed plugin data.
|
|
17
|
+
*/ export function usePluginIndexes(getInstalledPlugins) {
|
|
18
|
+
// Creates indexes from the installed plugins data (does useEvent because this accesses the getInstalledPlugins prop
|
|
19
|
+
// and we want a stable reference for the callback below)
|
|
20
|
+
const createPluginIndexes = useEvent(async ()=>{
|
|
21
|
+
const installedPlugins = await getInstalledPlugins();
|
|
22
|
+
// Create the two indexes from the installed plugins
|
|
23
|
+
const pluginResourcesByTypeAndKind = new Map();
|
|
24
|
+
const pluginMetadataByType = new Map();
|
|
25
|
+
for (const resource of installedPlugins){
|
|
26
|
+
for (const pluginMetadata of resource.spec.plugins){
|
|
27
|
+
const { pluginType , kind } = pluginMetadata;
|
|
28
|
+
// Index the plugin by type and kind to point at the module that contains it
|
|
29
|
+
const key = getTypeAndKindKey(pluginType, kind);
|
|
30
|
+
if (pluginResourcesByTypeAndKind.has(key)) {
|
|
31
|
+
console.warn(`Got more than one ${pluginType} plugin for kind ${kind}`);
|
|
32
|
+
}
|
|
33
|
+
pluginResourcesByTypeAndKind.set(key, resource);
|
|
34
|
+
// Index the metadata by plugin type
|
|
35
|
+
let list = pluginMetadataByType.get(pluginType);
|
|
36
|
+
if (list === undefined) {
|
|
37
|
+
list = [];
|
|
38
|
+
pluginMetadataByType.set(pluginType, list);
|
|
39
|
+
}
|
|
40
|
+
list.push(pluginMetadata);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
pluginResourcesByTypeAndKind,
|
|
45
|
+
pluginMetadataByType
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
// De-dupe creating plugin indexes (i.e. requests to get installed plugins)
|
|
49
|
+
const pluginIndexesCache = useRef(undefined);
|
|
50
|
+
const getPluginIndexes = useCallback(()=>{
|
|
51
|
+
let request = pluginIndexesCache.current;
|
|
52
|
+
if (request === undefined) {
|
|
53
|
+
request = createPluginIndexes();
|
|
54
|
+
pluginIndexesCache.current = request;
|
|
55
|
+
// Remove failed requests from the cache so they can potentially be retried
|
|
56
|
+
request.catch(()=>pluginIndexesCache.current === undefined);
|
|
57
|
+
}
|
|
58
|
+
return request;
|
|
59
|
+
}, [
|
|
60
|
+
createPluginIndexes
|
|
61
|
+
]);
|
|
62
|
+
return getPluginIndexes;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Gets a unique key for a plugin type/kind that can be used as a cache key.
|
|
66
|
+
*/ export function getTypeAndKindKey(pluginType, kind) {
|
|
67
|
+
return `${pluginType}:${kind}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=plugin-indexes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/plugin-indexes.ts"],"sourcesContent":["// Copyright 2022 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 { useEvent } from '@perses-dev/core';\nimport { useCallback, useRef } from 'react';\nimport { PluginLoader, PluginMetadata, PluginModuleResource, PluginType } from '../../model';\n\nexport interface PluginIndexes {\n // Plugin resources by plugin type and kind (i.e. look up what module a plugin type and kind is in)\n pluginResourcesByTypeAndKind: Map<string, PluginModuleResource>;\n // Plugin metadata by plugin type\n pluginMetadataByType: Map<PluginType, PluginMetadata[]>;\n}\n\n/**\n * Returns an async callback for getting indexes of the installed plugin data.\n */\nexport function usePluginIndexes(getInstalledPlugins: PluginLoader['getInstalledPlugins']) {\n // Creates indexes from the installed plugins data (does useEvent because this accesses the getInstalledPlugins prop\n // and we want a stable reference for the callback below)\n const createPluginIndexes = useEvent(async (): Promise<PluginIndexes> => {\n const installedPlugins = await getInstalledPlugins();\n\n // Create the two indexes from the installed plugins\n const pluginResourcesByTypeAndKind = new Map<string, PluginModuleResource>();\n const pluginMetadataByType = new Map<PluginType, PluginMetadata[]>();\n\n for (const resource of installedPlugins) {\n for (const pluginMetadata of resource.spec.plugins) {\n const { pluginType, kind } = pluginMetadata;\n\n // Index the plugin by type and kind to point at the module that contains it\n const key = getTypeAndKindKey(pluginType, kind);\n if (pluginResourcesByTypeAndKind.has(key)) {\n console.warn(`Got more than one ${pluginType} plugin for kind ${kind}`);\n }\n pluginResourcesByTypeAndKind.set(key, resource);\n\n // Index the metadata by plugin type\n let list = pluginMetadataByType.get(pluginType);\n if (list === undefined) {\n list = [];\n pluginMetadataByType.set(pluginType, list);\n }\n list.push(pluginMetadata);\n }\n }\n\n return {\n pluginResourcesByTypeAndKind,\n pluginMetadataByType,\n };\n });\n\n // De-dupe creating plugin indexes (i.e. requests to get installed plugins)\n const pluginIndexesCache = useRef<Promise<PluginIndexes> | undefined>(undefined);\n const getPluginIndexes = useCallback(() => {\n let request = pluginIndexesCache.current;\n if (request === undefined) {\n request = createPluginIndexes();\n pluginIndexesCache.current = request;\n\n // Remove failed requests from the cache so they can potentially be retried\n request.catch(() => pluginIndexesCache.current === undefined);\n }\n return request;\n }, [createPluginIndexes]);\n\n return getPluginIndexes;\n}\n\n/**\n * Gets a unique key for a plugin type/kind that can be used as a cache key.\n */\nexport function getTypeAndKindKey(pluginType: PluginType, kind: string) {\n return `${pluginType}:${kind}`;\n}\n"],"names":["useEvent","useCallback","useRef","usePluginIndexes","getInstalledPlugins","createPluginIndexes","installedPlugins","pluginResourcesByTypeAndKind","Map","pluginMetadataByType","resource","pluginMetadata","spec","plugins","pluginType","kind","key","getTypeAndKindKey","has","console","warn","set","list","get","undefined","push","pluginIndexesCache","getPluginIndexes","request","current","catch"],"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,SAASA,QAAQ,QAAQ,kBAAkB,CAAC;AAC5C,SAASC,WAAW,EAAEC,MAAM,QAAQ,OAAO,CAAC;AAU5C;;CAEC,GACD,OAAO,SAASC,gBAAgB,CAACC,mBAAwD,EAAE;IACzF,oHAAoH;IACpH,yDAAyD;IACzD,MAAMC,mBAAmB,GAAGL,QAAQ,CAAC,UAAoC;QACvE,MAAMM,gBAAgB,GAAG,MAAMF,mBAAmB,EAAE,AAAC;QAErD,oDAAoD;QACpD,MAAMG,4BAA4B,GAAG,IAAIC,GAAG,EAAgC,AAAC;QAC7E,MAAMC,oBAAoB,GAAG,IAAID,GAAG,EAAgC,AAAC;QAErE,KAAK,MAAME,QAAQ,IAAIJ,gBAAgB,CAAE;YACvC,KAAK,MAAMK,cAAc,IAAID,QAAQ,CAACE,IAAI,CAACC,OAAO,CAAE;gBAClD,MAAM,EAAEC,UAAU,CAAA,EAAEC,IAAI,CAAA,EAAE,GAAGJ,cAAc,AAAC;gBAE5C,4EAA4E;gBAC5E,MAAMK,GAAG,GAAGC,iBAAiB,CAACH,UAAU,EAAEC,IAAI,CAAC,AAAC;gBAChD,IAAIR,4BAA4B,CAACW,GAAG,CAACF,GAAG,CAAC,EAAE;oBACzCG,OAAO,CAACC,IAAI,CAAC,CAAC,kBAAkB,EAAEN,UAAU,CAAC,iBAAiB,EAAEC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC1E,CAAC;gBACDR,4BAA4B,CAACc,GAAG,CAACL,GAAG,EAAEN,QAAQ,CAAC,CAAC;gBAEhD,oCAAoC;gBACpC,IAAIY,IAAI,GAAGb,oBAAoB,CAACc,GAAG,CAACT,UAAU,CAAC,AAAC;gBAChD,IAAIQ,IAAI,KAAKE,SAAS,EAAE;oBACtBF,IAAI,GAAG,EAAE,CAAC;oBACVb,oBAAoB,CAACY,GAAG,CAACP,UAAU,EAAEQ,IAAI,CAAC,CAAC;gBAC7C,CAAC;gBACDA,IAAI,CAACG,IAAI,CAACd,cAAc,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,OAAO;YACLJ,4BAA4B;YAC5BE,oBAAoB;SACrB,CAAC;IACJ,CAAC,CAAC,AAAC;IAEH,2EAA2E;IAC3E,MAAMiB,kBAAkB,GAAGxB,MAAM,CAAqCsB,SAAS,CAAC,AAAC;IACjF,MAAMG,gBAAgB,GAAG1B,WAAW,CAAC,IAAM;QACzC,IAAI2B,OAAO,GAAGF,kBAAkB,CAACG,OAAO,AAAC;QACzC,IAAID,OAAO,KAAKJ,SAAS,EAAE;YACzBI,OAAO,GAAGvB,mBAAmB,EAAE,CAAC;YAChCqB,kBAAkB,CAACG,OAAO,GAAGD,OAAO,CAAC;YAErC,2EAA2E;YAC3EA,OAAO,CAACE,KAAK,CAAC,IAAMJ,kBAAkB,CAACG,OAAO,KAAKL,SAAS,CAAC,CAAC;QAChE,CAAC;QACD,OAAOI,OAAO,CAAC;IACjB,CAAC,EAAE;QAACvB,mBAAmB;KAAC,CAAC,AAAC;IAE1B,OAAOsB,gBAAgB,CAAC;AAC1B,CAAC;AAED;;CAEC,GACD,OAAO,SAASV,iBAAiB,CAACH,UAAsB,EAAEC,IAAY,EAAE;IACtE,OAAO,CAAC,EAAED,UAAU,CAAC,CAAC,EAAEC,IAAI,CAAC,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UnknownSpec } from '@perses-dev/core';
|
|
3
|
+
import { OptionsEditorProps, PluginType } from '../model';
|
|
4
|
+
export interface PluginSpecEditorProps extends OptionsEditorProps<UnknownSpec> {
|
|
5
|
+
pluginType: PluginType;
|
|
6
|
+
pluginKind: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function PluginSpecEditor(props: PluginSpecEditorProps): JSX.Element | null;
|
|
9
|
+
//# sourceMappingURL=PluginSpecEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginSpecEditor.d.ts","sourceRoot":"","sources":["../../src/components/PluginSpecEditor.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB,CAAC,WAAW,CAAC;IAC5E,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,sBAmB5D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { ErrorAlert } from '@perses-dev/components';
|
|
15
|
+
import { usePlugin } from '../runtime';
|
|
16
|
+
export function PluginSpecEditor(props) {
|
|
17
|
+
const { pluginType , pluginKind , ...others } = props;
|
|
18
|
+
const { data: plugin , isLoading , error } = usePlugin(pluginType, pluginKind);
|
|
19
|
+
if (error) {
|
|
20
|
+
return /*#__PURE__*/ _jsx(ErrorAlert, {
|
|
21
|
+
error: error
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// TODO: Proper loading indicator
|
|
25
|
+
if (isLoading) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (plugin === undefined) {
|
|
29
|
+
throw new Error(`Missing OptionsEditorComponent for ${pluginType} plugin with kind '${pluginKind}'`);
|
|
30
|
+
}
|
|
31
|
+
const { OptionsEditorComponent } = plugin;
|
|
32
|
+
return /*#__PURE__*/ _jsx(OptionsEditorComponent, {
|
|
33
|
+
...others
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=PluginSpecEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/PluginSpecEditor.tsx"],"sourcesContent":["// Copyright 2022 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 { ErrorAlert } from '@perses-dev/components';\nimport { UnknownSpec } from '@perses-dev/core';\nimport { OptionsEditorProps, PluginType } from '../model';\nimport { usePlugin } from '../runtime';\n\nexport interface PluginSpecEditorProps extends OptionsEditorProps<UnknownSpec> {\n pluginType: PluginType;\n pluginKind: string;\n}\n\nexport function PluginSpecEditor(props: PluginSpecEditorProps) {\n const { pluginType, pluginKind, ...others } = props;\n const { data: plugin, isLoading, error } = usePlugin(pluginType, pluginKind);\n\n if (error) {\n return <ErrorAlert error={error} />;\n }\n\n // TODO: Proper loading indicator\n if (isLoading) {\n return null;\n }\n\n if (plugin === undefined) {\n throw new Error(`Missing OptionsEditorComponent for ${pluginType} plugin with kind '${pluginKind}'`);\n }\n\n const { OptionsEditorComponent } = plugin;\n return <OptionsEditorComponent {...others} />;\n}\n"],"names":["ErrorAlert","usePlugin","PluginSpecEditor","props","pluginType","pluginKind","others","data","plugin","isLoading","error","undefined","Error","OptionsEditorComponent"],"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;AAAA,SAASA,UAAU,QAAQ,wBAAwB,CAAC;AAGpD,SAASC,SAAS,QAAQ,YAAY,CAAC;AAOvC,OAAO,SAASC,gBAAgB,CAACC,KAA4B,EAAE;IAC7D,MAAM,EAAEC,UAAU,CAAA,EAAEC,UAAU,CAAA,EAAE,GAAGC,MAAM,EAAE,GAAGH,KAAK,AAAC;IACpD,MAAM,EAAEI,IAAI,EAAEC,MAAM,CAAA,EAAEC,SAAS,CAAA,EAAEC,KAAK,CAAA,EAAE,GAAGT,SAAS,CAACG,UAAU,EAAEC,UAAU,CAAC,AAAC;IAE7E,IAAIK,KAAK,EAAE;QACT,qBAAO,KAACV,UAAU;YAACU,KAAK,EAAEA,KAAK;UAAI,CAAC;IACtC,CAAC;IAED,iCAAiC;IACjC,IAAID,SAAS,EAAE;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAID,MAAM,KAAKG,SAAS,EAAE;QACxB,MAAM,IAAIC,KAAK,CAAC,CAAC,mCAAmC,EAAER,UAAU,CAAC,mBAAmB,EAAEC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACvG,CAAC;IAED,MAAM,EAAEQ,sBAAsB,CAAA,EAAE,GAAGL,MAAM,AAAC;IAC1C,qBAAO,KAACK,sBAAsB;QAAE,GAAGP,MAAM;MAAI,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginSpecEditor.test.d.ts","sourceRoot":"","sources":["../../src/components/PluginSpecEditor.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import userEvent from '@testing-library/user-event';
|
|
15
|
+
import { screen } from '@testing-library/react';
|
|
16
|
+
import { renderWithContext } from '../test';
|
|
17
|
+
import { PluginSpecEditor } from './PluginSpecEditor';
|
|
18
|
+
describe('PluginSpecEditor', ()=>{
|
|
19
|
+
const renderComponent = (props)=>{
|
|
20
|
+
renderWithContext(/*#__PURE__*/ _jsx(PluginSpecEditor, {
|
|
21
|
+
...props
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
it('shows the options editor component for a plugin', async ()=>{
|
|
25
|
+
renderComponent({
|
|
26
|
+
pluginType: 'Panel',
|
|
27
|
+
pluginKind: 'BertPanel1',
|
|
28
|
+
value: {},
|
|
29
|
+
onChange: jest.fn()
|
|
30
|
+
});
|
|
31
|
+
const editor = await screen.findByLabelText('BertPanel1 editor');
|
|
32
|
+
expect(editor).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
it('propagates value changes', async ()=>{
|
|
35
|
+
const onChange = jest.fn();
|
|
36
|
+
renderComponent({
|
|
37
|
+
pluginType: 'Panel',
|
|
38
|
+
pluginKind: 'BertPanel1',
|
|
39
|
+
value: {
|
|
40
|
+
option1: 'Option1Value'
|
|
41
|
+
},
|
|
42
|
+
onChange
|
|
43
|
+
});
|
|
44
|
+
const editor = await screen.findByLabelText('BertPanel1 editor');
|
|
45
|
+
expect(editor).toHaveValue('Option1Value');
|
|
46
|
+
userEvent.clear(editor);
|
|
47
|
+
expect(onChange).toHaveBeenCalledWith({
|
|
48
|
+
option1: ''
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
it('shows an error if plugin fails to load', async ()=>{
|
|
52
|
+
renderComponent({
|
|
53
|
+
pluginType: 'Variable',
|
|
54
|
+
pluginKind: 'DoesNotExist',
|
|
55
|
+
value: {},
|
|
56
|
+
onChange: jest.fn()
|
|
57
|
+
});
|
|
58
|
+
const errorAlert = await screen.findByRole('alert');
|
|
59
|
+
expect(errorAlert).toHaveTextContent(/doesnotexist/i);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=PluginSpecEditor.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/PluginSpecEditor.test.tsx"],"sourcesContent":["// Copyright 2022 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 userEvent from '@testing-library/user-event';\nimport { screen } from '@testing-library/react';\nimport { renderWithContext } from '../test';\nimport { PluginSpecEditor, PluginSpecEditorProps } from './PluginSpecEditor';\n\ndescribe('PluginSpecEditor', () => {\n const renderComponent = (props: PluginSpecEditorProps) => {\n renderWithContext(<PluginSpecEditor {...props} />);\n };\n\n it('shows the options editor component for a plugin', async () => {\n renderComponent({ pluginType: 'Panel', pluginKind: 'BertPanel1', value: {}, onChange: jest.fn() });\n const editor = await screen.findByLabelText('BertPanel1 editor');\n expect(editor).toBeInTheDocument();\n });\n\n it('propagates value changes', async () => {\n const onChange = jest.fn();\n renderComponent({ pluginType: 'Panel', pluginKind: 'BertPanel1', value: { option1: 'Option1Value' }, onChange });\n\n const editor = await screen.findByLabelText('BertPanel1 editor');\n expect(editor).toHaveValue('Option1Value');\n userEvent.clear(editor);\n expect(onChange).toHaveBeenCalledWith({ option1: '' });\n });\n\n it('shows an error if plugin fails to load', async () => {\n renderComponent({ pluginType: 'Variable', pluginKind: 'DoesNotExist', value: {}, onChange: jest.fn() });\n const errorAlert = await screen.findByRole('alert');\n expect(errorAlert).toHaveTextContent(/doesnotexist/i);\n });\n});\n"],"names":["userEvent","screen","renderWithContext","PluginSpecEditor","describe","renderComponent","props","it","pluginType","pluginKind","value","onChange","jest","fn","editor","findByLabelText","expect","toBeInTheDocument","option1","toHaveValue","clear","toHaveBeenCalledWith","errorAlert","findByRole","toHaveTextContent"],"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;AAAA,OAAOA,SAAS,MAAM,6BAA6B,CAAC;AACpD,SAASC,MAAM,QAAQ,wBAAwB,CAAC;AAChD,SAASC,iBAAiB,QAAQ,SAAS,CAAC;AAC5C,SAASC,gBAAgB,QAA+B,oBAAoB,CAAC;AAE7EC,QAAQ,CAAC,kBAAkB,EAAE,IAAM;IACjC,MAAMC,eAAe,GAAG,CAACC,KAA4B,GAAK;QACxDJ,iBAAiB,eAAC,KAACC,gBAAgB;YAAE,GAAGG,KAAK;UAAI,CAAC,CAAC;IACrD,CAAC,AAAC;IAEFC,EAAE,CAAC,iDAAiD,EAAE,UAAY;QAChEF,eAAe,CAAC;YAAEG,UAAU,EAAE,OAAO;YAAEC,UAAU,EAAE,YAAY;YAAEC,KAAK,EAAE,EAAE;YAAEC,QAAQ,EAAEC,IAAI,CAACC,EAAE,EAAE;SAAE,CAAC,CAAC;QACnG,MAAMC,MAAM,GAAG,MAAMb,MAAM,CAACc,eAAe,CAAC,mBAAmB,CAAC,AAAC;QACjEC,MAAM,CAACF,MAAM,CAAC,CAACG,iBAAiB,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;IAEHV,EAAE,CAAC,0BAA0B,EAAE,UAAY;QACzC,MAAMI,QAAQ,GAAGC,IAAI,CAACC,EAAE,EAAE,AAAC;QAC3BR,eAAe,CAAC;YAAEG,UAAU,EAAE,OAAO;YAAEC,UAAU,EAAE,YAAY;YAAEC,KAAK,EAAE;gBAAEQ,OAAO,EAAE,cAAc;aAAE;YAAEP,QAAQ;SAAE,CAAC,CAAC;QAEjH,MAAMG,MAAM,GAAG,MAAMb,MAAM,CAACc,eAAe,CAAC,mBAAmB,CAAC,AAAC;QACjEC,MAAM,CAACF,MAAM,CAAC,CAACK,WAAW,CAAC,cAAc,CAAC,CAAC;QAC3CnB,SAAS,CAACoB,KAAK,CAACN,MAAM,CAAC,CAAC;QACxBE,MAAM,CAACL,QAAQ,CAAC,CAACU,oBAAoB,CAAC;YAAEH,OAAO,EAAE,EAAE;SAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEHX,EAAE,CAAC,wCAAwC,EAAE,UAAY;QACvDF,eAAe,CAAC;YAAEG,UAAU,EAAE,UAAU;YAAEC,UAAU,EAAE,cAAc;YAAEC,KAAK,EAAE,EAAE;YAAEC,QAAQ,EAAEC,IAAI,CAACC,EAAE,EAAE;SAAE,CAAC,CAAC;QACxG,MAAMS,UAAU,GAAG,MAAMrB,MAAM,CAACsB,UAAU,CAAC,OAAO,CAAC,AAAC;QACpDP,MAAM,CAACM,UAAU,CAAC,CAACE,iBAAiB,iBAAiB,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
import { TimeSeriesQueryDefinition } from '@perses-dev/core';
|
|
4
|
+
declare type OmittedMuiProps = 'children' | 'value' | 'onChange';
|
|
5
|
+
export interface TimeSeriesQueryEditorProps extends Omit<BoxProps, OmittedMuiProps> {
|
|
6
|
+
value: TimeSeriesQueryDefinition;
|
|
7
|
+
onChange: (next: TimeSeriesQueryDefinition) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Displays an editor for TimeSeriesQueryDefinition objects.
|
|
11
|
+
*/
|
|
12
|
+
export declare function TimeSeriesQueryEditor(props: TimeSeriesQueryEditorProps): JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=TimeSeriesQueryEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeSeriesQueryEditor.d.ts","sourceRoot":"","sources":["../../src/components/TimeSeriesQueryEditor.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAM7D,aAAK,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC;IACjF,KAAK,EAAE,yBAAyB,CAAC;IACjC,QAAQ,EAAE,CAAC,IAAI,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACrD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eAyBtE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { Box } from '@mui/material';
|
|
15
|
+
import { produce } from 'immer';
|
|
16
|
+
import { PluginEditor } from './PluginEditor';
|
|
17
|
+
/**
|
|
18
|
+
* Displays an editor for TimeSeriesQueryDefinition objects.
|
|
19
|
+
*/ export function TimeSeriesQueryEditor(props) {
|
|
20
|
+
const { value , onChange , ...others } = props;
|
|
21
|
+
const { spec: { plugin } , } = value;
|
|
22
|
+
const handlePluginChange = (next)=>{
|
|
23
|
+
onChange(produce(value, (draft)=>{
|
|
24
|
+
draft.spec.plugin = next;
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/ _jsx(Box, {
|
|
28
|
+
...others,
|
|
29
|
+
children: /*#__PURE__*/ _jsx(PluginEditor, {
|
|
30
|
+
pluginType: "TimeSeriesQuery",
|
|
31
|
+
pluginKindLabel: "Query Type",
|
|
32
|
+
value: plugin,
|
|
33
|
+
onChange: handlePluginChange
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=TimeSeriesQueryEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/TimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright 2022 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 { Box, BoxProps } from '@mui/material';\nimport { TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { produce } from 'immer';\nimport { PluginEditor, PluginEditorProps } from './PluginEditor';\n\n// Props on MUI Box 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\nexport interface TimeSeriesQueryEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n value: TimeSeriesQueryDefinition;\n onChange: (next: TimeSeriesQueryDefinition) => void;\n}\n\n/**\n * Displays an editor for TimeSeriesQueryDefinition objects.\n */\nexport function TimeSeriesQueryEditor(props: TimeSeriesQueryEditorProps) {\n const { value, onChange, ...others } = props;\n const {\n spec: { plugin },\n } = value;\n\n const handlePluginChange: PluginEditorProps['onChange'] = (next) => {\n onChange(\n produce(value, (draft) => {\n draft.spec.plugin = next;\n })\n );\n };\n\n return (\n <Box {...others}>\n {/* If TimeSeriesQuery plugins ever have common props on the definition, the inputs could go here */}\n <PluginEditor\n pluginType=\"TimeSeriesQuery\"\n pluginKindLabel=\"Query Type\"\n value={plugin}\n onChange={handlePluginChange}\n />\n </Box>\n );\n}\n"],"names":["Box","produce","PluginEditor","TimeSeriesQueryEditor","props","value","onChange","others","spec","plugin","handlePluginChange","next","draft","pluginType","pluginKindLabel"],"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;AAAA,SAASA,GAAG,QAAkB,eAAe,CAAC;AAE9C,SAASC,OAAO,QAAQ,OAAO,CAAC;AAChC,SAASC,YAAY,QAA2B,gBAAgB,CAAC;AAWjE;;CAEC,GACD,OAAO,SAASC,qBAAqB,CAACC,KAAiC,EAAE;IACvE,MAAM,EAAEC,KAAK,CAAA,EAAEC,QAAQ,CAAA,EAAE,GAAGC,MAAM,EAAE,GAAGH,KAAK,AAAC;IAC7C,MAAM,EACJI,IAAI,EAAE,EAAEC,MAAM,CAAA,EAAE,CAAA,IACjB,GAAGJ,KAAK,AAAC;IAEV,MAAMK,kBAAkB,GAAkC,CAACC,IAAI,GAAK;QAClEL,QAAQ,CACNL,OAAO,CAACI,KAAK,EAAE,CAACO,KAAK,GAAK;YACxBA,KAAK,CAACJ,IAAI,CAACC,MAAM,GAAGE,IAAI,CAAC;QAC3B,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,AAAC;IAEF,qBACE,KAACX,GAAG;QAAE,GAAGO,MAAM;kBAEb,cAAA,KAACL,YAAY;YACXW,UAAU,EAAC,iBAAiB;YAC5BC,eAAe,EAAC,YAAY;YAC5BT,KAAK,EAAEI,MAAM;YACbH,QAAQ,EAAEI,kBAAkB;UAC5B;MACE,CACN;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './CalculationSelector';
|
|
2
|
+
export * from './DatasourceSelect';
|
|
3
|
+
export * from './OptionsEditorTabs';
|
|
4
|
+
export * from './PluginEditor';
|
|
5
|
+
export * from './PluginKindSelect';
|
|
6
|
+
export * from './PluginRegistry';
|
|
7
|
+
export * from './PluginSpecEditor';
|
|
8
|
+
export * from './TimeSeriesQueryEditor';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2022 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 './CalculationSelector';
|
|
14
|
+
export * from './DatasourceSelect';
|
|
15
|
+
export * from './OptionsEditorTabs';
|
|
16
|
+
export * from './PluginEditor';
|
|
17
|
+
export * from './PluginKindSelect';
|
|
18
|
+
export * from './PluginRegistry';
|
|
19
|
+
export * from './PluginSpecEditor';
|
|
20
|
+
export * from './TimeSeriesQueryEditor';
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2022 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 './CalculationSelector';\nexport * from './DatasourceSelect';\nexport * from './OptionsEditorTabs';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeSeriesQueryEditor';\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,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright 2022 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 './components';
|
|
14
|
+
export * from './model';
|
|
15
|
+
export * from './runtime';
|
|
16
|
+
export * from './test-utils';
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2022 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 './components';\nexport * from './model';\nexport * from './runtime';\nexport * from './test-utils';\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,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TimeSeriesValueTuple } from './time-series-queries';
|
|
2
|
+
export declare const CalculationsMap: {
|
|
3
|
+
First: typeof first;
|
|
4
|
+
Last: typeof last;
|
|
5
|
+
LastNumber: typeof lastNumber;
|
|
6
|
+
Mean: typeof mean;
|
|
7
|
+
Sum: typeof sum;
|
|
8
|
+
};
|
|
9
|
+
export declare type CalculationType = keyof typeof CalculationsMap;
|
|
10
|
+
export declare type CalculationConfig = {
|
|
11
|
+
label: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const CALCULATIONS_CONFIG: Readonly<Record<CalculationType, CalculationConfig>>;
|
|
14
|
+
export declare const DEFAULT_CALCULATION: CalculationType;
|
|
15
|
+
declare function first(values: TimeSeriesValueTuple[]): number | undefined;
|
|
16
|
+
declare function last(values: TimeSeriesValueTuple[]): number | undefined;
|
|
17
|
+
declare function lastNumber(values: TimeSeriesValueTuple[]): number | undefined;
|
|
18
|
+
declare function mean(values: TimeSeriesValueTuple[]): number | undefined;
|
|
19
|
+
declare function sum(values: TimeSeriesValueTuple[]): number | undefined;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=calculations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculations.d.ts","sourceRoot":"","sources":["../../src/model/calculations.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,eAAO,MAAM,eAAe;;;;;;CAM3B,CAAC;AAEF,oBAAY,eAAe,GAAG,MAAM,OAAO,eAAe,CAAC;AAE3D,oBAAY,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAgB3E,CAAC;AAEX,eAAO,MAAM,mBAAmB,EAAE,eAAuB,CAAC;AAE1D,iBAAS,KAAK,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,GAAG,SAAS,CAGjE;AAED,iBAAS,IAAI,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,GAAG,SAAS,CAKhE;AAED,iBAAS,UAAU,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,GAAG,SAAS,CAGtE;AAED,iBAAS,IAAI,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,GAAG,SAAS,CAGhE;AAED,iBAAS,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,GAAG,SAAS,CAG/D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
import { findLast, meanBy, sumBy } from 'lodash-es';
|
|
14
|
+
export const CalculationsMap = {
|
|
15
|
+
First: first,
|
|
16
|
+
Last: last,
|
|
17
|
+
LastNumber: lastNumber,
|
|
18
|
+
Mean: mean,
|
|
19
|
+
Sum: sum
|
|
20
|
+
};
|
|
21
|
+
export const CALCULATIONS_CONFIG = {
|
|
22
|
+
First: {
|
|
23
|
+
label: 'First'
|
|
24
|
+
},
|
|
25
|
+
Last: {
|
|
26
|
+
label: 'Last'
|
|
27
|
+
},
|
|
28
|
+
LastNumber: {
|
|
29
|
+
label: 'Last number'
|
|
30
|
+
},
|
|
31
|
+
Mean: {
|
|
32
|
+
label: 'Mean'
|
|
33
|
+
},
|
|
34
|
+
Sum: {
|
|
35
|
+
label: 'Sum'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export const DEFAULT_CALCULATION = 'Sum';
|
|
39
|
+
function first(values) {
|
|
40
|
+
const tuple = values[0];
|
|
41
|
+
return tuple === undefined ? undefined : getValue(tuple);
|
|
42
|
+
}
|
|
43
|
+
function last(values) {
|
|
44
|
+
if (values.length <= 0) return undefined;
|
|
45
|
+
const tuple = values[values.length - 1];
|
|
46
|
+
return tuple === undefined ? undefined : getValue(tuple);
|
|
47
|
+
}
|
|
48
|
+
function lastNumber(values) {
|
|
49
|
+
const tuple = findLast(values, (tuple)=>isNaN(getValue(tuple)) === false);
|
|
50
|
+
return tuple === undefined ? undefined : getValue(tuple);
|
|
51
|
+
}
|
|
52
|
+
function mean(values) {
|
|
53
|
+
if (values.length <= 0) return undefined;
|
|
54
|
+
return meanBy(values, getValue);
|
|
55
|
+
}
|
|
56
|
+
function sum(values) {
|
|
57
|
+
if (values.length <= 0) return undefined;
|
|
58
|
+
return sumBy(values, getValue);
|
|
59
|
+
}
|
|
60
|
+
function getValue(valueTuple) {
|
|
61
|
+
return valueTuple[1];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=calculations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/calculations.ts"],"sourcesContent":["// Copyright 2022 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 { findLast, meanBy, sumBy } from 'lodash-es';\nimport { TimeSeriesValueTuple } from './time-series-queries';\n\nexport const CalculationsMap = {\n First: first,\n Last: last,\n LastNumber: lastNumber,\n Mean: mean,\n Sum: sum,\n};\n\nexport type CalculationType = keyof typeof CalculationsMap;\n\nexport type CalculationConfig = {\n label: string;\n};\nexport const CALCULATIONS_CONFIG: Readonly<Record<CalculationType, CalculationConfig>> = {\n First: {\n label: 'First',\n },\n Last: {\n label: 'Last',\n },\n LastNumber: {\n label: 'Last number',\n },\n Mean: {\n label: 'Mean',\n },\n Sum: {\n label: 'Sum',\n },\n} as const;\n\nexport const DEFAULT_CALCULATION: CalculationType = 'Sum';\n\nfunction first(values: TimeSeriesValueTuple[]): number | undefined {\n const tuple = values[0];\n return tuple === undefined ? undefined : getValue(tuple);\n}\n\nfunction last(values: TimeSeriesValueTuple[]): number | undefined {\n if (values.length <= 0) return undefined;\n\n const tuple = values[values.length - 1];\n return tuple === undefined ? undefined : getValue(tuple);\n}\n\nfunction lastNumber(values: TimeSeriesValueTuple[]): number | undefined {\n const tuple = findLast(values, (tuple) => isNaN(getValue(tuple)) === false);\n return tuple === undefined ? undefined : getValue(tuple);\n}\n\nfunction mean(values: TimeSeriesValueTuple[]): number | undefined {\n if (values.length <= 0) return undefined;\n return meanBy(values, getValue);\n}\n\nfunction sum(values: TimeSeriesValueTuple[]): number | undefined {\n if (values.length <= 0) return undefined;\n return sumBy(values, getValue);\n}\n\nfunction getValue(valueTuple: TimeSeriesValueTuple) {\n return valueTuple[1];\n}\n"],"names":["findLast","meanBy","sumBy","CalculationsMap","First","first","Last","last","LastNumber","lastNumber","Mean","mean","Sum","sum","CALCULATIONS_CONFIG","label","DEFAULT_CALCULATION","values","tuple","undefined","getValue","length","isNaN","valueTuple"],"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,SAASA,QAAQ,EAAEC,MAAM,EAAEC,KAAK,QAAQ,WAAW,CAAC;AAGpD,OAAO,MAAMC,eAAe,GAAG;IAC7BC,KAAK,EAAEC,KAAK;IACZC,IAAI,EAAEC,IAAI;IACVC,UAAU,EAAEC,UAAU;IACtBC,IAAI,EAAEC,IAAI;IACVC,GAAG,EAAEC,GAAG;CACT,CAAC;AAOF,OAAO,MAAMC,mBAAmB,GAAyD;IACvFV,KAAK,EAAE;QACLW,KAAK,EAAE,OAAO;KACf;IACDT,IAAI,EAAE;QACJS,KAAK,EAAE,MAAM;KACd;IACDP,UAAU,EAAE;QACVO,KAAK,EAAE,aAAa;KACrB;IACDL,IAAI,EAAE;QACJK,KAAK,EAAE,MAAM;KACd;IACDH,GAAG,EAAE;QACHG,KAAK,EAAE,KAAK;KACb;CACF,AAAS,CAAC;AAEX,OAAO,MAAMC,mBAAmB,GAAoB,KAAK,CAAC;AAE1D,SAASX,KAAK,CAACY,MAA8B,EAAsB;IACjE,MAAMC,KAAK,GAAGD,MAAM,CAAC,CAAC,CAAC,AAAC;IACxB,OAAOC,KAAK,KAAKC,SAAS,GAAGA,SAAS,GAAGC,QAAQ,CAACF,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAASX,IAAI,CAACU,MAA8B,EAAsB;IAChE,IAAIA,MAAM,CAACI,MAAM,IAAI,CAAC,EAAE,OAAOF,SAAS,CAAC;IAEzC,MAAMD,KAAK,GAAGD,MAAM,CAACA,MAAM,CAACI,MAAM,GAAG,CAAC,CAAC,AAAC;IACxC,OAAOH,KAAK,KAAKC,SAAS,GAAGA,SAAS,GAAGC,QAAQ,CAACF,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAST,UAAU,CAACQ,MAA8B,EAAsB;IACtE,MAAMC,KAAK,GAAGlB,QAAQ,CAACiB,MAAM,EAAE,CAACC,KAAK,GAAKI,KAAK,CAACF,QAAQ,CAACF,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,AAAC;IAC5E,OAAOA,KAAK,KAAKC,SAAS,GAAGA,SAAS,GAAGC,QAAQ,CAACF,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAASP,IAAI,CAACM,MAA8B,EAAsB;IAChE,IAAIA,MAAM,CAACI,MAAM,IAAI,CAAC,EAAE,OAAOF,SAAS,CAAC;IACzC,OAAOlB,MAAM,CAACgB,MAAM,EAAEG,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED,SAASP,GAAG,CAACI,MAA8B,EAAsB;IAC/D,IAAIA,MAAM,CAACI,MAAM,IAAI,CAAC,EAAE,OAAOF,SAAS,CAAC;IACzC,OAAOjB,KAAK,CAACe,MAAM,EAAEG,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED,SAASA,QAAQ,CAACG,UAAgC,EAAE;IAClD,OAAOA,UAAU,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnknownSpec } from '@perses-dev/core';
|
|
2
|
+
import { Plugin } from './plugin-base';
|
|
3
|
+
/**
|
|
4
|
+
* Plugin that defines options for an external system that Perses talks to for data.
|
|
5
|
+
*/
|
|
6
|
+
export interface DatasourcePlugin<Spec = UnknownSpec, Client = unknown> extends Plugin<Spec> {
|
|
7
|
+
createClient: (spec: Spec, options: DatasourceClientOptions) => Client;
|
|
8
|
+
}
|
|
9
|
+
export interface DatasourceClientOptions {
|
|
10
|
+
proxyUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=datasource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/model/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,EAAE,MAAM,GAAG,OAAO,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IAC1F,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,uBAAuB,KAAK,MAAM,CAAC;CACxE;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2022 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 { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=datasource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/datasource.ts"],"sourcesContent":["// Copyright 2022 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 { UnknownSpec } from '@perses-dev/core';\nimport { Plugin } from './plugin-base';\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface DatasourcePlugin<Spec = UnknownSpec, Client = unknown> extends Plugin<Spec> {\n createClient: (spec: Spec, options: DatasourceClientOptions) => Client;\n}\n\nexport interface DatasourceClientOptions {\n proxyUrl?: string;\n}\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,WAYC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './calculations';
|
|
2
|
+
export * from './datasource';
|
|
3
|
+
export * from './panels';
|
|
4
|
+
export * from './plugins';
|
|
5
|
+
export * from './time-series-queries';
|
|
6
|
+
export * from './variables';
|
|
7
|
+
export * from './plugin-base';
|
|
8
|
+
export * from './plugin-loading';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2022 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 './calculations';
|
|
14
|
+
export * from './datasource';
|
|
15
|
+
export * from './panels';
|
|
16
|
+
export * from './plugins';
|
|
17
|
+
export * from './time-series-queries';
|
|
18
|
+
export * from './variables';
|
|
19
|
+
export * from './plugin-base';
|
|
20
|
+
export * from './plugin-loading';
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2022 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 './calculations';\nexport * from './datasource';\nexport * from './panels';\nexport * from './plugins';\nexport * from './time-series-queries';\nexport * from './variables';\nexport * from './plugin-base';\nexport * from './plugin-loading';\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,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UnknownSpec } from '@perses-dev/core';
|
|
3
|
+
import { Plugin } from './plugin-base';
|
|
4
|
+
/**
|
|
5
|
+
* Plugin the provides custom visualizations inside of a Panel.
|
|
6
|
+
*/
|
|
7
|
+
export interface PanelPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
|
|
8
|
+
PanelComponent: React.ComponentType<PanelProps<Spec>>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The props provided by Perses to a panel plugin's PanelComponent.
|
|
12
|
+
*/
|
|
13
|
+
export interface PanelProps<Spec> {
|
|
14
|
+
spec: Spec;
|
|
15
|
+
contentDimensions?: {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=panels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../src/model/panels.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACnE,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,IAAI;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,iBAAiB,CAAC,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2022 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 { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=panels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/panels.ts"],"sourcesContent":["// Copyright 2022 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 { UnknownSpec } from '@perses-dev/core';\nimport { Plugin } from './plugin-base';\n\n/**\n * Plugin the provides custom visualizations inside of a Panel.\n */\nexport interface PanelPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n PanelComponent: React.ComponentType<PanelProps<Spec>>;\n}\n\n/**\n * The props provided by Perses to a panel plugin's PanelComponent.\n */\nexport interface PanelProps<Spec> {\n spec: Spec;\n contentDimensions?: {\n width: number;\n height: number;\n };\n}\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,WAmBC"}
|