@perses-dev/plugin-system 0.38.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 +69 -0
- package/dist/cjs/components/OptionsEditorRadios/index.js +30 -0
- package/dist/cjs/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +8 -6
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +30 -0
- 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 -18
- 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 +55 -35
- package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
- package/dist/cjs/runtime/DataQueriesProvider/model.js +61 -0
- 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 +96 -4
- 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 -8
- package/dist/cjs/test/mock-data.js +57 -0
- 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 +16 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +61 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
- package/dist/components/OptionsEditorRadios/index.d.ts +2 -0
- package/dist/components/OptionsEditorRadios/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorRadios/index.js +15 -0
- package/dist/components/OptionsEditorRadios/index.js.map +1 -0
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +9 -0
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -0
- package/dist/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +2 -2
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
- package/dist/components/OptionsEditorTabPanel/index.d.ts +2 -0
- package/dist/components/OptionsEditorTabPanel/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabPanel/index.js +15 -0
- package/dist/components/OptionsEditorTabPanel/index.js.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
- 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 +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -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.d.ts +5 -5
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +40 -28
- 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 +17 -12
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +47 -1
- 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 +62 -2
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +83 -1
- 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.d.ts +1 -0
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +1 -0
- package/dist/test/index.js.map +1 -1
- package/dist/test/mock-data.d.ts +3 -0
- package/dist/test/mock-data.d.ts.map +1 -0
- package/dist/test/mock-data.js +49 -0
- package/dist/test/mock-data.js.map +1 -0
- 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
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts +0 -9
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +0 -1
- package/dist/components/OptionsEditorTabs/TabPanel.js.map +0 -1
|
@@ -14,19 +14,25 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "VariableEditorForm", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return VariableEditorForm;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
22
|
-
const _react = /*#__PURE__*/
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
23
25
|
const _material = require("@mui/material");
|
|
24
|
-
const
|
|
26
|
+
const _useimmer = require("use-immer");
|
|
25
27
|
const _components = require("@perses-dev/components");
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const _reacthookform = require("react-hook-form");
|
|
29
|
+
const _zod = require("@hookform/resolvers/zod");
|
|
30
|
+
const _utils = require("../../../utils");
|
|
31
|
+
const _variablemodel = require("../variable-model");
|
|
32
|
+
const _PluginEditor = require("../../PluginEditor");
|
|
33
|
+
const _validation = require("../../../validation");
|
|
34
|
+
const _VariablePreview = require("./VariablePreview");
|
|
35
|
+
const _variableeditorformmodel = require("./variable-editor-form-model");
|
|
30
36
|
function _getRequireWildcardCache(nodeInterop) {
|
|
31
37
|
if (typeof WeakMap !== "function") return null;
|
|
32
38
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -35,7 +41,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
35
41
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
36
42
|
})(nodeInterop);
|
|
37
43
|
}
|
|
38
|
-
function
|
|
44
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
39
45
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
40
46
|
return obj;
|
|
41
47
|
}
|
|
@@ -66,35 +72,18 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
66
72
|
}
|
|
67
73
|
return newObj;
|
|
68
74
|
}
|
|
69
|
-
// TODO: Replace with proper validation library
|
|
70
|
-
function getValidation(state) {
|
|
71
|
-
/** Name validation */ let name = null;
|
|
72
|
-
if (!state.name) {
|
|
73
|
-
name = 'Name is required';
|
|
74
|
-
}
|
|
75
|
-
// name can only contain alphanumeric characters and underscores and no spaces
|
|
76
|
-
if (state.name && !/^[a-zA-Z0-9_-]+$/.test(state.name)) {
|
|
77
|
-
name = 'Name can only contain alphanumeric characters, underscores, and dashes';
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
name,
|
|
81
|
-
isValid: !name
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
75
|
function FallbackPreview() {
|
|
85
|
-
return /*#__PURE__*/ (0,
|
|
76
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
|
86
77
|
children: "Error previewing values"
|
|
87
78
|
});
|
|
88
79
|
}
|
|
89
|
-
function
|
|
90
|
-
const { initialVariableDefinition ,
|
|
91
|
-
const initialState = (0,
|
|
92
|
-
const [state, setState] = (0,
|
|
93
|
-
const
|
|
94
|
-
state
|
|
95
|
-
]);
|
|
96
|
-
const [isDiscardDialogStateOpened, setDiscardDialogStateOpened] = (0, _react.useState)(false);
|
|
80
|
+
function VariableEditorForm(props) {
|
|
81
|
+
const { initialVariableDefinition , initialAction , isDraft , isReadonly , onSave , onClose , onDelete } = props;
|
|
82
|
+
const initialState = (0, _variableeditorformmodel.getInitialState)(initialVariableDefinition);
|
|
83
|
+
const [state, setState] = (0, _useimmer.useImmer)(initialState);
|
|
84
|
+
const [isDiscardDialogOpened, setDiscardDialogOpened] = (0, _react.useState)(false);
|
|
97
85
|
const [previewKey, setPreviewKey] = (0, _react.useState)(0);
|
|
86
|
+
const [action, setAction] = (0, _react.useState)(initialAction);
|
|
98
87
|
const refreshPreview = ()=>{
|
|
99
88
|
setPreviewKey((prev)=>prev + 1);
|
|
100
89
|
};
|
|
@@ -102,39 +91,42 @@ function VariableEditForm(props) {
|
|
|
102
91
|
* spec that will be used for preview. The reason why we do this is to avoid
|
|
103
92
|
* having to re-fetch the values when the user is still editing the spec.
|
|
104
93
|
*/ const previewSpec = (0, _react.useMemo)(()=>{
|
|
105
|
-
return (0,
|
|
94
|
+
return (0, _variableeditorformmodel.getVariableDefinitionFromState)(state);
|
|
106
95
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
107
96
|
}, [
|
|
108
97
|
previewKey
|
|
109
98
|
]);
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
99
|
+
const titleAction = (0, _utils.getTitleAction)(action, isDraft);
|
|
100
|
+
const submitText = (0, _utils.getSubmitText)(action, isDraft);
|
|
101
|
+
const form = (0, _reacthookform.useForm)({
|
|
102
|
+
resolver: (0, _zod.zodResolver)(_validation.variableEditValidationSchema),
|
|
103
|
+
mode: 'onBlur',
|
|
104
|
+
defaultValues: state
|
|
105
|
+
});
|
|
106
|
+
const processForm = ()=>{
|
|
107
|
+
onSave((0, _variableeditorformmodel.getVariableDefinitionFromState)(state));
|
|
108
|
+
};
|
|
118
109
|
// When user click on cancel, several possibilities:
|
|
119
110
|
// - create action: ask for discard approval
|
|
120
111
|
// - update action: ask for discard approval if changed
|
|
121
112
|
// - read action: don´t ask for discard approval
|
|
122
113
|
const handleCancel = (0, _react.useCallback)(()=>{
|
|
123
|
-
if (
|
|
124
|
-
|
|
114
|
+
if (JSON.stringify(initialState) !== JSON.stringify(state)) {
|
|
115
|
+
setDiscardDialogOpened(true);
|
|
125
116
|
} else {
|
|
126
|
-
|
|
117
|
+
onClose();
|
|
127
118
|
}
|
|
128
119
|
}, [
|
|
129
120
|
state,
|
|
130
121
|
initialState,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
onCancel
|
|
122
|
+
setDiscardDialogOpened,
|
|
123
|
+
onClose
|
|
134
124
|
]);
|
|
135
|
-
|
|
125
|
+
var _state_textVariableFields_constant;
|
|
126
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reacthookform.FormProvider, {
|
|
127
|
+
...form,
|
|
136
128
|
children: [
|
|
137
|
-
/*#__PURE__*/ (0,
|
|
129
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
138
130
|
sx: {
|
|
139
131
|
display: 'flex',
|
|
140
132
|
alignItems: 'center',
|
|
@@ -142,152 +134,231 @@ function VariableEditForm(props) {
|
|
|
142
134
|
borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
|
|
143
135
|
},
|
|
144
136
|
children: [
|
|
145
|
-
/*#__PURE__*/ (0,
|
|
137
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
|
|
146
138
|
variant: "h2",
|
|
147
|
-
children:
|
|
139
|
+
children: [
|
|
140
|
+
titleAction,
|
|
141
|
+
" Variable"
|
|
142
|
+
]
|
|
148
143
|
}),
|
|
149
|
-
/*#__PURE__*/ (0,
|
|
144
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
150
145
|
direction: "row",
|
|
151
146
|
spacing: 1,
|
|
152
147
|
sx: {
|
|
153
148
|
marginLeft: 'auto'
|
|
154
149
|
},
|
|
155
|
-
children:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
150
|
+
children: action === 'read' ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
151
|
+
children: [
|
|
152
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
153
|
+
disabled: isReadonly,
|
|
154
|
+
variant: "contained",
|
|
155
|
+
onClick: ()=>setAction('update'),
|
|
156
|
+
children: "Edit"
|
|
157
|
+
}),
|
|
158
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
159
|
+
color: "error",
|
|
160
|
+
variant: "outlined",
|
|
161
|
+
onClick: onDelete,
|
|
162
|
+
children: "Delete"
|
|
163
|
+
}),
|
|
164
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {
|
|
165
|
+
orientation: "vertical",
|
|
166
|
+
flexItem: true,
|
|
167
|
+
sx: (theme)=>({
|
|
168
|
+
borderColor: theme.palette.grey['500'],
|
|
169
|
+
'&.MuiDivider-root': {
|
|
170
|
+
marginLeft: 2,
|
|
171
|
+
marginRight: 1
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
176
|
+
color: "secondary",
|
|
177
|
+
variant: "outlined",
|
|
178
|
+
onClick: onClose,
|
|
179
|
+
children: "Close"
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
183
|
+
children: [
|
|
184
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
185
|
+
type: "submit",
|
|
186
|
+
variant: "contained",
|
|
187
|
+
disabled: !form.formState.isValid,
|
|
188
|
+
onClick: form.handleSubmit(processForm),
|
|
189
|
+
children: submitText
|
|
190
|
+
}),
|
|
191
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
192
|
+
color: "secondary",
|
|
193
|
+
variant: "outlined",
|
|
194
|
+
onClick: handleCancel,
|
|
195
|
+
children: "Cancel"
|
|
196
|
+
})
|
|
197
|
+
]
|
|
198
|
+
})
|
|
171
199
|
})
|
|
172
200
|
]
|
|
173
201
|
}),
|
|
174
|
-
/*#__PURE__*/ (0,
|
|
202
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
175
203
|
padding: 2,
|
|
176
204
|
sx: {
|
|
177
205
|
overflowY: 'scroll'
|
|
178
206
|
},
|
|
179
207
|
children: [
|
|
180
|
-
/*#__PURE__*/ (0,
|
|
208
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
|
|
181
209
|
container: true,
|
|
182
210
|
spacing: 2,
|
|
183
211
|
mb: 2,
|
|
184
212
|
children: [
|
|
185
|
-
/*#__PURE__*/ (0,
|
|
213
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
186
214
|
item: true,
|
|
187
215
|
xs: 8,
|
|
188
|
-
children: /*#__PURE__*/ (0,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
216
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
217
|
+
name: "name",
|
|
218
|
+
render: ({ field , fieldState })=>{
|
|
219
|
+
var _fieldState_error;
|
|
220
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
221
|
+
...field,
|
|
222
|
+
required: true,
|
|
223
|
+
fullWidth: true,
|
|
224
|
+
label: "Name",
|
|
225
|
+
InputLabelProps: {
|
|
226
|
+
shrink: action === 'read' ? true : undefined
|
|
227
|
+
},
|
|
228
|
+
InputProps: {
|
|
229
|
+
disabled: action === 'update',
|
|
230
|
+
readOnly: action === 'read'
|
|
231
|
+
},
|
|
232
|
+
error: !!fieldState.error,
|
|
233
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
234
|
+
onChange: (event)=>{
|
|
235
|
+
field.onChange(event);
|
|
236
|
+
setState((draft)=>{
|
|
237
|
+
draft.name = event.target.value;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
201
240
|
});
|
|
202
241
|
}
|
|
203
242
|
})
|
|
204
243
|
}),
|
|
205
|
-
/*#__PURE__*/ (0,
|
|
244
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
206
245
|
item: true,
|
|
207
246
|
xs: 4,
|
|
208
|
-
children: /*#__PURE__*/ (0,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
247
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
248
|
+
name: "title",
|
|
249
|
+
render: ({ field , fieldState })=>{
|
|
250
|
+
var _fieldState_error;
|
|
251
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
252
|
+
...field,
|
|
253
|
+
fullWidth: true,
|
|
254
|
+
label: "Display Label",
|
|
255
|
+
InputLabelProps: {
|
|
256
|
+
shrink: action === 'read' ? true : undefined
|
|
257
|
+
},
|
|
258
|
+
InputProps: {
|
|
259
|
+
readOnly: action === 'read'
|
|
260
|
+
},
|
|
261
|
+
error: !!fieldState.error,
|
|
262
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
263
|
+
onChange: (event)=>{
|
|
264
|
+
field.onChange(event);
|
|
265
|
+
setState((draft)=>{
|
|
266
|
+
draft.title = event.target.value;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
218
269
|
});
|
|
219
270
|
}
|
|
220
271
|
})
|
|
221
272
|
}),
|
|
222
|
-
/*#__PURE__*/ (0,
|
|
273
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
223
274
|
item: true,
|
|
224
275
|
xs: 8,
|
|
225
|
-
children: /*#__PURE__*/ (0,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
276
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
277
|
+
name: "description",
|
|
278
|
+
render: ({ field , fieldState })=>{
|
|
279
|
+
var _fieldState_error;
|
|
280
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
281
|
+
...field,
|
|
282
|
+
fullWidth: true,
|
|
283
|
+
label: "Description",
|
|
284
|
+
InputLabelProps: {
|
|
285
|
+
shrink: action === 'read' ? true : undefined
|
|
286
|
+
},
|
|
287
|
+
InputProps: {
|
|
288
|
+
readOnly: action === 'read'
|
|
289
|
+
},
|
|
290
|
+
error: !!fieldState.error,
|
|
291
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
292
|
+
onChange: (event)=>{
|
|
293
|
+
field.onChange(event);
|
|
294
|
+
setState((draft)=>{
|
|
295
|
+
draft.description = event.target.value;
|
|
296
|
+
});
|
|
297
|
+
}
|
|
235
298
|
});
|
|
236
299
|
}
|
|
237
300
|
})
|
|
238
301
|
}),
|
|
239
|
-
/*#__PURE__*/ (0,
|
|
302
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
240
303
|
item: true,
|
|
241
304
|
xs: 4,
|
|
242
|
-
children: /*#__PURE__*/ (0,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
labelId: "variable-type-select-label",
|
|
251
|
-
id: "variable-type-select",
|
|
305
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
306
|
+
name: "kind",
|
|
307
|
+
render: ({ field , fieldState })=>{
|
|
308
|
+
var _fieldState_error;
|
|
309
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
310
|
+
select: true,
|
|
311
|
+
...field,
|
|
312
|
+
fullWidth: true,
|
|
252
313
|
label: "Type",
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
314
|
+
InputLabelProps: {
|
|
315
|
+
shrink: action === 'read' ? true : undefined
|
|
316
|
+
},
|
|
317
|
+
InputProps: {
|
|
318
|
+
readOnly: action === 'read'
|
|
319
|
+
},
|
|
320
|
+
error: !!fieldState.error,
|
|
321
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
322
|
+
onChange: (event)=>{
|
|
323
|
+
field.onChange(event);
|
|
256
324
|
setState((draft)=>{
|
|
257
|
-
draft.kind =
|
|
325
|
+
draft.kind = event.target.value;
|
|
258
326
|
});
|
|
259
327
|
},
|
|
260
|
-
children:
|
|
328
|
+
children: _variablemodel.VARIABLE_TYPES.map((v)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
261
329
|
value: v.kind,
|
|
262
330
|
children: v.label
|
|
263
331
|
}, v.kind))
|
|
264
|
-
})
|
|
265
|
-
|
|
332
|
+
});
|
|
333
|
+
}
|
|
266
334
|
})
|
|
267
335
|
})
|
|
268
336
|
]
|
|
269
337
|
}),
|
|
270
|
-
/*#__PURE__*/ (0,
|
|
271
|
-
state.kind === 'TextVariable' && /*#__PURE__*/ (0,
|
|
338
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {}),
|
|
339
|
+
state.kind === 'TextVariable' && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
272
340
|
children: [
|
|
273
|
-
/*#__PURE__*/ (0,
|
|
341
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
274
342
|
py: 1,
|
|
275
343
|
variant: "subtitle1",
|
|
276
344
|
children: "Text Options"
|
|
277
345
|
}),
|
|
278
|
-
/*#__PURE__*/ (0,
|
|
346
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
279
347
|
spacing: 2,
|
|
280
348
|
children: [
|
|
281
|
-
/*#__PURE__*/ (0,
|
|
282
|
-
children: /*#__PURE__*/ (0,
|
|
349
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
350
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_VariablePreview.VariablePreview, {
|
|
283
351
|
values: [
|
|
284
352
|
state.textVariableFields.value
|
|
285
353
|
]
|
|
286
354
|
})
|
|
287
355
|
}),
|
|
288
|
-
/*#__PURE__*/ (0,
|
|
356
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
289
357
|
label: "Value",
|
|
290
358
|
value: state.textVariableFields.value,
|
|
359
|
+
InputLabelProps: {
|
|
360
|
+
shrink: action === 'read' ? true : undefined
|
|
361
|
+
},
|
|
291
362
|
InputProps: {
|
|
292
363
|
readOnly: action === 'read'
|
|
293
364
|
},
|
|
@@ -296,43 +367,56 @@ function VariableEditForm(props) {
|
|
|
296
367
|
draft.textVariableFields.value = v.target.value;
|
|
297
368
|
});
|
|
298
369
|
}
|
|
370
|
+
}),
|
|
371
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
372
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
373
|
+
checked: (_state_textVariableFields_constant = state.textVariableFields.constant) !== null && _state_textVariableFields_constant !== void 0 ? _state_textVariableFields_constant : false,
|
|
374
|
+
readOnly: action === 'read',
|
|
375
|
+
onChange: (e)=>{
|
|
376
|
+
if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
|
|
377
|
+
setState((draft)=>{
|
|
378
|
+
draft.textVariableFields.constant = e.target.checked;
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}),
|
|
382
|
+
label: "Constant"
|
|
299
383
|
})
|
|
300
384
|
]
|
|
301
385
|
})
|
|
302
386
|
]
|
|
303
387
|
}),
|
|
304
|
-
state.kind === 'ListVariable' && /*#__PURE__*/ (0,
|
|
388
|
+
state.kind === 'ListVariable' && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
305
389
|
children: [
|
|
306
|
-
/*#__PURE__*/ (0,
|
|
390
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
307
391
|
py: 1,
|
|
308
392
|
variant: "subtitle1",
|
|
309
393
|
children: "List Options"
|
|
310
394
|
}),
|
|
311
|
-
/*#__PURE__*/ (0,
|
|
395
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
312
396
|
spacing: 2,
|
|
313
397
|
mb: 2,
|
|
314
398
|
children: [
|
|
315
|
-
state.listVariableFields.plugin.kind ? /*#__PURE__*/ (0,
|
|
316
|
-
children: /*#__PURE__*/ (0,
|
|
399
|
+
state.listVariableFields.plugin.kind ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
400
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
317
401
|
FallbackComponent: FallbackPreview,
|
|
318
402
|
resetKeys: [
|
|
319
403
|
previewSpec
|
|
320
404
|
],
|
|
321
|
-
children: /*#__PURE__*/ (0,
|
|
405
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_VariablePreview.VariableListPreview, {
|
|
322
406
|
definition: previewSpec,
|
|
323
407
|
onRefresh: refreshPreview
|
|
324
408
|
})
|
|
325
409
|
})
|
|
326
|
-
}) : /*#__PURE__*/ (0,
|
|
410
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_VariablePreview.VariablePreview, {
|
|
327
411
|
isLoading: true
|
|
328
412
|
}),
|
|
329
|
-
/*#__PURE__*/ (0,
|
|
413
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
330
414
|
children: [
|
|
331
|
-
/*#__PURE__*/ (0,
|
|
415
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ClickAwayListener, {
|
|
332
416
|
onClickAway: ()=>refreshPreview(),
|
|
333
|
-
children: /*#__PURE__*/ (0,
|
|
417
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {})
|
|
334
418
|
}),
|
|
335
|
-
/*#__PURE__*/ (0,
|
|
419
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginEditor.PluginEditor, {
|
|
336
420
|
width: "100%",
|
|
337
421
|
pluginType: "Variable",
|
|
338
422
|
pluginKindLabel: "Source",
|
|
@@ -346,10 +430,13 @@ function VariableEditForm(props) {
|
|
|
346
430
|
})
|
|
347
431
|
]
|
|
348
432
|
}),
|
|
349
|
-
/*#__PURE__*/ (0,
|
|
350
|
-
children: /*#__PURE__*/ (0,
|
|
433
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
434
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
351
435
|
label: "Capturing Regexp Filter",
|
|
352
|
-
value: state.listVariableFields.
|
|
436
|
+
value: state.listVariableFields.capturingRegexp || '',
|
|
437
|
+
InputLabelProps: {
|
|
438
|
+
shrink: action === 'read' ? true : undefined
|
|
439
|
+
},
|
|
353
440
|
InputProps: {
|
|
354
441
|
readOnly: action === 'read'
|
|
355
442
|
},
|
|
@@ -357,9 +444,9 @@ function VariableEditForm(props) {
|
|
|
357
444
|
setState((draft)=>{
|
|
358
445
|
if (e.target.value) {
|
|
359
446
|
// TODO: do a better fix, if empty string => it should skip the filter
|
|
360
|
-
draft.listVariableFields.
|
|
447
|
+
draft.listVariableFields.capturingRegexp = e.target.value;
|
|
361
448
|
} else {
|
|
362
|
-
draft.listVariableFields.
|
|
449
|
+
draft.listVariableFields.capturingRegexp = undefined;
|
|
363
450
|
}
|
|
364
451
|
});
|
|
365
452
|
},
|
|
@@ -368,19 +455,19 @@ function VariableEditForm(props) {
|
|
|
368
455
|
})
|
|
369
456
|
]
|
|
370
457
|
}),
|
|
371
|
-
/*#__PURE__*/ (0,
|
|
372
|
-
/*#__PURE__*/ (0,
|
|
458
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {}),
|
|
459
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
373
460
|
py: 1,
|
|
374
461
|
variant: "subtitle1",
|
|
375
462
|
children: "Dropdown Options"
|
|
376
463
|
}),
|
|
377
|
-
/*#__PURE__*/ (0,
|
|
464
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
378
465
|
spacing: "2",
|
|
379
466
|
children: [
|
|
380
|
-
/*#__PURE__*/ (0,
|
|
467
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
381
468
|
children: [
|
|
382
|
-
/*#__PURE__*/ (0,
|
|
383
|
-
control: /*#__PURE__*/ (0,
|
|
469
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
470
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
384
471
|
checked: state.listVariableFields.allowMultiple,
|
|
385
472
|
readOnly: action === 'read',
|
|
386
473
|
onChange: (e)=>{
|
|
@@ -392,16 +479,16 @@ function VariableEditForm(props) {
|
|
|
392
479
|
}),
|
|
393
480
|
label: "Allow Multiple Values"
|
|
394
481
|
}),
|
|
395
|
-
/*#__PURE__*/ (0,
|
|
482
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
396
483
|
variant: "caption",
|
|
397
484
|
children: "Enables multiple values to be selected at the same time"
|
|
398
485
|
})
|
|
399
486
|
]
|
|
400
487
|
}),
|
|
401
|
-
/*#__PURE__*/ (0,
|
|
488
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
402
489
|
children: [
|
|
403
|
-
/*#__PURE__*/ (0,
|
|
404
|
-
control: /*#__PURE__*/ (0,
|
|
490
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControlLabel, {
|
|
491
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
405
492
|
checked: state.listVariableFields.allowAll,
|
|
406
493
|
readOnly: action === 'read',
|
|
407
494
|
onChange: (e)=>{
|
|
@@ -413,14 +500,17 @@ function VariableEditForm(props) {
|
|
|
413
500
|
}),
|
|
414
501
|
label: "Allow All option"
|
|
415
502
|
}),
|
|
416
|
-
/*#__PURE__*/ (0,
|
|
503
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
417
504
|
mb: 1,
|
|
418
505
|
variant: "caption",
|
|
419
506
|
children: "Enables an option to include all variable values"
|
|
420
507
|
}),
|
|
421
|
-
state.listVariableFields.allowAll && /*#__PURE__*/ (0,
|
|
508
|
+
state.listVariableFields.allowAll && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
422
509
|
label: "Custom All Value",
|
|
423
510
|
value: state.listVariableFields.customAllValue,
|
|
511
|
+
InputLabelProps: {
|
|
512
|
+
shrink: action === 'read' ? true : undefined
|
|
513
|
+
},
|
|
424
514
|
InputProps: {
|
|
425
515
|
readOnly: action === 'read'
|
|
426
516
|
},
|
|
@@ -443,15 +533,15 @@ function VariableEditForm(props) {
|
|
|
443
533
|
})
|
|
444
534
|
]
|
|
445
535
|
}),
|
|
446
|
-
/*#__PURE__*/ (0,
|
|
536
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.DiscardChangesConfirmationDialog, {
|
|
447
537
|
description: "Are you sure you want to discard these changes? Changes cannot be recovered.",
|
|
448
|
-
isOpen:
|
|
538
|
+
isOpen: isDiscardDialogOpened,
|
|
449
539
|
onCancel: ()=>{
|
|
450
|
-
|
|
540
|
+
setDiscardDialogOpened(false);
|
|
451
541
|
},
|
|
452
542
|
onDiscardChanges: ()=>{
|
|
453
|
-
|
|
454
|
-
|
|
543
|
+
setDiscardDialogOpened(false);
|
|
544
|
+
onClose();
|
|
455
545
|
}
|
|
456
546
|
})
|
|
457
547
|
]
|