@perses-dev/plugin-system 0.43.0-rc2 → 0.44.0-rc0
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 +1 -1
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +8 -8
- package/dist/cjs/components/DatasourceSelect.js +11 -9
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
- package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +49 -11
- package/dist/cjs/components/PluginEditor/PluginEditor.js +2 -3
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +3 -3
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +2 -2
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +4 -4
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
- package/dist/cjs/components/ProjectSelect.js +2 -2
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +3 -3
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +3 -3
- package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +143 -0
- package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +96 -0
- package/dist/cjs/components/TraceQueryEditor/index.js +30 -0
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +29 -23
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +10 -8
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
- package/dist/cjs/components/Variables/variable-model.js +12 -13
- package/dist/cjs/context/ProjectStoreProvider.js +5 -5
- package/dist/cjs/model/legend.js +5 -5
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +6 -6
- package/dist/cjs/runtime/DataQueriesProvider/model.js +3 -3
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +8 -6
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +16 -16
- package/dist/cjs/runtime/builtin-variables.js +5 -5
- package/dist/cjs/runtime/datasources.js +7 -7
- package/dist/cjs/runtime/plugin-registry.js +12 -12
- package/dist/cjs/runtime/template-variables.js +15 -7
- package/dist/cjs/runtime/time-series-queries.js +14 -14
- package/dist/cjs/runtime/trace-queries.js +24 -7
- package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +3 -1
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +1 -1
- package/dist/cjs/test/test-plugins/bert/index.js +2 -2
- package/dist/cjs/test/test-plugins/ernie/index.js +2 -2
- package/dist/cjs/test/test-plugins/index.js +3 -1
- package/dist/cjs/test-utils/mock-plugin-registry.js +4 -4
- package/dist/cjs/utils/action.js +3 -3
- package/dist/cjs/utils/variables.js +4 -4
- package/dist/cjs/validation/role.js +3 -3
- package/dist/cjs/validation/secret.js +3 -3
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -2
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
- 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 +8 -8
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceSelect.d.ts +3 -4
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +8 -6
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +1 -2
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +3 -3
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.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.d.ts +3 -3
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +1 -2
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +49 -11
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts +1 -2
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +2 -3
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +3 -3
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +3 -3
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +2 -2
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +1 -2
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/ProjectSelect.d.ts +2 -3
- package/dist/components/ProjectSelect.d.ts.map +1 -1
- package/dist/components/ProjectSelect.js +2 -2
- package/dist/components/ProjectSelect.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +1 -2
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +3 -3
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +1 -2
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +3 -3
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +8 -0
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +1 -0
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js +130 -0
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +1 -0
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +12 -0
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +1 -0
- package/dist/components/TraceQueryEditor/TraceQueryInput.js +83 -0
- package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +1 -0
- package/dist/components/TraceQueryEditor/index.d.ts +2 -0
- package/dist/components/TraceQueryEditor/index.d.ts.map +1 -0
- package/dist/components/TraceQueryEditor/index.js +15 -0
- package/dist/components/TraceQueryEditor/index.js.map +1 -0
- 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 +26 -22
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -3
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +4 -4
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +6 -7
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/context/ProjectStoreProvider.d.ts +1 -1
- package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
- package/dist/context/ProjectStoreProvider.js +2 -2
- package/dist/context/ProjectStoreProvider.js.map +1 -1
- package/dist/context/query-params.js.map +1 -1
- package/dist/model/datasource.js +3 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/legend.d.ts +2 -2
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.d.ts +3 -2
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.d.ts +4 -4
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +2 -2
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/trace-queries.d.ts +3 -2
- package/dist/model/trace-queries.d.ts.map +1 -1
- package/dist/model/trace-queries.js.map +1 -1
- package/dist/model/variables.d.ts +2 -2
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js +3 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +2 -2
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +2 -2
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +3 -3
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +4 -4
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/builtin-variables.d.ts +1 -1
- package/dist/runtime/builtin-variables.d.ts.map +1 -1
- package/dist/runtime/builtin-variables.js +2 -2
- package/dist/runtime/builtin-variables.js.map +1 -1
- package/dist/runtime/datasources.js +1 -1
- package/dist/runtime/datasources.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 +4 -4
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/template-variables.d.ts +4 -4
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +10 -2
- package/dist/runtime/template-variables.js.map +1 -1
- package/dist/runtime/time-series-queries.js +7 -7
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts +6 -2
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +21 -7
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +2 -3
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +1 -2
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +2 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +2 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +2 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +2 -3
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
- package/dist/test/render.d.ts +1 -1
- package/dist/test/render.d.ts.map +1 -1
- 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 +2 -2
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js +2 -2
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +1 -1
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/variables.js.map +1 -1
- package/dist/validation/datasource.d.ts +1 -1
- package/dist/validation/datasource.d.ts.map +1 -1
- package/dist/validation/datasource.js.map +1 -1
- package/dist/validation/resource.js.map +1 -1
- package/dist/validation/role.d.ts +43 -43
- package/dist/validation/role.d.ts.map +1 -1
- package/dist/validation/role.js.map +1 -1
- package/dist/validation/rolebinding.d.ts +10 -10
- package/dist/validation/rolebinding.d.ts.map +1 -1
- package/dist/validation/rolebinding.js.map +1 -1
- package/dist/validation/secret.d.ts +19 -19
- package/dist/validation/secret.d.ts.map +1 -1
- package/dist/validation/secret.js.map +1 -1
- package/dist/validation/variable.d.ts +1 -1
- package/dist/validation/variable.d.ts.map +1 -1
- package/dist/validation/variable.js.map +1 -1
- package/package.json +4 -4
|
@@ -29,7 +29,7 @@ const CALC_OPTIONS = Object.entries(_core.CALCULATIONS_CONFIG).map(([id, config]
|
|
|
29
29
|
...config
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
|
-
function CalculationSelector({ value
|
|
32
|
+
function CalculationSelector({ value, onChange }) {
|
|
33
33
|
const handleCalculationChange = (_, newValue)=>{
|
|
34
34
|
onChange(newValue.id);
|
|
35
35
|
};
|
|
@@ -50,7 +50,7 @@ const _validation = require("../../validation");
|
|
|
50
50
|
}
|
|
51
51
|
function DatasourceEditorForm(props) {
|
|
52
52
|
var _state_spec_display, _state_spec_display1;
|
|
53
|
-
const { initialName
|
|
53
|
+
const { initialName, initialSpec, initialAction, isDraft, isReadonly, onSave, onClose, onDelete } = props;
|
|
54
54
|
const initialState = getInitialState(initialName, initialSpec);
|
|
55
55
|
const [state, setState] = (0, _useimmer.useImmer)(initialState);
|
|
56
56
|
const [isDiscardDialogOpened, setDiscardDialogOpened] = (0, _react.useState)(false);
|
|
@@ -186,9 +186,9 @@ function DatasourceEditorForm(props) {
|
|
|
186
186
|
xs: 4,
|
|
187
187
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
188
188
|
name: "name",
|
|
189
|
-
render: ({ field
|
|
189
|
+
render: ({ field, fieldState })=>{
|
|
190
190
|
var _fieldState_error;
|
|
191
|
-
/*#__PURE__*/
|
|
191
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
192
192
|
...field,
|
|
193
193
|
required: true,
|
|
194
194
|
fullWidth: true,
|
|
@@ -218,9 +218,9 @@ function DatasourceEditorForm(props) {
|
|
|
218
218
|
xs: 8,
|
|
219
219
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
220
220
|
name: "title",
|
|
221
|
-
render: ({ field
|
|
221
|
+
render: ({ field, fieldState })=>{
|
|
222
222
|
var _fieldState_error;
|
|
223
|
-
/*#__PURE__*/
|
|
223
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
224
224
|
...field,
|
|
225
225
|
fullWidth: true,
|
|
226
226
|
name: "title",
|
|
@@ -250,9 +250,9 @@ function DatasourceEditorForm(props) {
|
|
|
250
250
|
xs: 12,
|
|
251
251
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
252
252
|
name: "description",
|
|
253
|
-
render: ({ field
|
|
253
|
+
render: ({ field, fieldState })=>{
|
|
254
254
|
var _fieldState_error;
|
|
255
|
-
/*#__PURE__*/
|
|
255
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
256
256
|
...field,
|
|
257
257
|
fullWidth: true,
|
|
258
258
|
name: "description",
|
|
@@ -287,7 +287,7 @@ function DatasourceEditorForm(props) {
|
|
|
287
287
|
children: [
|
|
288
288
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
289
289
|
name: "default",
|
|
290
|
-
render: ({ field
|
|
290
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
291
291
|
...field,
|
|
292
292
|
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
293
293
|
checked: state.spec.default,
|
|
@@ -21,11 +21,11 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
DatasourceSelect: function() {
|
|
25
|
-
return DatasourceSelect;
|
|
26
|
-
},
|
|
27
24
|
DatasourceName: function() {
|
|
28
25
|
return DatasourceName;
|
|
26
|
+
},
|
|
27
|
+
DatasourceSelect: function() {
|
|
28
|
+
return DatasourceSelect;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _jsxruntime = require("react/jsx-runtime");
|
|
@@ -39,8 +39,8 @@ function _interop_require_default(obj) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function DatasourceSelect(props) {
|
|
42
|
-
const { datasourcePluginKind
|
|
43
|
-
const { data
|
|
42
|
+
const { datasourcePluginKind, value, project, onChange, ...others } = props;
|
|
43
|
+
const { data, isLoading } = (0, _runtime.useListDatasourceSelectItems)(datasourcePluginKind, project);
|
|
44
44
|
// Rebuild the group of the value if not provided
|
|
45
45
|
const defaultValue = (0, _react.useMemo)(()=>{
|
|
46
46
|
var _flatMap_find;
|
|
@@ -57,18 +57,20 @@ function DatasourceSelect(props) {
|
|
|
57
57
|
]);
|
|
58
58
|
// Convert the datasource list into menu items with name/group?/value strings that the Select input can work with
|
|
59
59
|
const menuItems = (0, _react.useMemo)(()=>{
|
|
60
|
-
var _item_saved;
|
|
61
60
|
return (data !== null && data !== void 0 ? data : []).map((itemGroup)=>({
|
|
62
61
|
group: itemGroup.group,
|
|
63
62
|
editLink: itemGroup.editLink,
|
|
64
|
-
items: itemGroup.items.map((item)=>
|
|
63
|
+
items: itemGroup.items.map((item)=>{
|
|
64
|
+
var _item_saved;
|
|
65
|
+
return {
|
|
65
66
|
name: item.name,
|
|
66
67
|
overriding: item.overriding,
|
|
67
68
|
overridden: item.overridden,
|
|
68
69
|
saved: (_item_saved = item.saved) !== null && _item_saved !== void 0 ? _item_saved : true,
|
|
69
70
|
group: item.selector.group,
|
|
70
71
|
value: selectorToOptionValue(item.selector)
|
|
71
|
-
}
|
|
72
|
+
};
|
|
73
|
+
})
|
|
72
74
|
}));
|
|
73
75
|
}, [
|
|
74
76
|
data
|
|
@@ -140,7 +142,7 @@ function DatasourceSelect(props) {
|
|
|
140
142
|
});
|
|
141
143
|
}
|
|
142
144
|
function DatasourceName(props) {
|
|
143
|
-
const { name
|
|
145
|
+
const { name, overridden, overriding } = props;
|
|
144
146
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
145
147
|
children: [
|
|
146
148
|
`${name} `,
|
|
@@ -49,7 +49,7 @@ const VALUE_OPTIONS = Object.entries(_model.LEGEND_VALUE_CONFIG).map(([id, confi
|
|
|
49
49
|
...config
|
|
50
50
|
};
|
|
51
51
|
});
|
|
52
|
-
function LegendOptionsEditor({ value
|
|
52
|
+
function LegendOptionsEditor({ value, onChange }) {
|
|
53
53
|
const handleLegendShowChange = (_, checked)=>{
|
|
54
54
|
// legend is hidden when legend obj is undefined
|
|
55
55
|
const legendValue = checked === true ? {
|
|
@@ -25,7 +25,7 @@ const _material = require("@mui/material");
|
|
|
25
25
|
const _react = require("react");
|
|
26
26
|
const _OptionsEditorTabPanel = require("../OptionsEditorTabPanel");
|
|
27
27
|
const OptionsEditorRadios = (props)=>{
|
|
28
|
-
const { tabs
|
|
28
|
+
const { tabs, defaultTab, onModeChange, isReadonly } = props;
|
|
29
29
|
const [activeTab, setActiveTab] = (0, _react.useState)(defaultTab);
|
|
30
30
|
const handleChange = (_, value)=>{
|
|
31
31
|
const v = parseInt(value);
|
|
@@ -46,7 +46,7 @@ const OptionsEditorRadios = (props)=>{
|
|
|
46
46
|
value: activeTab,
|
|
47
47
|
onChange: handleChange,
|
|
48
48
|
"aria-labelledby": "Configuration radio",
|
|
49
|
-
children: tabs.map(({ label
|
|
49
|
+
children: tabs.map(({ label }, i)=>{
|
|
50
50
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
51
51
|
disabled: isReadonly,
|
|
52
52
|
value: i,
|
|
@@ -57,7 +57,7 @@ const OptionsEditorRadios = (props)=>{
|
|
|
57
57
|
})
|
|
58
58
|
})
|
|
59
59
|
}),
|
|
60
|
-
tabs.map(({ label
|
|
60
|
+
tabs.map(({ label, content }, i)=>{
|
|
61
61
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorTabPanel.OptionsEditorTabPanel, {
|
|
62
62
|
value: activeTab,
|
|
63
63
|
index: i,
|
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "OptionsEditorTabPanel", {
|
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
25
|
function OptionsEditorTabPanel(props) {
|
|
26
|
-
const { children
|
|
26
|
+
const { children, value, index, ...other } = props;
|
|
27
27
|
const isActive = value === index;
|
|
28
28
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
29
29
|
role: "tabpanel",
|
|
@@ -24,7 +24,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
25
|
const _react = require("react");
|
|
26
26
|
const _OptionsEditorTabPanel = require("../OptionsEditorTabPanel");
|
|
27
|
-
const OptionsEditorTabs = ({ tabs
|
|
27
|
+
const OptionsEditorTabs = ({ tabs })=>{
|
|
28
28
|
const [activeTab, setActiveTab] = (0, _react.useState)(0);
|
|
29
29
|
const handleChange = (_, newValue)=>{
|
|
30
30
|
setActiveTab(newValue);
|
|
@@ -40,7 +40,7 @@ const OptionsEditorTabs = ({ tabs })=>{
|
|
|
40
40
|
value: activeTab,
|
|
41
41
|
onChange: handleChange,
|
|
42
42
|
"aria-label": "Panel configuration tabs",
|
|
43
|
-
children: tabs.map(({ label
|
|
43
|
+
children: tabs.map(({ label }, i)=>{
|
|
44
44
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tab, {
|
|
45
45
|
label: label,
|
|
46
46
|
id: `options-editor-tab-${i}`,
|
|
@@ -49,7 +49,7 @@ const OptionsEditorTabs = ({ tabs })=>{
|
|
|
49
49
|
})
|
|
50
50
|
})
|
|
51
51
|
}),
|
|
52
|
-
tabs.map(({ label
|
|
52
|
+
tabs.map(({ label, content }, i)=>{
|
|
53
53
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorTabPanel.OptionsEditorTabPanel, {
|
|
54
54
|
value: activeTab,
|
|
55
55
|
index: i,
|
|
@@ -25,10 +25,11 @@ const _components = require("@perses-dev/components");
|
|
|
25
25
|
const _runtime = require("../../runtime");
|
|
26
26
|
const _OptionsEditorTabs = require("../OptionsEditorTabs");
|
|
27
27
|
const _TimeSeriesQueryEditor = require("../TimeSeriesQueryEditor");
|
|
28
|
+
const _TraceQueryEditor = require("../TraceQueryEditor");
|
|
28
29
|
function PanelSpecEditor(props) {
|
|
29
|
-
const { panelDefinition
|
|
30
|
-
const { kind
|
|
31
|
-
const { data: plugin
|
|
30
|
+
const { panelDefinition, onJSONChange, onQueriesChange, onPluginSpecChange } = props;
|
|
31
|
+
const { kind } = panelDefinition.spec.plugin;
|
|
32
|
+
const { data: plugin, isLoading, error } = (0, _runtime.usePlugin)('Panel', kind);
|
|
32
33
|
if (error) {
|
|
33
34
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorAlert, {
|
|
34
35
|
error: error
|
|
@@ -41,21 +42,58 @@ function PanelSpecEditor(props) {
|
|
|
41
42
|
if (plugin === undefined) {
|
|
42
43
|
throw new Error(`Missing implementation for panel plugin with kind '${kind}'`);
|
|
43
44
|
}
|
|
44
|
-
const
|
|
45
|
+
const getQueryType = ()=>{
|
|
46
|
+
var _panelDefinition_spec, _queriesList_;
|
|
47
|
+
const queriesList = panelDefinition === null || panelDefinition === void 0 ? void 0 : (_panelDefinition_spec = panelDefinition.spec) === null || _panelDefinition_spec === void 0 ? void 0 : _panelDefinition_spec.queries;
|
|
48
|
+
if (queriesList === undefined) {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
const queryType = (_queriesList_ = queriesList[0]) === null || _queriesList_ === void 0 ? void 0 : _queriesList_.kind;
|
|
52
|
+
return queryType;
|
|
53
|
+
};
|
|
54
|
+
// Get the corresponding queryEditor depending on the queryType
|
|
55
|
+
const getQueryEditorComponent = ()=>{
|
|
56
|
+
const queryType = getQueryType();
|
|
57
|
+
// default case handles cause where there is no queryType yet (e.g. UI > 'editing' mode > 'Add Panel')
|
|
58
|
+
switch(queryType){
|
|
59
|
+
case 'TimeSeriesQuery':
|
|
60
|
+
var _panelDefinition_spec_queries;
|
|
61
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeSeriesQueryEditor.TimeSeriesQueryEditor, {
|
|
62
|
+
queries: (_panelDefinition_spec_queries = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries !== void 0 ? _panelDefinition_spec_queries : [],
|
|
63
|
+
onChange: onQueriesChange
|
|
64
|
+
});
|
|
65
|
+
case 'TraceQuery':
|
|
66
|
+
var _panelDefinition_spec_queries1;
|
|
67
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TraceQueryEditor.TraceQueryEditor, {
|
|
68
|
+
queries: (_panelDefinition_spec_queries1 = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries1 !== void 0 ? _panelDefinition_spec_queries1 : [],
|
|
69
|
+
onChange: onQueriesChange
|
|
70
|
+
});
|
|
71
|
+
default:
|
|
72
|
+
// ScatterChart only handles trace queries for now
|
|
73
|
+
if (kind === 'ScatterChart') {
|
|
74
|
+
var _panelDefinition_spec_queries2;
|
|
75
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TraceQueryEditor.TraceQueryEditor, {
|
|
76
|
+
queries: (_panelDefinition_spec_queries2 = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries2 !== void 0 ? _panelDefinition_spec_queries2 : [],
|
|
77
|
+
onChange: onQueriesChange
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
var _panelDefinition_spec_queries3;
|
|
81
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeSeriesQueryEditor.TimeSeriesQueryEditor, {
|
|
82
|
+
queries: (_panelDefinition_spec_queries3 = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries3 !== void 0 ? _panelDefinition_spec_queries3 : [],
|
|
83
|
+
onChange: onQueriesChange
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const { panelOptionsEditorComponents, hideQueryEditor } = plugin;
|
|
45
88
|
let tabs = [];
|
|
46
89
|
if (!hideQueryEditor) {
|
|
47
|
-
var _panelDefinition_spec_queries;
|
|
48
|
-
// Since we only support TimeSeriesQuery for now, we will always show a TimeSeriesQueryEditor
|
|
49
90
|
tabs.push({
|
|
50
91
|
label: 'Query',
|
|
51
|
-
content:
|
|
52
|
-
queries: (_panelDefinition_spec_queries = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries !== void 0 ? _panelDefinition_spec_queries : [],
|
|
53
|
-
onChange: onQueriesChange
|
|
54
|
-
})
|
|
92
|
+
content: getQueryEditorComponent()
|
|
55
93
|
});
|
|
56
94
|
}
|
|
57
95
|
if (panelOptionsEditorComponents !== undefined) {
|
|
58
|
-
tabs = tabs.concat(panelOptionsEditorComponents.map(({ label
|
|
96
|
+
tabs = tabs.concat(panelOptionsEditorComponents.map(({ label, content: OptionsEditorComponent })=>({
|
|
59
97
|
label,
|
|
60
98
|
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(OptionsEditorComponent, {
|
|
61
99
|
value: panelDefinition.spec.plugin.spec,
|
|
@@ -27,8 +27,8 @@ const _PluginSpecEditor = require("../PluginSpecEditor");
|
|
|
27
27
|
const _plugineditorapi = require("./plugin-editor-api");
|
|
28
28
|
function PluginEditor(props) {
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
-
const { value
|
|
31
|
-
const { pendingKind
|
|
30
|
+
const { value, pluginType, pluginKindLabel, onChange: _, isReadonly, ...others } = props;
|
|
31
|
+
const { pendingKind, isLoading, error, onKindChange, onSpecChange } = (0, _plugineditorapi.usePluginEditor)(props);
|
|
32
32
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
33
33
|
...others,
|
|
34
34
|
children: [
|
|
@@ -51,7 +51,6 @@ function PluginEditor(props) {
|
|
|
51
51
|
onChange: onKindChange
|
|
52
52
|
}),
|
|
53
53
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginSpecEditor.PluginSpecEditor, {
|
|
54
|
-
isExplore: isExplore,
|
|
55
54
|
pluginType: pluginType,
|
|
56
55
|
pluginKind: value.kind,
|
|
57
56
|
value: value.spec,
|
|
@@ -26,7 +26,7 @@ const _immer = require("immer");
|
|
|
26
26
|
const _runtime = require("../../runtime");
|
|
27
27
|
function usePluginEditor(props) {
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
29
|
-
const { pluginType
|
|
29
|
+
const { pluginType, value, onHideQueryEditorChange = ()=>{} } = props; // setting onHideQueryEditorChange to empty function here because useEvent requires a function
|
|
30
30
|
// Keep a stable reference so we don't run the effect below when we don't need to
|
|
31
31
|
const onChange = (0, _core.useEvent)(props.onChange);
|
|
32
32
|
const onHideQuery = (0, _core.useEvent)(onHideQueryEditorChange);
|
|
@@ -48,13 +48,13 @@ function usePluginEditor(props) {
|
|
|
48
48
|
const hideQueryState = (0, _react.useRef)({
|
|
49
49
|
[value.kind]: false
|
|
50
50
|
});
|
|
51
|
-
const { defaultPluginKinds
|
|
51
|
+
const { defaultPluginKinds } = (0, _runtime.usePluginRegistry)();
|
|
52
52
|
const defaultPluginKind = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds[pluginType];
|
|
53
53
|
const initPendingKind = !value.kind && defaultPluginKind ? defaultPluginKind : '';
|
|
54
54
|
// When kind changes and we haven't loaded that plugin before, we will need to enter a "pending" state so that we
|
|
55
55
|
// can generate proper initial spec values that match the new plugin kind
|
|
56
56
|
const [pendingKind, setPendingKind] = (0, _react.useState)(initPendingKind);
|
|
57
|
-
const { data: plugin
|
|
57
|
+
const { data: plugin, isFetching, error } = (0, _runtime.usePlugin)(pluginType, pendingKind);
|
|
58
58
|
(0, _react.useEffect)(()=>{
|
|
59
59
|
// Nothing to do if no new plugin kind is pending
|
|
60
60
|
if (pendingKind === '') return;
|
|
@@ -25,8 +25,8 @@ const _material = require("@mui/material");
|
|
|
25
25
|
const _react = require("react");
|
|
26
26
|
const _runtime = require("../../runtime");
|
|
27
27
|
const PluginKindSelect = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
|
|
28
|
-
const { pluginType
|
|
29
|
-
const { data
|
|
28
|
+
const { pluginType, value: propValue, ...others } = props;
|
|
29
|
+
const { data, isLoading } = (0, _runtime.useListPluginMetadata)(pluginType);
|
|
30
30
|
// Pass an empty value while options are still loading so MUI doesn't complain about us using an "out of range" value
|
|
31
31
|
const value = propValue !== '' && isLoading ? '' : propValue;
|
|
32
32
|
// TODO: Does this need a loading indicator of some kind?
|
|
@@ -26,7 +26,7 @@ const _react = require("react");
|
|
|
26
26
|
const _runtime = require("../../runtime");
|
|
27
27
|
const _pluginindexes = require("./plugin-indexes");
|
|
28
28
|
function PluginRegistry(props) {
|
|
29
|
-
const { pluginLoader: { getInstalledPlugins
|
|
29
|
+
const { pluginLoader: { getInstalledPlugins, importPluginModule }, children, defaultPluginKinds } = props;
|
|
30
30
|
const getPluginIndexes = (0, _pluginindexes.usePluginIndexes)(getInstalledPlugins);
|
|
31
31
|
// De-dupe calls to import plugin modules
|
|
32
32
|
const importCache = (0, _react.useRef)(new Map());
|
|
@@ -21,11 +21,11 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
usePluginIndexes: function() {
|
|
25
|
-
return usePluginIndexes;
|
|
26
|
-
},
|
|
27
24
|
getTypeAndKindKey: function() {
|
|
28
25
|
return getTypeAndKindKey;
|
|
26
|
+
},
|
|
27
|
+
usePluginIndexes: function() {
|
|
28
|
+
return usePluginIndexes;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _core = require("@perses-dev/core");
|
|
@@ -40,7 +40,7 @@ function usePluginIndexes(getInstalledPlugins) {
|
|
|
40
40
|
const pluginMetadataByType = new Map();
|
|
41
41
|
for (const resource of installedPlugins){
|
|
42
42
|
for (const pluginMetadata of resource.spec.plugins){
|
|
43
|
-
const { pluginType
|
|
43
|
+
const { pluginType, kind } = pluginMetadata;
|
|
44
44
|
// Index the plugin by type and kind to point at the module that contains it
|
|
45
45
|
const key = getTypeAndKindKey(pluginType, kind);
|
|
46
46
|
if (pluginResourcesByTypeAndKind.has(key)) {
|
|
@@ -24,8 +24,8 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _components = require("@perses-dev/components");
|
|
25
25
|
const _runtime = require("../../runtime");
|
|
26
26
|
function PluginSpecEditor(props) {
|
|
27
|
-
const { pluginType
|
|
28
|
-
const { data: plugin
|
|
27
|
+
const { pluginType, pluginKind, ...others } = props;
|
|
28
|
+
const { data: plugin, isLoading, error } = (0, _runtime.usePlugin)(pluginType, pluginKind);
|
|
29
29
|
if (error) {
|
|
30
30
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorAlert, {
|
|
31
31
|
error: error
|
|
@@ -41,7 +41,7 @@ function PluginSpecEditor(props) {
|
|
|
41
41
|
if (pluginType === 'Panel') {
|
|
42
42
|
throw new Error('This editor should not be used for panel type. Please use Panel Spec Editor instead.');
|
|
43
43
|
}
|
|
44
|
-
const { OptionsEditorComponent
|
|
44
|
+
const { OptionsEditorComponent } = plugin;
|
|
45
45
|
if (OptionsEditorComponent !== undefined) {
|
|
46
46
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(OptionsEditorComponent, {
|
|
47
47
|
...others
|
|
@@ -24,8 +24,8 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
25
|
const _context = require("../context");
|
|
26
26
|
function ProjectSelect(props) {
|
|
27
|
-
const { onChange
|
|
28
|
-
const { data
|
|
27
|
+
const { onChange, value, ...others } = props;
|
|
28
|
+
const { data, isLoading } = (0, _context.useProjectList)();
|
|
29
29
|
// While loading available values, just use an empty string so MUI select doesn't warn about values out of range
|
|
30
30
|
const optionValue = isLoading ? '' : projectToOptionValue(value);
|
|
31
31
|
// When the user makes a selection, convert the string option value back to a DatasourceSelector
|
|
@@ -33,12 +33,12 @@ function _interop_require_default(obj) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
const DEFAULT_QUERY_PLUGIN_TYPE = 'TimeSeriesQuery';
|
|
36
|
-
function TimeSeriesQueryEditor({ queries =[]
|
|
36
|
+
function TimeSeriesQueryEditor({ queries = [], onChange }) {
|
|
37
37
|
const hasMoreThanOneQuery = queries.length > 1;
|
|
38
|
-
const { defaultPluginKinds
|
|
38
|
+
const { defaultPluginKinds } = (0, _runtime.usePluginRegistry)();
|
|
39
39
|
var _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE;
|
|
40
40
|
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 : '';
|
|
41
|
-
const { data: defaultQueryPlugin
|
|
41
|
+
const { data: defaultQueryPlugin } = (0, _runtime.usePlugin)(DEFAULT_QUERY_PLUGIN_TYPE, defaultTimeSeriesQueryKind, {
|
|
42
42
|
useErrorBoundary: true,
|
|
43
43
|
enabled: true
|
|
44
44
|
});
|
|
@@ -32,7 +32,7 @@ function _interop_require_default(obj) {
|
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
const TimeSeriesQueryInput = ({ index
|
|
35
|
+
const TimeSeriesQueryInput = ({ index, query, isCollapsed, onDelete, onChange, onCollapseExpand })=>{
|
|
36
36
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
37
37
|
spacing: 1,
|
|
38
38
|
children: [
|
|
@@ -77,8 +77,8 @@ const TimeSeriesQueryInput = ({ index , query , isCollapsed , onDelete , onChang
|
|
|
77
77
|
/**
|
|
78
78
|
* Displays an editor for TimeSeriesQueryDefinition objects.
|
|
79
79
|
*/ function QueryEditor(props) {
|
|
80
|
-
const { value
|
|
81
|
-
const { spec: { plugin
|
|
80
|
+
const { value, onChange, ...others } = props;
|
|
81
|
+
const { spec: { plugin } } = value;
|
|
82
82
|
const handlePluginChange = (next)=>{
|
|
83
83
|
onChange((0, _immer.default)(value, (draft)=>{
|
|
84
84
|
draft.spec.plugin = next;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "TraceQueryEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return TraceQueryEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
26
|
+
const _react = require("react");
|
|
27
|
+
const _immer = require("immer");
|
|
28
|
+
const _runtime = require("../../runtime");
|
|
29
|
+
const _TraceQueryInput = require("./TraceQueryInput");
|
|
30
|
+
function _interop_require_default(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const DEFAULT_QUERY_PLUGIN_TYPE = 'TraceQuery';
|
|
36
|
+
function TraceQueryEditor({ queries = [], onChange }) {
|
|
37
|
+
const hasMoreThanOneQuery = queries.length > 1;
|
|
38
|
+
const defaultTraceQueryKind = 'TempoTraceQuery';
|
|
39
|
+
// State for which queries are collapsed
|
|
40
|
+
// TODO: Would be easier if we had IDs for queries.
|
|
41
|
+
const [queriesCollapsed, setQueriesCollapsed] = (0, _react.useState)(queries.map(()=>false));
|
|
42
|
+
const { data: defaultQueryPlugin } = (0, _runtime.usePlugin)(DEFAULT_QUERY_PLUGIN_TYPE, defaultTraceQueryKind, {
|
|
43
|
+
useErrorBoundary: true,
|
|
44
|
+
enabled: true
|
|
45
|
+
});
|
|
46
|
+
// Query handlers
|
|
47
|
+
const handleQueryChange = (index, queryDef)=>{
|
|
48
|
+
onChange((0, _immer.produce)(queries, (draft)=>{
|
|
49
|
+
if (draft) {
|
|
50
|
+
draft[index] = queryDef;
|
|
51
|
+
} else {
|
|
52
|
+
draft = [
|
|
53
|
+
queryDef
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
const handleQueryAdd = ()=>{
|
|
59
|
+
if (!defaultQueryPlugin) return;
|
|
60
|
+
onChange((0, _immer.produce)(queries, (draft)=>{
|
|
61
|
+
const queryDef = {
|
|
62
|
+
kind: DEFAULT_QUERY_PLUGIN_TYPE,
|
|
63
|
+
spec: {
|
|
64
|
+
plugin: {
|
|
65
|
+
kind: defaultTraceQueryKind,
|
|
66
|
+
spec: defaultQueryPlugin.createInitialOptions()
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (draft) {
|
|
71
|
+
draft.push(queryDef);
|
|
72
|
+
} else {
|
|
73
|
+
draft = [
|
|
74
|
+
...queries,
|
|
75
|
+
queryDef
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
setQueriesCollapsed((queriesCollapsed)=>{
|
|
80
|
+
queriesCollapsed.push(false);
|
|
81
|
+
return [
|
|
82
|
+
...queriesCollapsed
|
|
83
|
+
];
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const handleQueryDelete = (index)=>{
|
|
87
|
+
onChange((0, _immer.produce)(queries, (draft)=>{
|
|
88
|
+
draft.splice(index, 1);
|
|
89
|
+
}));
|
|
90
|
+
setQueriesCollapsed((queriesCollapsed)=>{
|
|
91
|
+
queriesCollapsed.splice(index, 1);
|
|
92
|
+
return [
|
|
93
|
+
...queriesCollapsed
|
|
94
|
+
];
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const handleQueryCollapseExpand = (index)=>{
|
|
98
|
+
setQueriesCollapsed((queriesCollapsed)=>{
|
|
99
|
+
queriesCollapsed[index] = !queriesCollapsed[index];
|
|
100
|
+
return [
|
|
101
|
+
...queriesCollapsed
|
|
102
|
+
];
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
// show one query input if queries is empty
|
|
106
|
+
const queryDefinitions = queries.length ? queries : [
|
|
107
|
+
{
|
|
108
|
+
kind: 'TraceQuery',
|
|
109
|
+
spec: {
|
|
110
|
+
plugin: {
|
|
111
|
+
kind: 'TempoTraceQuery',
|
|
112
|
+
spec: {
|
|
113
|
+
query: ''
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
120
|
+
children: [
|
|
121
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
122
|
+
spacing: 1,
|
|
123
|
+
children: queryDefinitions.map((query, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_TraceQueryInput.TraceQueryInput, {
|
|
124
|
+
index: i,
|
|
125
|
+
query: query,
|
|
126
|
+
isCollapsed: !!queriesCollapsed[i],
|
|
127
|
+
onChange: handleQueryChange,
|
|
128
|
+
onDelete: hasMoreThanOneQuery ? handleQueryDelete : undefined,
|
|
129
|
+
onCollapseExpand: handleQueryCollapseExpand
|
|
130
|
+
}, i))
|
|
131
|
+
}),
|
|
132
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
133
|
+
variant: "contained",
|
|
134
|
+
startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {}),
|
|
135
|
+
sx: {
|
|
136
|
+
marginTop: 1
|
|
137
|
+
},
|
|
138
|
+
onClick: handleQueryAdd,
|
|
139
|
+
children: "Add Query"
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
}
|