@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
|
@@ -16,9 +16,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "LegendOptionsEditor", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return LegendOptionsEditor;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _core = require("@perses-dev/core");
|
|
24
26
|
const _components = require("@perses-dev/components");
|
|
@@ -102,24 +104,24 @@ function LegendOptionsEditor({ value , onChange }) {
|
|
|
102
104
|
}
|
|
103
105
|
return result;
|
|
104
106
|
}, []);
|
|
105
|
-
return /*#__PURE__*/ (0,
|
|
107
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
106
108
|
children: [
|
|
107
|
-
!isValidLegend && /*#__PURE__*/ (0,
|
|
109
|
+
!isValidLegend && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorAlert, {
|
|
108
110
|
error: {
|
|
109
111
|
name: 'invalid-legend',
|
|
110
112
|
message: 'Invalid legend spec'
|
|
111
113
|
}
|
|
112
114
|
}),
|
|
113
|
-
/*#__PURE__*/ (0,
|
|
115
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
114
116
|
label: "Show",
|
|
115
|
-
control: /*#__PURE__*/ (0,
|
|
117
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
116
118
|
checked: value !== undefined,
|
|
117
119
|
onChange: handleLegendShowChange
|
|
118
120
|
})
|
|
119
121
|
}),
|
|
120
|
-
/*#__PURE__*/ (0,
|
|
122
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
121
123
|
label: "Position",
|
|
122
|
-
control: /*#__PURE__*/ (0,
|
|
124
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SettingsAutocomplete, {
|
|
123
125
|
value: {
|
|
124
126
|
...legendPositionConfig,
|
|
125
127
|
id: currentPosition
|
|
@@ -130,9 +132,9 @@ function LegendOptionsEditor({ value , onChange }) {
|
|
|
130
132
|
disableClearable: true
|
|
131
133
|
})
|
|
132
134
|
}),
|
|
133
|
-
/*#__PURE__*/ (0,
|
|
135
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
134
136
|
label: "Mode",
|
|
135
|
-
control: /*#__PURE__*/ (0,
|
|
137
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SettingsAutocomplete, {
|
|
136
138
|
value: {
|
|
137
139
|
...legendModeConfig,
|
|
138
140
|
id: currentMode
|
|
@@ -143,9 +145,9 @@ function LegendOptionsEditor({ value , onChange }) {
|
|
|
143
145
|
disableClearable: true
|
|
144
146
|
})
|
|
145
147
|
}),
|
|
146
|
-
/*#__PURE__*/ (0,
|
|
148
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
147
149
|
label: "Size",
|
|
148
|
-
control: /*#__PURE__*/ (0,
|
|
150
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SettingsAutocomplete, {
|
|
149
151
|
value: {
|
|
150
152
|
...legendSizeConfig,
|
|
151
153
|
id: currentSize
|
|
@@ -154,23 +156,23 @@ function LegendOptionsEditor({ value , onChange }) {
|
|
|
154
156
|
onChange: handleLegendSizeChange,
|
|
155
157
|
// TODO: enable sizes for list mode when we normalize the layout of
|
|
156
158
|
// lists to more closely match tables.
|
|
157
|
-
disabled: value === undefined || currentMode !== '
|
|
159
|
+
disabled: value === undefined || currentMode !== 'table',
|
|
158
160
|
disableClearable: true
|
|
159
161
|
})
|
|
160
162
|
}),
|
|
161
|
-
/*#__PURE__*/ (0,
|
|
163
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
162
164
|
label: "Values",
|
|
163
165
|
control: // For some reason, the inferred option type doesn't always seem to work
|
|
164
166
|
// quite right when `multiple` is true. Explicitly setting the generics
|
|
165
167
|
// to work around this.
|
|
166
|
-
/*#__PURE__*/ (0,
|
|
168
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SettingsAutocomplete, {
|
|
167
169
|
multiple: true,
|
|
168
170
|
disableCloseOnSelect: true,
|
|
169
171
|
disableClearable: true,
|
|
170
172
|
value: legendValuesConfig,
|
|
171
173
|
options: VALUE_OPTIONS,
|
|
172
174
|
onChange: handleLegendValueChange,
|
|
173
|
-
disabled: value === undefined || currentMode !== '
|
|
175
|
+
disabled: value === undefined || currentMode !== 'table',
|
|
174
176
|
limitTags: 1,
|
|
175
177
|
ChipProps: {
|
|
176
178
|
size: 'small'
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./LegendOptionsEditor"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -16,12 +16,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "OptionsEditorRadios", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return OptionsEditorRadios;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _react = require("react");
|
|
24
|
-
const
|
|
26
|
+
const _OptionsEditorTabPanel = require("../OptionsEditorTabPanel");
|
|
25
27
|
const OptionsEditorRadios = (props)=>{
|
|
26
28
|
const { tabs , defaultTab , onModeChange , isReadonly } = props;
|
|
27
29
|
const [activeTab, setActiveTab] = (0, _react.useState)(defaultTab);
|
|
@@ -30,40 +32,33 @@ const OptionsEditorRadios = (props)=>{
|
|
|
30
32
|
setActiveTab(v);
|
|
31
33
|
onModeChange(v);
|
|
32
34
|
};
|
|
33
|
-
return /*#__PURE__*/ (0,
|
|
35
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
34
36
|
children: [
|
|
35
|
-
/*#__PURE__*/ (0,
|
|
37
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
36
38
|
sx: {
|
|
37
39
|
borderBottom: 1,
|
|
38
40
|
borderColor: (theme)=>theme.palette.divider
|
|
39
41
|
},
|
|
40
|
-
children: /*#__PURE__*/ (0,
|
|
41
|
-
children:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
55
|
-
disabled: isReadonly,
|
|
56
|
-
value: i,
|
|
57
|
-
control: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
58
|
-
label: label
|
|
59
|
-
}, label);
|
|
60
|
-
})
|
|
42
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControl, {
|
|
43
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.RadioGroup, {
|
|
44
|
+
row: true,
|
|
45
|
+
defaultValue: defaultTab,
|
|
46
|
+
value: activeTab,
|
|
47
|
+
onChange: handleChange,
|
|
48
|
+
"aria-labelledby": "Configuration radio",
|
|
49
|
+
children: tabs.map(({ label }, i)=>{
|
|
50
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
51
|
+
disabled: isReadonly,
|
|
52
|
+
value: i,
|
|
53
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Radio, {}),
|
|
54
|
+
label: label
|
|
55
|
+
}, label);
|
|
61
56
|
})
|
|
62
|
-
|
|
57
|
+
})
|
|
63
58
|
})
|
|
64
59
|
}),
|
|
65
60
|
tabs.map(({ label , content }, i)=>{
|
|
66
|
-
return /*#__PURE__*/ (0,
|
|
61
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorTabPanel.OptionsEditorTabPanel, {
|
|
67
62
|
value: activeTab,
|
|
68
63
|
index: i,
|
|
69
64
|
children: content
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./OptionsEditorRadios"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -16,20 +16,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "OptionsEditorTabPanel", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return OptionsEditorTabPanel;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
function OptionsEditorTabPanel(props) {
|
|
24
26
|
const { children , value , index , ...other } = props;
|
|
25
27
|
const isActive = value === index;
|
|
26
|
-
return /*#__PURE__*/ (0,
|
|
28
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
27
29
|
role: "tabpanel",
|
|
28
30
|
hidden: !isActive,
|
|
29
31
|
id: `options-editor-tabpanel-${index}`,
|
|
30
32
|
"aria-labelledby": `options-editor-tab-${index}`,
|
|
31
33
|
...other,
|
|
32
|
-
children: isActive && /*#__PURE__*/ (0,
|
|
34
|
+
children: isActive && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
33
35
|
mt: 2,
|
|
34
36
|
children: children
|
|
35
37
|
})
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./OptionsEditorTabPanel"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -16,30 +16,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "OptionsEditorTabs", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return OptionsEditorTabs;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
25
|
const _react = require("react");
|
|
24
|
-
const
|
|
26
|
+
const _OptionsEditorTabPanel = require("../OptionsEditorTabPanel");
|
|
25
27
|
const OptionsEditorTabs = ({ tabs })=>{
|
|
26
28
|
const [activeTab, setActiveTab] = (0, _react.useState)(0);
|
|
27
29
|
const handleChange = (_, newValue)=>{
|
|
28
30
|
setActiveTab(newValue);
|
|
29
31
|
};
|
|
30
|
-
return /*#__PURE__*/ (0,
|
|
32
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
31
33
|
children: [
|
|
32
|
-
/*#__PURE__*/ (0,
|
|
34
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
33
35
|
sx: {
|
|
34
36
|
borderBottom: 1,
|
|
35
37
|
borderColor: (theme)=>theme.palette.divider
|
|
36
38
|
},
|
|
37
|
-
children: /*#__PURE__*/ (0,
|
|
39
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tabs, {
|
|
38
40
|
value: activeTab,
|
|
39
41
|
onChange: handleChange,
|
|
40
42
|
"aria-label": "Panel configuration tabs",
|
|
41
43
|
children: tabs.map(({ label }, i)=>{
|
|
42
|
-
return /*#__PURE__*/ (0,
|
|
44
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tab, {
|
|
43
45
|
label: label,
|
|
44
46
|
id: `options-editor-tab-${i}`,
|
|
45
47
|
"aria-controls": `options-editor-tabpanel-${i}`
|
|
@@ -48,7 +50,7 @@ const OptionsEditorTabs = ({ tabs })=>{
|
|
|
48
50
|
})
|
|
49
51
|
}),
|
|
50
52
|
tabs.map(({ label , content }, i)=>{
|
|
51
|
-
return /*#__PURE__*/ (0,
|
|
53
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorTabPanel.OptionsEditorTabPanel, {
|
|
52
54
|
value: activeTab,
|
|
53
55
|
index: i,
|
|
54
56
|
children: content
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./OptionsEditorTabs"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -16,19 +16,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PanelSpecEditor", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PanelSpecEditor;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _components = require("@perses-dev/components");
|
|
23
25
|
const _runtime = require("../../runtime");
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
+
const _OptionsEditorTabs = require("../OptionsEditorTabs");
|
|
27
|
+
const _TimeSeriesQueryEditor = require("../TimeSeriesQueryEditor");
|
|
26
28
|
function PanelSpecEditor(props) {
|
|
27
29
|
const { panelDefinition , onJSONChange , onQueriesChange , onPluginSpecChange } = props;
|
|
28
30
|
const { kind } = panelDefinition.spec.plugin;
|
|
29
31
|
const { data: plugin , isLoading , error } = (0, _runtime.usePlugin)('Panel', kind);
|
|
30
32
|
if (error) {
|
|
31
|
-
return /*#__PURE__*/ (0,
|
|
33
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorAlert, {
|
|
32
34
|
error: error
|
|
33
35
|
});
|
|
34
36
|
}
|
|
@@ -42,12 +44,12 @@ function PanelSpecEditor(props) {
|
|
|
42
44
|
const { panelOptionsEditorComponents , hideQueryEditor } = plugin;
|
|
43
45
|
let tabs = [];
|
|
44
46
|
if (!hideQueryEditor) {
|
|
45
|
-
var
|
|
47
|
+
var _panelDefinition_spec_queries;
|
|
46
48
|
// Since we only support TimeSeriesQuery for now, we will always show a TimeSeriesQueryEditor
|
|
47
49
|
tabs.push({
|
|
48
50
|
label: 'Query',
|
|
49
|
-
content: /*#__PURE__*/ (0,
|
|
50
|
-
queries: (
|
|
51
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeSeriesQueryEditor.TimeSeriesQueryEditor, {
|
|
52
|
+
queries: (_panelDefinition_spec_queries = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries !== void 0 ? _panelDefinition_spec_queries : [],
|
|
51
53
|
onChange: onQueriesChange
|
|
52
54
|
})
|
|
53
55
|
});
|
|
@@ -55,7 +57,7 @@ function PanelSpecEditor(props) {
|
|
|
55
57
|
if (panelOptionsEditorComponents !== undefined) {
|
|
56
58
|
tabs = tabs.concat(panelOptionsEditorComponents.map(({ label , content: OptionsEditorComponent })=>({
|
|
57
59
|
label,
|
|
58
|
-
content: /*#__PURE__*/ (0,
|
|
60
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(OptionsEditorComponent, {
|
|
59
61
|
value: panelDefinition.spec.plugin.spec,
|
|
60
62
|
onChange: onPluginSpecChange
|
|
61
63
|
})
|
|
@@ -64,12 +66,12 @@ function PanelSpecEditor(props) {
|
|
|
64
66
|
// always show json editor by default
|
|
65
67
|
tabs.push({
|
|
66
68
|
label: 'JSON',
|
|
67
|
-
content: /*#__PURE__*/ (0,
|
|
69
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.JSONEditor, {
|
|
68
70
|
value: panelDefinition,
|
|
69
71
|
onChange: onJSONChange
|
|
70
72
|
})
|
|
71
73
|
});
|
|
72
|
-
return /*#__PURE__*/ (0,
|
|
74
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorTabs.OptionsEditorTabs, {
|
|
73
75
|
tabs: tabs
|
|
74
76
|
}, tabs.length);
|
|
75
77
|
}
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./PanelSpecEditor"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -16,48 +16,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PluginEditor", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PluginEditor;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
25
|
+
const _PluginKindSelect = require("../PluginKindSelect");
|
|
26
|
+
const _PluginSpecEditor = require("../PluginSpecEditor");
|
|
27
|
+
const _plugineditorapi = require("./plugin-editor-api");
|
|
26
28
|
function PluginEditor(props) {
|
|
27
29
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
30
|
const { value , pluginType , pluginKindLabel , onChange: _ , isReadonly , ...others } = props;
|
|
29
|
-
const { pendingKind , isLoading , error , onKindChange , onSpecChange } = (0,
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Box, {
|
|
31
|
+
const { pendingKind , isLoading , error , onKindChange , onSpecChange } = (0, _plugineditorapi.usePluginEditor)(props);
|
|
32
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
32
33
|
...others,
|
|
33
34
|
children: [
|
|
34
|
-
/*#__PURE__*/ (0,
|
|
35
|
-
margin: "dense",
|
|
35
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginKindSelect.PluginKindSelect, {
|
|
36
36
|
fullWidth: false,
|
|
37
|
-
disabled: isLoading,
|
|
38
|
-
error: error !== null,
|
|
39
37
|
sx: {
|
|
40
|
-
mb: 1
|
|
38
|
+
mb: 1,
|
|
39
|
+
minWidth: 120
|
|
40
|
+
},
|
|
41
|
+
margin: "dense",
|
|
42
|
+
label: pluginKindLabel,
|
|
43
|
+
pluginType: pluginType,
|
|
44
|
+
disabled: isLoading,
|
|
45
|
+
value: pendingKind !== '' ? pendingKind : value.kind,
|
|
46
|
+
InputProps: {
|
|
47
|
+
readOnly: isReadonly
|
|
41
48
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
children: pluginKindLabel
|
|
46
|
-
}),
|
|
47
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginKindSelect.PluginKindSelect, {
|
|
48
|
-
labelId: "plugin-kind-label",
|
|
49
|
-
label: pluginKindLabel,
|
|
50
|
-
pluginType: pluginType,
|
|
51
|
-
value: pendingKind !== '' ? pendingKind : value.kind,
|
|
52
|
-
readOnly: isReadonly,
|
|
53
|
-
onChange: onKindChange
|
|
54
|
-
}),
|
|
55
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormHelperText, {
|
|
56
|
-
children: (ref = error === null || error === void 0 ? void 0 : error.message) !== null && ref !== void 0 ? ref : ''
|
|
57
|
-
})
|
|
58
|
-
]
|
|
49
|
+
error: !!error,
|
|
50
|
+
helperText: error === null || error === void 0 ? void 0 : error.message,
|
|
51
|
+
onChange: onKindChange
|
|
59
52
|
}),
|
|
60
|
-
/*#__PURE__*/ (0,
|
|
53
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginSpecEditor.PluginSpecEditor, {
|
|
61
54
|
pluginType: pluginType,
|
|
62
55
|
pluginKind: value.kind,
|
|
63
56
|
value: value.spec,
|
|
@@ -14,16 +14,18 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function
|
|
17
|
+
_export_star(require("./PluginEditor"), exports);
|
|
18
|
+
_export_star(require("./plugin-editor-api"), exports);
|
|
19
|
+
function _export_star(from, to) {
|
|
20
20
|
Object.keys(from).forEach(function(k) {
|
|
21
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
22
|
+
Object.defineProperty(to, k, {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function() {
|
|
25
|
+
return from[k];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
});
|
|
28
30
|
return from;
|
|
29
31
|
}
|
|
@@ -16,7 +16,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "usePluginEditor", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return usePluginEditor;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const _core = require("@perses-dev/core");
|
|
22
24
|
const _react = require("react");
|
|
@@ -86,10 +88,10 @@ function usePluginEditor(props) {
|
|
|
86
88
|
* When the user tries to change the plugin kind, make sure we have the correct spec for that plugin kind before we
|
|
87
89
|
* make the switch.
|
|
88
90
|
*/ const onKindChange = (e)=>{
|
|
89
|
-
var
|
|
91
|
+
var _prevSpecState_current_pluginType;
|
|
90
92
|
const nextKind = e.target.value;
|
|
91
93
|
// If we already have state for this plugin type/kind from a previous selection, just use it
|
|
92
|
-
const previousState = (
|
|
94
|
+
const previousState = (_prevSpecState_current_pluginType = prevSpecState.current[pluginType]) === null || _prevSpecState_current_pluginType === void 0 ? void 0 : _prevSpecState_current_pluginType[nextKind];
|
|
93
95
|
if (previousState !== undefined) {
|
|
94
96
|
rememberCurrentSpecState();
|
|
95
97
|
onChange({
|
|
@@ -16,26 +16,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PluginKindSelect", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PluginKindSelect;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
25
|
+
const _react = require("react");
|
|
23
26
|
const _runtime = require("../../runtime");
|
|
24
|
-
|
|
27
|
+
const PluginKindSelect = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
|
|
25
28
|
const { pluginType , value: propValue , ...others } = props;
|
|
26
29
|
const { data , isLoading } = (0, _runtime.useListPluginMetadata)(pluginType);
|
|
27
30
|
// Pass an empty value while options are still loading so MUI doesn't complain about us using an "out of range" value
|
|
28
31
|
const value = propValue !== '' && isLoading ? '' : propValue;
|
|
29
32
|
// TODO: Does this need a loading indicator of some kind?
|
|
30
|
-
return /*#__PURE__*/ (0,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
33
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
34
|
+
select: true,
|
|
35
|
+
inputRef: ref,
|
|
34
36
|
...others,
|
|
35
37
|
value: value,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
"data-testid": "plugin-kind-select",
|
|
39
|
+
children: [
|
|
40
|
+
isLoading && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
41
|
+
value: "",
|
|
42
|
+
children: "Loading..."
|
|
43
|
+
}),
|
|
44
|
+
data === null || data === void 0 ? void 0 : data.map((metadata)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
45
|
+
"data-testid": "option",
|
|
46
|
+
value: metadata.kind,
|
|
47
|
+
children: metadata.display.name
|
|
48
|
+
}, metadata.kind))
|
|
49
|
+
]
|
|
40
50
|
});
|
|
41
|
-
}
|
|
51
|
+
});
|
|
52
|
+
PluginKindSelect.displayName = 'PluginKindSelect';
|