@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
|
@@ -12,42 +12,29 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
15
|
-
import { Box, Typography, Switch, TextField, Grid,
|
|
15
|
+
import { Box, Typography, Switch, TextField, Grid, FormControlLabel, MenuItem, Button, Stack, ClickAwayListener, Divider } from '@mui/material';
|
|
16
16
|
import { useImmer } from 'use-immer';
|
|
17
17
|
import { DiscardChangesConfirmationDialog, ErrorBoundary } from '@perses-dev/components';
|
|
18
|
+
import { Controller, FormProvider, useForm } from 'react-hook-form';
|
|
19
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
20
|
+
import { getSubmitText, getTitleAction } from '../../../utils';
|
|
18
21
|
import { VARIABLE_TYPES } from '../variable-model';
|
|
19
22
|
import { PluginEditor } from '../../PluginEditor';
|
|
23
|
+
import { variableEditValidationSchema } from '../../../validation';
|
|
20
24
|
import { VariableListPreview, VariablePreview } from './VariablePreview';
|
|
21
25
|
import { getVariableDefinitionFromState, getInitialState } from './variable-editor-form-model';
|
|
22
|
-
// TODO: Replace with proper validation library
|
|
23
|
-
function getValidation(state) {
|
|
24
|
-
/** Name validation */ let name = null;
|
|
25
|
-
if (!state.name) {
|
|
26
|
-
name = 'Name is required';
|
|
27
|
-
}
|
|
28
|
-
// name can only contain alphanumeric characters and underscores and no spaces
|
|
29
|
-
if (state.name && !/^[a-zA-Z0-9_-]+$/.test(state.name)) {
|
|
30
|
-
name = 'Name can only contain alphanumeric characters, underscores, and dashes';
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
name,
|
|
34
|
-
isValid: !name
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
26
|
function FallbackPreview() {
|
|
38
27
|
return /*#__PURE__*/ _jsx("div", {
|
|
39
28
|
children: "Error previewing values"
|
|
40
29
|
});
|
|
41
30
|
}
|
|
42
|
-
export function
|
|
43
|
-
const { initialVariableDefinition ,
|
|
31
|
+
export function VariableEditorForm(props) {
|
|
32
|
+
const { initialVariableDefinition , initialAction , isDraft , isReadonly , onSave , onClose , onDelete } = props;
|
|
44
33
|
const initialState = getInitialState(initialVariableDefinition);
|
|
45
34
|
const [state, setState] = useImmer(initialState);
|
|
46
|
-
const
|
|
47
|
-
state
|
|
48
|
-
]);
|
|
49
|
-
const [isDiscardDialogStateOpened, setDiscardDialogStateOpened] = useState(false);
|
|
35
|
+
const [isDiscardDialogOpened, setDiscardDialogOpened] = useState(false);
|
|
50
36
|
const [previewKey, setPreviewKey] = useState(0);
|
|
37
|
+
const [action, setAction] = useState(initialAction);
|
|
51
38
|
const refreshPreview = ()=>{
|
|
52
39
|
setPreviewKey((prev)=>prev + 1);
|
|
53
40
|
};
|
|
@@ -60,32 +47,35 @@ export function VariableEditForm(props) {
|
|
|
60
47
|
}, [
|
|
61
48
|
previewKey
|
|
62
49
|
]);
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
50
|
+
const titleAction = getTitleAction(action, isDraft);
|
|
51
|
+
const submitText = getSubmitText(action, isDraft);
|
|
52
|
+
const form = useForm({
|
|
53
|
+
resolver: zodResolver(variableEditValidationSchema),
|
|
54
|
+
mode: 'onBlur',
|
|
55
|
+
defaultValues: state
|
|
56
|
+
});
|
|
57
|
+
const processForm = ()=>{
|
|
58
|
+
onSave(getVariableDefinitionFromState(state));
|
|
59
|
+
};
|
|
71
60
|
// When user click on cancel, several possibilities:
|
|
72
61
|
// - create action: ask for discard approval
|
|
73
62
|
// - update action: ask for discard approval if changed
|
|
74
63
|
// - read action: don´t ask for discard approval
|
|
75
64
|
const handleCancel = useCallback(()=>{
|
|
76
|
-
if (
|
|
77
|
-
|
|
65
|
+
if (JSON.stringify(initialState) !== JSON.stringify(state)) {
|
|
66
|
+
setDiscardDialogOpened(true);
|
|
78
67
|
} else {
|
|
79
|
-
|
|
68
|
+
onClose();
|
|
80
69
|
}
|
|
81
70
|
}, [
|
|
82
71
|
state,
|
|
83
72
|
initialState,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
onCancel
|
|
73
|
+
setDiscardDialogOpened,
|
|
74
|
+
onClose
|
|
87
75
|
]);
|
|
88
|
-
|
|
76
|
+
var _state_textVariableFields_constant;
|
|
77
|
+
return /*#__PURE__*/ _jsxs(FormProvider, {
|
|
78
|
+
...form,
|
|
89
79
|
children: [
|
|
90
80
|
/*#__PURE__*/ _jsxs(Box, {
|
|
91
81
|
sx: {
|
|
@@ -95,32 +85,68 @@ export function VariableEditForm(props) {
|
|
|
95
85
|
borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
|
|
96
86
|
},
|
|
97
87
|
children: [
|
|
98
|
-
/*#__PURE__*/
|
|
88
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
99
89
|
variant: "h2",
|
|
100
|
-
children:
|
|
90
|
+
children: [
|
|
91
|
+
titleAction,
|
|
92
|
+
" Variable"
|
|
93
|
+
]
|
|
101
94
|
}),
|
|
102
|
-
/*#__PURE__*/
|
|
95
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
103
96
|
direction: "row",
|
|
104
97
|
spacing: 1,
|
|
105
98
|
sx: {
|
|
106
99
|
marginLeft: 'auto'
|
|
107
100
|
},
|
|
108
|
-
children:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
101
|
+
children: action === 'read' ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
104
|
+
disabled: isReadonly,
|
|
105
|
+
variant: "contained",
|
|
106
|
+
onClick: ()=>setAction('update'),
|
|
107
|
+
children: "Edit"
|
|
108
|
+
}),
|
|
109
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
110
|
+
color: "error",
|
|
111
|
+
variant: "outlined",
|
|
112
|
+
onClick: onDelete,
|
|
113
|
+
children: "Delete"
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
116
|
+
orientation: "vertical",
|
|
117
|
+
flexItem: true,
|
|
118
|
+
sx: (theme)=>({
|
|
119
|
+
borderColor: theme.palette.grey['500'],
|
|
120
|
+
'&.MuiDivider-root': {
|
|
121
|
+
marginLeft: 2,
|
|
122
|
+
marginRight: 1
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
127
|
+
color: "secondary",
|
|
128
|
+
variant: "outlined",
|
|
129
|
+
onClick: onClose,
|
|
130
|
+
children: "Close"
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
134
|
+
children: [
|
|
135
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
136
|
+
type: "submit",
|
|
137
|
+
variant: "contained",
|
|
138
|
+
disabled: !form.formState.isValid,
|
|
139
|
+
onClick: form.handleSubmit(processForm),
|
|
140
|
+
children: submitText
|
|
141
|
+
}),
|
|
142
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
143
|
+
color: "secondary",
|
|
144
|
+
variant: "outlined",
|
|
145
|
+
onClick: handleCancel,
|
|
146
|
+
children: "Cancel"
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
})
|
|
124
150
|
})
|
|
125
151
|
]
|
|
126
152
|
}),
|
|
@@ -138,19 +164,30 @@ export function VariableEditForm(props) {
|
|
|
138
164
|
/*#__PURE__*/ _jsx(Grid, {
|
|
139
165
|
item: true,
|
|
140
166
|
xs: 8,
|
|
141
|
-
children: /*#__PURE__*/ _jsx(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
167
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
168
|
+
name: "name",
|
|
169
|
+
render: ({ field , fieldState })=>{
|
|
170
|
+
var _fieldState_error;
|
|
171
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
172
|
+
...field,
|
|
173
|
+
required: true,
|
|
174
|
+
fullWidth: true,
|
|
175
|
+
label: "Name",
|
|
176
|
+
InputLabelProps: {
|
|
177
|
+
shrink: action === 'read' ? true : undefined
|
|
178
|
+
},
|
|
179
|
+
InputProps: {
|
|
180
|
+
disabled: action === 'update',
|
|
181
|
+
readOnly: action === 'read'
|
|
182
|
+
},
|
|
183
|
+
error: !!fieldState.error,
|
|
184
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
185
|
+
onChange: (event)=>{
|
|
186
|
+
field.onChange(event);
|
|
187
|
+
setState((draft)=>{
|
|
188
|
+
draft.name = event.target.value;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
154
191
|
});
|
|
155
192
|
}
|
|
156
193
|
})
|
|
@@ -158,16 +195,28 @@ export function VariableEditForm(props) {
|
|
|
158
195
|
/*#__PURE__*/ _jsx(Grid, {
|
|
159
196
|
item: true,
|
|
160
197
|
xs: 4,
|
|
161
|
-
children: /*#__PURE__*/ _jsx(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
198
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
199
|
+
name: "title",
|
|
200
|
+
render: ({ field , fieldState })=>{
|
|
201
|
+
var _fieldState_error;
|
|
202
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
203
|
+
...field,
|
|
204
|
+
fullWidth: true,
|
|
205
|
+
label: "Display Label",
|
|
206
|
+
InputLabelProps: {
|
|
207
|
+
shrink: action === 'read' ? true : undefined
|
|
208
|
+
},
|
|
209
|
+
InputProps: {
|
|
210
|
+
readOnly: action === 'read'
|
|
211
|
+
},
|
|
212
|
+
error: !!fieldState.error,
|
|
213
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
214
|
+
onChange: (event)=>{
|
|
215
|
+
field.onChange(event);
|
|
216
|
+
setState((draft)=>{
|
|
217
|
+
draft.title = event.target.value;
|
|
218
|
+
});
|
|
219
|
+
}
|
|
171
220
|
});
|
|
172
221
|
}
|
|
173
222
|
})
|
|
@@ -175,16 +224,28 @@ export function VariableEditForm(props) {
|
|
|
175
224
|
/*#__PURE__*/ _jsx(Grid, {
|
|
176
225
|
item: true,
|
|
177
226
|
xs: 8,
|
|
178
|
-
children: /*#__PURE__*/ _jsx(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
227
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
228
|
+
name: "description",
|
|
229
|
+
render: ({ field , fieldState })=>{
|
|
230
|
+
var _fieldState_error;
|
|
231
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
232
|
+
...field,
|
|
233
|
+
fullWidth: true,
|
|
234
|
+
label: "Description",
|
|
235
|
+
InputLabelProps: {
|
|
236
|
+
shrink: action === 'read' ? true : undefined
|
|
237
|
+
},
|
|
238
|
+
InputProps: {
|
|
239
|
+
readOnly: action === 'read'
|
|
240
|
+
},
|
|
241
|
+
error: !!fieldState.error,
|
|
242
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
243
|
+
onChange: (event)=>{
|
|
244
|
+
field.onChange(event);
|
|
245
|
+
setState((draft)=>{
|
|
246
|
+
draft.description = event.target.value;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
188
249
|
});
|
|
189
250
|
}
|
|
190
251
|
})
|
|
@@ -192,30 +253,35 @@ export function VariableEditForm(props) {
|
|
|
192
253
|
/*#__PURE__*/ _jsx(Grid, {
|
|
193
254
|
item: true,
|
|
194
255
|
xs: 4,
|
|
195
|
-
children: /*#__PURE__*/
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
labelId: "variable-type-select-label",
|
|
204
|
-
id: "variable-type-select",
|
|
256
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
257
|
+
name: "kind",
|
|
258
|
+
render: ({ field , fieldState })=>{
|
|
259
|
+
var _fieldState_error;
|
|
260
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
261
|
+
select: true,
|
|
262
|
+
...field,
|
|
263
|
+
fullWidth: true,
|
|
205
264
|
label: "Type",
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
265
|
+
InputLabelProps: {
|
|
266
|
+
shrink: action === 'read' ? true : undefined
|
|
267
|
+
},
|
|
268
|
+
InputProps: {
|
|
269
|
+
readOnly: action === 'read'
|
|
270
|
+
},
|
|
271
|
+
error: !!fieldState.error,
|
|
272
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
273
|
+
onChange: (event)=>{
|
|
274
|
+
field.onChange(event);
|
|
209
275
|
setState((draft)=>{
|
|
210
|
-
draft.kind =
|
|
276
|
+
draft.kind = event.target.value;
|
|
211
277
|
});
|
|
212
278
|
},
|
|
213
279
|
children: VARIABLE_TYPES.map((v)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
214
280
|
value: v.kind,
|
|
215
281
|
children: v.label
|
|
216
282
|
}, v.kind))
|
|
217
|
-
})
|
|
218
|
-
|
|
283
|
+
});
|
|
284
|
+
}
|
|
219
285
|
})
|
|
220
286
|
})
|
|
221
287
|
]
|
|
@@ -241,6 +307,9 @@ export function VariableEditForm(props) {
|
|
|
241
307
|
/*#__PURE__*/ _jsx(TextField, {
|
|
242
308
|
label: "Value",
|
|
243
309
|
value: state.textVariableFields.value,
|
|
310
|
+
InputLabelProps: {
|
|
311
|
+
shrink: action === 'read' ? true : undefined
|
|
312
|
+
},
|
|
244
313
|
InputProps: {
|
|
245
314
|
readOnly: action === 'read'
|
|
246
315
|
},
|
|
@@ -249,6 +318,19 @@ export function VariableEditForm(props) {
|
|
|
249
318
|
draft.textVariableFields.value = v.target.value;
|
|
250
319
|
});
|
|
251
320
|
}
|
|
321
|
+
}),
|
|
322
|
+
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
323
|
+
control: /*#__PURE__*/ _jsx(Switch, {
|
|
324
|
+
checked: (_state_textVariableFields_constant = state.textVariableFields.constant) !== null && _state_textVariableFields_constant !== void 0 ? _state_textVariableFields_constant : false,
|
|
325
|
+
readOnly: action === 'read',
|
|
326
|
+
onChange: (e)=>{
|
|
327
|
+
if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
|
|
328
|
+
setState((draft)=>{
|
|
329
|
+
draft.textVariableFields.constant = e.target.checked;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
label: "Constant"
|
|
252
334
|
})
|
|
253
335
|
]
|
|
254
336
|
})
|
|
@@ -302,7 +384,10 @@ export function VariableEditForm(props) {
|
|
|
302
384
|
/*#__PURE__*/ _jsx(Stack, {
|
|
303
385
|
children: /*#__PURE__*/ _jsx(TextField, {
|
|
304
386
|
label: "Capturing Regexp Filter",
|
|
305
|
-
value: state.listVariableFields.
|
|
387
|
+
value: state.listVariableFields.capturingRegexp || '',
|
|
388
|
+
InputLabelProps: {
|
|
389
|
+
shrink: action === 'read' ? true : undefined
|
|
390
|
+
},
|
|
306
391
|
InputProps: {
|
|
307
392
|
readOnly: action === 'read'
|
|
308
393
|
},
|
|
@@ -310,9 +395,9 @@ export function VariableEditForm(props) {
|
|
|
310
395
|
setState((draft)=>{
|
|
311
396
|
if (e.target.value) {
|
|
312
397
|
// TODO: do a better fix, if empty string => it should skip the filter
|
|
313
|
-
draft.listVariableFields.
|
|
398
|
+
draft.listVariableFields.capturingRegexp = e.target.value;
|
|
314
399
|
} else {
|
|
315
|
-
draft.listVariableFields.
|
|
400
|
+
draft.listVariableFields.capturingRegexp = undefined;
|
|
316
401
|
}
|
|
317
402
|
});
|
|
318
403
|
},
|
|
@@ -374,6 +459,9 @@ export function VariableEditForm(props) {
|
|
|
374
459
|
state.listVariableFields.allowAll && /*#__PURE__*/ _jsx(TextField, {
|
|
375
460
|
label: "Custom All Value",
|
|
376
461
|
value: state.listVariableFields.customAllValue,
|
|
462
|
+
InputLabelProps: {
|
|
463
|
+
shrink: action === 'read' ? true : undefined
|
|
464
|
+
},
|
|
377
465
|
InputProps: {
|
|
378
466
|
readOnly: action === 'read'
|
|
379
467
|
},
|
|
@@ -398,13 +486,13 @@ export function VariableEditForm(props) {
|
|
|
398
486
|
}),
|
|
399
487
|
/*#__PURE__*/ _jsx(DiscardChangesConfirmationDialog, {
|
|
400
488
|
description: "Are you sure you want to discard these changes? Changes cannot be recovered.",
|
|
401
|
-
isOpen:
|
|
489
|
+
isOpen: isDiscardDialogOpened,
|
|
402
490
|
onCancel: ()=>{
|
|
403
|
-
|
|
491
|
+
setDiscardDialogOpened(false);
|
|
404
492
|
},
|
|
405
493
|
onDiscardChanges: ()=>{
|
|
406
|
-
|
|
407
|
-
|
|
494
|
+
setDiscardDialogOpened(false);
|
|
495
|
+
onClose();
|
|
408
496
|
}
|
|
409
497
|
})
|
|
410
498
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/VariableEditorForm.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { useCallback, useMemo, useState } from 'react';\nimport {\n Box,\n Typography,\n Switch,\n TextField,\n Grid,\n FormControl,\n FormControlLabel,\n InputLabel,\n MenuItem,\n Button,\n Stack,\n ClickAwayListener,\n Divider,\n Select,\n capitalize,\n} from '@mui/material';\nimport { useImmer } from 'use-immer';\nimport { VariableDefinition, ListVariableDefinition } from '@perses-dev/core';\nimport { DiscardChangesConfirmationDialog, ErrorBoundary } from '@perses-dev/components';\nimport { VARIABLE_TYPES } from '../variable-model';\nimport { PluginEditor } from '../../PluginEditor';\nimport { VariableListPreview, VariablePreview } from './VariablePreview';\nimport { VariableEditorState, getVariableDefinitionFromState, getInitialState } from './variable-editor-form-model';\n\n// TODO: Replace with proper validation library\nfunction getValidation(state: ReturnType<typeof getInitialState>) {\n /** Name validation */\n let name = null;\n if (!state.name) {\n name = 'Name is required';\n }\n // name can only contain alphanumeric characters and underscores and no spaces\n if (state.name && !/^[a-zA-Z0-9_-]+$/.test(state.name)) {\n name = 'Name can only contain alphanumeric characters, underscores, and dashes';\n }\n\n return {\n name,\n isValid: !name,\n };\n}\n\nfunction FallbackPreview() {\n return <div>Error previewing values</div>;\n}\n\nexport type Action = 'create' | 'read' | 'update';\n\ninterface VariableEditFormProps {\n initialVariableDefinition: VariableDefinition;\n onChange: (def: VariableDefinition) => void;\n onCancel: () => void;\n action?: Action;\n}\n\nexport function VariableEditForm(props: VariableEditFormProps) {\n const { initialVariableDefinition, onChange, onCancel, action = 'update' } = props;\n const initialState = getInitialState(initialVariableDefinition);\n const [state, setState] = useImmer(initialState);\n const validation = useMemo(() => getValidation(state), [state]);\n const [isDiscardDialogStateOpened, setDiscardDialogStateOpened] = useState<boolean>(false);\n const [previewKey, setPreviewKey] = useState(0);\n\n const refreshPreview = () => {\n setPreviewKey((prev) => prev + 1);\n };\n\n /** We use the `previewKey` that we increment to know when to explicitly update the\n * spec that will be used for preview. The reason why we do this is to avoid\n * having to re-fetch the values when the user is still editing the spec.\n */\n const previewSpec = useMemo(() => {\n return getVariableDefinitionFromState(state) as ListVariableDefinition;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [previewKey]);\n\n const title = useMemo(() => {\n if (action === 'read') return 'View Variable';\n if (action === 'create') return 'Create Variable';\n if (action === 'update') return 'Edit Variable';\n return '';\n }, [action]);\n\n // When user click on cancel, several possibilities:\n // - create action: ask for discard approval\n // - update action: ask for discard approval if changed\n // - read action: don´t ask for discard approval\n const handleCancel = useCallback(() => {\n if (action === 'create' || (action === 'update' && JSON.stringify(initialState) !== JSON.stringify(state))) {\n setDiscardDialogStateOpened(true);\n } else {\n onCancel();\n }\n }, [state, initialState, action, setDiscardDialogStateOpened, onCancel]);\n\n return (\n <>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">{title}</Typography>\n <Stack direction=\"row\" spacing={1} sx={{ marginLeft: 'auto' }}>\n {action !== 'read' && (\n <Button\n disabled={!validation.isValid}\n variant=\"contained\"\n onClick={() => {\n onChange(getVariableDefinitionFromState(state));\n }}\n >\n {capitalize(action)}\n </Button>\n )}\n <Button color=\"secondary\" variant=\"outlined\" onClick={handleCancel}>\n {action === 'read' ? 'Close' : 'Cancel'}\n </Button>\n </Stack>\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Grid container spacing={2} mb={2}>\n <Grid item xs={8}>\n <TextField\n required\n error={!!validation.name}\n fullWidth\n label=\"Name\"\n value={state.name}\n helperText={validation.name}\n InputProps={{\n readOnly: action === 'update' || action === 'read',\n }}\n onChange={(v) => {\n setState((draft) => {\n draft.name = v.target.value;\n });\n }}\n />\n </Grid>\n <Grid item xs={4}>\n <TextField\n fullWidth\n label=\"Display Label\"\n value={state.title || ''}\n InputProps={{\n readOnly: action === 'read',\n }}\n onChange={(v) => {\n setState((draft) => {\n draft.title = v.target.value;\n });\n }}\n />\n </Grid>\n <Grid item xs={8}>\n <TextField\n fullWidth\n label=\"Description\"\n value={state.description}\n InputProps={{\n readOnly: action === 'read',\n }}\n onChange={(v) => {\n setState((draft) => {\n draft.description = v.target.value;\n });\n }}\n />\n </Grid>\n <Grid item xs={4}>\n <FormControl fullWidth>\n <InputLabel id=\"variable-type-select-label\">Type</InputLabel>\n <Select\n labelId=\"variable-type-select-label\"\n id=\"variable-type-select\"\n label=\"Type\"\n value={state.kind}\n readOnly={action === 'read'}\n onChange={(v) => {\n setState((draft) => {\n draft.kind = v.target.value as VariableEditorState['kind'];\n });\n }}\n >\n {VARIABLE_TYPES.map((v) => (\n <MenuItem key={v.kind} value={v.kind}>\n {v.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </Grid>\n </Grid>\n\n <Divider />\n\n {state.kind === 'TextVariable' && (\n <>\n <Typography py={1} variant=\"subtitle1\">\n Text Options\n </Typography>\n <Stack spacing={2}>\n <Box>\n <VariablePreview values={[state.textVariableFields.value]} />\n </Box>\n <TextField\n label=\"Value\"\n value={state.textVariableFields.value}\n InputProps={{\n readOnly: action === 'read',\n }}\n onChange={(v) => {\n setState((draft) => {\n draft.textVariableFields.value = v.target.value;\n });\n }}\n />\n </Stack>\n </>\n )}\n\n {state.kind === 'ListVariable' && (\n <>\n <Typography py={1} variant=\"subtitle1\">\n List Options\n </Typography>\n <Stack spacing={2} mb={2}>\n {state.listVariableFields.plugin.kind ? (\n <Box>\n <ErrorBoundary FallbackComponent={FallbackPreview} resetKeys={[previewSpec]}>\n <VariableListPreview definition={previewSpec} onRefresh={refreshPreview} />\n </ErrorBoundary>\n </Box>\n ) : (\n <VariablePreview isLoading={true} />\n )}\n\n <Stack>\n {/** Hack?: Cool technique to refresh the preview to simulate onBlur event */}\n <ClickAwayListener onClickAway={() => refreshPreview()}>\n <Box />\n </ClickAwayListener>\n {/** */}\n <PluginEditor\n width=\"100%\"\n pluginType=\"Variable\"\n pluginKindLabel=\"Source\"\n value={state.listVariableFields.plugin}\n isReadonly={action === 'read'}\n onChange={(val) => {\n setState((draft) => {\n draft.listVariableFields.plugin = val;\n });\n }}\n />\n </Stack>\n\n <Stack>\n <TextField\n label=\"Capturing Regexp Filter\"\n value={state.listVariableFields.capturing_regexp || ''}\n InputProps={{\n readOnly: action === 'read',\n }}\n onChange={(e) => {\n setState((draft) => {\n if (e.target.value) {\n // TODO: do a better fix, if empty string => it should skip the filter\n draft.listVariableFields.capturing_regexp = e.target.value;\n } else {\n draft.listVariableFields.capturing_regexp = undefined;\n }\n });\n }}\n helperText=\"Optional, if you want to filter on captured result.\"\n />\n </Stack>\n </Stack>\n\n <Divider />\n\n <Typography py={1} variant=\"subtitle1\">\n Dropdown Options\n </Typography>\n <Stack spacing=\"2\">\n <Stack>\n <FormControlLabel\n control={\n <Switch\n checked={state.listVariableFields.allowMultiple}\n readOnly={action === 'read'}\n onChange={(e) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n setState((draft) => {\n draft.listVariableFields.allowMultiple = e.target.checked;\n });\n }}\n />\n }\n label=\"Allow Multiple Values\"\n />\n <Typography variant=\"caption\">Enables multiple values to be selected at the same time</Typography>\n </Stack>\n <Stack>\n <FormControlLabel\n control={\n <Switch\n checked={state.listVariableFields.allowAll}\n readOnly={action === 'read'}\n onChange={(e) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n setState((draft) => {\n draft.listVariableFields.allowAll = e.target.checked;\n });\n }}\n />\n }\n label=\"Allow All option\"\n />\n <Typography mb={1} variant=\"caption\">\n Enables an option to include all variable values\n </Typography>\n {state.listVariableFields.allowAll && (\n <TextField\n label=\"Custom All Value\"\n value={state.listVariableFields.customAllValue}\n InputProps={{\n readOnly: action === 'read',\n }}\n onChange={(e) => {\n setState((draft) => {\n if (e.target.value) {\n draft.listVariableFields.customAllValue = e.target.value;\n } else {\n draft.listVariableFields.customAllValue = undefined;\n }\n });\n }}\n helperText=\"When All is selected, this value will be used\"\n />\n )}\n </Stack>\n </Stack>\n </>\n )}\n </Box>\n <DiscardChangesConfirmationDialog\n description=\"Are you sure you want to discard these changes? Changes cannot be recovered.\"\n isOpen={isDiscardDialogStateOpened}\n onCancel={() => {\n setDiscardDialogStateOpened(false);\n }}\n onDiscardChanges={() => {\n setDiscardDialogStateOpened(false);\n onCancel();\n }}\n />\n </>\n );\n}\n"],"names":["React","useCallback","useMemo","useState","Box","Typography","Switch","TextField","Grid","FormControl","FormControlLabel","InputLabel","MenuItem","Button","Stack","ClickAwayListener","Divider","Select","capitalize","useImmer","DiscardChangesConfirmationDialog","ErrorBoundary","VARIABLE_TYPES","PluginEditor","VariableListPreview","VariablePreview","getVariableDefinitionFromState","getInitialState","getValidation","state","name","test","isValid","FallbackPreview","div","VariableEditForm","props","initialVariableDefinition","onChange","onCancel","action","initialState","setState","validation","isDiscardDialogStateOpened","setDiscardDialogStateOpened","previewKey","setPreviewKey","refreshPreview","prev","previewSpec","title","handleCancel","JSON","stringify","sx","display","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","direction","marginLeft","disabled","onClick","color","overflowY","container","mb","item","xs","required","error","fullWidth","label","value","helperText","InputProps","readOnly","v","draft","target","description","id","labelId","kind","map","py","values","textVariableFields","listVariableFields","plugin","FallbackComponent","resetKeys","definition","onRefresh","isLoading","onClickAway","width","pluginType","pluginKindLabel","isReadonly","val","capturing_regexp","e","undefined","control","checked","allowMultiple","allowAll","customAllValue","isOpen","onDiscardChanges"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AAC9D,SACEC,GAAG,EACHC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,WAAW,EACXC,gBAAgB,EAChBC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,KAAK,EACLC,iBAAiB,EACjBC,OAAO,EACPC,MAAM,EACNC,UAAU,QACL,eAAe,CAAC;AACvB,SAASC,QAAQ,QAAQ,WAAW,CAAC;AAErC,SAASC,gCAAgC,EAAEC,aAAa,QAAQ,wBAAwB,CAAC;AACzF,SAASC,cAAc,QAAQ,mBAAmB,CAAC;AACnD,SAASC,YAAY,QAAQ,oBAAoB,CAAC;AAClD,SAASC,mBAAmB,EAAEC,eAAe,QAAQ,mBAAmB,CAAC;AACzE,SAA8BC,8BAA8B,EAAEC,eAAe,QAAQ,8BAA8B,CAAC;AAEpH,+CAA+C;AAC/C,SAASC,aAAa,CAACC,KAAyC,EAAE;IAChE,oBAAoB,GACpB,IAAIC,IAAI,GAAG,IAAI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CACK;;8BACF;;sBACP,AACJ;;cACG;0BACN,KAAC5D,gCAAgC;gBAC/BkE,WAAW,EAAC,8EAA8E;gBAC1F6B,MAAM,EAAEvE,0BAA0B;gBAClCL,QAAQ,EAAE,IAAM;oBACdM,2BAA2B,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;gBACDuE,gBAAgB,EAAE,IAAM;oBACtBvE,2BAA2B,CAAC,KAAK,CAAC,CAAC;oBACnCN,QAAQ,EAAE,CAAC;gBACb,CAAC;cACD;;MACD,CACH;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Variables/VariableEditorForm/VariableEditorForm.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { DispatchWithoutAction, useCallback, useMemo, useState } from 'react';\nimport {\n Box,\n Typography,\n Switch,\n TextField,\n Grid,\n FormControlLabel,\n MenuItem,\n Button,\n Stack,\n ClickAwayListener,\n Divider,\n} from '@mui/material';\nimport { useImmer } from 'use-immer';\nimport { VariableDefinition, ListVariableDefinition } from '@perses-dev/core';\nimport { DiscardChangesConfirmationDialog, ErrorBoundary } from '@perses-dev/components';\nimport { Controller, FormProvider, SubmitHandler, useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Action, getSubmitText, getTitleAction } from '../../../utils';\nimport { VARIABLE_TYPES } from '../variable-model';\nimport { PluginEditor } from '../../PluginEditor';\nimport { variableEditValidationSchema, VariableEditValidationType } from '../../../validation';\nimport { VariableListPreview, VariablePreview } from './VariablePreview';\nimport { VariableEditorState, getVariableDefinitionFromState, getInitialState } from './variable-editor-form-model';\n\nfunction FallbackPreview() {\n return <div>Error previewing values</div>;\n}\n\ninterface VariableEditorFormProps {\n initialVariableDefinition: VariableDefinition;\n initialAction: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onSave: (def: VariableDefinition) => void;\n onClose: () => void;\n onDelete?: DispatchWithoutAction;\n}\n\nexport function VariableEditorForm(props: VariableEditorFormProps) {\n const { initialVariableDefinition, initialAction, isDraft, isReadonly, onSave, onClose, onDelete } = props;\n\n const initialState = getInitialState(initialVariableDefinition);\n const [state, setState] = useImmer(initialState);\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const [previewKey, setPreviewKey] = useState(0);\n const [action, setAction] = useState(initialAction);\n\n const refreshPreview = () => {\n setPreviewKey((prev) => prev + 1);\n };\n\n /** We use the `previewKey` that we increment to know when to explicitly update the\n * spec that will be used for preview. The reason why we do this is to avoid\n * having to re-fetch the values when the user is still editing the spec.\n */\n const previewSpec = useMemo(() => {\n return getVariableDefinitionFromState(state) as ListVariableDefinition;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [previewKey]);\n\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const form = useForm<VariableEditValidationType>({\n resolver: zodResolver(variableEditValidationSchema),\n mode: 'onBlur',\n defaultValues: state,\n });\n\n const processForm: SubmitHandler<VariableEditValidationType> = () => {\n onSave(getVariableDefinitionFromState(state));\n };\n\n // When user click on cancel, several possibilities:\n // - create action: ask for discard approval\n // - update action: ask for discard approval if changed\n // - read action: don´t ask for discard approval\n const handleCancel = useCallback(() => {\n if (JSON.stringify(initialState) !== JSON.stringify(state)) {\n setDiscardDialogOpened(true);\n } else {\n onClose();\n }\n }, [state, initialState, setDiscardDialogOpened, onClose]);\n\n return (\n <FormProvider {...form}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">{titleAction} Variable</Typography>\n <Stack direction=\"row\" spacing={1} sx={{ marginLeft: 'auto' }}>\n {action === 'read' ? (\n <>\n <Button disabled={isReadonly} variant=\"contained\" onClick={() => setAction('update')}>\n Edit\n </Button>\n <Button color=\"error\" variant=\"outlined\" onClick={onDelete}>\n Delete\n </Button>\n <Divider\n orientation=\"vertical\"\n flexItem\n sx={(theme) => ({\n borderColor: theme.palette.grey['500'],\n '&.MuiDivider-root': {\n marginLeft: 2,\n marginRight: 1,\n },\n })}\n />\n <Button color=\"secondary\" variant=\"outlined\" onClick={onClose}>\n Close\n </Button>\n </>\n ) : (\n <>\n <Button\n type=\"submit\"\n variant=\"contained\"\n disabled={!form.formState.isValid}\n onClick={form.handleSubmit(processForm)}\n >\n {submitText}\n </Button>\n <Button color=\"secondary\" variant=\"outlined\" onClick={handleCancel}>\n Cancel\n </Button>\n </>\n )}\n </Stack>\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Grid container spacing={2} mb={2}>\n <Grid item xs={8}>\n <Controller\n name=\"name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n label=\"Name\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n disabled: action === 'update',\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n setState((draft) => {\n draft.name = event.target.value;\n });\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={4}>\n <Controller\n name=\"title\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Display Label\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n setState((draft) => {\n draft.title = event.target.value;\n });\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={8}>\n <Controller\n name=\"description\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Description\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n setState((draft) => {\n draft.description = event.target.value;\n });\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={4}>\n <Controller\n name=\"kind\"\n render={({ field, fieldState }) => (\n <TextField\n select\n {...field}\n fullWidth\n label=\"Type\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n setState((draft) => {\n draft.kind = event.target.value as VariableEditorState['kind'];\n });\n }}\n >\n {VARIABLE_TYPES.map((v) => (\n <MenuItem key={v.kind} value={v.kind}>\n {v.label}\n </MenuItem>\n ))}\n </TextField>\n )}\n />\n </Grid>\n </Grid>\n\n <Divider />\n\n {state.kind === 'TextVariable' && (\n <>\n <Typography py={1} variant=\"subtitle1\">\n Text Options\n </Typography>\n <Stack spacing={2}>\n <Box>\n <VariablePreview values={[state.textVariableFields.value]} />\n </Box>\n <TextField\n label=\"Value\"\n value={state.textVariableFields.value}\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n onChange={(v) => {\n setState((draft) => {\n draft.textVariableFields.value = v.target.value;\n });\n }}\n />\n <FormControlLabel\n control={\n <Switch\n checked={state.textVariableFields.constant ?? false}\n readOnly={action === 'read'}\n onChange={(e) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n setState((draft) => {\n draft.textVariableFields.constant = e.target.checked;\n });\n }}\n />\n }\n label=\"Constant\"\n />\n </Stack>\n </>\n )}\n\n {state.kind === 'ListVariable' && (\n <>\n <Typography py={1} variant=\"subtitle1\">\n List Options\n </Typography>\n <Stack spacing={2} mb={2}>\n {state.listVariableFields.plugin.kind ? (\n <Box>\n <ErrorBoundary FallbackComponent={FallbackPreview} resetKeys={[previewSpec]}>\n <VariableListPreview definition={previewSpec} onRefresh={refreshPreview} />\n </ErrorBoundary>\n </Box>\n ) : (\n <VariablePreview isLoading={true} />\n )}\n\n <Stack>\n {/** Hack?: Cool technique to refresh the preview to simulate onBlur event */}\n <ClickAwayListener onClickAway={() => refreshPreview()}>\n <Box />\n </ClickAwayListener>\n {/** */}\n <PluginEditor\n width=\"100%\"\n pluginType=\"Variable\"\n pluginKindLabel=\"Source\"\n value={state.listVariableFields.plugin}\n isReadonly={action === 'read'}\n onChange={(val) => {\n setState((draft) => {\n draft.listVariableFields.plugin = val;\n });\n }}\n />\n </Stack>\n\n <Stack>\n <TextField\n label=\"Capturing Regexp Filter\"\n value={state.listVariableFields.capturingRegexp || ''}\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n onChange={(e) => {\n setState((draft) => {\n if (e.target.value) {\n // TODO: do a better fix, if empty string => it should skip the filter\n draft.listVariableFields.capturingRegexp = e.target.value;\n } else {\n draft.listVariableFields.capturingRegexp = undefined;\n }\n });\n }}\n helperText=\"Optional, if you want to filter on captured result.\"\n />\n </Stack>\n </Stack>\n\n <Divider />\n\n <Typography py={1} variant=\"subtitle1\">\n Dropdown Options\n </Typography>\n <Stack spacing=\"2\">\n <Stack>\n <FormControlLabel\n control={\n <Switch\n checked={state.listVariableFields.allowMultiple}\n readOnly={action === 'read'}\n onChange={(e) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n setState((draft) => {\n draft.listVariableFields.allowMultiple = e.target.checked;\n });\n }}\n />\n }\n label=\"Allow Multiple Values\"\n />\n <Typography variant=\"caption\">Enables multiple values to be selected at the same time</Typography>\n </Stack>\n <Stack>\n <FormControlLabel\n control={\n <Switch\n checked={state.listVariableFields.allowAll}\n readOnly={action === 'read'}\n onChange={(e) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n setState((draft) => {\n draft.listVariableFields.allowAll = e.target.checked;\n });\n }}\n />\n }\n label=\"Allow All option\"\n />\n <Typography mb={1} variant=\"caption\">\n Enables an option to include all variable values\n </Typography>\n {state.listVariableFields.allowAll && (\n <TextField\n label=\"Custom All Value\"\n value={state.listVariableFields.customAllValue}\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n onChange={(e) => {\n setState((draft) => {\n if (e.target.value) {\n draft.listVariableFields.customAllValue = e.target.value;\n } else {\n draft.listVariableFields.customAllValue = undefined;\n }\n });\n }}\n helperText=\"When All is selected, this value will be used\"\n />\n )}\n </Stack>\n </Stack>\n </>\n )}\n </Box>\n <DiscardChangesConfirmationDialog\n description=\"Are you sure you want to discard these changes? Changes cannot be recovered.\"\n isOpen={isDiscardDialogOpened}\n onCancel={() => {\n setDiscardDialogOpened(false);\n }}\n onDiscardChanges={() => {\n setDiscardDialogOpened(false);\n onClose();\n }}\n />\n </FormProvider>\n );\n}\n"],"names":["React","useCallback","useMemo","useState","Box","Typography","Switch","TextField","Grid","FormControlLabel","MenuItem","Button","Stack","ClickAwayListener","Divider","useImmer","DiscardChangesConfirmationDialog","ErrorBoundary","Controller","FormProvider","useForm","zodResolver","getSubmitText","getTitleAction","VARIABLE_TYPES","PluginEditor","variableEditValidationSchema","VariableListPreview","VariablePreview","getVariableDefinitionFromState","getInitialState","FallbackPreview","div","VariableEditorForm","props","initialVariableDefinition","initialAction","isDraft","isReadonly","onSave","onClose","onDelete","initialState","state","setState","isDiscardDialogOpened","setDiscardDialogOpened","previewKey","setPreviewKey","action","setAction","refreshPreview","prev","previewSpec","titleAction","submitText","form","resolver","mode","defaultValues","processForm","handleCancel","JSON","stringify","sx","display","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","direction","marginLeft","disabled","onClick","color","orientation","flexItem","borderColor","grey","marginRight","type","formState","isValid","handleSubmit","overflowY","container","mb","item","xs","name","render","field","fieldState","required","fullWidth","label","InputLabelProps","shrink","undefined","InputProps","readOnly","error","helperText","message","onChange","event","draft","target","value","title","description","select","kind","map","v","py","values","textVariableFields","control","checked","constant","e","listVariableFields","plugin","FallbackComponent","resetKeys","definition","onRefresh","isLoading","onClickAway","width","pluginType","pluginKindLabel","val","capturingRegexp","allowMultiple","allowAll","customAllValue","isOpen","onCancel","onDiscardChanges"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAAgCC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACrF,SACEC,GAAG,EACHC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,MAAM,EACNC,KAAK,EACLC,iBAAiB,EACjBC,OAAO,QACF,gBAAgB;AACvB,SAASC,QAAQ,QAAQ,YAAY;AAErC,SAASC,gCAAgC,EAAEC,aAAa,QAAQ,yBAAyB;AACzF,SAASC,UAAU,EAAEC,YAAY,EAAiBC,OAAO,QAAQ,kBAAkB;AACnF,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAAiBC,aAAa,EAAEC,cAAc,QAAQ,iBAAiB;AACvE,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,4BAA4B,QAAoC,sBAAsB;AAC/F,SAASC,mBAAmB,EAAEC,eAAe,QAAQ,oBAAoB;AACzE,SAA8BC,8BAA8B,EAAEC,eAAe,QAAQ,+BAA+B;AAEpH,SAASC;IACP,qBAAO,KAACC;kBAAI;;AACd;AAYA,OAAO,SAASC,mBAAmBC,KAA8B;IAC/D,MAAM,EAAEC,0BAAyB,EAAEC,cAAa,EAAEC,QA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