@perses-dev/plugin-system 0.50.1 → 0.51.0-beta.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/DatasourceEditorForm/DatasourceEditorForm.js +17 -71
- package/dist/cjs/components/DatasourceSelect.js +8 -13
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +534 -0
- package/dist/cjs/components/HTTPSettingsEditor/index.js +30 -0
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +4 -4
- package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +1 -1
- package/dist/cjs/components/MetricLabelInput/index.js +1 -1
- package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +15 -14
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +7 -11
- package/dist/cjs/components/PluginEditor/PluginEditor.js +10 -6
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +4 -5
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +7 -8
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +7 -10
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +17 -14
- package/dist/cjs/components/ProjectSelect.js +2 -3
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +46 -92
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +6 -6
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -11
- package/dist/cjs/components/Variables/variable-model.js +4 -7
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/model/explore.js +16 -0
- package/dist/cjs/remote/PersesPlugin.types.js +16 -0
- package/dist/cjs/remote/PluginLoaderComponent.js +75 -0
- package/dist/cjs/remote/PluginRuntime.js +267 -0
- package/dist/cjs/remote/index.js +31 -0
- package/dist/cjs/remote/remotePluginLoader.js +61 -0
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +4 -10
- package/dist/cjs/runtime/DataQueriesProvider/model.js +4 -7
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +2 -2
- package/dist/cjs/runtime/builtin-variables.js +1 -1
- package/dist/cjs/runtime/datasources.js +3 -3
- package/dist/cjs/runtime/plugin-registry.js +5 -6
- package/dist/cjs/runtime/time-series-queries.js +11 -18
- package/dist/cjs/runtime/trace-queries.js +1 -2
- package/dist/cjs/runtime/variables.js +10 -28
- package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +1 -67
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +4 -4
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemVariables.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +1 -1
- package/dist/cjs/test/render.js +1 -2
- package/dist/cjs/test-utils/mock-plugin-registry.js +10 -10
- package/dist/cjs/utils/variables.js +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +17 -30
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceSelect.d.ts +2 -2
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +8 -13
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +11 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +480 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.d.ts +2 -0
- package/dist/components/HTTPSettingsEditor/index.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.js +15 -0
- package/dist/components/HTTPSettingsEditor/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +4 -4
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
- package/dist/components/MetricLabelInput/index.js +1 -1
- package/dist/components/MetricLabelInput/index.js.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +15 -14
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +7 -11
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +10 -6
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +4 -5
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +7 -8
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +7 -10
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -4
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +17 -14
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/ProjectSelect.js +2 -3
- package/dist/components/ProjectSelect.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +46 -92
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +6 -6
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -11
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/variable-model.js +4 -7
- 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/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/explore.d.ts +13 -0
- package/dist/model/explore.d.ts.map +1 -0
- package/dist/model/explore.js +17 -0
- package/dist/model/explore.js.map +1 -0
- package/dist/model/panels.d.ts +13 -3
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugins.d.ts +31 -17
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/remote/PersesPlugin.types.d.ts +7 -0
- package/dist/remote/PersesPlugin.types.d.ts.map +1 -0
- package/dist/remote/PersesPlugin.types.js +15 -0
- package/dist/remote/PersesPlugin.types.js.map +1 -0
- package/dist/remote/PluginLoaderComponent.d.ts +10 -0
- package/dist/remote/PluginLoaderComponent.d.ts.map +1 -0
- package/dist/remote/PluginLoaderComponent.js +67 -0
- package/dist/remote/PluginLoaderComponent.js.map +1 -0
- package/dist/remote/PluginRuntime.d.ts +11 -0
- package/dist/remote/PluginRuntime.d.ts.map +1 -0
- package/dist/remote/PluginRuntime.js +202 -0
- package/dist/remote/PluginRuntime.js.map +1 -0
- package/dist/remote/index.d.ts +3 -0
- package/dist/remote/index.d.ts.map +1 -0
- package/dist/remote/index.js +16 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/remotePluginLoader.d.ts +3 -0
- package/dist/remote/remotePluginLoader.d.ts.map +1 -0
- package/dist/remote/remotePluginLoader.js +53 -0
- package/dist/remote/remotePluginLoader.js.map +1 -0
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +4 -10
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +4 -7
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +2 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/builtin-variables.js +1 -1
- package/dist/runtime/builtin-variables.js.map +1 -1
- package/dist/runtime/datasources.d.ts +2 -2
- package/dist/runtime/datasources.js +3 -3
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +6 -6
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +5 -6
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/time-series-queries.js +11 -18
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.js +1 -2
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/variables.js +10 -28
- package/dist/runtime/variables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -22
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +4 -4
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
- package/dist/test/render.js +1 -2
- package/dist/test/render.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts +5 -3
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +10 -10
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/variables.js +1 -1
- package/dist/utils/variables.js.map +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "HTTPSettingsEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return HTTPSettingsEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
26
|
+
const _immer = require("immer");
|
|
27
|
+
const _reacthookform = require("react-hook-form");
|
|
28
|
+
const _Minus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Minus"));
|
|
29
|
+
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
30
|
+
const _OptionsEditorRadios = require("../OptionsEditorRadios");
|
|
31
|
+
function _interop_require_default(obj) {
|
|
32
|
+
return obj && obj.__esModule ? obj : {
|
|
33
|
+
default: obj
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
37
|
+
if (typeof WeakMap !== "function") return null;
|
|
38
|
+
var cacheBabelInterop = new WeakMap();
|
|
39
|
+
var cacheNodeInterop = new WeakMap();
|
|
40
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
41
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
42
|
+
})(nodeInterop);
|
|
43
|
+
}
|
|
44
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
45
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
49
|
+
return {
|
|
50
|
+
default: obj
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
54
|
+
if (cache && cache.has(obj)) {
|
|
55
|
+
return cache.get(obj);
|
|
56
|
+
}
|
|
57
|
+
var newObj = {
|
|
58
|
+
__proto__: null
|
|
59
|
+
};
|
|
60
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
61
|
+
for(var key in obj){
|
|
62
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
63
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
64
|
+
if (desc && (desc.get || desc.set)) {
|
|
65
|
+
Object.defineProperty(newObj, key, desc);
|
|
66
|
+
} else {
|
|
67
|
+
newObj[key] = obj[key];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
newObj.default = obj;
|
|
72
|
+
if (cache) {
|
|
73
|
+
cache.set(obj, newObj);
|
|
74
|
+
}
|
|
75
|
+
return newObj;
|
|
76
|
+
}
|
|
77
|
+
function HTTPSettingsEditor(props) {
|
|
78
|
+
const { value, onChange, isReadonly, initialSpecDirect, initialSpecProxy } = props;
|
|
79
|
+
const strDirect = 'Direct access';
|
|
80
|
+
const strProxy = 'Proxy';
|
|
81
|
+
// utilitary function used for headers when renaming a property
|
|
82
|
+
// -> TODO it would be cleaner to manipulate headers as an intermediary list instead, to avoid doing this.
|
|
83
|
+
const buildNewHeaders = (oldHeaders, oldName, newName)=>{
|
|
84
|
+
if (oldHeaders === undefined) return oldHeaders;
|
|
85
|
+
const keys = Object.keys(oldHeaders);
|
|
86
|
+
const newHeaders = keys.reduce((acc, val)=>{
|
|
87
|
+
if (val === oldName) {
|
|
88
|
+
acc[newName] = oldHeaders[oldName] || '';
|
|
89
|
+
} else {
|
|
90
|
+
acc[val] = oldHeaders[val] || '';
|
|
91
|
+
}
|
|
92
|
+
return acc;
|
|
93
|
+
}, {});
|
|
94
|
+
return {
|
|
95
|
+
...newHeaders
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
const tabs = [
|
|
99
|
+
{
|
|
100
|
+
label: strDirect,
|
|
101
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
102
|
+
name: "URL",
|
|
103
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
104
|
+
...field,
|
|
105
|
+
fullWidth: true,
|
|
106
|
+
label: "URL",
|
|
107
|
+
value: value.directUrl || '',
|
|
108
|
+
error: !!fieldState.error,
|
|
109
|
+
helperText: fieldState.error?.message,
|
|
110
|
+
InputProps: {
|
|
111
|
+
readOnly: isReadonly
|
|
112
|
+
},
|
|
113
|
+
InputLabelProps: {
|
|
114
|
+
shrink: isReadonly ? true : undefined
|
|
115
|
+
},
|
|
116
|
+
onChange: (e)=>{
|
|
117
|
+
field.onChange(e);
|
|
118
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
119
|
+
draft.directUrl = e.target.value;
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: strProxy,
|
|
127
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
128
|
+
children: [
|
|
129
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
130
|
+
name: "URL",
|
|
131
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
132
|
+
...field,
|
|
133
|
+
fullWidth: true,
|
|
134
|
+
label: "URL",
|
|
135
|
+
value: value.proxy?.spec.url || '',
|
|
136
|
+
error: !!fieldState.error,
|
|
137
|
+
helperText: fieldState.error?.message,
|
|
138
|
+
InputProps: {
|
|
139
|
+
readOnly: isReadonly
|
|
140
|
+
},
|
|
141
|
+
InputLabelProps: {
|
|
142
|
+
shrink: isReadonly ? true : undefined
|
|
143
|
+
},
|
|
144
|
+
onChange: (e)=>{
|
|
145
|
+
field.onChange(e);
|
|
146
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
147
|
+
if (draft.proxy !== undefined) {
|
|
148
|
+
draft.proxy.spec.url = e.target.value;
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
151
|
+
},
|
|
152
|
+
sx: {
|
|
153
|
+
mb: 2
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
}),
|
|
157
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
158
|
+
variant: "h4",
|
|
159
|
+
mb: 2,
|
|
160
|
+
children: "Allowed endpoints"
|
|
161
|
+
}),
|
|
162
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
|
|
163
|
+
container: true,
|
|
164
|
+
spacing: 2,
|
|
165
|
+
mb: 2,
|
|
166
|
+
children: [
|
|
167
|
+
value.proxy?.spec.allowedEndpoints && value.proxy?.spec.allowedEndpoints.length !== 0 ? value.proxy.spec.allowedEndpoints.map(({ endpointPattern, method }, i)=>{
|
|
168
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
171
|
+
item: true,
|
|
172
|
+
xs: 8,
|
|
173
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
174
|
+
name: `Endpoint pattern ${i}`,
|
|
175
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
176
|
+
...field,
|
|
177
|
+
fullWidth: true,
|
|
178
|
+
label: "Endpoint pattern",
|
|
179
|
+
value: endpointPattern,
|
|
180
|
+
error: !!fieldState.error,
|
|
181
|
+
helperText: fieldState.error?.message,
|
|
182
|
+
InputProps: {
|
|
183
|
+
readOnly: isReadonly
|
|
184
|
+
},
|
|
185
|
+
InputLabelProps: {
|
|
186
|
+
shrink: isReadonly ? true : undefined
|
|
187
|
+
},
|
|
188
|
+
onChange: (e)=>{
|
|
189
|
+
field.onChange(e);
|
|
190
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
191
|
+
if (draft.proxy !== undefined) {
|
|
192
|
+
draft.proxy.spec.allowedEndpoints = draft.proxy.spec.allowedEndpoints?.map((item, itemIndex)=>{
|
|
193
|
+
if (i === itemIndex) {
|
|
194
|
+
return {
|
|
195
|
+
endpointPattern: e.target.value,
|
|
196
|
+
method: item.method
|
|
197
|
+
};
|
|
198
|
+
} else {
|
|
199
|
+
return item;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
209
|
+
item: true,
|
|
210
|
+
xs: 3,
|
|
211
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
212
|
+
name: `Method ${i}`,
|
|
213
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
214
|
+
...field,
|
|
215
|
+
select: true,
|
|
216
|
+
fullWidth: true,
|
|
217
|
+
label: "Method",
|
|
218
|
+
value: method,
|
|
219
|
+
error: !!fieldState.error,
|
|
220
|
+
helperText: fieldState.error?.message,
|
|
221
|
+
InputProps: {
|
|
222
|
+
readOnly: isReadonly
|
|
223
|
+
},
|
|
224
|
+
InputLabelProps: {
|
|
225
|
+
shrink: isReadonly ? true : undefined
|
|
226
|
+
},
|
|
227
|
+
onChange: (e)=>{
|
|
228
|
+
field.onChange(e);
|
|
229
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
230
|
+
if (draft.proxy !== undefined) {
|
|
231
|
+
draft.proxy.spec.allowedEndpoints = draft.proxy.spec.allowedEndpoints?.map((item, itemIndex)=>{
|
|
232
|
+
if (i === itemIndex) {
|
|
233
|
+
return {
|
|
234
|
+
endpointPattern: item.endpointPattern,
|
|
235
|
+
method: e.target.value
|
|
236
|
+
};
|
|
237
|
+
} else {
|
|
238
|
+
return item;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}));
|
|
243
|
+
},
|
|
244
|
+
children: [
|
|
245
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
246
|
+
value: "GET",
|
|
247
|
+
children: "GET"
|
|
248
|
+
}),
|
|
249
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
250
|
+
value: "POST",
|
|
251
|
+
children: "POST"
|
|
252
|
+
}),
|
|
253
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
254
|
+
value: "PUT",
|
|
255
|
+
children: "PUT"
|
|
256
|
+
}),
|
|
257
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
258
|
+
value: "PATCH",
|
|
259
|
+
children: "PATCH"
|
|
260
|
+
}),
|
|
261
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
262
|
+
value: "DELETE",
|
|
263
|
+
children: "DELETE"
|
|
264
|
+
})
|
|
265
|
+
]
|
|
266
|
+
})
|
|
267
|
+
})
|
|
268
|
+
}),
|
|
269
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
270
|
+
item: true,
|
|
271
|
+
xs: 1,
|
|
272
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
273
|
+
name: `Remove Endpoint ${i}`,
|
|
274
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
275
|
+
...field,
|
|
276
|
+
disabled: isReadonly,
|
|
277
|
+
// Remove the given allowed endpoint from the list
|
|
278
|
+
onClick: (e)=>{
|
|
279
|
+
field.onChange(e);
|
|
280
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
281
|
+
if (draft.proxy !== undefined) {
|
|
282
|
+
draft.proxy.spec.allowedEndpoints = [
|
|
283
|
+
...draft.proxy.spec.allowedEndpoints?.filter((item, itemIndex)=>{
|
|
284
|
+
return itemIndex !== i;
|
|
285
|
+
}) || []
|
|
286
|
+
];
|
|
287
|
+
}
|
|
288
|
+
}));
|
|
289
|
+
},
|
|
290
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Minus.default, {})
|
|
291
|
+
})
|
|
292
|
+
})
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
}, i);
|
|
296
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
297
|
+
item: true,
|
|
298
|
+
xs: 4,
|
|
299
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
300
|
+
sx: {
|
|
301
|
+
fontStyle: 'italic'
|
|
302
|
+
},
|
|
303
|
+
children: "None"
|
|
304
|
+
})
|
|
305
|
+
}),
|
|
306
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
307
|
+
item: true,
|
|
308
|
+
xs: 12,
|
|
309
|
+
sx: {
|
|
310
|
+
paddingTop: '0px !important',
|
|
311
|
+
paddingLeft: '5px !important'
|
|
312
|
+
},
|
|
313
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
314
|
+
disabled: isReadonly,
|
|
315
|
+
// Add a new (empty) allowed endpoint to the list
|
|
316
|
+
onClick: ()=>onChange((0, _immer.produce)(value, (draft)=>{
|
|
317
|
+
if (draft.proxy !== undefined) {
|
|
318
|
+
draft.proxy.spec.allowedEndpoints = [
|
|
319
|
+
...draft.proxy.spec.allowedEndpoints ?? [],
|
|
320
|
+
{
|
|
321
|
+
endpointPattern: '',
|
|
322
|
+
method: ''
|
|
323
|
+
}
|
|
324
|
+
];
|
|
325
|
+
}
|
|
326
|
+
})),
|
|
327
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {})
|
|
328
|
+
})
|
|
329
|
+
})
|
|
330
|
+
]
|
|
331
|
+
}),
|
|
332
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
333
|
+
variant: "h4",
|
|
334
|
+
mb: 2,
|
|
335
|
+
children: "Request Headers"
|
|
336
|
+
}),
|
|
337
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
|
|
338
|
+
container: true,
|
|
339
|
+
spacing: 2,
|
|
340
|
+
mb: 2,
|
|
341
|
+
children: [
|
|
342
|
+
value.proxy?.spec.headers && Object.keys(value.proxy.spec.headers).map((headerName, i)=>{
|
|
343
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
344
|
+
children: [
|
|
345
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
346
|
+
item: true,
|
|
347
|
+
xs: 4,
|
|
348
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
349
|
+
name: `Header name ${i}`,
|
|
350
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
351
|
+
...field,
|
|
352
|
+
fullWidth: true,
|
|
353
|
+
label: "Header name",
|
|
354
|
+
value: headerName,
|
|
355
|
+
error: !!fieldState.error,
|
|
356
|
+
helperText: fieldState.error?.message,
|
|
357
|
+
InputProps: {
|
|
358
|
+
readOnly: isReadonly
|
|
359
|
+
},
|
|
360
|
+
InputLabelProps: {
|
|
361
|
+
shrink: isReadonly ? true : undefined
|
|
362
|
+
},
|
|
363
|
+
onChange: (e)=>{
|
|
364
|
+
field.onChange(e);
|
|
365
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
366
|
+
if (draft.proxy !== undefined) {
|
|
367
|
+
draft.proxy.spec.headers = buildNewHeaders(draft.proxy.spec.headers, headerName, e.target.value);
|
|
368
|
+
}
|
|
369
|
+
}));
|
|
370
|
+
}
|
|
371
|
+
})
|
|
372
|
+
})
|
|
373
|
+
}),
|
|
374
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
375
|
+
item: true,
|
|
376
|
+
xs: 7,
|
|
377
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
378
|
+
name: `Header value ${i}`,
|
|
379
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
380
|
+
...field,
|
|
381
|
+
fullWidth: true,
|
|
382
|
+
label: "Header value",
|
|
383
|
+
value: value.proxy?.spec.headers?.[headerName],
|
|
384
|
+
error: !!fieldState.error,
|
|
385
|
+
helperText: fieldState.error?.message,
|
|
386
|
+
InputProps: {
|
|
387
|
+
readOnly: isReadonly
|
|
388
|
+
},
|
|
389
|
+
InputLabelProps: {
|
|
390
|
+
shrink: isReadonly ? true : undefined
|
|
391
|
+
},
|
|
392
|
+
onChange: (e)=>{
|
|
393
|
+
field.onChange(e);
|
|
394
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
395
|
+
if (draft.proxy !== undefined) {
|
|
396
|
+
draft.proxy.spec.headers = {
|
|
397
|
+
...draft.proxy.spec.headers,
|
|
398
|
+
[headerName]: e.target.value
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
}));
|
|
402
|
+
}
|
|
403
|
+
})
|
|
404
|
+
})
|
|
405
|
+
}),
|
|
406
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
407
|
+
item: true,
|
|
408
|
+
xs: 1,
|
|
409
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
410
|
+
name: `Remove Header ${i}`,
|
|
411
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
412
|
+
...field,
|
|
413
|
+
disabled: isReadonly,
|
|
414
|
+
// Remove the given header from the list
|
|
415
|
+
onClick: (e)=>{
|
|
416
|
+
field.onChange(e);
|
|
417
|
+
const newHeaders = {
|
|
418
|
+
...value.proxy?.spec.headers
|
|
419
|
+
};
|
|
420
|
+
delete newHeaders[headerName];
|
|
421
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
422
|
+
if (draft.proxy !== undefined) {
|
|
423
|
+
draft.proxy.spec.headers = newHeaders;
|
|
424
|
+
}
|
|
425
|
+
}));
|
|
426
|
+
},
|
|
427
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Minus.default, {})
|
|
428
|
+
})
|
|
429
|
+
})
|
|
430
|
+
})
|
|
431
|
+
]
|
|
432
|
+
}, i);
|
|
433
|
+
}),
|
|
434
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
435
|
+
item: true,
|
|
436
|
+
xs: 12,
|
|
437
|
+
sx: {
|
|
438
|
+
paddingTop: '0px !important',
|
|
439
|
+
paddingLeft: '5px !important'
|
|
440
|
+
},
|
|
441
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
442
|
+
disabled: isReadonly,
|
|
443
|
+
// Add a new (empty) header to the list
|
|
444
|
+
onClick: ()=>onChange((0, _immer.produce)(value, (draft)=>{
|
|
445
|
+
if (draft.proxy !== undefined) {
|
|
446
|
+
draft.proxy.spec.headers = {
|
|
447
|
+
...draft.proxy.spec.headers,
|
|
448
|
+
'': ''
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
})),
|
|
452
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {})
|
|
453
|
+
})
|
|
454
|
+
})
|
|
455
|
+
]
|
|
456
|
+
}),
|
|
457
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
458
|
+
name: "Secret",
|
|
459
|
+
render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
460
|
+
...field,
|
|
461
|
+
fullWidth: true,
|
|
462
|
+
label: "Secret",
|
|
463
|
+
value: value.proxy?.spec.secret || '',
|
|
464
|
+
error: !!fieldState.error,
|
|
465
|
+
helperText: fieldState.error?.message,
|
|
466
|
+
InputProps: {
|
|
467
|
+
readOnly: isReadonly
|
|
468
|
+
},
|
|
469
|
+
InputLabelProps: {
|
|
470
|
+
shrink: isReadonly ? true : undefined
|
|
471
|
+
},
|
|
472
|
+
onChange: (e)=>{
|
|
473
|
+
field.onChange(e);
|
|
474
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
475
|
+
if (draft.proxy !== undefined) {
|
|
476
|
+
draft.proxy.spec.secret = e.target.value;
|
|
477
|
+
}
|
|
478
|
+
}));
|
|
479
|
+
}
|
|
480
|
+
})
|
|
481
|
+
})
|
|
482
|
+
]
|
|
483
|
+
})
|
|
484
|
+
}
|
|
485
|
+
];
|
|
486
|
+
// Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or
|
|
487
|
+
// bug in case the tabs get eventually swapped in the future.
|
|
488
|
+
const directModeId = tabs.findIndex((tab)=>tab.label === strDirect);
|
|
489
|
+
const proxyModeId = tabs.findIndex((tab)=>tab.label === strProxy);
|
|
490
|
+
// In "update datasource" case, set defaultTab to the mode that this datasource is currently relying on.
|
|
491
|
+
// Otherwise (create datasource), set defaultTab to Direct access.
|
|
492
|
+
const defaultTab = value.proxy ? proxyModeId : directModeId;
|
|
493
|
+
// For better user experience, save previous states in mind for both mode.
|
|
494
|
+
// This avoids losing everything when the user changes their mind back.
|
|
495
|
+
const [previousSpecDirect, setPreviousSpecDirect] = (0, _react.useState)(initialSpecDirect);
|
|
496
|
+
const [previousSpecProxy, setPreviousSpecProxy] = (0, _react.useState)(initialSpecProxy);
|
|
497
|
+
// When changing mode, remove previous mode's config + append default values for the new mode.
|
|
498
|
+
const handleModeChange = (v)=>{
|
|
499
|
+
if (tabs[v]?.label === strDirect) {
|
|
500
|
+
setPreviousSpecProxy(value);
|
|
501
|
+
// Copy all settings (for example, scrapeInterval), except 'proxy'
|
|
502
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
503
|
+
const { proxy, ...newValue } = value;
|
|
504
|
+
onChange({
|
|
505
|
+
...newValue,
|
|
506
|
+
directUrl: previousSpecDirect.directUrl
|
|
507
|
+
});
|
|
508
|
+
} else if (tabs[v]?.label === strProxy) {
|
|
509
|
+
setPreviousSpecDirect(value);
|
|
510
|
+
// Copy all settings (for example, scrapeInterval), except 'directUrl'
|
|
511
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
512
|
+
const { directUrl, ...newValue } = value;
|
|
513
|
+
onChange({
|
|
514
|
+
...newValue,
|
|
515
|
+
proxy: previousSpecProxy.proxy
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
520
|
+
children: [
|
|
521
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
522
|
+
variant: "h4",
|
|
523
|
+
mt: 2,
|
|
524
|
+
children: "HTTP Settings"
|
|
525
|
+
}),
|
|
526
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorRadios.OptionsEditorRadios, {
|
|
527
|
+
isReadonly: isReadonly,
|
|
528
|
+
tabs: tabs,
|
|
529
|
+
defaultTab: defaultTab,
|
|
530
|
+
onModeChange: handleModeChange
|
|
531
|
+
})
|
|
532
|
+
]
|
|
533
|
+
});
|
|
534
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
_export_star(require("./HTTPSettingsEditor"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
|
@@ -87,13 +87,13 @@ function LegendOptionsEditor({ value, onChange, showValuesEditor = true }) {
|
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
89
|
const isValidLegend = (0, _model.validateLegendSpec)(value);
|
|
90
|
-
const currentPosition = (0, _core.getLegendPosition)(value
|
|
90
|
+
const currentPosition = (0, _core.getLegendPosition)(value?.position);
|
|
91
91
|
const legendPositionConfig = _model.LEGEND_POSITIONS_CONFIG[currentPosition];
|
|
92
|
-
const currentMode = (0, _core.getLegendMode)(value
|
|
92
|
+
const currentMode = (0, _core.getLegendMode)(value?.mode);
|
|
93
93
|
const legendModeConfig = _model.LEGEND_MODE_CONFIG[currentMode];
|
|
94
|
-
const currentSize = (0, _core.getLegendSize)(value
|
|
94
|
+
const currentSize = (0, _core.getLegendSize)(value?.size);
|
|
95
95
|
const legendSizeConfig = _model.LEGEND_SIZE_CONFIG[currentSize];
|
|
96
|
-
const currentValues =
|
|
96
|
+
const currentValues = value?.values || [];
|
|
97
97
|
const legendValuesConfig = currentValues.reduce((result, item)=>{
|
|
98
98
|
const config = _model.LEGEND_VALUE_CONFIG[item];
|
|
99
99
|
if (config) {
|
|
@@ -33,34 +33,35 @@ function _interop_require_default(obj) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
function useDefaultQueryDefinition(queryTypes) {
|
|
36
|
-
var _queryPlugins_;
|
|
37
36
|
// Build the default query plugin
|
|
38
37
|
// This will be used only if the queries are empty, to open a starting query
|
|
39
38
|
// Firs the default query type
|
|
40
39
|
const defaultQueryType = queryTypes[0];
|
|
41
40
|
// Then the default plugin kind
|
|
42
41
|
// Use as default the plugin kind explicitly set as default or the first in the list
|
|
43
|
-
const { data: queryPlugins } = (0, _runtime.useListPluginMetadata)(queryTypes);
|
|
42
|
+
const { data: queryPlugins, isLoading } = (0, _runtime.useListPluginMetadata)(queryTypes);
|
|
44
43
|
const { defaultPluginKinds } = (0, _runtime.usePluginRegistry)();
|
|
45
|
-
|
|
46
|
-
const defaultQueryKind = (_ref = (_defaultPluginKinds_defaultQueryType = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds[defaultQueryType]) !== null && _defaultPluginKinds_defaultQueryType !== void 0 ? _defaultPluginKinds_defaultQueryType : queryPlugins === null || queryPlugins === void 0 ? void 0 : (_queryPlugins_ = queryPlugins[0]) === null || _queryPlugins_ === void 0 ? void 0 : _queryPlugins_.kind) !== null && _ref !== void 0 ? _ref : '';
|
|
44
|
+
const defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';
|
|
47
45
|
const { data: defaultQueryPlugin } = (0, _runtime.usePlugin)(defaultQueryType, defaultQueryKind, {
|
|
48
|
-
|
|
46
|
+
throwOnError: true,
|
|
49
47
|
enabled: true
|
|
50
48
|
});
|
|
51
49
|
// This default query definition is used if no query is provided initially or when we add a new query
|
|
52
50
|
return {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
defaultInitialQueryDefinition: {
|
|
52
|
+
kind: defaultQueryType,
|
|
53
|
+
spec: {
|
|
54
|
+
plugin: {
|
|
55
|
+
kind: defaultQueryKind,
|
|
56
|
+
spec: defaultQueryPlugin?.createInitialOptions() || {}
|
|
57
|
+
}
|
|
58
58
|
}
|
|
59
|
-
}
|
|
59
|
+
},
|
|
60
|
+
isLoading
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
function MultiQueryEditor({ queryTypes, queries = [], onChange }) {
|
|
63
|
-
const defaultInitialQueryDefinition = useDefaultQueryDefinition(queryTypes);
|
|
64
|
+
const { defaultInitialQueryDefinition, isLoading } = useDefaultQueryDefinition(queryTypes);
|
|
64
65
|
// State for which queries are collapsed
|
|
65
66
|
const [queriesCollapsed, setQueriesCollapsed] = (0, _react.useState)(queries.map(()=>false));
|
|
66
67
|
// Query handlers
|
|
@@ -113,9 +114,9 @@ function MultiQueryEditor({ queryTypes, queries = [], onChange }) {
|
|
|
113
114
|
});
|
|
114
115
|
};
|
|
115
116
|
// show one query input if queries is empty
|
|
116
|
-
const queryDefinitions = queries.length ? queries : [
|
|
117
|
+
const queryDefinitions = queries.length ? queries : !isLoading ? [
|
|
117
118
|
defaultInitialQueryDefinition
|
|
118
|
-
];
|
|
119
|
+
] : [];
|
|
119
120
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
120
121
|
children: [
|
|
121
122
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|