@perses-dev/plugin-system 0.39.0 → 0.40.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/CalculationSelector/CalculationSelector.js +6 -4
- package/dist/cjs/components/CalculationSelector/index.js +10 -8
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +380 -0
- package/dist/cjs/components/DatasourceEditorForm/index.js +30 -0
- package/dist/cjs/components/DatasourceSelect.js +119 -21
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +18 -16
- package/dist/cjs/components/LegendOptionsEditor/index.js +10 -8
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +23 -28
- package/dist/cjs/components/OptionsEditorRadios/index.js +10 -8
- package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +6 -4
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +10 -8
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +10 -8
- package/dist/cjs/components/OptionsEditorTabs/index.js +10 -8
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +13 -11
- package/dist/cjs/components/PanelSpecEditor/index.js +10 -8
- package/dist/cjs/components/PluginEditor/PluginEditor.js +24 -31
- package/dist/cjs/components/PluginEditor/index.js +11 -9
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +5 -3
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +23 -12
- package/dist/cjs/components/PluginKindSelect/index.js +10 -8
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -9
- package/dist/cjs/components/PluginRegistry/index.js +10 -8
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +6 -2
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +6 -4
- package/dist/cjs/components/PluginSpecEditor/index.js +10 -8
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +15 -13
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +21 -19
- package/dist/cjs/components/TimeSeriesQueryEditor/index.js +10 -8
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +256 -166
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +32 -28
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +11 -9
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +28 -32
- package/dist/cjs/components/Variables/index.js +11 -9
- package/dist/cjs/components/Variables/variable-model.js +17 -9
- package/dist/cjs/components/index.js +22 -19
- package/dist/cjs/constants/index.js +10 -8
- package/dist/cjs/constants/user-interface-text.js +3 -1
- package/dist/cjs/index.js +16 -13
- package/dist/cjs/model/index.js +17 -15
- package/dist/cjs/model/legend.js +32 -20
- package/dist/cjs/model/panels.js +2 -2
- package/dist/cjs/model/plugin-base.js +2 -2
- package/dist/cjs/model/plugin-loading.js +3 -1
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +19 -11
- package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
- package/dist/cjs/runtime/DataQueriesProvider/model.js +12 -8
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +19 -11
- package/dist/cjs/runtime/TimeRangeProvider/index.js +11 -9
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +36 -18
- package/dist/cjs/runtime/builtin-variables.js +81 -0
- package/dist/cjs/runtime/datasources.js +29 -11
- package/dist/cjs/runtime/index.js +16 -13
- package/dist/cjs/runtime/plugin-registry.js +41 -11
- package/dist/cjs/runtime/template-variables.js +42 -12
- package/dist/cjs/runtime/time-series-queries.js +39 -27
- package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +7 -5
- package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +16 -14
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +42 -0
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +19 -13
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +6 -4
- package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +7 -5
- package/dist/cjs/stories/shared-utils/decorators/index.js +15 -12
- package/dist/cjs/stories/shared-utils/index.js +10 -8
- package/dist/cjs/test/index.js +11 -9
- package/dist/cjs/test/mock-data.js +3 -1
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/test/test-plugins/bert/index.js +14 -10
- package/dist/cjs/test/test-plugins/ernie/index.js +13 -9
- package/dist/cjs/test/test-plugins/index.js +11 -9
- package/dist/cjs/test-utils/index.js +10 -8
- package/dist/cjs/test-utils/mock-plugin-registry.js +8 -4
- package/dist/cjs/utils/action.js +43 -0
- package/dist/cjs/utils/index.js +11 -8
- package/dist/cjs/utils/variables.js +26 -8
- package/dist/cjs/validation/datasource.js +30 -0
- package/dist/cjs/validation/index.js +32 -0
- package/dist/cjs/validation/resource.js +24 -0
- package/dist/cjs/validation/variable.js +29 -0
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/CalculationSelector/index.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +15 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +333 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
- package/dist/components/DatasourceEditorForm/index.d.ts +2 -0
- package/dist/components/DatasourceEditorForm/index.d.ts.map +1 -0
- package/dist/components/DatasourceEditorForm/index.js +15 -0
- package/dist/components/DatasourceEditorForm/index.js.map +1 -0
- package/dist/components/DatasourceSelect.d.ts +5 -0
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +102 -19
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -2
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/LegendOptionsEditor/index.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +2 -2
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +16 -23
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorRadios/index.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/OptionsEditorTabs/index.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +2 -2
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +15 -24
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +2 -2
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -3
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +21 -12
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginKindSelect/index.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +3 -3
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/index.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/PluginSpecEditor/index.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +4 -4
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +10 -7
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +200 -112
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +5 -4
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +22 -30
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/index.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 +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/model/datasource.d.ts +2 -1
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +1 -1
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +14 -14
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +4 -4
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +3 -2
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +4 -4
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/builtin-variables.d.ts +11 -0
- package/dist/runtime/builtin-variables.d.ts.map +1 -0
- package/dist/runtime/builtin-variables.js +59 -0
- package/dist/runtime/builtin-variables.js.map +1 -0
- package/dist/runtime/datasources.d.ts +14 -6
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +13 -6
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +2 -0
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +19 -2
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/template-variables.d.ts +2 -1
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +27 -8
- package/dist/runtime/template-variables.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +3 -3
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +14 -12
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +13 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +39 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +11 -7
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
- package/dist/stories/shared-utils/decorators/index.d.ts +1 -0
- package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/index.js +1 -0
- package/dist/stories/shared-utils/decorators/index.js.map +1 -1
- package/dist/stories/shared-utils/index.js.map +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render.js +2 -2
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test/test-plugins/index.js.map +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +2 -2
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/action.d.ts +4 -0
- package/dist/utils/action.d.ts.map +1 -0
- package/dist/utils/action.js +27 -0
- package/dist/utils/action.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +17 -5
- package/dist/utils/variables.js.map +1 -1
- package/dist/validation/datasource.d.ts +19 -0
- package/dist/validation/datasource.d.ts.map +1 -0
- package/dist/validation/datasource.js +22 -0
- package/dist/validation/datasource.js.map +1 -0
- package/dist/validation/index.d.ts +4 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +17 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/resource.d.ts +3 -0
- package/dist/validation/resource.d.ts.map +1 -0
- package/dist/validation/resource.js +16 -0
- package/dist/validation/resource.js.map +1 -0
- package/dist/validation/variable.d.ts +19 -0
- package/dist/validation/variable.d.ts.map +1 -0
- package/dist/validation/variable.js +21 -0
- package/dist/validation/variable.js.map +1 -0
- package/package.json +8 -6
|
@@ -10,29 +10,38 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { MenuItem, TextField } from '@mui/material';
|
|
15
|
+
import { forwardRef } from 'react';
|
|
15
16
|
import { useListPluginMetadata } from '../../runtime';
|
|
16
17
|
/**
|
|
17
18
|
* Displays a MUI Select input for selecting a plugin's kind from a list of all the available plugins of a specific
|
|
18
19
|
* plugin type. (e.g. "Show a list of all the Panel plugins" or "Show a list of all the Variable plugins").
|
|
19
|
-
*/ export
|
|
20
|
+
*/ export const PluginKindSelect = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
20
21
|
const { pluginType , value: propValue , ...others } = props;
|
|
21
22
|
const { data , isLoading } = useListPluginMetadata(pluginType);
|
|
22
23
|
// Pass an empty value while options are still loading so MUI doesn't complain about us using an "out of range" value
|
|
23
24
|
const value = propValue !== '' && isLoading ? '' : propValue;
|
|
24
25
|
// TODO: Does this need a loading indicator of some kind?
|
|
25
|
-
return /*#__PURE__*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
26
|
+
return /*#__PURE__*/ _jsxs(TextField, {
|
|
27
|
+
select: true,
|
|
28
|
+
inputRef: ref,
|
|
29
29
|
...others,
|
|
30
30
|
value: value,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
"data-testid": "plugin-kind-select",
|
|
32
|
+
children: [
|
|
33
|
+
isLoading && /*#__PURE__*/ _jsx(MenuItem, {
|
|
34
|
+
value: "",
|
|
35
|
+
children: "Loading..."
|
|
36
|
+
}),
|
|
37
|
+
data === null || data === void 0 ? void 0 : data.map((metadata)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
38
|
+
"data-testid": "option",
|
|
39
|
+
value: metadata.kind,
|
|
40
|
+
children: metadata.display.name
|
|
41
|
+
}, metadata.kind))
|
|
42
|
+
]
|
|
35
43
|
});
|
|
36
|
-
}
|
|
44
|
+
});
|
|
45
|
+
PluginKindSelect.displayName = 'PluginKindSelect';
|
|
37
46
|
|
|
38
47
|
//# sourceMappingURL=PluginKindSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginKindSelect/PluginKindSelect.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 {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginKindSelect/PluginKindSelect.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 { MenuItem, TextField, TextFieldProps } from '@mui/material';\nimport { forwardRef } from 'react';\nimport { PluginType } from '../../model';\nimport { useListPluginMetadata } from '../../runtime';\n\nexport interface PluginKindSelectProps extends Omit<TextFieldProps, 'children'> {\n pluginType: PluginType;\n}\n\n/**\n * Displays a MUI Select input for selecting a plugin's kind from a list of all the available plugins of a specific\n * plugin type. (e.g. \"Show a list of all the Panel plugins\" or \"Show a list of all the Variable plugins\").\n */\nexport const PluginKindSelect = forwardRef((props: PluginKindSelectProps, ref) => {\n const { pluginType, value: propValue, ...others } = props;\n const { data, isLoading } = useListPluginMetadata(pluginType);\n\n // Pass an empty value while options are still loading so MUI doesn't complain about us using an \"out of range\" value\n const value = propValue !== '' && isLoading ? '' : propValue;\n\n // TODO: Does this need a loading indicator of some kind?\n return (\n <TextField select inputRef={ref} {...others} value={value} data-testid=\"plugin-kind-select\">\n {isLoading && <MenuItem value=\"\">Loading...</MenuItem>}\n {data?.map((metadata) => (\n <MenuItem data-testid=\"option\" key={metadata.kind} value={metadata.kind}>\n {metadata.display.name}\n </MenuItem>\n ))}\n </TextField>\n );\n});\nPluginKindSelect.displayName = 'PluginKindSelect';\n"],"names":["MenuItem","TextField","forwardRef","useListPluginMetadata","PluginKindSelect","props","ref","pluginType","value","propValue","others","data","isLoading","select","inputRef","data-testid","map","metadata","kind","display","name","displayName"],"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,SAAS,QAAwB,gBAAgB;AACpE,SAASC,UAAU,QAAQ,QAAQ;AAEnC,SAASC,qBAAqB,QAAQ,gBAAgB;AAMtD;;;CAGC,GACD,OAAO,MAAMC,iCAAmBF,WAAW,CAACG,OAA8BC;IACxE,MAAM,EAAEC,WAAU,EAAEC,OAAOC,UAAS,EAAE,GAAGC,QAAQ,GAAGL;IACpD,MAAM,EAAEM,KAAI,EAAEC,UAAS,EAAE,GAAGT,sBAAsBI;IAElD,qHAAqH;IACrH,MAAMC,QAAQC,cAAc,MAAMG,YAAY,KAAKH;IAEnD,yDAAyD;IACzD,qBACE,MAACR;QAAUY,MAAM;QAACC,UAAUR;QAAM,GAAGI,MAAM;QAAEF,OAAOA;QAAOO,eAAY;;YACpEH,2BAAa,KAACZ;gBAASQ,OAAM;0BAAG;;YAChCG,iBAAAA,kBAAAA,KAAAA,IAAAA,KAAMK,IAAI,CAACC,yBACV,KAACjB;oBAASe,eAAY;oBAA6BP,OAAOS,SAASC;8BAChED,SAASE,QAAQC;mBADgBH,SAASC;;;AAMrD,GAAG;AACHd,iBAAiBiB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginKindSelect/index.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\nexport * from './PluginKindSelect';\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,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginKindSelect/index.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\nexport * from './PluginKindSelect';\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"}
|
|
@@ -19,7 +19,7 @@ import { usePluginIndexes, getTypeAndKindKey } from './plugin-indexes';
|
|
|
19
19
|
* PluginRegistryContext provider that keeps track of all available plugins and provides an API for getting them or
|
|
20
20
|
* querying the metadata about them.
|
|
21
21
|
*/ export function PluginRegistry(props) {
|
|
22
|
-
const { pluginLoader: { getInstalledPlugins , importPluginModule } , children , defaultPluginKinds
|
|
22
|
+
const { pluginLoader: { getInstalledPlugins , importPluginModule } , children , defaultPluginKinds } = props;
|
|
23
23
|
const getPluginIndexes = usePluginIndexes(getInstalledPlugins);
|
|
24
24
|
// De-dupe calls to import plugin modules
|
|
25
25
|
const importCache = useRef(new Map());
|
|
@@ -58,8 +58,8 @@ import { usePluginIndexes, getTypeAndKindKey } from './plugin-indexes';
|
|
|
58
58
|
]);
|
|
59
59
|
const listPluginMetadata = useCallback(async (pluginType)=>{
|
|
60
60
|
const pluginIndexes = await getPluginIndexes();
|
|
61
|
-
var
|
|
62
|
-
return (
|
|
61
|
+
var _pluginIndexes_pluginMetadataByType_get;
|
|
62
|
+
return (_pluginIndexes_pluginMetadataByType_get = pluginIndexes.pluginMetadataByType.get(pluginType)) !== null && _pluginIndexes_pluginMetadataByType_get !== void 0 ? _pluginIndexes_pluginMetadataByType_get : [];
|
|
63
63
|
}, [
|
|
64
64
|
getPluginIndexes
|
|
65
65
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginRegistry/PluginRegistry.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 { UnknownSpec, useEvent } from '@perses-dev/core';\nimport { useRef, useCallback, useMemo } from 'react';\nimport {\n PluginModuleResource,\n PluginType,\n PluginImplementation,\n Plugin,\n PluginLoader,\n DefaultPluginKinds,\n} from '../../model';\nimport { PluginRegistryContext } from '../../runtime';\nimport { usePluginIndexes, getTypeAndKindKey } from './plugin-indexes';\n\nexport interface PluginRegistryProps {\n pluginLoader: PluginLoader;\n defaultPluginKinds: DefaultPluginKinds;\n children?: React.ReactNode;\n}\n\n/**\n * PluginRegistryContext provider that keeps track of all available plugins and provides an API for getting them or\n * querying the metadata about them.\n */\nexport function PluginRegistry(props: PluginRegistryProps) {\n const {\n pluginLoader: { getInstalledPlugins, importPluginModule },\n children,\n defaultPluginKinds,\n } = props;\n\n const getPluginIndexes = usePluginIndexes(getInstalledPlugins);\n\n // De-dupe calls to import plugin modules\n const importCache = useRef(new Map<PluginModuleResource, Promise<unknown>>());\n\n // Do useEvent here since this accesses the importPluginModule prop and we want a stable reference to it for the\n // callback below\n const loadPluginModule = useEvent((resource: PluginModuleResource) => {\n let request = importCache.current.get(resource);\n if (request === undefined) {\n request = importPluginModule(resource);\n importCache.current.set(resource, request);\n\n // Remove failed requests from the cache so they can potentially be retried\n request.catch(() => importCache.current.delete(resource));\n }\n return request;\n });\n\n const getPlugin = useCallback(\n async <T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>> => {\n // Get the indexes of the installed plugins\n const pluginIndexes = await getPluginIndexes();\n\n // Figure out what module the plugin is in by looking in the index\n const typeAndKindKey = getTypeAndKindKey(pluginType, kind);\n const resource = pluginIndexes.pluginResourcesByTypeAndKind.get(typeAndKindKey);\n if (resource === undefined) {\n throw new Error(`A ${pluginType} plugin for kind '${kind}' is not installed`);\n }\n\n // Treat the plugin module as a bunch of named exports that have plugins\n const pluginModule = (await loadPluginModule(resource)) as Record<string, Plugin<UnknownSpec>>;\n\n // We currently assume that plugin modules will have named exports that match the kinds they handle\n const plugin = pluginModule[kind];\n if (plugin === undefined) {\n throw new Error(\n `The ${pluginType} plugin for kind '${kind}' is missing from the ${resource.metadata.name} plugin module`\n );\n }\n\n return plugin as PluginImplementation<T>;\n },\n [getPluginIndexes, loadPluginModule]\n );\n\n const listPluginMetadata = useCallback(\n async (pluginType: PluginType) => {\n const pluginIndexes = await getPluginIndexes();\n return pluginIndexes.pluginMetadataByType.get(pluginType) ?? [];\n },\n [getPluginIndexes]\n );\n\n // Create the registry's context value and render\n const context = useMemo(\n () => ({ getPlugin, listPluginMetadata, defaultPluginKinds }),\n [getPlugin, listPluginMetadata, defaultPluginKinds]\n );\n return <PluginRegistryContext.Provider value={context}>{children}</PluginRegistryContext.Provider>;\n}\n"],"names":["useEvent","useRef","useCallback","useMemo","PluginRegistryContext","usePluginIndexes","getTypeAndKindKey","PluginRegistry","props","pluginLoader","getInstalledPlugins","importPluginModule","children","defaultPluginKinds","getPluginIndexes","importCache","Map","loadPluginModule","resource","request","current","get","undefined","set","catch","delete","getPlugin","pluginType","kind","pluginIndexes","typeAndKindKey","pluginResourcesByTypeAndKind","Error","pluginModule","plugin","metadata","name","listPluginMetadata","pluginMetadataByType","context","Provider","value"],"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
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/PluginRegistry.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 { UnknownSpec, useEvent } from '@perses-dev/core';\nimport { useRef, useCallback, useMemo } from 'react';\nimport {\n PluginModuleResource,\n PluginType,\n PluginImplementation,\n Plugin,\n PluginLoader,\n DefaultPluginKinds,\n} from '../../model';\nimport { PluginRegistryContext } from '../../runtime';\nimport { usePluginIndexes, getTypeAndKindKey } from './plugin-indexes';\n\nexport interface PluginRegistryProps {\n pluginLoader: PluginLoader;\n defaultPluginKinds: DefaultPluginKinds;\n children?: React.ReactNode;\n}\n\n/**\n * PluginRegistryContext provider that keeps track of all available plugins and provides an API for getting them or\n * querying the metadata about them.\n */\nexport function PluginRegistry(props: PluginRegistryProps) {\n const {\n pluginLoader: { getInstalledPlugins, importPluginModule },\n children,\n defaultPluginKinds,\n } = props;\n\n const getPluginIndexes = usePluginIndexes(getInstalledPlugins);\n\n // De-dupe calls to import plugin modules\n const importCache = useRef(new Map<PluginModuleResource, Promise<unknown>>());\n\n // Do useEvent here since this accesses the importPluginModule prop and we want a stable reference to it for the\n // callback below\n const loadPluginModule = useEvent((resource: PluginModuleResource) => {\n let request = importCache.current.get(resource);\n if (request === undefined) {\n request = importPluginModule(resource);\n importCache.current.set(resource, request);\n\n // Remove failed requests from the cache so they can potentially be retried\n request.catch(() => importCache.current.delete(resource));\n }\n return request;\n });\n\n const getPlugin = useCallback(\n async <T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>> => {\n // Get the indexes of the installed plugins\n const pluginIndexes = await getPluginIndexes();\n\n // Figure out what module the plugin is in by looking in the index\n const typeAndKindKey = getTypeAndKindKey(pluginType, kind);\n const resource = pluginIndexes.pluginResourcesByTypeAndKind.get(typeAndKindKey);\n if (resource === undefined) {\n throw new Error(`A ${pluginType} plugin for kind '${kind}' is not installed`);\n }\n\n // Treat the plugin module as a bunch of named exports that have plugins\n const pluginModule = (await loadPluginModule(resource)) as Record<string, Plugin<UnknownSpec>>;\n\n // We currently assume that plugin modules will have named exports that match the kinds they handle\n const plugin = pluginModule[kind];\n if (plugin === undefined) {\n throw new Error(\n `The ${pluginType} plugin for kind '${kind}' is missing from the ${resource.metadata.name} plugin module`\n );\n }\n\n return plugin as PluginImplementation<T>;\n },\n [getPluginIndexes, loadPluginModule]\n );\n\n const listPluginMetadata = useCallback(\n async (pluginType: PluginType) => {\n const pluginIndexes = await getPluginIndexes();\n return pluginIndexes.pluginMetadataByType.get(pluginType) ?? [];\n },\n [getPluginIndexes]\n );\n\n // Create the registry's context value and render\n const context = useMemo(\n () => ({ getPlugin, listPluginMetadata, defaultPluginKinds }),\n [getPlugin, listPluginMetadata, defaultPluginKinds]\n );\n return <PluginRegistryContext.Provider value={context}>{children}</PluginRegistryContext.Provider>;\n}\n"],"names":["useEvent","useRef","useCallback","useMemo","PluginRegistryContext","usePluginIndexes","getTypeAndKindKey","PluginRegistry","props","pluginLoader","getInstalledPlugins","importPluginModule","children","defaultPluginKinds","getPluginIndexes","importCache","Map","loadPluginModule","resource","request","current","get","undefined","set","catch","delete","getPlugin","pluginType","kind","pluginIndexes","typeAndKindKey","pluginResourcesByTypeAndKind","Error","pluginModule","plugin","metadata","name","listPluginMetadata","pluginMetadataByType","context","Provider","value"],"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,SAAsBA,QAAQ,QAAQ,mBAAmB;AACzD,SAASC,MAAM,EAAEC,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AASrD,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,mBAAmB;AAQvE;;;CAGC,GACD,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EACJC,cAAc,EAAEC,oBAAmB,EAAEC,mBAAkB,EAAE,CAAA,EACzDC,SAAQ,EACRC,mBAAkB,EACnB,GAAGL;IAEJ,MAAMM,mBAAmBT,iBAAiBK;IAE1C,yCAAyC;IACzC,MAAMK,cAAcd,OAAO,IAAIe;IAE/B,gHAAgH;IAChH,iBAAiB;IACjB,MAAMC,mBAAmBjB,SAAS,CAACkB;QACjC,IAAIC,UAAUJ,YAAYK,QAAQC,IAAIH;QACtC,IAAIC,YAAYG,WAAW;YACzBH,UAAUR,mBAAmBO;YAC7BH,YAAYK,QAAQG,IAAIL,UAAUC;YAElC,2EAA2E;YAC3EA,QAAQK,MAAM,IAAMT,YAAYK,QAAQK,OAAOP;QACjD;QACA,OAAOC;IACT;IAEA,MAAMO,YAAYxB,YAChB,OAA6ByB,YAAeC;QAC1C,2CAA2C;QAC3C,MAAMC,gBAAgB,MAAMf;QAE5B,kEAAkE;QAClE,MAAMgB,iBAAiBxB,kBAAkBqB,YAAYC;QACrD,MAAMV,WAAWW,cAAcE,6BAA6BV,IAAIS;QAChE,IAAIZ,aAAaI,WAAW;YAC1B,MAAM,IAAIU,MAAM,CAAC,EAAE,EAAEL,WAAW,kBAAkB,EAAEC,KAAK,kBAAkB,CAAC;QAC9E;QAEA,wEAAwE;QACxE,MAAMK,eAAgB,MAAMhB,iBAAiBC;QAE7C,mGAAmG;QACnG,MAAMgB,SAASD,YAAY,CAACL,KAAK;QACjC,IAAIM,WAAWZ,WAAW;YACxB,MAAM,IAAIU,MACR,CAAC,IAAI,EAAEL,WAAW,kBAAkB,EAAEC,KAAK,sBAAsB,EAAEV,SAASiB,SAASC,KAAK,cAAc,CAAC;QAE7G;QAEA,OAAOF;IACT,GACA;QAACpB;QAAkBG;KAAiB;IAGtC,MAAMoB,qBAAqBnC,YACzB,OAAOyB;QACL,MAAME,gBAAgB,MAAMf;YACrBe;QAAP,OAAOA,CAAAA,0CAAAA,cAAcS,qBAAqBjB,IAAIM,yBAAvCE,qDAAAA,0CAAsD,EAAE;IACjE,GACA;QAACf;KAAiB;IAGpB,iDAAiD;IACjD,MAAMyB,UAAUpC,QACd,IAAO,CAAA;YAAEuB;YAAWW;YAAoBxB;QAAmB,CAAA,GAC3D;QAACa;QAAWW;QAAoBxB;KAAmB;IAErD,qBAAO,KAACT,sBAAsBoC;QAASC,OAAOF;kBAAU3B;;AAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginRegistry/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 './PluginRegistry';\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,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/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 './PluginRegistry';\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,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginRegistry/plugin-indexes.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\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,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/plugin-indexes.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\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,mBAAmB;AAC5C,SAASC,WAAW,EAAEC,MAAM,QAAQ,QAAQ;AAU5C;;CAEC,GACD,OAAO,SAASC,iBAAiBC,mBAAwD;IACvF,oHAAoH;IACpH,yDAAyD;IACzD,MAAMC,sBAAsBL,SAAS;QACnC,MAAMM,mBAAmB,MAAMF;QAE/B,oDAAoD;QACpD,MAAMG,+BAA+B,IAAIC;QACzC,MAAMC,uBAAuB,IAAID;QAEjC,KAAK,MAAME,YAAYJ,iBAAkB;YACvC,KAAK,MAAMK,kBAAkBD,SAASE,KAAKC,QAAS;gBAClD,MAAM,EAAEC,WAAU,EAAEC,KAAI,EAAE,GAAGJ;gBAE7B,4EAA4E;gBAC5E,MAAMK,MAAMC,kBAAkBH,YAAYC;gBAC1C,IAAIR,6BAA6BW,IAAIF,MAAM;oBACzCG,QAAQC,KAAK,CAAC,kBAAkB,EAAEN,WAAW,iBAAiB,EAAEC,KAAK,CAAC;gBACxE;gBACAR,6BAA6Bc,IAAIL,KAAKN;gBAEtC,oCAAoC;gBACpC,IAAIY,OAAOb,qBAAqBc,IAAIT;gBACpC,IAAIQ,SAASE,WAAW;oBACtBF,OAAO,EAAE;oBACTb,qBAAqBY,IAAIP,YAAYQ;gBACvC;gBACAA,KAAKG,KAAKd;YACZ;QACF;QAEA,OAAO;YACLJ;YACAE;QACF;IACF;IAEA,2EAA2E;IAC3E,MAAMiB,qBAAqBxB,OAA2CsB;IACtE,MAAMG,mBAAmB1B,YAAY;QACnC,IAAI2B,UAAUF,mBAAmBG;QACjC,IAAID,YAAYJ,WAAW;YACzBI,UAAUvB;YACVqB,mBAAmBG,UAAUD;YAE7B,2EAA2E;YAC3EA,QAAQE,MAAM,IAAMJ,mBAAmBG,YAAYL;QACrD;QACA,OAAOI;IACT,GAAG;QAACvB;KAAoB;IAExB,OAAOsB;AACT;AAEA;;CAEC,GACD,OAAO,SAASV,kBAAkBH,UAAsB,EAAEC,IAAY;IACpE,OAAO,CAAC,EAAED,WAAW,CAAC,EAAEC,KAAK,CAAC;AAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginSpecEditor/PluginSpecEditor.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 { 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 implementation for ${pluginType} plugin with kind '${pluginKind}'`);\n }\n\n if (pluginType === 'Panel') {\n throw new Error('This editor should not be used for panel type. Please use Panel Spec Editor instead.');\n }\n\n const { OptionsEditorComponent } = plugin;\n\n if (OptionsEditorComponent !== undefined) {\n return <OptionsEditorComponent {...others} />;\n }\n\n return null;\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
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginSpecEditor/PluginSpecEditor.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 { 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 implementation for ${pluginType} plugin with kind '${pluginKind}'`);\n }\n\n if (pluginType === 'Panel') {\n throw new Error('This editor should not be used for panel type. Please use Panel Spec Editor instead.');\n }\n\n const { OptionsEditorComponent } = plugin;\n\n if (OptionsEditorComponent !== undefined) {\n return <OptionsEditorComponent {...others} />;\n }\n\n return null;\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,SAASA,UAAU,QAAQ,yBAAyB;AAGpD,SAASC,SAAS,QAAQ,gBAAgB;AAO1C,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,WAAU,EAAEC,WAAU,EAAE,GAAGC,QAAQ,GAAGH;IAC9C,MAAM,EAAEI,MAAMC,OAAM,EAAEC,UAAS,EAAEC,MAAK,EAAE,GAAGT,UAAUG,YAAYC;IAEjE,IAAIK,OAAO;QACT,qBAAO,KAACV;YAAWU,OAAOA;;IAC5B;IAEA,iCAAiC;IACjC,IAAID,WAAW;QACb,OAAO;IACT;IAEA,IAAID,WAAWG,WAAW;QACxB,MAAM,IAAIC,MAAM,CAAC,2BAA2B,EAAER,WAAW,mBAAmB,EAAEC,WAAW,CAAC,CAAC;IAC7F;IAEA,IAAID,eAAe,SAAS;QAC1B,MAAM,IAAIQ,MAAM;IAClB;IAEA,MAAM,EAAEC,uBAAsB,EAAE,GAAGL;IAEnC,IAAIK,2BAA2BF,WAAW;QACxC,qBAAO,KAACE;YAAwB,GAAGP,MAAM;;IAC3C;IAEA,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginSpecEditor/index.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\nexport * from './PluginSpecEditor';\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,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginSpecEditor/index.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\nexport * from './PluginSpecEditor';\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"}
|
|
@@ -21,8 +21,8 @@ const DEFAULT_QUERY_PLUGIN_TYPE = 'TimeSeriesQuery';
|
|
|
21
21
|
export function TimeSeriesQueryEditor({ queries =[] , onChange }) {
|
|
22
22
|
const hasMoreThanOneQuery = queries.length > 1;
|
|
23
23
|
const { defaultPluginKinds } = usePluginRegistry();
|
|
24
|
-
var
|
|
25
|
-
const defaultTimeSeriesQueryKind = (
|
|
24
|
+
var _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE;
|
|
25
|
+
const defaultTimeSeriesQueryKind = (_defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds[DEFAULT_QUERY_PLUGIN_TYPE]) !== null && _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE !== void 0 ? _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE : '';
|
|
26
26
|
const { data: defaultQueryPlugin } = usePlugin(DEFAULT_QUERY_PLUGIN_TYPE, defaultTimeSeriesQueryKind, {
|
|
27
27
|
useErrorBoundary: true,
|
|
28
28
|
enabled: true
|
|
@@ -89,14 +89,14 @@ export function TimeSeriesQueryEditor({ queries =[] , onChange }) {
|
|
|
89
89
|
];
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
|
-
var
|
|
92
|
+
var _defaultPluginKinds_TimeSeriesQuery;
|
|
93
93
|
// show one query input if queries is empty
|
|
94
94
|
const queryDefinitions = queries.length ? queries : [
|
|
95
95
|
{
|
|
96
96
|
kind: 'TimeSeriesQuery',
|
|
97
97
|
spec: {
|
|
98
98
|
plugin: {
|
|
99
|
-
kind: (
|
|
99
|
+
kind: (_defaultPluginKinds_TimeSeriesQuery = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds['TimeSeriesQuery']) !== null && _defaultPluginKinds_TimeSeriesQuery !== void 0 ? _defaultPluginKinds_TimeSeriesQuery : '',
|
|
100
100
|
spec: {
|
|
101
101
|
query: ''
|
|
102
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.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 { useState } from 'react';\nimport { produce } from 'immer';\nimport { Button, Stack } from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { TimeSeriesQueryDefinition, QueryDefinition } from '@perses-dev/core';\nimport { usePlugin, usePluginRegistry } from '../../runtime';\nimport { TimeSeriesQueryInput } from './TimeSeriesQueryInput';\n\nconst DEFAULT_QUERY_PLUGIN_TYPE = 'TimeSeriesQuery';\n\nexport interface TimeSeriesQueryEditorProps {\n queries?: TimeSeriesQueryDefinition[];\n onChange: (queries: QueryDefinition[]) => void;\n}\n\nexport function TimeSeriesQueryEditor({ queries = [], onChange }: TimeSeriesQueryEditorProps) {\n const hasMoreThanOneQuery = queries.length > 1;\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultTimeSeriesQueryKind = defaultPluginKinds?.[DEFAULT_QUERY_PLUGIN_TYPE] ?? '';\n\n const { data: defaultQueryPlugin } = usePlugin(DEFAULT_QUERY_PLUGIN_TYPE, defaultTimeSeriesQueryKind, {\n useErrorBoundary: true,\n enabled: true,\n });\n\n // State for which queries are collapsed\n // TODO: Would be easier if we had IDs for queries.\n const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(() => false));\n\n // Query handlers\n const handleQueryChange = (index: number, queryDef: TimeSeriesQueryDefinition) => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft[index] = queryDef;\n } else {\n draft = [queryDef];\n }\n })\n );\n };\n\n const handleQueryAdd = () => {\n if (!defaultQueryPlugin) return;\n onChange(\n produce(queries, (draft) => {\n const queryDef: TimeSeriesQueryDefinition = {\n kind: DEFAULT_QUERY_PLUGIN_TYPE,\n spec: {\n plugin: { kind: defaultTimeSeriesQueryKind, spec: defaultQueryPlugin.createInitialOptions() },\n },\n };\n if (draft) {\n draft.push(queryDef);\n } else {\n draft = [...queries, queryDef];\n }\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.push(false);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryDelete = (index: number) => {\n onChange(\n produce(queries, (draft) => {\n draft.splice(index, 1);\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.splice(index, 1);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryCollapseExpand = (index: number) => {\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed[index] = !queriesCollapsed[index];\n return [...queriesCollapsed];\n });\n };\n\n // show one query input if queries is empty\n const queryDefinitions: TimeSeriesQueryDefinition[] = queries.length\n ? queries\n : [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: defaultPluginKinds?.['TimeSeriesQuery'] ?? '',\n spec: {\n query: '',\n },\n },\n },\n },\n ];\n\n return (\n <Stack spacing={1}>\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginLeft: 'auto' }} onClick={handleQueryAdd}>\n Add Query\n </Button>\n {queryDefinitions.map((query: TimeSeriesQueryDefinition, i: number) => (\n <TimeSeriesQueryInput\n key={i}\n index={i}\n query={query}\n isCollapsed={!!queriesCollapsed[i]}\n onChange={handleQueryChange}\n onDelete={hasMoreThanOneQuery ? handleQueryDelete : undefined}\n onCollapseExpand={handleQueryCollapseExpand}\n />\n ))}\n </Stack>\n );\n}\n"],"names":["useState","produce","Button","Stack","AddIcon","usePlugin","usePluginRegistry","TimeSeriesQueryInput","DEFAULT_QUERY_PLUGIN_TYPE","TimeSeriesQueryEditor","queries","onChange","hasMoreThanOneQuery","length","defaultPluginKinds","defaultTimeSeriesQueryKind","data","defaultQueryPlugin","useErrorBoundary","enabled","queriesCollapsed","setQueriesCollapsed","map","handleQueryChange","index","queryDef","draft","handleQueryAdd","kind","spec","plugin","createInitialOptions","push","handleQueryDelete","splice","handleQueryCollapseExpand","queryDefinitions","query","spacing","variant","startIcon","sx","marginLeft","onClick","i","isCollapsed","onDelete","undefined","onCollapseExpand"],"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
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.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 { useState } from 'react';\nimport { produce } from 'immer';\nimport { Button, Stack } from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { TimeSeriesQueryDefinition, QueryDefinition } from '@perses-dev/core';\nimport { usePlugin, usePluginRegistry } from '../../runtime';\nimport { TimeSeriesQueryInput } from './TimeSeriesQueryInput';\n\nconst DEFAULT_QUERY_PLUGIN_TYPE = 'TimeSeriesQuery';\n\nexport interface TimeSeriesQueryEditorProps {\n queries?: TimeSeriesQueryDefinition[];\n onChange: (queries: QueryDefinition[]) => void;\n}\n\nexport function TimeSeriesQueryEditor({ queries = [], onChange }: TimeSeriesQueryEditorProps) {\n const hasMoreThanOneQuery = queries.length > 1;\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultTimeSeriesQueryKind = defaultPluginKinds?.[DEFAULT_QUERY_PLUGIN_TYPE] ?? '';\n\n const { data: defaultQueryPlugin } = usePlugin(DEFAULT_QUERY_PLUGIN_TYPE, defaultTimeSeriesQueryKind, {\n useErrorBoundary: true,\n enabled: true,\n });\n\n // State for which queries are collapsed\n // TODO: Would be easier if we had IDs for queries.\n const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(() => false));\n\n // Query handlers\n const handleQueryChange = (index: number, queryDef: TimeSeriesQueryDefinition) => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft[index] = queryDef;\n } else {\n draft = [queryDef];\n }\n })\n );\n };\n\n const handleQueryAdd = () => {\n if (!defaultQueryPlugin) return;\n onChange(\n produce(queries, (draft) => {\n const queryDef: TimeSeriesQueryDefinition = {\n kind: DEFAULT_QUERY_PLUGIN_TYPE,\n spec: {\n plugin: { kind: defaultTimeSeriesQueryKind, spec: defaultQueryPlugin.createInitialOptions() },\n },\n };\n if (draft) {\n draft.push(queryDef);\n } else {\n draft = [...queries, queryDef];\n }\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.push(false);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryDelete = (index: number) => {\n onChange(\n produce(queries, (draft) => {\n draft.splice(index, 1);\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.splice(index, 1);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryCollapseExpand = (index: number) => {\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed[index] = !queriesCollapsed[index];\n return [...queriesCollapsed];\n });\n };\n\n // show one query input if queries is empty\n const queryDefinitions: TimeSeriesQueryDefinition[] = queries.length\n ? queries\n : [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: defaultPluginKinds?.['TimeSeriesQuery'] ?? '',\n spec: {\n query: '',\n },\n },\n },\n },\n ];\n\n return (\n <Stack spacing={1}>\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginLeft: 'auto' }} onClick={handleQueryAdd}>\n Add Query\n </Button>\n {queryDefinitions.map((query: TimeSeriesQueryDefinition, i: number) => (\n <TimeSeriesQueryInput\n key={i}\n index={i}\n query={query}\n isCollapsed={!!queriesCollapsed[i]}\n onChange={handleQueryChange}\n onDelete={hasMoreThanOneQuery ? handleQueryDelete : undefined}\n onCollapseExpand={handleQueryCollapseExpand}\n />\n ))}\n </Stack>\n );\n}\n"],"names":["useState","produce","Button","Stack","AddIcon","usePlugin","usePluginRegistry","TimeSeriesQueryInput","DEFAULT_QUERY_PLUGIN_TYPE","TimeSeriesQueryEditor","queries","onChange","hasMoreThanOneQuery","length","defaultPluginKinds","defaultTimeSeriesQueryKind","data","defaultQueryPlugin","useErrorBoundary","enabled","queriesCollapsed","setQueriesCollapsed","map","handleQueryChange","index","queryDef","draft","handleQueryAdd","kind","spec","plugin","createInitialOptions","push","handleQueryDelete","splice","handleQueryCollapseExpand","queryDefinitions","query","spacing","variant","startIcon","sx","marginLeft","onClick","i","isCollapsed","onDelete","undefined","onCollapseExpand"],"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,QAAQ;AACjC,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAC9C,OAAOC,aAAa,uBAAuB;AAE3C,SAASC,SAAS,EAAEC,iBAAiB,QAAQ,gBAAgB;AAC7D,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,MAAMC,4BAA4B;AAOlC,OAAO,SAASC,sBAAsB,EAAEC,SAAU,EAAE,CAAA,EAAEC,SAAQ,EAA8B;IAC1F,MAAMC,sBAAsBF,QAAQG,SAAS;IAC7C,MAAM,EAAEC,mBAAkB,EAAE,GAAGR;QACIQ;IAAnC,MAAMC,6BAA6BD,CAAAA,gDAAAA,+BAAAA,gCAAAA,KAAAA,IAAAA,kBAAoB,CAACN,0BAA0B,cAA/CM,2DAAAA,gDAAmD;IAEtF,MAAM,EAAEE,MAAMC,mBAAkB,EAAE,GAAGZ,UAAUG,2BAA2BO,4BAA4B;QACpGG,kBAAkB;QAClBC,SAAS;IACX;IAEA,wCAAwC;IACxC,mDAAmD;IACnD,MAAM,CAACC,kBAAkBC,oBAAoB,GAAGrB,SAASU,QAAQY,IAAI,IAAM;IAE3E,iBAAiB;IACjB,MAAMC,oBAAoB,CAACC,OAAeC;QACxCd,SACEV,QAAQS,SAAS,CAACgB;YAChB,IAAIA,OAAO;gBACTA,KAAK,CAACF,MAAM,GAAGC;YACjB,OAAO;gBACLC,QAAQ;oBAACD;iBAAS;YACpB;QACF;IAEJ;IAEA,MAAME,iBAAiB;QACrB,IAAI,CAACV,oBAAoB;QACzBN,SACEV,QAAQS,SAAS,CAACgB;YAChB,MAAMD,WAAsC;gBAC1CG,MAAMpB;gBACNqB,MAAM;oBACJC,QAAQ;wBAAEF,MAAMb;wBAA4Bc,MAAMZ,mBAAmBc;oBAAuB;gBAC9F;YACF;YACA,IAAIL,OAAO;gBACTA,MAAMM,KAAKP;YACb,OAAO;gBACLC,QAAQ;uBAAIhB;oBAASe;iBAAS;YAChC;QACF;QAEFJ,oBAAoB,CAACD;YACnBA,iBAAiBY,KAAK;YACtB,OAAO;mBAAIZ;aAAiB;QAC9B;IACF;IAEA,MAAMa,oBAAoB,CAACT;QACzBb,SACEV,QAAQS,SAAS,CAACgB;YAChBA,MAAMQ,OAAOV,OAAO;QACtB;QAEFH,oBAAoB,CAACD;YACnBA,iBAAiBc,OAAOV,OAAO;YAC/B,OAAO;mBAAIJ;aAAiB;QAC9B;IACF;IAEA,MAAMe,4BAA4B,CAACX;QACjCH,oBAAoB,CAACD;YACnBA,gBAAgB,CAACI,MAAM,GAAG,CAACJ,gBAAgB,CAACI,MAAM;YAClD,OAAO;mBAAIJ;aAAiB;QAC9B;IACF;QAUkBN;IARlB,2CAA2C;IAC3C,MAAMsB,mBAAgD1B,QAAQG,SAC1DH,UACA;QACE;YACEkB,MAAM;YACNC,MAAM;gBACJC,QAAQ;oBACNF,MAAMd,CAAAA,sCAAAA,+BAAAA,gCAAAA,KAAAA,IAAAA,kBAAoB,CAAC,kBAAkB,cAAvCA,iDAAAA,sCAA2C;oBACjDe,MAAM;wBACJQ,OAAO;oBACT;gBACF;YACF;QACF;KACD;IAEL,qBACE,MAAClC;QAAMmC,SAAS;;0BACd,KAACpC;gBAAOqC,SAAQ;gBAAYC,yBAAW,KAACpC;gBAAYqC,IAAI;oBAAEC,YAAY;gBAAO;gBAAGC,SAAShB;0BAAgB;;YAGxGS,iBAAiBd,IAAI,CAACe,OAAkCO,kBACvD,KAACrC;oBAECiB,OAAOoB;oBACPP,OAAOA;oBACPQ,aAAa,CAAC,CAACzB,gBAAgB,CAACwB,EAAE;oBAClCjC,UAAUY;oBACVuB,UAAUlC,sBAAsBqB,oBAAoBc;oBACpDC,kBAAkBb;mBANbS;;;AAWf"}
|
|
@@ -63,7 +63,7 @@ export const TimeSeriesQueryInput = ({ index , query , isCollapsed , onDelete ,
|
|
|
63
63
|
* Displays an editor for TimeSeriesQueryDefinition objects.
|
|
64
64
|
*/ function QueryEditor(props) {
|
|
65
65
|
const { value , onChange , ...others } = props;
|
|
66
|
-
const { spec: { plugin }
|
|
66
|
+
const { spec: { plugin } } = value;
|
|
67
67
|
const handlePluginChange = (next)=>{
|
|
68
68
|
onChange(produce(value, (draft)=>{
|
|
69
69
|
draft.spec.plugin = next;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.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 produce from 'immer';\nimport { TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { Stack, IconButton, Typography, BoxProps, Box } from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport { PluginEditor, PluginEditorProps } from '../PluginEditor';\n\ninterface TimeSeriesQueryInputProps {\n query: TimeSeriesQueryDefinition;\n index: number;\n onChange: (index: number, query: TimeSeriesQueryDefinition) => void;\n onCollapseExpand: (index: number) => void;\n isCollapsed?: boolean;\n onDelete?: (index: number) => void;\n}\n\nexport const TimeSeriesQueryInput = ({\n index,\n query,\n isCollapsed,\n onDelete,\n onChange,\n onCollapseExpand,\n}: TimeSeriesQueryInputProps) => {\n return (\n <Stack key={index} spacing={1}>\n <Stack direction=\"row\" alignItems=\"center\" borderBottom={1} borderColor={(theme) => theme.palette.divider}>\n <IconButton size=\"small\" onClick={() => onCollapseExpand(index)}>\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\">\n Query {index + 1}\n </Typography>\n <IconButton\n size=\"small\"\n // Use `visibility` to ensure that the row has the same height when delete button is visible or not visible\n sx={{ marginLeft: 'auto', visibility: `${onDelete ? 'visible' : 'hidden'}` }}\n onClick={() => onDelete && onDelete(index)}\n >\n <DeleteIcon />\n </IconButton>\n </Stack>\n {!isCollapsed && <QueryEditor value={query} onChange={(next) => onChange(index, next)} />}\n </Stack>\n );\n};\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\ninterface QueryEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n value: TimeSeriesQueryDefinition;\n onChange: (next: TimeSeriesQueryDefinition) => void;\n}\n\n/**\n * Displays an editor for TimeSeriesQueryDefinition objects.\n */\nfunction QueryEditor(props: QueryEditorProps) {\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":["produce","Stack","IconButton","Typography","Box","DeleteIcon","ChevronDown","ChevronRight","PluginEditor","TimeSeriesQueryInput","index","query","isCollapsed","onDelete","onChange","onCollapseExpand","spacing","direction","alignItems","borderBottom","borderColor","theme","palette","divider","size","onClick","variant","component","sx","marginLeft","visibility","QueryEditor","value","next","props","others","spec","plugin","handlePluginChange","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
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.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 produce from 'immer';\nimport { TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { Stack, IconButton, Typography, BoxProps, Box } from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport { PluginEditor, PluginEditorProps } from '../PluginEditor';\n\ninterface TimeSeriesQueryInputProps {\n query: TimeSeriesQueryDefinition;\n index: number;\n onChange: (index: number, query: TimeSeriesQueryDefinition) => void;\n onCollapseExpand: (index: number) => void;\n isCollapsed?: boolean;\n onDelete?: (index: number) => void;\n}\n\nexport const TimeSeriesQueryInput = ({\n index,\n query,\n isCollapsed,\n onDelete,\n onChange,\n onCollapseExpand,\n}: TimeSeriesQueryInputProps) => {\n return (\n <Stack key={index} spacing={1}>\n <Stack direction=\"row\" alignItems=\"center\" borderBottom={1} borderColor={(theme) => theme.palette.divider}>\n <IconButton size=\"small\" onClick={() => onCollapseExpand(index)}>\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\">\n Query {index + 1}\n </Typography>\n <IconButton\n size=\"small\"\n // Use `visibility` to ensure that the row has the same height when delete button is visible or not visible\n sx={{ marginLeft: 'auto', visibility: `${onDelete ? 'visible' : 'hidden'}` }}\n onClick={() => onDelete && onDelete(index)}\n >\n <DeleteIcon />\n </IconButton>\n </Stack>\n {!isCollapsed && <QueryEditor value={query} onChange={(next) => onChange(index, next)} />}\n </Stack>\n );\n};\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\ninterface QueryEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n value: TimeSeriesQueryDefinition;\n onChange: (next: TimeSeriesQueryDefinition) => void;\n}\n\n/**\n * Displays an editor for TimeSeriesQueryDefinition objects.\n */\nfunction QueryEditor(props: QueryEditorProps) {\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":["produce","Stack","IconButton","Typography","Box","DeleteIcon","ChevronDown","ChevronRight","PluginEditor","TimeSeriesQueryInput","index","query","isCollapsed","onDelete","onChange","onCollapseExpand","spacing","direction","alignItems","borderBottom","borderColor","theme","palette","divider","size","onClick","variant","component","sx","marginLeft","visibility","QueryEditor","value","next","props","others","spec","plugin","handlePluginChange","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,OAAOA,aAAa,QAAQ;AAE5B,SAASC,KAAK,EAAEC,UAAU,EAAEC,UAAU,EAAYC,GAAG,QAAQ,gBAAgB;AAC7E,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,kBAAkB,+BAA+B;AACxD,SAASC,YAAY,QAA2B,kBAAkB;AAWlE,OAAO,MAAMC,uBAAuB,CAAC,EACnCC,MAAK,EACLC,MAAK,EACLC,YAAW,EACXC,SAAQ,EACRC,SAAQ,EACRC,iBAAgB,EACU;IAC1B,qBACE,MAACd;QAAkBe,SAAS;;0BAC1B,MAACf;gBAAMgB,WAAU;gBAAMC,YAAW;gBAASC,cAAc;gBAAGC,aAAa,CAACC,QAAUA,MAAMC,QAAQC;;kCAChG,KAACrB;wBAAWsB,MAAK;wBAAQC,SAAS,IAAMV,iBAAiBL;kCACtDE,4BAAc,KAACL,kCAAkB,KAACD;;kCAErC,MAACH;wBAAWuB,SAAQ;wBAAWC,WAAU;;4BAAK;4BACrCjB,QAAQ;;;kCAEjB,KAACR;wBACCsB,MAAK;wBACL,2GAA2G;wBAC3GI,IAAI;4BAAEC,YAAY;4BAAQC,YAAY,CAAC,EAAEjB,WAAW,YAAY,SAAS,CAAC;wBAAC;wBAC3EY,SAAS,IAAMZ,YAAYA,SAASH;kCAEpC,cAAA,KAACL;;;;YAGJ,CAACO,6BAAe,KAACmB;gBAAYC,OAAOrB;gBAAOG,UAAU,CAACmB,OAASnB,SAASJ,OAAOuB;;;OAjBtEvB;AAoBhB,EAAE;AAWF;;CAEC,GACD,SAASqB,YAAYG,KAAuB;IAC1C,MAAM,EAAEF,MAAK,EAAElB,SAAQ,EAAE,GAAGqB,QAAQ,GAAGD;IACvC,MAAM,EACJE,MAAM,EAAEC,OAAM,EAAE,CAAA,EACjB,GAAGL;IAEJ,MAAMM,qBAAoD,CAACL;QACzDnB,SACEd,QAAQgC,OAAO,CAACO;YACdA,MAAMH,KAAKC,SAASJ;QACtB;IAEJ;IAEA,qBACE,KAAC7B;QAAK,GAAG+B,MAAM;kBAEb,cAAA,KAAC3B;YACCgC,YAAW;YACXC,iBAAgB;YAChBT,OAAOK;YACPvB,UAAUwB;;;AAIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/index.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\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,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/index.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\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,0BAA0B"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { DispatchWithoutAction } from 'react';
|
|
2
2
|
import { VariableDefinition } from '@perses-dev/core';
|
|
3
|
-
|
|
4
|
-
interface
|
|
3
|
+
import { Action } from '../../../utils';
|
|
4
|
+
interface VariableEditorFormProps {
|
|
5
5
|
initialVariableDefinition: VariableDefinition;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
initialAction: Action;
|
|
7
|
+
isDraft: boolean;
|
|
8
|
+
isReadonly?: boolean;
|
|
9
|
+
onSave: (def: VariableDefinition) => void;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onDelete?: DispatchWithoutAction;
|
|
9
12
|
}
|
|
10
|
-
export declare function
|
|
13
|
+
export declare function VariableEditorForm(props: VariableEditorFormProps): JSX.Element;
|
|
11
14
|
export {};
|
|
12
15
|
//# sourceMappingURL=VariableEditorForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariableEditorForm.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/VariableEditorForm.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"VariableEditorForm.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/VariableEditorForm.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAE,qBAAqB,EAAkC,MAAM,OAAO,CAAC;AAerF,OAAO,EAAE,kBAAkB,EAA0B,MAAM,kBAAkB,CAAC;AAI9E,OAAO,EAAE,MAAM,EAAiC,MAAM,gBAAgB,CAAC;AAWvE,UAAU,uBAAuB;IAC/B,yBAAyB,EAAE,kBAAkB,CAAC;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAuYhE"}
|