@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.
Files changed (34) hide show
  1. package/dist/cjs/model/prometheus-client.js +16 -0
  2. package/dist/cjs/model/prometheus-selectors.js +1 -1
  3. package/dist/cjs/plugins/PrometheusDatasourceEditor.js +272 -186
  4. package/dist/cjs/plugins/prometheus-datasource.js +4 -0
  5. package/dist/cjs/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js +88 -0
  6. package/dist/cjs/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js +123 -0
  7. package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +34 -60
  8. package/dist/model/prometheus-client.d.ts +4 -0
  9. package/dist/model/prometheus-client.d.ts.map +1 -1
  10. package/dist/model/prometheus-client.js +15 -0
  11. package/dist/model/prometheus-client.js.map +1 -1
  12. package/dist/model/prometheus-selectors.js +1 -1
  13. package/dist/model/prometheus-selectors.js.map +1 -1
  14. package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +1 -1
  15. package/dist/plugins/PrometheusDatasourceEditor.js +272 -186
  16. package/dist/plugins/PrometheusDatasourceEditor.js.map +1 -1
  17. package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
  18. package/dist/plugins/prometheus-datasource.js +5 -1
  19. package/dist/plugins/prometheus-datasource.js.map +1 -1
  20. package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.d.ts +21 -0
  21. package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
  22. package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js +80 -0
  23. package/dist/plugins/prometheus-time-series-query/DashboardPrometheusTimeSeriesQueryEditor.js.map +1 -0
  24. package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.d.ts +21 -0
  25. package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
  26. package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js +115 -0
  27. package/dist/plugins/prometheus-time-series-query/ExplorePrometheusTimeSeriesQueryEditor.js.map +1 -0
  28. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
  29. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +37 -63
  30. package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
  31. package/dist/plugins/types.d.ts +1 -15
  32. package/dist/plugins/types.d.ts.map +1 -1
  33. package/dist/plugins/types.js.map +1 -1
  34. 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, _value_proxy3, _value_proxy4;
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(_Fragment, {
47
- children: /*#__PURE__*/ _jsx(TextField, {
48
- fullWidth: true,
49
- label: "URL",
50
- value: value.directUrl || '',
51
- InputProps: {
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: ((_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.url) || '',
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
- if (draft.proxy !== undefined) {
82
- draft.proxy.spec.url = e.target.value;
83
- }
67
+ draft.directUrl = e.target.value;
84
68
  }));
85
- },
86
- sx: {
87
- mb: 2
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
- ((_value_proxy1 = value.proxy) === null || _value_proxy1 === void 0 ? void 0 : _value_proxy1.spec.allowedEndpoints) && ((_value_proxy2 = value.proxy) === null || _value_proxy2 === void 0 ? void 0 : _value_proxy2.spec.allowedEndpoints.length) != 0 ? value.proxy.spec.allowedEndpoints.map(({ endpointPattern , method }, i)=>{
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(TextField, {
107
- fullWidth: true,
108
- label: "Endpoint pattern",
109
- value: endpointPattern,
110
- InputProps: {
111
- readOnly: isReadonly
112
- },
113
- InputLabelProps: {
114
- shrink: isReadonly ? true : undefined
115
- },
116
- onChange: (e)=>{
117
- onChange(produce(value, (draft)=>{
118
- if (draft.proxy !== undefined) {
119
- var _draft_proxy_spec_allowedEndpoints;
120
- 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)=>{
121
- if (i === itemIndex) {
122
- return {
123
- endpointPattern: e.target.value,
124
- method: item.method
125
- };
126
- } else {
127
- return item;
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__*/ _jsxs(TextField, {
139
- select: true,
140
- fullWidth: true,
141
- label: "Method",
142
- value: method,
143
- InputProps: {
144
- readOnly: isReadonly
145
- },
146
- InputLabelProps: {
147
- shrink: isReadonly ? true : undefined
148
- },
149
- onChange: (e)=>{
150
- onChange(produce(value, (draft)=>{
151
- if (draft.proxy !== undefined) {
152
- var _draft_proxy_spec_allowedEndpoints;
153
- 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)=>{
154
- if (i === itemIndex) {
155
- return {
156
- endpointPattern: item.endpointPattern,
157
- method: e.target.value
158
- };
159
- } else {
160
- return item;
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
- children: [
167
- /*#__PURE__*/ _jsx(MenuItem, {
168
- value: "GET",
169
- children: "GET"
170
- }),
171
- /*#__PURE__*/ _jsx(MenuItem, {
172
- value: "POST",
173
- children: "POST"
174
- }),
175
- /*#__PURE__*/ _jsx(MenuItem, {
176
- value: "PUT",
177
- children: "PUT"
178
- }),
179
- /*#__PURE__*/ _jsx(MenuItem, {
180
- value: "PATCH",
181
- children: "PATCH"
182
- }),
183
- /*#__PURE__*/ _jsx(MenuItem, {
184
- value: "DELETE",
185
- children: "DELETE"
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(IconButton, {
194
- disabled: isReadonly,
195
- // Remove the given allowed endpoint from the list
196
- onClick: ()=>{
197
- onChange(produce(value, (draft)=>{
198
- if (draft.proxy !== undefined) {
199
- var _draft_proxy_spec_allowedEndpoints;
200
- draft.proxy.spec.allowedEndpoints = [
201
- ...((_draft_proxy_spec_allowedEndpoints = draft.proxy.spec.allowedEndpoints) === null || _draft_proxy_spec_allowedEndpoints === void 0 ? void 0 : _draft_proxy_spec_allowedEndpoints.filter((item, itemIndex)=>{
202
- return itemIndex !== i;
203
- })) || []
204
- ];
205
- }
206
- }));
207
- },
208
- children: /*#__PURE__*/ _jsx(MinusIcon, {})
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
- ((_value_proxy3 = value.proxy) === null || _value_proxy3 === void 0 ? void 0 : _value_proxy3.spec.headers) && Object.keys(value.proxy.spec.headers).map((headerName, i)=>{
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(TextField, {
268
- fullWidth: true,
269
- label: "Header name",
270
- value: headerName,
271
- InputProps: {
272
- readOnly: isReadonly
273
- },
274
- InputLabelProps: {
275
- shrink: isReadonly ? true : undefined
276
- },
277
- onChange: (e)=>onChange(produce(value, (draft)=>{
278
- if (draft.proxy !== undefined) {
279
- draft.proxy.spec.headers = buildNewHeaders(draft.proxy.spec.headers, headerName, e.target.value);
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(TextField, {
288
- fullWidth: true,
289
- label: "Header value",
290
- 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],
291
- InputProps: {
292
- readOnly: isReadonly
293
- },
294
- InputLabelProps: {
295
- shrink: isReadonly ? true : undefined
296
- },
297
- onChange: (e)=>onChange(produce(value, (draft)=>{
298
- if (draft.proxy !== undefined) {
299
- draft.proxy.spec.headers = {
300
- ...draft.proxy.spec.headers,
301
- [headerName]: e.target.value
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(IconButton, {
311
- disabled: isReadonly,
312
- // Remove the given header from the list
313
- onClick: ()=>{
314
- var _value_proxy;
315
- const newHeaders = {
316
- ...(_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.headers
317
- };
318
- delete newHeaders[headerName];
319
- onChange(produce(value, (draft)=>{
320
- if (draft.proxy !== undefined) {
321
- draft.proxy.spec.headers = newHeaders;
322
- }
323
- }));
324
- },
325
- children: /*#__PURE__*/ _jsx(MinusIcon, {})
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(TextField, {
355
- fullWidth: true,
356
- label: "Secret",
357
- value: ((_value_proxy4 = value.proxy) === null || _value_proxy4 === void 0 ? void 0 : _value_proxy4.spec.secret) || '',
358
- InputProps: {
359
- readOnly: isReadonly
360
- },
361
- InputLabelProps: {
362
- shrink: isReadonly ? true : undefined
363
- },
364
- onChange: (e)=>{
365
- onChange(produce(value, (draft)=>{
366
- if (draft.proxy !== undefined) {
367
- draft.proxy.spec.secret = e.target.value;
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
  ]