@perses-dev/plugin-system 0.54.0-beta.0 → 0.54.0-beta.10
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/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +283 -0
- package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +197 -0
- package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +30 -0
- package/dist/cjs/components/Annotations/constants.js +23 -0
- package/dist/cjs/components/Annotations/index.js +31 -0
- package/dist/cjs/components/CalculationSelector/CalculationSelector.js +3 -3
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +2 -3
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +4 -5
- package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +97 -12
- package/dist/cjs/components/MultiQueryEditor/index.js +1 -0
- package/dist/cjs/{utils/action.js → components/MultiQueryEditor/utils.js} +8 -15
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +3 -6
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -15
- package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +92 -0
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +16 -13
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +2 -3
- package/dist/cjs/components/Variables/variable-model.js +115 -29
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/context/ValidationProvider.js +10 -4
- package/dist/cjs/model/alerts-queries.js +16 -0
- package/dist/cjs/model/annotations.js +16 -0
- package/dist/cjs/model/calculations.js +178 -0
- package/dist/cjs/model/index.js +4 -0
- package/dist/cjs/model/legend.js +6 -5
- package/dist/cjs/model/log-volume-utils.js +10 -10
- package/dist/cjs/model/plugin-loading.js +24 -8
- package/dist/cjs/model/plugins.js +10 -0
- package/dist/cjs/model/silences-queries.js +16 -0
- package/dist/cjs/model/time-series-queries.js +10 -0
- package/dist/cjs/remote/PluginRuntime.js +46 -10
- package/dist/cjs/remote/remotePluginLoader.js +28 -5
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +33 -24
- package/dist/cjs/runtime/DataQueriesProvider/model.js +3 -93
- package/dist/cjs/runtime/UsageMetricsProvider.js +2 -2
- package/dist/cjs/runtime/alerts-queries.js +101 -0
- package/dist/cjs/runtime/annotations.js +148 -0
- package/dist/cjs/runtime/index.js +3 -1
- package/dist/cjs/runtime/item-actions.js +3 -3
- package/dist/cjs/runtime/log-queries.js +4 -1
- package/dist/cjs/runtime/plugin-registry.js +12 -3
- package/dist/cjs/runtime/profile-queries.js +4 -1
- package/dist/cjs/runtime/silences-queries.js +101 -0
- package/dist/cjs/runtime/time-series-queries.js +4 -1
- package/dist/cjs/runtime/trace-queries.js +4 -1
- package/dist/cjs/test/mock-data.js +51 -0
- package/dist/cjs/test/test-plugins/bert/index.js +9 -12
- package/dist/cjs/test/test-plugins/ernie/index.js +9 -12
- package/dist/cjs/test/test-plugins/index.js +2 -2
- package/dist/cjs/test/utils.js +2 -2
- package/dist/cjs/test-utils/mock-plugin-registry.js +8 -2
- package/dist/cjs/utils/index.js +0 -1
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts +16 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +270 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts +8 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +184 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/index.d.ts +2 -0
- package/dist/components/Annotations/AnnotationEditorForm/index.d.ts.map +1 -0
- package/dist/{runtime/QueryCountProvider.js → components/Annotations/AnnotationEditorForm/index.js} +2 -13
- package/dist/components/Annotations/AnnotationEditorForm/index.js.map +1 -0
- package/dist/components/Annotations/constants.d.ts +2 -0
- package/dist/components/Annotations/constants.d.ts.map +1 -0
- package/dist/components/Annotations/constants.js +15 -0
- package/dist/components/Annotations/constants.js.map +1 -0
- package/dist/components/Annotations/index.d.ts +3 -0
- package/dist/components/Annotations/index.d.ts.map +1 -0
- package/dist/components/Annotations/index.js +16 -0
- package/dist/components/Annotations/index.js.map +1 -0
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js +2 -2
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +2 -3
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.js +2 -2
- package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +2 -2
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -3
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js +100 -15
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
- package/dist/components/MultiQueryEditor/index.d.ts +1 -0
- package/dist/components/MultiQueryEditor/index.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/index.js +1 -0
- package/dist/components/MultiQueryEditor/index.js.map +1 -1
- package/dist/components/MultiQueryEditor/utils.d.ts +8 -0
- package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -0
- package/dist/{utils/action.js → components/MultiQueryEditor/utils.js} +8 -12
- package/dist/components/MultiQueryEditor/utils.js.map +1 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +5 -8
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +1 -1
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +12 -16
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +12 -0
- package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -0
- package/dist/components/PluginRegistry/getPluginSearchHelper.js +88 -0
- package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -0
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -6
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +15 -13
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +1 -1
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +2 -3
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts +9 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +117 -31
- 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/context/ValidationProvider.d.ts +4 -2
- package/dist/context/ValidationProvider.d.ts.map +1 -1
- package/dist/context/ValidationProvider.js +10 -4
- package/dist/context/ValidationProvider.js.map +1 -1
- package/dist/model/alerts-queries.d.ts +33 -0
- package/dist/model/alerts-queries.d.ts.map +1 -0
- package/dist/model/alerts-queries.js +15 -0
- package/dist/model/alerts-queries.js.map +1 -0
- package/dist/model/annotations.d.ts +28 -0
- package/dist/model/annotations.d.ts.map +1 -0
- package/dist/model/annotations.js +17 -0
- package/dist/model/annotations.js.map +1 -0
- package/dist/model/calculations.d.ts +45 -0
- package/dist/model/calculations.d.ts.map +1 -0
- package/dist/model/calculations.js +165 -0
- package/dist/model/calculations.js.map +1 -0
- package/dist/model/index.d.ts +4 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +4 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +3 -2
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +2 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/log-queries.d.ts +2 -1
- package/dist/model/log-queries.d.ts.map +1 -1
- package/dist/model/log-queries.js.map +1 -1
- package/dist/model/plugin-loading.d.ts.map +1 -1
- package/dist/model/plugin-loading.js +24 -8
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.d.ts +23 -0
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js +4 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/silences-queries.d.ts +33 -0
- package/dist/model/silences-queries.d.ts.map +1 -0
- package/dist/model/silences-queries.js +15 -0
- package/dist/model/silences-queries.js.map +1 -0
- package/dist/model/time-series-queries.d.ts +11 -1
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js +4 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/trace-queries.d.ts +2 -3
- package/dist/model/trace-queries.d.ts.map +1 -1
- package/dist/model/trace-queries.js.map +1 -1
- package/dist/remote/PersesPlugin.types.d.ts +2 -0
- package/dist/remote/PersesPlugin.types.d.ts.map +1 -1
- package/dist/remote/PersesPlugin.types.js.map +1 -1
- package/dist/remote/PluginLoaderComponent.js +1 -1
- package/dist/remote/PluginLoaderComponent.js.map +1 -1
- package/dist/remote/PluginRuntime.d.ts +7 -1
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.js +46 -10
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/dist/remote/remotePluginLoader.d.ts.map +1 -1
- package/dist/remote/remotePluginLoader.js +28 -5
- package/dist/remote/remotePluginLoader.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +35 -26
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +4 -4
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +0 -82
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/RouterProvider.js +1 -1
- package/dist/runtime/RouterProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.js +2 -2
- package/dist/runtime/UsageMetricsProvider.js.map +1 -1
- package/dist/runtime/alerts-queries.d.ts +11 -0
- package/dist/runtime/alerts-queries.d.ts.map +1 -0
- package/dist/runtime/alerts-queries.js +89 -0
- package/dist/runtime/alerts-queries.js.map +1 -0
- package/dist/runtime/annotations.d.ts +6 -0
- package/dist/runtime/annotations.d.ts.map +1 -0
- package/dist/runtime/annotations.js +129 -0
- package/dist/runtime/annotations.js.map +1 -0
- package/dist/runtime/datasources.d.ts +6 -0
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/item-actions.js +1 -1
- package/dist/runtime/item-actions.js.map +1 -1
- package/dist/runtime/log-queries.js +4 -1
- package/dist/runtime/log-queries.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +2 -2
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +12 -3
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/profile-queries.js +4 -1
- package/dist/runtime/profile-queries.js.map +1 -1
- package/dist/runtime/silences-queries.d.ts +11 -0
- package/dist/runtime/silences-queries.d.ts.map +1 -0
- package/dist/runtime/silences-queries.js +89 -0
- package/dist/runtime/silences-queries.js.map +1 -0
- package/dist/runtime/time-series-queries.js +4 -1
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.js +4 -1
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/test/mock-data.d.ts +3 -1
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +45 -0
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts +12 -6
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js +6 -2
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.d.ts +8 -6
- package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
- package/dist/test/test-plugins/ernie/index.js +6 -2
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test/test-plugins/index.js +2 -2
- package/dist/test/test-plugins/index.js.map +1 -1
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/utils.js +2 -2
- package/dist/test/utils.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +8 -2
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +7 -6
- package/dist/cjs/runtime/QueryCountProvider.js +0 -83
- package/dist/runtime/QueryCountProvider.d.ts +0 -9
- package/dist/runtime/QueryCountProvider.d.ts.map +0 -1
- package/dist/runtime/QueryCountProvider.js.map +0 -1
- package/dist/utils/action.d.ts +0 -4
- package/dist/utils/action.d.ts.map +0 -1
- package/dist/utils/action.js.map +0 -1
|
@@ -34,7 +34,7 @@ _export(exports, {
|
|
|
34
34
|
const _jsxruntime = require("react/jsx-runtime");
|
|
35
35
|
const _react = require("react");
|
|
36
36
|
const _spec = require("@perses-dev/spec");
|
|
37
|
-
const
|
|
37
|
+
const _client = require("@perses-dev/client");
|
|
38
38
|
const ValidationSchemasContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
39
39
|
function useValidationSchemas() {
|
|
40
40
|
const ctx = (0, _react.useContext)(ValidationSchemasContext);
|
|
@@ -44,11 +44,12 @@ function useValidationSchemas() {
|
|
|
44
44
|
return ctx;
|
|
45
45
|
}
|
|
46
46
|
function ValidationProvider({ children }) {
|
|
47
|
-
const [datasourceEditorSchema, setDatasourceEditorSchema] = (0, _react.useState)(
|
|
47
|
+
const [datasourceEditorSchema, setDatasourceEditorSchema] = (0, _react.useState)(_client.datasourceDefinitionSchema);
|
|
48
48
|
const [panelEditorSchema, setPanelEditorSchema] = (0, _react.useState)(_spec.panelEditorSchema); // TODO I don't get why this does not compile
|
|
49
49
|
const [variableEditorSchema, setVariableEditorSchema] = (0, _react.useState)(_spec.variableDefinitionSchema);
|
|
50
|
+
const [annotationEditorSchema, setAnnotationEditorSchema] = (0, _react.useState)(_spec.annotationSpecSchema);
|
|
50
51
|
function setDatasourceEditorSchemaPlugin(pluginSchema) {
|
|
51
|
-
setDatasourceEditorSchema((0,
|
|
52
|
+
setDatasourceEditorSchema((0, _client.buildDatasourceDefinitionSchema)(pluginSchema));
|
|
52
53
|
}
|
|
53
54
|
function setPanelEditorSchemaPlugin(pluginSchema) {
|
|
54
55
|
setPanelEditorSchema((0, _spec.buildPanelEditorSchema)(pluginSchema));
|
|
@@ -56,14 +57,19 @@ function ValidationProvider({ children }) {
|
|
|
56
57
|
function setVariableEditorSchemaPlugin(pluginSchema) {
|
|
57
58
|
setVariableEditorSchema((0, _spec.buildVariableDefinitionSchema)(pluginSchema));
|
|
58
59
|
}
|
|
60
|
+
function setAnnotationEditorSchemaPlugin(pluginSchema) {
|
|
61
|
+
setAnnotationEditorSchema((0, _spec.buildAnnotationSpecSchema)(pluginSchema));
|
|
62
|
+
}
|
|
59
63
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(ValidationSchemasContext.Provider, {
|
|
60
64
|
value: {
|
|
61
65
|
datasourceEditorSchema,
|
|
62
66
|
panelEditorSchema,
|
|
63
67
|
variableEditorSchema,
|
|
68
|
+
annotationEditorSchema,
|
|
64
69
|
setDatasourceEditorSchemaPlugin,
|
|
65
70
|
setPanelEditorSchemaPlugin,
|
|
66
|
-
setVariableEditorSchemaPlugin
|
|
71
|
+
setVariableEditorSchemaPlugin,
|
|
72
|
+
setAnnotationEditorSchemaPlugin
|
|
67
73
|
},
|
|
68
74
|
children: children
|
|
69
75
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Copyright 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get CALCULATIONS_CONFIG () {
|
|
25
|
+
return CALCULATIONS_CONFIG;
|
|
26
|
+
},
|
|
27
|
+
get CalculationsMap () {
|
|
28
|
+
return CalculationsMap;
|
|
29
|
+
},
|
|
30
|
+
get DEFAULT_CALCULATION () {
|
|
31
|
+
return DEFAULT_CALCULATION;
|
|
32
|
+
},
|
|
33
|
+
get getCalculation () {
|
|
34
|
+
return getCalculation;
|
|
35
|
+
},
|
|
36
|
+
get getCalculations () {
|
|
37
|
+
return getCalculations;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const DEFAULT_CALCULATION = 'last'; // aligned with cue
|
|
41
|
+
const CalculationsMap = {
|
|
42
|
+
first: first,
|
|
43
|
+
last: last,
|
|
44
|
+
'first-number': firstNumber,
|
|
45
|
+
'last-number': lastNumber,
|
|
46
|
+
mean: mean,
|
|
47
|
+
sum: sum,
|
|
48
|
+
min: min,
|
|
49
|
+
max: max
|
|
50
|
+
};
|
|
51
|
+
const CALCULATIONS_CONFIG = {
|
|
52
|
+
first: {
|
|
53
|
+
label: 'First',
|
|
54
|
+
description: 'First value'
|
|
55
|
+
},
|
|
56
|
+
last: {
|
|
57
|
+
label: 'Last',
|
|
58
|
+
description: 'Last value'
|
|
59
|
+
},
|
|
60
|
+
'first-number': {
|
|
61
|
+
label: 'First *',
|
|
62
|
+
description: 'First numeric value'
|
|
63
|
+
},
|
|
64
|
+
'last-number': {
|
|
65
|
+
label: 'Last *',
|
|
66
|
+
description: 'Last numeric value'
|
|
67
|
+
},
|
|
68
|
+
mean: {
|
|
69
|
+
label: 'Avg',
|
|
70
|
+
description: 'Average value excluding nulls'
|
|
71
|
+
},
|
|
72
|
+
sum: {
|
|
73
|
+
label: 'Sum',
|
|
74
|
+
description: 'The sum of all values'
|
|
75
|
+
},
|
|
76
|
+
min: {
|
|
77
|
+
label: 'Min',
|
|
78
|
+
description: 'Minimum value'
|
|
79
|
+
},
|
|
80
|
+
max: {
|
|
81
|
+
label: 'Max',
|
|
82
|
+
description: 'Maximum value'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function getCalculations(values, includeCalculations) {
|
|
86
|
+
const calculations = includeCalculations.reduce((initResult, calculation)=>{
|
|
87
|
+
initResult[calculation] = undefined;
|
|
88
|
+
return initResult;
|
|
89
|
+
}, {});
|
|
90
|
+
// We save these values as separate values instead of directly setting them
|
|
91
|
+
// in the calculations because they are needed by multiple calculations.
|
|
92
|
+
let nonNullCount = 0;
|
|
93
|
+
let sum = 0;
|
|
94
|
+
// We use this large function capable of performing one or more calculations
|
|
95
|
+
// in a single iteration of the data to minimize the performance impact of
|
|
96
|
+
// generating multiple calculations for large timeseries values. This is
|
|
97
|
+
// less optimized for certain single calculations when done in isolation (e.g.
|
|
98
|
+
// `last`), but will be more performant in the more expensive cases where
|
|
99
|
+
// multiple values are being used (e.g. table legend).
|
|
100
|
+
values.forEach((tuple, i)=>{
|
|
101
|
+
const value = tuple[1];
|
|
102
|
+
if (i === 0 && 'first' in calculations) {
|
|
103
|
+
calculations.first = value;
|
|
104
|
+
}
|
|
105
|
+
if (i === values.length - 1 && 'last' in calculations) {
|
|
106
|
+
calculations.last = value;
|
|
107
|
+
}
|
|
108
|
+
// Handling specific to non-null values.
|
|
109
|
+
if (typeof value === 'number') {
|
|
110
|
+
nonNullCount += 1;
|
|
111
|
+
sum += value;
|
|
112
|
+
if ('first-number' in calculations && calculations['first-number'] === undefined) {
|
|
113
|
+
// Save the first number we see.
|
|
114
|
+
calculations['first-number'] = value;
|
|
115
|
+
}
|
|
116
|
+
if ('last-number' in calculations) {
|
|
117
|
+
// Keep setting the numbers we see, which will eventually be set to the
|
|
118
|
+
// last number when finished iterating.
|
|
119
|
+
calculations['last-number'] = value;
|
|
120
|
+
}
|
|
121
|
+
if ('min' in calculations) {
|
|
122
|
+
if (typeof calculations.min !== 'number') {
|
|
123
|
+
// Init the first time we see a number
|
|
124
|
+
calculations.min = value;
|
|
125
|
+
} else {
|
|
126
|
+
// Use lowest value once initialized
|
|
127
|
+
calculations.min = Math.min(calculations.min, value);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if ('max' in calculations) {
|
|
131
|
+
if (typeof calculations.max !== 'number') {
|
|
132
|
+
// Init the first time we see a number
|
|
133
|
+
calculations.max = value;
|
|
134
|
+
} else {
|
|
135
|
+
// Use highest value once initialized
|
|
136
|
+
calculations.max = Math.max(calculations.max, value);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
// Set calculations that require iterating over all values.
|
|
142
|
+
if (nonNullCount > 0 && 'sum' in calculations) {
|
|
143
|
+
calculations.sum = sum;
|
|
144
|
+
}
|
|
145
|
+
if (nonNullCount > 0 && 'mean' in calculations) {
|
|
146
|
+
calculations.mean = sum / nonNullCount;
|
|
147
|
+
}
|
|
148
|
+
return calculations;
|
|
149
|
+
}
|
|
150
|
+
function getCalculation(values, calculation) {
|
|
151
|
+
return getCalculations(values, [
|
|
152
|
+
calculation
|
|
153
|
+
])[calculation];
|
|
154
|
+
}
|
|
155
|
+
function first(values) {
|
|
156
|
+
return getCalculation(values, 'first');
|
|
157
|
+
}
|
|
158
|
+
function last(values) {
|
|
159
|
+
return getCalculation(values, 'last');
|
|
160
|
+
}
|
|
161
|
+
function firstNumber(values) {
|
|
162
|
+
return getCalculation(values, 'first-number');
|
|
163
|
+
}
|
|
164
|
+
function lastNumber(values) {
|
|
165
|
+
return getCalculation(values, 'last-number');
|
|
166
|
+
}
|
|
167
|
+
function mean(values) {
|
|
168
|
+
return getCalculation(values, 'mean');
|
|
169
|
+
}
|
|
170
|
+
function sum(values) {
|
|
171
|
+
return getCalculation(values, 'sum');
|
|
172
|
+
}
|
|
173
|
+
function min(values) {
|
|
174
|
+
return getCalculation(values, 'min');
|
|
175
|
+
}
|
|
176
|
+
function max(values) {
|
|
177
|
+
return getCalculation(values, 'max');
|
|
178
|
+
}
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
_export_star(require("./annotations"), exports);
|
|
17
18
|
_export_star(require("./datasource"), exports);
|
|
18
19
|
_export_star(require("./legend"), exports);
|
|
19
20
|
_export_star(require("./log-queries"), exports);
|
|
@@ -26,6 +27,9 @@ _export_star(require("./time-series-queries"), exports);
|
|
|
26
27
|
_export_star(require("./trace-queries"), exports);
|
|
27
28
|
_export_star(require("./profile-queries"), exports);
|
|
28
29
|
_export_star(require("./variables"), exports);
|
|
30
|
+
_export_star(require("./calculations"), exports);
|
|
31
|
+
_export_star(require("./alerts-queries"), exports);
|
|
32
|
+
_export_star(require("./silences-queries"), exports);
|
|
29
33
|
function _export_star(from, to) {
|
|
30
34
|
Object.keys(from).forEach(function(k) {
|
|
31
35
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/dist/cjs/model/legend.js
CHANGED
|
@@ -43,7 +43,8 @@ _export(exports, {
|
|
|
43
43
|
return validateLegendSpec;
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
const
|
|
46
|
+
const _components = require("@perses-dev/components");
|
|
47
|
+
const _calculations = require("./calculations");
|
|
47
48
|
const legendValues = [
|
|
48
49
|
'mean',
|
|
49
50
|
'first',
|
|
@@ -89,7 +90,7 @@ const LEGEND_SIZE_CONFIG = {
|
|
|
89
90
|
}
|
|
90
91
|
};
|
|
91
92
|
const LEGEND_VALUE_CONFIG = legendValues.reduce((config, value)=>{
|
|
92
|
-
config[value] =
|
|
93
|
+
config[value] = _calculations.CALCULATIONS_CONFIG[value];
|
|
93
94
|
return config;
|
|
94
95
|
}, {});
|
|
95
96
|
function validateLegendSpec(legend) {
|
|
@@ -97,13 +98,13 @@ function validateLegendSpec(legend) {
|
|
|
97
98
|
// undefined is valid since this is how legend is hidden by default
|
|
98
99
|
return true;
|
|
99
100
|
}
|
|
100
|
-
if (!(0,
|
|
101
|
+
if (!(0, _components.isValidLegendPosition)(legend.position)) {
|
|
101
102
|
return false;
|
|
102
103
|
}
|
|
103
|
-
if (legend.mode && !(0,
|
|
104
|
+
if (legend.mode && !(0, _components.isValidLegendMode)(legend.mode)) {
|
|
104
105
|
return false;
|
|
105
106
|
}
|
|
106
|
-
if (legend.size && !(0,
|
|
107
|
+
if (legend.size && !(0, _components.isValidLegendSize)(legend.size)) {
|
|
107
108
|
return false;
|
|
108
109
|
}
|
|
109
110
|
return true;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "calculateVolumeInterval", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return calculateVolumeInterval;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
1
11
|
// Copyright The Perses Authors
|
|
2
12
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
13
|
// you may not use this file except in compliance with the License.
|
|
@@ -11,16 +21,6 @@
|
|
|
11
21
|
// See the License for the specific language governing permissions and
|
|
12
22
|
// limitations under the License.
|
|
13
23
|
// Target number of bars for log volume histogram
|
|
14
|
-
"use strict";
|
|
15
|
-
Object.defineProperty(exports, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "calculateVolumeInterval", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function() {
|
|
21
|
-
return calculateVolumeInterval;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
24
|
const TARGET_HISTOGRAM_BARS = 40;
|
|
25
25
|
// Standard intervals for histogram calculations (in milliseconds)
|
|
26
26
|
const STANDARD_INTERVALS = [
|
|
@@ -20,21 +20,37 @@ Object.defineProperty(exports, "dynamicImportPluginLoader", {
|
|
|
20
20
|
return dynamicImportPluginLoader;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
+
const _plugins = require("./plugins");
|
|
23
24
|
function dynamicImportPluginLoader(plugins) {
|
|
24
|
-
const importMap = new Map(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const importMap = new Map();
|
|
26
|
+
for (const p of plugins){
|
|
27
|
+
const { resource, resource: { kind, metadata: { name, registry, version } }, importPlugin } = p;
|
|
28
|
+
importMap.set((0, _plugins.getPluginModuleCompoundKey)({
|
|
29
|
+
kind,
|
|
30
|
+
name,
|
|
31
|
+
registry,
|
|
32
|
+
version
|
|
33
|
+
}), {
|
|
34
|
+
resource,
|
|
35
|
+
importPlugin
|
|
36
|
+
});
|
|
37
|
+
}
|
|
28
38
|
return {
|
|
29
39
|
async getInstalledPlugins () {
|
|
30
|
-
return Promise.resolve(Array.from(importMap.
|
|
40
|
+
return Promise.resolve(Array.from(importMap.values()).map((v)=>v.resource));
|
|
31
41
|
},
|
|
32
42
|
importPluginModule (resource) {
|
|
33
|
-
const
|
|
34
|
-
|
|
43
|
+
const { kind, metadata: { name, version, registry } } = resource;
|
|
44
|
+
const { importPlugin } = importMap.get((0, _plugins.getPluginModuleCompoundKey)({
|
|
45
|
+
kind,
|
|
46
|
+
name,
|
|
47
|
+
registry,
|
|
48
|
+
version
|
|
49
|
+
})) || {};
|
|
50
|
+
if (importPlugin === undefined) {
|
|
35
51
|
throw new Error('Plugin not found');
|
|
36
52
|
}
|
|
37
|
-
return
|
|
53
|
+
return importPlugin();
|
|
38
54
|
}
|
|
39
55
|
};
|
|
40
56
|
}
|
|
@@ -14,3 +14,13 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
Object.defineProperty(exports, "getPluginModuleCompoundKey", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return getPluginModuleCompoundKey;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function getPluginModuleCompoundKey(compoundKey) {
|
|
24
|
+
const { kind, name, registry, version } = compoundKey;
|
|
25
|
+
return `${kind}:${name}:${registry ?? ''}:${version ?? ''}`;
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
@@ -14,3 +14,13 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
Object.defineProperty(exports, "isTimeSeriesValueTuple", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return isTimeSeriesValueTuple;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function isTimeSeriesValueTuple(data) {
|
|
24
|
+
if (data.length !== 2) return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
@@ -147,7 +147,14 @@ const getPluginRuntime = ()=>{
|
|
|
147
147
|
requiredVersion: '^5.5.0'
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
|
-
|
|
150
|
+
'@perses-dev/spec': {
|
|
151
|
+
version: '0.2.0-beta.2',
|
|
152
|
+
lib: ()=>require('@perses-dev/spec'),
|
|
153
|
+
shareConfig: {
|
|
154
|
+
singleton: true,
|
|
155
|
+
requiredVersion: '^0.2.0-beta.2'
|
|
156
|
+
}
|
|
157
|
+
},
|
|
151
158
|
'@perses-dev/core': {
|
|
152
159
|
version: '0.53.1',
|
|
153
160
|
lib: ()=>require('@perses-dev/core'),
|
|
@@ -156,6 +163,14 @@ const getPluginRuntime = ()=>{
|
|
|
156
163
|
requiredVersion: '^0.53.1'
|
|
157
164
|
}
|
|
158
165
|
},
|
|
166
|
+
'@perses-dev/client': {
|
|
167
|
+
version: '0.54.0-beta.1',
|
|
168
|
+
lib: ()=>require('@perses-dev/client'),
|
|
169
|
+
shareConfig: {
|
|
170
|
+
singleton: true,
|
|
171
|
+
requiredVersion: '^0.54.0-beta.1'
|
|
172
|
+
}
|
|
173
|
+
},
|
|
159
174
|
'@perses-dev/components': {
|
|
160
175
|
version: '0.53.1',
|
|
161
176
|
lib: ()=>require('@perses-dev/components'),
|
|
@@ -268,28 +283,49 @@ const getPluginRuntime = ()=>{
|
|
|
268
283
|
}
|
|
269
284
|
return instance;
|
|
270
285
|
};
|
|
271
|
-
|
|
286
|
+
function getModuleFederationRemoteName(name, registry, version) {
|
|
287
|
+
return `${name}:${registry ?? ''}:${version ?? ''}`;
|
|
288
|
+
}
|
|
289
|
+
const registerRemote = (name, registry, version, baseURL)=>{
|
|
272
290
|
const pluginRuntime = getPluginRuntime();
|
|
273
|
-
const
|
|
291
|
+
const registryName = getModuleFederationRemoteName(name, registry, version);
|
|
292
|
+
const existingRemote = pluginRuntime.options.remotes.find((remote)=>remote.name === registryName);
|
|
274
293
|
if (!existingRemote) {
|
|
275
|
-
const
|
|
294
|
+
const nameVersionRegistry = [
|
|
295
|
+
name,
|
|
296
|
+
version,
|
|
297
|
+
registry
|
|
298
|
+
].filter(Boolean).join('~');
|
|
299
|
+
const prefix = baseURL || '/plugins';
|
|
300
|
+
const remoteEntryURL = `${prefix}/${nameVersionRegistry}/mf-manifest.json`;
|
|
276
301
|
pluginRuntime.registerRemotes([
|
|
277
302
|
{
|
|
278
|
-
name,
|
|
303
|
+
name: registryName,
|
|
279
304
|
entry: remoteEntryURL,
|
|
280
|
-
alias:
|
|
305
|
+
alias: registryName
|
|
281
306
|
}
|
|
282
307
|
]);
|
|
283
308
|
}
|
|
284
309
|
};
|
|
285
|
-
const loadPlugin = async (
|
|
286
|
-
|
|
310
|
+
const loadPlugin = async (target)=>{
|
|
311
|
+
const { moduleName, pluginName, registry, version, baseURL } = target;
|
|
312
|
+
registerRemote(moduleName, registry, version, baseURL);
|
|
287
313
|
const pluginRuntime = getPluginRuntime();
|
|
288
|
-
|
|
314
|
+
const registryName = getModuleFederationRemoteName(moduleName, registry, version);
|
|
315
|
+
return pluginRuntime.loadRemote(`${registryName}/${pluginName}`);
|
|
289
316
|
};
|
|
290
317
|
function usePluginRuntime({ plugin }) {
|
|
291
318
|
return {
|
|
292
319
|
pluginRuntime: getPluginRuntime(),
|
|
293
|
-
loadPlugin: ()=>
|
|
320
|
+
loadPlugin: ()=>{
|
|
321
|
+
const { moduleName, name: pluginName, registry, version, baseURL } = plugin;
|
|
322
|
+
return loadPlugin({
|
|
323
|
+
moduleName,
|
|
324
|
+
pluginName,
|
|
325
|
+
registry,
|
|
326
|
+
version,
|
|
327
|
+
baseURL
|
|
328
|
+
});
|
|
329
|
+
}
|
|
294
330
|
};
|
|
295
331
|
}
|
|
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "remotePluginLoader", {
|
|
|
20
20
|
return remotePluginLoader;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
23
24
|
const _PluginRuntime = require("./PluginRuntime");
|
|
24
25
|
const isPluginMetadata = (plugin)=>{
|
|
25
26
|
return typeof plugin === 'object' && plugin !== null && 'kind' in plugin && 'spec' in plugin && typeof plugin.spec === 'object' && plugin.spec !== null && 'name' in plugin.spec;
|
|
@@ -59,17 +60,39 @@ function remotePluginLoader(options) {
|
|
|
59
60
|
return pluginModules;
|
|
60
61
|
},
|
|
61
62
|
importPluginModule: async (resource)=>{
|
|
62
|
-
const pluginModuleName = resource.metadata
|
|
63
|
+
const { name: pluginModuleName, version, registry } = resource.metadata;
|
|
63
64
|
const pluginModule = {};
|
|
64
|
-
|
|
65
|
-
const remotePluginModule = await (0, _PluginRuntime.loadPlugin)(
|
|
65
|
+
const loadPromises = resource.spec.plugins.map(async (plugin)=>{
|
|
66
|
+
const remotePluginModule = await (0, _PluginRuntime.loadPlugin)({
|
|
67
|
+
moduleName: pluginModuleName,
|
|
68
|
+
pluginName: plugin.spec.name,
|
|
69
|
+
registry,
|
|
70
|
+
version,
|
|
71
|
+
baseURL: pluginsAssetsPath
|
|
72
|
+
});
|
|
66
73
|
const remotePlugin = remotePluginModule?.[plugin.spec.name];
|
|
67
74
|
if (remotePlugin) {
|
|
68
|
-
|
|
75
|
+
return {
|
|
76
|
+
kind: plugin.kind,
|
|
77
|
+
name: plugin.spec.name,
|
|
78
|
+
remotePlugin
|
|
79
|
+
};
|
|
69
80
|
} else {
|
|
70
81
|
console.error(`RemotePluginLoader: Error loading plugin ${plugin.spec.name}`);
|
|
82
|
+
return null;
|
|
71
83
|
}
|
|
72
|
-
}
|
|
84
|
+
});
|
|
85
|
+
const loadedPlugins = await Promise.all(loadPromises);
|
|
86
|
+
loadedPlugins.forEach((item)=>{
|
|
87
|
+
if (item?.remotePlugin) {
|
|
88
|
+
pluginModule[(0, _pluginsystem.getPluginModuleCompoundKey)({
|
|
89
|
+
kind: item.kind,
|
|
90
|
+
name: item.name,
|
|
91
|
+
registry,
|
|
92
|
+
version
|
|
93
|
+
})] = item.remotePlugin;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
73
96
|
return pluginModule;
|
|
74
97
|
}
|
|
75
98
|
};
|