@perses-dev/prometheus-plugin 0.41.0 → 0.42.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/model/prometheus-client.js +16 -0
- package/dist/cjs/model/prometheus-selectors.js +1 -1
- package/dist/cjs/plugins/PrometheusDatasourceEditor.js +272 -186
- package/dist/cjs/plugins/prometheus-datasource.js +4 -0
- package/dist/cjs/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js +88 -0
- package/dist/cjs/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js +123 -0
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +34 -60
- package/dist/model/prometheus-client.d.ts +4 -0
- package/dist/model/prometheus-client.d.ts.map +1 -1
- package/dist/model/prometheus-client.js +15 -0
- package/dist/model/prometheus-client.js.map +1 -1
- package/dist/model/prometheus-selectors.js +1 -1
- package/dist/model/prometheus-selectors.js.map +1 -1
- package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +1 -1
- package/dist/plugins/PrometheusDatasourceEditor.js +272 -186
- package/dist/plugins/PrometheusDatasourceEditor.js.map +1 -1
- package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
- package/dist/plugins/prometheus-datasource.js +5 -1
- package/dist/plugins/prometheus-datasource.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.d.ts +21 -0
- package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
- package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js +80 -0
- package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js.map +1 -0
- package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.d.ts +21 -0
- package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
- package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js +115 -0
- package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js.map +1 -0
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +37 -63
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
- package/dist/plugins/types.d.ts +1 -15
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js.map +1 -1
- package/package.json +4 -4
|
@@ -15,11 +15,12 @@ import { OptionsEditorRadios } from '@perses-dev/plugin-system';
|
|
|
15
15
|
import { Grid, IconButton, MenuItem, TextField, Typography } from '@mui/material';
|
|
16
16
|
import React, { Fragment, useState } from 'react';
|
|
17
17
|
import { produce } from 'immer';
|
|
18
|
+
import { Controller } from 'react-hook-form';
|
|
18
19
|
import MinusIcon from 'mdi-material-ui/Minus';
|
|
19
20
|
import PlusIcon from 'mdi-material-ui/Plus';
|
|
20
21
|
import { DEFAULT_SCRAPE_INTERVAL } from './types';
|
|
21
22
|
export function PrometheusDatasourceEditor(props) {
|
|
22
|
-
var _value_proxy, _value_proxy1, _value_proxy2
|
|
23
|
+
var _value_proxy, _value_proxy1, _value_proxy2;
|
|
23
24
|
const { value , onChange , isReadonly } = props;
|
|
24
25
|
const strDirect = 'Direct access';
|
|
25
26
|
const strProxy = 'Proxy';
|
|
@@ -43,33 +44,17 @@ export function PrometheusDatasourceEditor(props) {
|
|
|
43
44
|
const tabs = [
|
|
44
45
|
{
|
|
45
46
|
label: strDirect,
|
|
46
|
-
content: /*#__PURE__*/ _jsx(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
readOnly: isReadonly
|
|
53
|
-
},
|
|
54
|
-
InputLabelProps: {
|
|
55
|
-
shrink: isReadonly ? true : undefined
|
|
56
|
-
},
|
|
57
|
-
onChange: (e)=>{
|
|
58
|
-
onChange(produce(value, (draft)=>{
|
|
59
|
-
draft.directUrl = e.target.value;
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
label: strProxy,
|
|
67
|
-
content: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
68
|
-
children: [
|
|
69
|
-
/*#__PURE__*/ _jsx(TextField, {
|
|
47
|
+
content: /*#__PURE__*/ _jsx(Controller, {
|
|
48
|
+
name: "URL",
|
|
49
|
+
render: ({ field , fieldState })=>{
|
|
50
|
+
var _fieldState_error;
|
|
51
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
52
|
+
...field,
|
|
70
53
|
fullWidth: true,
|
|
71
54
|
label: "URL",
|
|
72
|
-
value:
|
|
55
|
+
value: value.directUrl || '',
|
|
56
|
+
error: !!fieldState.error,
|
|
57
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
73
58
|
InputProps: {
|
|
74
59
|
readOnly: isReadonly
|
|
75
60
|
},
|
|
@@ -77,14 +62,48 @@ export function PrometheusDatasourceEditor(props) {
|
|
|
77
62
|
shrink: isReadonly ? true : undefined
|
|
78
63
|
},
|
|
79
64
|
onChange: (e)=>{
|
|
65
|
+
field.onChange(e);
|
|
80
66
|
onChange(produce(value, (draft)=>{
|
|
81
|
-
|
|
82
|
-
draft.proxy.spec.url = e.target.value;
|
|
83
|
-
}
|
|
67
|
+
draft.directUrl = e.target.value;
|
|
84
68
|
}));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: strProxy,
|
|
76
|
+
content: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
77
|
+
children: [
|
|
78
|
+
/*#__PURE__*/ _jsx(Controller, {
|
|
79
|
+
name: "URL",
|
|
80
|
+
render: ({ field , fieldState })=>{
|
|
81
|
+
var _value_proxy, _fieldState_error;
|
|
82
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
83
|
+
...field,
|
|
84
|
+
fullWidth: true,
|
|
85
|
+
label: "URL",
|
|
86
|
+
value: ((_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.url) || '',
|
|
87
|
+
error: !!fieldState.error,
|
|
88
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
89
|
+
InputProps: {
|
|
90
|
+
readOnly: isReadonly
|
|
91
|
+
},
|
|
92
|
+
InputLabelProps: {
|
|
93
|
+
shrink: isReadonly ? true : undefined
|
|
94
|
+
},
|
|
95
|
+
onChange: (e)=>{
|
|
96
|
+
field.onChange(e);
|
|
97
|
+
onChange(produce(value, (draft)=>{
|
|
98
|
+
if (draft.proxy !== undefined) {
|
|
99
|
+
draft.proxy.spec.url = e.target.value;
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
},
|
|
103
|
+
sx: {
|
|
104
|
+
mb: 2
|
|
105
|
+
}
|
|
106
|
+
});
|
|
88
107
|
}
|
|
89
108
|
}),
|
|
90
109
|
/*#__PURE__*/ _jsx(Typography, {
|
|
@@ -97,115 +116,142 @@ export function PrometheusDatasourceEditor(props) {
|
|
|
97
116
|
spacing: 2,
|
|
98
117
|
mb: 2,
|
|
99
118
|
children: [
|
|
100
|
-
((
|
|
119
|
+
((_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.allowedEndpoints) && ((_value_proxy1 = value.proxy) === null || _value_proxy1 === void 0 ? void 0 : _value_proxy1.spec.allowedEndpoints.length) != 0 ? value.proxy.spec.allowedEndpoints.map(({ endpointPattern , method }, i)=>{
|
|
101
120
|
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
102
121
|
children: [
|
|
103
122
|
/*#__PURE__*/ _jsx(Grid, {
|
|
104
123
|
item: true,
|
|
105
124
|
xs: 8,
|
|
106
|
-
children: /*#__PURE__*/ _jsx(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
126
|
+
name: `Endpoint pattern ${i}`,
|
|
127
|
+
render: ({ field , fieldState })=>{
|
|
128
|
+
var _fieldState_error;
|
|
129
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
130
|
+
...field,
|
|
131
|
+
fullWidth: true,
|
|
132
|
+
label: "Endpoint pattern",
|
|
133
|
+
value: endpointPattern,
|
|
134
|
+
error: !!fieldState.error,
|
|
135
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
136
|
+
InputProps: {
|
|
137
|
+
readOnly: isReadonly
|
|
138
|
+
},
|
|
139
|
+
InputLabelProps: {
|
|
140
|
+
shrink: isReadonly ? true : undefined
|
|
141
|
+
},
|
|
142
|
+
onChange: (e)=>{
|
|
143
|
+
field.onChange(e);
|
|
144
|
+
onChange(produce(value, (draft)=>{
|
|
145
|
+
if (draft.proxy !== undefined) {
|
|
146
|
+
var _draft_proxy_spec_allowedEndpoints;
|
|
147
|
+
draft.proxy.spec.allowedEndpoints = (_draft_proxy_spec_allowedEndpoints = draft.proxy.spec.allowedEndpoints) === null || _draft_proxy_spec_allowedEndpoints === void 0 ? void 0 : _draft_proxy_spec_allowedEndpoints.map((item, itemIndex)=>{
|
|
148
|
+
if (i === itemIndex) {
|
|
149
|
+
return {
|
|
150
|
+
endpointPattern: e.target.value,
|
|
151
|
+
method: item.method
|
|
152
|
+
};
|
|
153
|
+
} else {
|
|
154
|
+
return item;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
128
157
|
}
|
|
129
|
-
});
|
|
158
|
+
}));
|
|
130
159
|
}
|
|
131
|
-
})
|
|
160
|
+
});
|
|
132
161
|
}
|
|
133
162
|
})
|
|
134
163
|
}),
|
|
135
164
|
/*#__PURE__*/ _jsx(Grid, {
|
|
136
165
|
item: true,
|
|
137
166
|
xs: 3,
|
|
138
|
-
children: /*#__PURE__*/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
168
|
+
name: `Method ${i}`,
|
|
169
|
+
render: ({ field , fieldState })=>{
|
|
170
|
+
var _fieldState_error;
|
|
171
|
+
/*#__PURE__*/ return _jsxs(TextField, {
|
|
172
|
+
...field,
|
|
173
|
+
select: true,
|
|
174
|
+
fullWidth: true,
|
|
175
|
+
label: "Method",
|
|
176
|
+
value: method,
|
|
177
|
+
error: !!fieldState.error,
|
|
178
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
179
|
+
InputProps: {
|
|
180
|
+
readOnly: isReadonly
|
|
181
|
+
},
|
|
182
|
+
InputLabelProps: {
|
|
183
|
+
shrink: isReadonly ? true : undefined
|
|
184
|
+
},
|
|
185
|
+
onChange: (e)=>{
|
|
186
|
+
field.onChange(e);
|
|
187
|
+
onChange(produce(value, (draft)=>{
|
|
188
|
+
if (draft.proxy !== undefined) {
|
|
189
|
+
var _draft_proxy_spec_allowedEndpoints;
|
|
190
|
+
draft.proxy.spec.allowedEndpoints = (_draft_proxy_spec_allowedEndpoints = draft.proxy.spec.allowedEndpoints) === null || _draft_proxy_spec_allowedEndpoints === void 0 ? void 0 : _draft_proxy_spec_allowedEndpoints.map((item, itemIndex)=>{
|
|
191
|
+
if (i === itemIndex) {
|
|
192
|
+
return {
|
|
193
|
+
endpointPattern: item.endpointPattern,
|
|
194
|
+
method: e.target.value
|
|
195
|
+
};
|
|
196
|
+
} else {
|
|
197
|
+
return item;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
161
200
|
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
})
|
|
187
|
-
|
|
201
|
+
}));
|
|
202
|
+
},
|
|
203
|
+
children: [
|
|
204
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
205
|
+
value: "GET",
|
|
206
|
+
children: "GET"
|
|
207
|
+
}),
|
|
208
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
209
|
+
value: "POST",
|
|
210
|
+
children: "POST"
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
213
|
+
value: "PUT",
|
|
214
|
+
children: "PUT"
|
|
215
|
+
}),
|
|
216
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
217
|
+
value: "PATCH",
|
|
218
|
+
children: "PATCH"
|
|
219
|
+
}),
|
|
220
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
221
|
+
value: "DELETE",
|
|
222
|
+
children: "DELETE"
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
});
|
|
226
|
+
}
|
|
188
227
|
})
|
|
189
228
|
}),
|
|
190
229
|
/*#__PURE__*/ _jsx(Grid, {
|
|
191
230
|
item: true,
|
|
192
231
|
xs: 1,
|
|
193
|
-
children: /*#__PURE__*/ _jsx(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
232
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
233
|
+
name: `Remove Endpoint ${i}`,
|
|
234
|
+
render: ({ field })=>{
|
|
235
|
+
/*#__PURE__*/ return _jsx(IconButton, {
|
|
236
|
+
...field,
|
|
237
|
+
disabled: isReadonly,
|
|
238
|
+
// Remove the given allowed endpoint from the list
|
|
239
|
+
onClick: (e)=>{
|
|
240
|
+
field.onChange(e);
|
|
241
|
+
onChange(produce(value, (draft)=>{
|
|
242
|
+
if (draft.proxy !== undefined) {
|
|
243
|
+
var _draft_proxy_spec_allowedEndpoints;
|
|
244
|
+
draft.proxy.spec.allowedEndpoints = [
|
|
245
|
+
...((_draft_proxy_spec_allowedEndpoints = draft.proxy.spec.allowedEndpoints) === null || _draft_proxy_spec_allowedEndpoints === void 0 ? void 0 : _draft_proxy_spec_allowedEndpoints.filter((item, itemIndex)=>{
|
|
246
|
+
return itemIndex !== i;
|
|
247
|
+
})) || []
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
}));
|
|
251
|
+
},
|
|
252
|
+
children: /*#__PURE__*/ _jsx(MinusIcon, {})
|
|
253
|
+
});
|
|
254
|
+
}
|
|
209
255
|
})
|
|
210
256
|
})
|
|
211
257
|
]
|
|
@@ -257,72 +303,102 @@ export function PrometheusDatasourceEditor(props) {
|
|
|
257
303
|
spacing: 2,
|
|
258
304
|
mb: 2,
|
|
259
305
|
children: [
|
|
260
|
-
((
|
|
261
|
-
var _value_proxy_spec_headers, _value_proxy;
|
|
306
|
+
((_value_proxy2 = value.proxy) === null || _value_proxy2 === void 0 ? void 0 : _value_proxy2.spec.headers) && Object.keys(value.proxy.spec.headers).map((headerName, i)=>{
|
|
262
307
|
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
263
308
|
children: [
|
|
264
309
|
/*#__PURE__*/ _jsx(Grid, {
|
|
265
310
|
item: true,
|
|
266
311
|
xs: 4,
|
|
267
|
-
children: /*#__PURE__*/ _jsx(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
312
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
313
|
+
name: `Header name ${i}`,
|
|
314
|
+
render: ({ field , fieldState })=>{
|
|
315
|
+
var _fieldState_error;
|
|
316
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
317
|
+
...field,
|
|
318
|
+
fullWidth: true,
|
|
319
|
+
label: "Header name",
|
|
320
|
+
value: headerName,
|
|
321
|
+
error: !!fieldState.error,
|
|
322
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
323
|
+
InputProps: {
|
|
324
|
+
readOnly: isReadonly
|
|
325
|
+
},
|
|
326
|
+
InputLabelProps: {
|
|
327
|
+
shrink: isReadonly ? true : undefined
|
|
328
|
+
},
|
|
329
|
+
onChange: (e)=>{
|
|
330
|
+
field.onChange(e);
|
|
331
|
+
onChange(produce(value, (draft)=>{
|
|
332
|
+
if (draft.proxy !== undefined) {
|
|
333
|
+
draft.proxy.spec.headers = buildNewHeaders(draft.proxy.spec.headers, headerName, e.target.value);
|
|
334
|
+
}
|
|
335
|
+
}));
|
|
280
336
|
}
|
|
281
|
-
})
|
|
337
|
+
});
|
|
338
|
+
}
|
|
282
339
|
})
|
|
283
340
|
}),
|
|
284
341
|
/*#__PURE__*/ _jsx(Grid, {
|
|
285
342
|
item: true,
|
|
286
343
|
xs: 7,
|
|
287
|
-
children: /*#__PURE__*/ _jsx(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
344
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
345
|
+
name: `Header value ${i}`,
|
|
346
|
+
render: ({ field , fieldState })=>{
|
|
347
|
+
var _value_proxy_spec_headers, _value_proxy, _fieldState_error;
|
|
348
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
349
|
+
...field,
|
|
350
|
+
fullWidth: true,
|
|
351
|
+
label: "Header value",
|
|
352
|
+
value: (_value_proxy_spec_headers = (_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.headers) === null || _value_proxy_spec_headers === void 0 ? void 0 : _value_proxy_spec_headers[headerName],
|
|
353
|
+
error: !!fieldState.error,
|
|
354
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
355
|
+
InputProps: {
|
|
356
|
+
readOnly: isReadonly
|
|
357
|
+
},
|
|
358
|
+
InputLabelProps: {
|
|
359
|
+
shrink: isReadonly ? true : undefined
|
|
360
|
+
},
|
|
361
|
+
onChange: (e)=>{
|
|
362
|
+
field.onChange(e);
|
|
363
|
+
onChange(produce(value, (draft)=>{
|
|
364
|
+
if (draft.proxy !== undefined) {
|
|
365
|
+
draft.proxy.spec.headers = {
|
|
366
|
+
...draft.proxy.spec.headers,
|
|
367
|
+
[headerName]: e.target.value
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
}));
|
|
303
371
|
}
|
|
304
|
-
})
|
|
372
|
+
});
|
|
373
|
+
}
|
|
305
374
|
})
|
|
306
375
|
}),
|
|
307
376
|
/*#__PURE__*/ _jsx(Grid, {
|
|
308
377
|
item: true,
|
|
309
378
|
xs: 1,
|
|
310
|
-
children: /*#__PURE__*/ _jsx(
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
379
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
380
|
+
name: `Remove Header ${i}`,
|
|
381
|
+
render: ({ field })=>{
|
|
382
|
+
/*#__PURE__*/ return _jsx(IconButton, {
|
|
383
|
+
...field,
|
|
384
|
+
disabled: isReadonly,
|
|
385
|
+
// Remove the given header from the list
|
|
386
|
+
onClick: (e)=>{
|
|
387
|
+
var _value_proxy;
|
|
388
|
+
field.onChange(e);
|
|
389
|
+
const newHeaders = {
|
|
390
|
+
...(_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.headers
|
|
391
|
+
};
|
|
392
|
+
delete newHeaders[headerName];
|
|
393
|
+
onChange(produce(value, (draft)=>{
|
|
394
|
+
if (draft.proxy !== undefined) {
|
|
395
|
+
draft.proxy.spec.headers = newHeaders;
|
|
396
|
+
}
|
|
397
|
+
}));
|
|
398
|
+
},
|
|
399
|
+
children: /*#__PURE__*/ _jsx(MinusIcon, {})
|
|
400
|
+
});
|
|
401
|
+
}
|
|
326
402
|
})
|
|
327
403
|
})
|
|
328
404
|
]
|
|
@@ -351,22 +427,32 @@ export function PrometheusDatasourceEditor(props) {
|
|
|
351
427
|
})
|
|
352
428
|
]
|
|
353
429
|
}),
|
|
354
|
-
/*#__PURE__*/ _jsx(
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
430
|
+
/*#__PURE__*/ _jsx(Controller, {
|
|
431
|
+
name: "Secret",
|
|
432
|
+
render: ({ field , fieldState })=>{
|
|
433
|
+
var _value_proxy, _fieldState_error;
|
|
434
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
435
|
+
...field,
|
|
436
|
+
fullWidth: true,
|
|
437
|
+
label: "Secret",
|
|
438
|
+
value: ((_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.secret) || '',
|
|
439
|
+
error: !!fieldState.error,
|
|
440
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
441
|
+
InputProps: {
|
|
442
|
+
readOnly: isReadonly
|
|
443
|
+
},
|
|
444
|
+
InputLabelProps: {
|
|
445
|
+
shrink: isReadonly ? true : undefined
|
|
446
|
+
},
|
|
447
|
+
onChange: (e)=>{
|
|
448
|
+
field.onChange(e);
|
|
449
|
+
onChange(produce(value, (draft)=>{
|
|
450
|
+
if (draft.proxy !== undefined) {
|
|
451
|
+
draft.proxy.spec.secret = e.target.value;
|
|
452
|
+
}
|
|
453
|
+
}));
|
|
368
454
|
}
|
|
369
|
-
})
|
|
455
|
+
});
|
|
370
456
|
}
|
|
371
457
|
})
|
|
372
458
|
]
|