@perses-dev/dashboards 0.37.1 → 0.38.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/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +12 -52
- package/dist/cjs/components/GridLayout/index.js +3 -1
- package/dist/cjs/components/Variables/TemplateVariable.js +2 -2
- package/dist/cjs/components/Variables/VariableEditor.js +17 -6
- package/dist/cjs/components/Variables/index.js +0 -2
- package/dist/cjs/context/DatasourceStoreProvider.js +22 -18
- package/dist/cjs/views/ViewDashboard/DashboardApp.js +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js +11 -46
- package/dist/components/DiscardChangesConfirmationDialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/components/GridLayout/index.d.ts +3 -1
- package/dist/components/GridLayout/index.d.ts.map +1 -1
- package/dist/components/GridLayout/index.js +3 -1
- package/dist/components/GridLayout/index.js.map +1 -1
- package/dist/components/Variables/TemplateVariable.d.ts.map +1 -1
- package/dist/components/Variables/TemplateVariable.js +1 -1
- package/dist/components/Variables/TemplateVariable.js.map +1 -1
- package/dist/components/Variables/VariableEditor.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditor.js +15 -4
- package/dist/components/Variables/VariableEditor.js.map +1 -1
- package/dist/components/Variables/index.d.ts +0 -2
- package/dist/components/Variables/index.d.ts.map +1 -1
- package/dist/components/Variables/index.js +0 -2
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/context/DatasourceStoreProvider.d.ts +4 -3
- package/dist/context/DatasourceStoreProvider.d.ts.map +1 -1
- package/dist/context/DatasourceStoreProvider.js +22 -18
- package/dist/context/DatasourceStoreProvider.js.map +1 -1
- package/dist/views/ViewDashboard/DashboardApp.js +2 -2
- package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +0 -399
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +0 -178
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +0 -29
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +0 -91
- package/dist/cjs/components/Variables/variable-model.js +0 -117
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +0 -10
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +0 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +0 -354
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +0 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +0 -16
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +0 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +0 -122
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +0 -1
- package/dist/components/Variables/VariableEditorForm/index.d.ts +0 -3
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +0 -1
- package/dist/components/Variables/VariableEditorForm/index.js +0 -16
- package/dist/components/Variables/VariableEditorForm/index.js.map +0 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +0 -23
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +0 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +0 -79
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +0 -1
- package/dist/components/Variables/variable-model.d.ts +0 -16
- package/dist/components/Variables/variable-model.d.ts.map +0 -1
- package/dist/components/Variables/variable-model.js +0 -105
- package/dist/components/Variables/variable-model.js.map +0 -1
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
function _export(target, all) {
|
|
18
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
getInitialState: ()=>getInitialState,
|
|
25
|
-
getVariableDefinitionFromState: ()=>getVariableDefinitionFromState
|
|
26
|
-
});
|
|
27
|
-
function getInitialState(initialVariableDefinition) {
|
|
28
|
-
var ref;
|
|
29
|
-
var _value;
|
|
30
|
-
const textVariableFields = {
|
|
31
|
-
value: (_value = initialVariableDefinition.spec.value) !== null && _value !== void 0 ? _value : ''
|
|
32
|
-
};
|
|
33
|
-
const listVariableFields = {
|
|
34
|
-
allowMultiple: false,
|
|
35
|
-
allowAll: false,
|
|
36
|
-
capturing_regexp: undefined,
|
|
37
|
-
plugin: {
|
|
38
|
-
kind: '',
|
|
39
|
-
spec: {}
|
|
40
|
-
},
|
|
41
|
-
customAllValue: undefined
|
|
42
|
-
};
|
|
43
|
-
if (initialVariableDefinition.kind === 'ListVariable') {
|
|
44
|
-
var _allow_all_value;
|
|
45
|
-
listVariableFields.allowMultiple = (_allow_all_value = initialVariableDefinition.spec.allow_all_value) !== null && _allow_all_value !== void 0 ? _allow_all_value : false;
|
|
46
|
-
var _allow_all_value1;
|
|
47
|
-
listVariableFields.allowAll = (_allow_all_value1 = initialVariableDefinition.spec.allow_all_value) !== null && _allow_all_value1 !== void 0 ? _allow_all_value1 : false;
|
|
48
|
-
listVariableFields.capturing_regexp = initialVariableDefinition.spec.capturing_regexp;
|
|
49
|
-
listVariableFields.plugin = initialVariableDefinition.spec.plugin;
|
|
50
|
-
listVariableFields.customAllValue = initialVariableDefinition.spec.custom_all_value;
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
name: initialVariableDefinition.spec.name,
|
|
54
|
-
title: (ref = initialVariableDefinition.spec.display) === null || ref === void 0 ? void 0 : ref.name,
|
|
55
|
-
kind: initialVariableDefinition.kind,
|
|
56
|
-
description: '',
|
|
57
|
-
listVariableFields,
|
|
58
|
-
textVariableFields
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function getVariableDefinitionFromState(state) {
|
|
62
|
-
const { name , title , kind } = state;
|
|
63
|
-
const display = title ? {
|
|
64
|
-
name: title
|
|
65
|
-
} : undefined;
|
|
66
|
-
if (kind === 'TextVariable') {
|
|
67
|
-
return {
|
|
68
|
-
kind,
|
|
69
|
-
spec: {
|
|
70
|
-
name,
|
|
71
|
-
display,
|
|
72
|
-
...state.textVariableFields
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
if (kind === 'ListVariable') {
|
|
77
|
-
return {
|
|
78
|
-
kind,
|
|
79
|
-
spec: {
|
|
80
|
-
name,
|
|
81
|
-
display,
|
|
82
|
-
allow_multiple: state.listVariableFields.allowMultiple,
|
|
83
|
-
allow_all_value: state.listVariableFields.allowAll,
|
|
84
|
-
capturing_regexp: state.listVariableFields.capturing_regexp,
|
|
85
|
-
plugin: state.listVariableFields.plugin,
|
|
86
|
-
custom_all_value: state.listVariableFields.customAllValue
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
throw new Error(`Unknown variable kind: ${kind}`);
|
|
91
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
function _export(target, all) {
|
|
18
|
-
for(var name1 in all)Object.defineProperty(target, name1, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: all[name1]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
filterVariableList: ()=>filterVariableList,
|
|
25
|
-
useListVariablePluginValues: ()=>useListVariablePluginValues,
|
|
26
|
-
getVariableValuesKey: ()=>getVariableValuesKey,
|
|
27
|
-
VARIABLE_TYPES: ()=>VARIABLE_TYPES
|
|
28
|
-
});
|
|
29
|
-
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
30
|
-
const _reactQuery = require("@tanstack/react-query");
|
|
31
|
-
function filterVariableList(data, capturedRegexp) {
|
|
32
|
-
const result = [];
|
|
33
|
-
const filteredSet = new Set();
|
|
34
|
-
for (const variableValue of data){
|
|
35
|
-
const matches = variableValue.value.matchAll(capturedRegexp);
|
|
36
|
-
let concat = '';
|
|
37
|
-
for (const match of matches){
|
|
38
|
-
for(let i = 1; i < match.length; i++){
|
|
39
|
-
const m = match[i];
|
|
40
|
-
if (m !== undefined) {
|
|
41
|
-
concat = `${concat}${m}`;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (concat !== '' && !filteredSet.has(concat)) {
|
|
46
|
-
// like that we are avoiding to have duplicating variable value
|
|
47
|
-
filteredSet.add(concat);
|
|
48
|
-
result.push({
|
|
49
|
-
label: variableValue.label,
|
|
50
|
-
value: concat
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
function useListVariablePluginValues(definition) {
|
|
57
|
-
const { data: variablePlugin } = (0, _pluginSystem.usePlugin)('Variable', definition.spec.plugin.kind);
|
|
58
|
-
const datasourceStore = (0, _pluginSystem.useDatasourceStore)();
|
|
59
|
-
const allVariables = (0, _pluginSystem.useTemplateVariableValues)();
|
|
60
|
-
const { absoluteTimeRange: timeRange , refreshKey } = (0, _pluginSystem.useTimeRange)();
|
|
61
|
-
const variablePluginCtx = {
|
|
62
|
-
timeRange,
|
|
63
|
-
datasourceStore,
|
|
64
|
-
variables: allVariables
|
|
65
|
-
};
|
|
66
|
-
const spec = definition.spec.plugin.spec;
|
|
67
|
-
const capturingRegexp = definition.spec.capturing_regexp !== undefined ? new RegExp(definition.spec.capturing_regexp, 'g') : undefined;
|
|
68
|
-
let dependsOnVariables;
|
|
69
|
-
if (variablePlugin === null || variablePlugin === void 0 ? void 0 : variablePlugin.dependsOn) {
|
|
70
|
-
const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);
|
|
71
|
-
dependsOnVariables = dependencies.variables;
|
|
72
|
-
}
|
|
73
|
-
const variables = (0, _pluginSystem.useTemplateVariableValues)(dependsOnVariables);
|
|
74
|
-
let waitToLoad = false;
|
|
75
|
-
if (dependsOnVariables) {
|
|
76
|
-
waitToLoad = dependsOnVariables.some((v)=>{
|
|
77
|
-
var ref;
|
|
78
|
-
return (ref = variables[v]) === null || ref === void 0 ? void 0 : ref.loading;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
const variablesValueKey = getVariableValuesKey(variables);
|
|
82
|
-
return (0, _reactQuery.useQuery)([
|
|
83
|
-
name,
|
|
84
|
-
definition,
|
|
85
|
-
variablesValueKey,
|
|
86
|
-
timeRange,
|
|
87
|
-
refreshKey
|
|
88
|
-
], async ()=>{
|
|
89
|
-
const resp = await (variablePlugin === null || variablePlugin === void 0 ? void 0 : variablePlugin.getVariableOptions(spec, {
|
|
90
|
-
datasourceStore,
|
|
91
|
-
variables,
|
|
92
|
-
timeRange
|
|
93
|
-
}));
|
|
94
|
-
if (resp === undefined) {
|
|
95
|
-
return [];
|
|
96
|
-
}
|
|
97
|
-
if (capturingRegexp === undefined) {
|
|
98
|
-
return resp.data;
|
|
99
|
-
}
|
|
100
|
-
return filterVariableList(resp.data, capturingRegexp);
|
|
101
|
-
}, {
|
|
102
|
-
enabled: !!variablePlugin || waitToLoad
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function getVariableValuesKey(v) {
|
|
106
|
-
return Object.values(v).map((v)=>JSON.stringify(v.value)).join(',');
|
|
107
|
-
}
|
|
108
|
-
const VARIABLE_TYPES = [
|
|
109
|
-
{
|
|
110
|
-
label: 'List',
|
|
111
|
-
kind: 'ListVariable'
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
label: 'Text',
|
|
115
|
-
kind: 'TextVariable'
|
|
116
|
-
}
|
|
117
|
-
];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { VariableDefinition } from '@perses-dev/core';
|
|
3
|
-
interface VariableEditFormProps {
|
|
4
|
-
initialVariableDefinition: VariableDefinition;
|
|
5
|
-
onChange: (def: VariableDefinition) => void;
|
|
6
|
-
onCancel: () => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function VariableEditForm(props: VariableEditFormProps): JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=VariableEditorForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VariableEditorForm.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/VariableEditorForm.tsx"],"names":[],"mappings":";AAgCA,OAAO,EAAE,kBAAkB,EAA0B,MAAM,kBAAkB,CAAC;AA6B9E,UAAU,qBAAqB;IAC7B,yBAAyB,EAAE,kBAAkB,CAAC;IAC9C,QAAQ,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC5C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAiQ5D"}
|
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
import React, { useMemo, useState } from 'react';
|
|
15
|
-
import { Box, Typography, Switch, TextField, Grid, FormControl, FormControlLabel, InputLabel, MenuItem, Select, Button, Stack, ClickAwayListener, Divider } from '@mui/material';
|
|
16
|
-
import { useImmer } from 'use-immer';
|
|
17
|
-
import { PluginEditor } from '@perses-dev/plugin-system';
|
|
18
|
-
import { ErrorBoundary } from '@perses-dev/components';
|
|
19
|
-
import { VARIABLE_TYPES } from '../variable-model';
|
|
20
|
-
import { VariableListPreview, VariablePreview } from './VariablePreview';
|
|
21
|
-
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
|
-
function FallbackPreview() {
|
|
38
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
39
|
-
children: "Error previewing values"
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
export function VariableEditForm(props) {
|
|
43
|
-
const { initialVariableDefinition , onChange , onCancel } = props;
|
|
44
|
-
const [state, setState] = useImmer(getInitialState(initialVariableDefinition));
|
|
45
|
-
const validation = useMemo(()=>getValidation(state), [
|
|
46
|
-
state
|
|
47
|
-
]);
|
|
48
|
-
const [previewKey, setPreviewKey] = useState(0);
|
|
49
|
-
const refreshPreview = ()=>{
|
|
50
|
-
setPreviewKey((prev)=>prev + 1);
|
|
51
|
-
};
|
|
52
|
-
/** We use the `previewKey` that we increment to know when to explicitly update the
|
|
53
|
-
* spec that will be used for preview. The reason why we do this is to avoid
|
|
54
|
-
* having to re-fetch the values when the user is still editing the spec.
|
|
55
|
-
*/ const previewSpec = useMemo(()=>{
|
|
56
|
-
return getVariableDefinitionFromState(state);
|
|
57
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
-
}, [
|
|
59
|
-
previewKey
|
|
60
|
-
]);
|
|
61
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
62
|
-
children: [
|
|
63
|
-
/*#__PURE__*/ _jsxs(Box, {
|
|
64
|
-
sx: {
|
|
65
|
-
display: 'flex',
|
|
66
|
-
alignItems: 'center',
|
|
67
|
-
padding: (theme)=>theme.spacing(1, 2),
|
|
68
|
-
borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
|
|
69
|
-
},
|
|
70
|
-
children: [
|
|
71
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
72
|
-
variant: "h2",
|
|
73
|
-
children: "Edit Variable"
|
|
74
|
-
}),
|
|
75
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
76
|
-
direction: "row",
|
|
77
|
-
spacing: 1,
|
|
78
|
-
sx: {
|
|
79
|
-
marginLeft: 'auto'
|
|
80
|
-
},
|
|
81
|
-
children: [
|
|
82
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
83
|
-
disabled: !validation.isValid,
|
|
84
|
-
variant: "contained",
|
|
85
|
-
onClick: ()=>{
|
|
86
|
-
onChange(getVariableDefinitionFromState(state));
|
|
87
|
-
},
|
|
88
|
-
children: "Update"
|
|
89
|
-
}),
|
|
90
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
91
|
-
color: "secondary",
|
|
92
|
-
variant: "outlined",
|
|
93
|
-
onClick: ()=>{
|
|
94
|
-
onCancel();
|
|
95
|
-
},
|
|
96
|
-
children: "Cancel"
|
|
97
|
-
})
|
|
98
|
-
]
|
|
99
|
-
})
|
|
100
|
-
]
|
|
101
|
-
}),
|
|
102
|
-
/*#__PURE__*/ _jsxs(Box, {
|
|
103
|
-
padding: 2,
|
|
104
|
-
sx: {
|
|
105
|
-
overflowY: 'scroll'
|
|
106
|
-
},
|
|
107
|
-
children: [
|
|
108
|
-
/*#__PURE__*/ _jsxs(Grid, {
|
|
109
|
-
container: true,
|
|
110
|
-
spacing: 2,
|
|
111
|
-
mb: 2,
|
|
112
|
-
children: [
|
|
113
|
-
/*#__PURE__*/ _jsx(Grid, {
|
|
114
|
-
item: true,
|
|
115
|
-
xs: 8,
|
|
116
|
-
children: /*#__PURE__*/ _jsx(TextField, {
|
|
117
|
-
required: true,
|
|
118
|
-
error: !!validation.name,
|
|
119
|
-
fullWidth: true,
|
|
120
|
-
label: "Name",
|
|
121
|
-
value: state.name,
|
|
122
|
-
helperText: validation.name,
|
|
123
|
-
onChange: (v)=>{
|
|
124
|
-
setState((draft)=>{
|
|
125
|
-
draft.name = v.target.value;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
}),
|
|
130
|
-
/*#__PURE__*/ _jsx(Grid, {
|
|
131
|
-
item: true,
|
|
132
|
-
xs: 4,
|
|
133
|
-
children: /*#__PURE__*/ _jsx(TextField, {
|
|
134
|
-
fullWidth: true,
|
|
135
|
-
label: "Display Label",
|
|
136
|
-
value: state.title || '',
|
|
137
|
-
onChange: (v)=>{
|
|
138
|
-
setState((draft)=>{
|
|
139
|
-
draft.title = v.target.value;
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
}),
|
|
144
|
-
/*#__PURE__*/ _jsx(Grid, {
|
|
145
|
-
item: true,
|
|
146
|
-
xs: 8,
|
|
147
|
-
children: /*#__PURE__*/ _jsx(TextField, {
|
|
148
|
-
fullWidth: true,
|
|
149
|
-
label: "Description",
|
|
150
|
-
value: state.description,
|
|
151
|
-
onChange: (v)=>{
|
|
152
|
-
setState((draft)=>{
|
|
153
|
-
draft.description = v.target.value;
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
}),
|
|
158
|
-
/*#__PURE__*/ _jsx(Grid, {
|
|
159
|
-
item: true,
|
|
160
|
-
xs: 4,
|
|
161
|
-
children: /*#__PURE__*/ _jsxs(FormControl, {
|
|
162
|
-
fullWidth: true,
|
|
163
|
-
children: [
|
|
164
|
-
/*#__PURE__*/ _jsx(InputLabel, {
|
|
165
|
-
id: "variable-type-select-label",
|
|
166
|
-
children: "Type"
|
|
167
|
-
}),
|
|
168
|
-
/*#__PURE__*/ _jsx(Select, {
|
|
169
|
-
labelId: "variable-type-select-label",
|
|
170
|
-
id: "variable-type-select",
|
|
171
|
-
label: "Type",
|
|
172
|
-
value: state.kind,
|
|
173
|
-
onChange: (v)=>{
|
|
174
|
-
setState((draft)=>{
|
|
175
|
-
draft.kind = v.target.value;
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
children: VARIABLE_TYPES.map((v)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
179
|
-
value: v.kind,
|
|
180
|
-
children: v.label
|
|
181
|
-
}, v.kind))
|
|
182
|
-
})
|
|
183
|
-
]
|
|
184
|
-
})
|
|
185
|
-
})
|
|
186
|
-
]
|
|
187
|
-
}),
|
|
188
|
-
/*#__PURE__*/ _jsx(Divider, {}),
|
|
189
|
-
state.kind === 'TextVariable' && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
190
|
-
children: [
|
|
191
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
192
|
-
py: 1,
|
|
193
|
-
variant: "subtitle1",
|
|
194
|
-
children: "Text Options"
|
|
195
|
-
}),
|
|
196
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
197
|
-
spacing: 2,
|
|
198
|
-
children: [
|
|
199
|
-
/*#__PURE__*/ _jsx(Box, {
|
|
200
|
-
children: /*#__PURE__*/ _jsx(VariablePreview, {
|
|
201
|
-
values: [
|
|
202
|
-
state.textVariableFields.value
|
|
203
|
-
]
|
|
204
|
-
})
|
|
205
|
-
}),
|
|
206
|
-
/*#__PURE__*/ _jsx(TextField, {
|
|
207
|
-
label: "Value",
|
|
208
|
-
value: state.textVariableFields.value,
|
|
209
|
-
onChange: (v)=>{
|
|
210
|
-
setState((draft)=>{
|
|
211
|
-
draft.textVariableFields.value = v.target.value;
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
})
|
|
215
|
-
]
|
|
216
|
-
})
|
|
217
|
-
]
|
|
218
|
-
}),
|
|
219
|
-
state.kind === 'ListVariable' && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
220
|
-
children: [
|
|
221
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
222
|
-
py: 1,
|
|
223
|
-
variant: "subtitle1",
|
|
224
|
-
children: "List Options"
|
|
225
|
-
}),
|
|
226
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
227
|
-
spacing: 2,
|
|
228
|
-
mb: 2,
|
|
229
|
-
children: [
|
|
230
|
-
state.listVariableFields.plugin.kind ? /*#__PURE__*/ _jsx(Box, {
|
|
231
|
-
children: /*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
232
|
-
FallbackComponent: FallbackPreview,
|
|
233
|
-
resetKeys: [
|
|
234
|
-
previewSpec
|
|
235
|
-
],
|
|
236
|
-
children: /*#__PURE__*/ _jsx(VariableListPreview, {
|
|
237
|
-
definition: previewSpec,
|
|
238
|
-
onRefresh: refreshPreview
|
|
239
|
-
})
|
|
240
|
-
})
|
|
241
|
-
}) : /*#__PURE__*/ _jsx(VariablePreview, {
|
|
242
|
-
isLoading: true
|
|
243
|
-
}),
|
|
244
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
245
|
-
children: [
|
|
246
|
-
/*#__PURE__*/ _jsx(ClickAwayListener, {
|
|
247
|
-
onClickAway: ()=>refreshPreview(),
|
|
248
|
-
children: /*#__PURE__*/ _jsx(Box, {})
|
|
249
|
-
}),
|
|
250
|
-
/*#__PURE__*/ _jsx(PluginEditor, {
|
|
251
|
-
width: "100%",
|
|
252
|
-
pluginType: "Variable",
|
|
253
|
-
pluginKindLabel: "Source",
|
|
254
|
-
value: state.listVariableFields.plugin,
|
|
255
|
-
onChange: (val)=>{
|
|
256
|
-
setState((draft)=>{
|
|
257
|
-
draft.listVariableFields.plugin = val;
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
})
|
|
261
|
-
]
|
|
262
|
-
}),
|
|
263
|
-
/*#__PURE__*/ _jsx(Stack, {
|
|
264
|
-
children: /*#__PURE__*/ _jsx(TextField, {
|
|
265
|
-
label: "Capturing Regexp Filter",
|
|
266
|
-
value: state.listVariableFields.capturing_regexp || '',
|
|
267
|
-
onChange: (e)=>{
|
|
268
|
-
setState((draft)=>{
|
|
269
|
-
if (e.target.value) {
|
|
270
|
-
// TODO: do a better fix, if empty string => it should skip the filter
|
|
271
|
-
draft.listVariableFields.capturing_regexp = e.target.value;
|
|
272
|
-
} else {
|
|
273
|
-
draft.listVariableFields.capturing_regexp = undefined;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
},
|
|
277
|
-
helperText: "Optional, if you want to filter on captured result."
|
|
278
|
-
})
|
|
279
|
-
})
|
|
280
|
-
]
|
|
281
|
-
}),
|
|
282
|
-
/*#__PURE__*/ _jsx(Divider, {}),
|
|
283
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
284
|
-
py: 1,
|
|
285
|
-
variant: "subtitle1",
|
|
286
|
-
children: "Dropdown Options"
|
|
287
|
-
}),
|
|
288
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
289
|
-
spacing: "2",
|
|
290
|
-
children: [
|
|
291
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
292
|
-
children: [
|
|
293
|
-
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
294
|
-
control: /*#__PURE__*/ _jsx(Switch, {
|
|
295
|
-
checked: state.listVariableFields.allowMultiple,
|
|
296
|
-
onChange: (e)=>{
|
|
297
|
-
setState((draft)=>{
|
|
298
|
-
draft.listVariableFields.allowMultiple = e.target.checked;
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
}),
|
|
302
|
-
label: "Allow Multiple Values"
|
|
303
|
-
}),
|
|
304
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
305
|
-
variant: "caption",
|
|
306
|
-
children: "Enables multiple values to be selected at the same time"
|
|
307
|
-
})
|
|
308
|
-
]
|
|
309
|
-
}),
|
|
310
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
311
|
-
children: [
|
|
312
|
-
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
313
|
-
control: /*#__PURE__*/ _jsx(Switch, {
|
|
314
|
-
checked: state.listVariableFields.allowAll,
|
|
315
|
-
onChange: (e)=>{
|
|
316
|
-
setState((draft)=>{
|
|
317
|
-
draft.listVariableFields.allowAll = e.target.checked;
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
}),
|
|
321
|
-
label: "Allow All option"
|
|
322
|
-
}),
|
|
323
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
324
|
-
mb: 1,
|
|
325
|
-
variant: "caption",
|
|
326
|
-
children: "Enables an option to include all variable values"
|
|
327
|
-
}),
|
|
328
|
-
state.listVariableFields.allowAll && /*#__PURE__*/ _jsx(TextField, {
|
|
329
|
-
label: "Custom All Value",
|
|
330
|
-
value: state.listVariableFields.customAllValue,
|
|
331
|
-
onChange: (e)=>{
|
|
332
|
-
setState((draft)=>{
|
|
333
|
-
if (e.target.value) {
|
|
334
|
-
draft.listVariableFields.customAllValue = e.target.value;
|
|
335
|
-
} else {
|
|
336
|
-
draft.listVariableFields.customAllValue = undefined;
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
},
|
|
340
|
-
helperText: "When All is selected, this value will be used"
|
|
341
|
-
})
|
|
342
|
-
]
|
|
343
|
-
})
|
|
344
|
-
]
|
|
345
|
-
})
|
|
346
|
-
]
|
|
347
|
-
})
|
|
348
|
-
]
|
|
349
|
-
})
|
|
350
|
-
]
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
//# sourceMappingURL=VariableEditorForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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, { useMemo, useState } from 'react';\nimport {\n Box,\n Typography,\n Switch,\n TextField,\n Grid,\n FormControl,\n FormControlLabel,\n InputLabel,\n MenuItem,\n Select,\n Button,\n Stack,\n ClickAwayListener,\n Divider,\n} from '@mui/material';\nimport { useImmer } from 'use-immer';\nimport { PluginEditor } from '@perses-dev/plugin-system';\nimport { VariableDefinition, ListVariableDefinition } from '@perses-dev/core';\nimport { ErrorBoundary } from '@perses-dev/components';\n\nimport { VARIABLE_TYPES } from '../variable-model';\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\ninterface VariableEditFormProps {\n initialVariableDefinition: VariableDefinition;\n onChange: (def: VariableDefinition) => void;\n onCancel: () => void;\n}\n\nexport function VariableEditForm(props: VariableEditFormProps) {\n const { initialVariableDefinition, onChange, onCancel } = props;\n const [state, setState] = useImmer(getInitialState(initialVariableDefinition));\n const validation = useMemo(() => getValidation(state), [state]);\n\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 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\">Edit Variable</Typography>\n <Stack direction=\"row\" spacing={1} sx={{ marginLeft: 'auto' }}>\n <Button\n disabled={!validation.isValid}\n variant=\"contained\"\n onClick={() => {\n onChange(getVariableDefinitionFromState(state));\n }}\n >\n Update\n </Button>\n <Button\n color=\"secondary\"\n variant=\"outlined\"\n onClick={() => {\n onCancel();\n }}\n >\n 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 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 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 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 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 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 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 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 onChange={(e) => {\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 onChange={(e) => {\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 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 </>\n );\n}\n"],"names":["React","useMemo","useState","Box","Typography","Switch","TextField","Grid","FormControl","FormControlLabel","InputLabel","MenuItem","Select","Button","Stack","ClickAwayListener","Divider","useImmer","PluginEditor","ErrorBoundary","VARIABLE_TYPES","VariableListPreview","VariablePreview","getVariableDefinitionFromState","getInitialState","getValidation","state","name","test","isValid","FallbackPreview","div","VariableEditForm","props","initialVariableDefinition","onChange","onCancel","setState","validation","previewKey","setPreviewKey","refreshPreview","prev","previewSpec","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","v","draft","target","title","description","id","labelId","kind","map","py","values","textVariableFields","listVariableFields","plugin","FallbackComponent","resetKeys","definition","onRefresh","isLoading","onClickAway","width","pluginType","pluginKindLabel","val","capturing_regexp","e","undefined","control","checked","allowMultiple","allowAll","customAllValue"],"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;AAA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ACJ,KAAK,CAAC;wDAC3D,OAAO;4DACLG,KAAK,CAACW,kBAAkB,CAACmB,cAAc,GAAGL,SAAS,CAAC;wDACtD,CAAC;oDACH,CAAC,CAAC,CAAC;gDACL,CAAC;gDACD3B,UAAU,EAAC,+CAA+C;8CAC1D,AACH;;sCACK;;8BACF;;sBACP,AACJ;;cACG;;MACL,CACH;AACJ,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ListVariableDefinition } from '@perses-dev/core';
|
|
3
|
-
interface VariablePreviewProps {
|
|
4
|
-
values?: string[];
|
|
5
|
-
onRefresh?: () => void;
|
|
6
|
-
isLoading?: boolean;
|
|
7
|
-
error?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function VariablePreview(props: VariablePreviewProps): JSX.Element;
|
|
10
|
-
interface VariableListPreviewProps {
|
|
11
|
-
definition: ListVariableDefinition;
|
|
12
|
-
onRefresh: () => void;
|
|
13
|
-
}
|
|
14
|
-
export declare function VariableListPreview(props: VariableListPreviewProps): JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=VariablePreview.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VariablePreview.d.ts","sourceRoot":"","sources":["../../../../src/components/Variables/VariableEditorForm/VariablePreview.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAM1D,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAuD1D;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,sBAAsB,CAAC;IACnC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,eAalE"}
|