@perses-dev/prometheus-plugin 0.41.1 → 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
|
@@ -21,6 +21,9 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
+
healthCheck: function() {
|
|
25
|
+
return healthCheck;
|
|
26
|
+
},
|
|
24
27
|
instantQuery: function() {
|
|
25
28
|
return instantQuery;
|
|
26
29
|
},
|
|
@@ -38,6 +41,19 @@ _export(exports, {
|
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
const _core = require("@perses-dev/core");
|
|
44
|
+
function healthCheck(queryOptions) {
|
|
45
|
+
return async ()=>{
|
|
46
|
+
const url = `${queryOptions.datasourceUrl}/-/healthy`;
|
|
47
|
+
try {
|
|
48
|
+
const resp = await (0, _core.fetch)(url, {
|
|
49
|
+
headers: queryOptions.headers
|
|
50
|
+
});
|
|
51
|
+
return resp.status === 200;
|
|
52
|
+
} catch (e) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
41
57
|
function instantQuery(params, queryOptions) {
|
|
42
58
|
return fetchWithPost('/api/v1/query', params, queryOptions);
|
|
43
59
|
}
|
|
@@ -39,7 +39,7 @@ const DEFAULT_PROM = {
|
|
|
39
39
|
kind: PROM_DATASOURCE_KIND
|
|
40
40
|
};
|
|
41
41
|
function isDefaultPromSelector(selector) {
|
|
42
|
-
return selector.name === undefined
|
|
42
|
+
return selector.name === undefined;
|
|
43
43
|
}
|
|
44
44
|
function isPrometheusDatasourceSelector(selector) {
|
|
45
45
|
return selector.kind === PROM_DATASOURCE_KIND;
|
|
@@ -25,6 +25,7 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
25
25
|
const _material = require("@mui/material");
|
|
26
26
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
27
27
|
const _immer = require("immer");
|
|
28
|
+
const _reacthookform = require("react-hook-form");
|
|
28
29
|
const _Minus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Minus"));
|
|
29
30
|
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
30
31
|
const _types = require("./types");
|
|
@@ -73,7 +74,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
73
74
|
return newObj;
|
|
74
75
|
}
|
|
75
76
|
function PrometheusDatasourceEditor(props) {
|
|
76
|
-
var _value_proxy, _value_proxy1, _value_proxy2
|
|
77
|
+
var _value_proxy, _value_proxy1, _value_proxy2;
|
|
77
78
|
const { value , onChange , isReadonly } = props;
|
|
78
79
|
const strDirect = 'Direct access';
|
|
79
80
|
const strProxy = 'Proxy';
|
|
@@ -97,33 +98,17 @@ function PrometheusDatasourceEditor(props) {
|
|
|
97
98
|
const tabs = [
|
|
98
99
|
{
|
|
99
100
|
label: strDirect,
|
|
100
|
-
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
readOnly: isReadonly
|
|
107
|
-
},
|
|
108
|
-
InputLabelProps: {
|
|
109
|
-
shrink: isReadonly ? true : undefined
|
|
110
|
-
},
|
|
111
|
-
onChange: (e)=>{
|
|
112
|
-
onChange((0, _immer.produce)(value, (draft)=>{
|
|
113
|
-
draft.directUrl = e.target.value;
|
|
114
|
-
}));
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
label: strProxy,
|
|
121
|
-
content: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
122
|
-
children: [
|
|
123
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
101
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
102
|
+
name: "URL",
|
|
103
|
+
render: ({ field , fieldState })=>{
|
|
104
|
+
var _fieldState_error;
|
|
105
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
106
|
+
...field,
|
|
124
107
|
fullWidth: true,
|
|
125
108
|
label: "URL",
|
|
126
|
-
value:
|
|
109
|
+
value: value.directUrl || '',
|
|
110
|
+
error: !!fieldState.error,
|
|
111
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
127
112
|
InputProps: {
|
|
128
113
|
readOnly: isReadonly
|
|
129
114
|
},
|
|
@@ -131,14 +116,48 @@ function PrometheusDatasourceEditor(props) {
|
|
|
131
116
|
shrink: isReadonly ? true : undefined
|
|
132
117
|
},
|
|
133
118
|
onChange: (e)=>{
|
|
119
|
+
field.onChange(e);
|
|
134
120
|
onChange((0, _immer.produce)(value, (draft)=>{
|
|
135
|
-
|
|
136
|
-
draft.proxy.spec.url = e.target.value;
|
|
137
|
-
}
|
|
121
|
+
draft.directUrl = e.target.value;
|
|
138
122
|
}));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: strProxy,
|
|
130
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
131
|
+
children: [
|
|
132
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
133
|
+
name: "URL",
|
|
134
|
+
render: ({ field , fieldState })=>{
|
|
135
|
+
var _value_proxy, _fieldState_error;
|
|
136
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
137
|
+
...field,
|
|
138
|
+
fullWidth: true,
|
|
139
|
+
label: "URL",
|
|
140
|
+
value: ((_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.url) || '',
|
|
141
|
+
error: !!fieldState.error,
|
|
142
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
143
|
+
InputProps: {
|
|
144
|
+
readOnly: isReadonly
|
|
145
|
+
},
|
|
146
|
+
InputLabelProps: {
|
|
147
|
+
shrink: isReadonly ? true : undefined
|
|
148
|
+
},
|
|
149
|
+
onChange: (e)=>{
|
|
150
|
+
field.onChange(e);
|
|
151
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
152
|
+
if (draft.proxy !== undefined) {
|
|
153
|
+
draft.proxy.spec.url = e.target.value;
|
|
154
|
+
}
|
|
155
|
+
}));
|
|
156
|
+
},
|
|
157
|
+
sx: {
|
|
158
|
+
mb: 2
|
|
159
|
+
}
|
|
160
|
+
});
|
|
142
161
|
}
|
|
143
162
|
}),
|
|
144
163
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
@@ -151,115 +170,142 @@ function PrometheusDatasourceEditor(props) {
|
|
|
151
170
|
spacing: 2,
|
|
152
171
|
mb: 2,
|
|
153
172
|
children: [
|
|
154
|
-
((
|
|
173
|
+
((_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)=>{
|
|
155
174
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
156
175
|
children: [
|
|
157
176
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
158
177
|
item: true,
|
|
159
178
|
xs: 8,
|
|
160
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
180
|
+
name: `Endpoint pattern ${i}`,
|
|
181
|
+
render: ({ field , fieldState })=>{
|
|
182
|
+
var _fieldState_error;
|
|
183
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
184
|
+
...field,
|
|
185
|
+
fullWidth: true,
|
|
186
|
+
label: "Endpoint pattern",
|
|
187
|
+
value: endpointPattern,
|
|
188
|
+
error: !!fieldState.error,
|
|
189
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
190
|
+
InputProps: {
|
|
191
|
+
readOnly: isReadonly
|
|
192
|
+
},
|
|
193
|
+
InputLabelProps: {
|
|
194
|
+
shrink: isReadonly ? true : undefined
|
|
195
|
+
},
|
|
196
|
+
onChange: (e)=>{
|
|
197
|
+
field.onChange(e);
|
|
198
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
199
|
+
if (draft.proxy !== undefined) {
|
|
200
|
+
var _draft_proxy_spec_allowedEndpoints;
|
|
201
|
+
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)=>{
|
|
202
|
+
if (i === itemIndex) {
|
|
203
|
+
return {
|
|
204
|
+
endpointPattern: e.target.value,
|
|
205
|
+
method: item.method
|
|
206
|
+
};
|
|
207
|
+
} else {
|
|
208
|
+
return item;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
182
211
|
}
|
|
183
|
-
});
|
|
212
|
+
}));
|
|
184
213
|
}
|
|
185
|
-
})
|
|
214
|
+
});
|
|
186
215
|
}
|
|
187
216
|
})
|
|
188
217
|
}),
|
|
189
218
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
190
219
|
item: true,
|
|
191
220
|
xs: 3,
|
|
192
|
-
children: /*#__PURE__*/ (0, _jsxruntime.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
221
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
222
|
+
name: `Method ${i}`,
|
|
223
|
+
render: ({ field , fieldState })=>{
|
|
224
|
+
var _fieldState_error;
|
|
225
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
226
|
+
...field,
|
|
227
|
+
select: true,
|
|
228
|
+
fullWidth: true,
|
|
229
|
+
label: "Method",
|
|
230
|
+
value: method,
|
|
231
|
+
error: !!fieldState.error,
|
|
232
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
233
|
+
InputProps: {
|
|
234
|
+
readOnly: isReadonly
|
|
235
|
+
},
|
|
236
|
+
InputLabelProps: {
|
|
237
|
+
shrink: isReadonly ? true : undefined
|
|
238
|
+
},
|
|
239
|
+
onChange: (e)=>{
|
|
240
|
+
field.onChange(e);
|
|
241
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
242
|
+
if (draft.proxy !== undefined) {
|
|
243
|
+
var _draft_proxy_spec_allowedEndpoints;
|
|
244
|
+
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)=>{
|
|
245
|
+
if (i === itemIndex) {
|
|
246
|
+
return {
|
|
247
|
+
endpointPattern: item.endpointPattern,
|
|
248
|
+
method: e.target.value
|
|
249
|
+
};
|
|
250
|
+
} else {
|
|
251
|
+
return item;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
215
254
|
}
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
})
|
|
241
|
-
|
|
255
|
+
}));
|
|
256
|
+
},
|
|
257
|
+
children: [
|
|
258
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
259
|
+
value: "GET",
|
|
260
|
+
children: "GET"
|
|
261
|
+
}),
|
|
262
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
263
|
+
value: "POST",
|
|
264
|
+
children: "POST"
|
|
265
|
+
}),
|
|
266
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
267
|
+
value: "PUT",
|
|
268
|
+
children: "PUT"
|
|
269
|
+
}),
|
|
270
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
271
|
+
value: "PATCH",
|
|
272
|
+
children: "PATCH"
|
|
273
|
+
}),
|
|
274
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
275
|
+
value: "DELETE",
|
|
276
|
+
children: "DELETE"
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
});
|
|
280
|
+
}
|
|
242
281
|
})
|
|
243
282
|
}),
|
|
244
283
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
245
284
|
item: true,
|
|
246
285
|
xs: 1,
|
|
247
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
286
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
287
|
+
name: `Remove Endpoint ${i}`,
|
|
288
|
+
render: ({ field })=>{
|
|
289
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
290
|
+
...field,
|
|
291
|
+
disabled: isReadonly,
|
|
292
|
+
// Remove the given allowed endpoint from the list
|
|
293
|
+
onClick: (e)=>{
|
|
294
|
+
field.onChange(e);
|
|
295
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
296
|
+
if (draft.proxy !== undefined) {
|
|
297
|
+
var _draft_proxy_spec_allowedEndpoints;
|
|
298
|
+
draft.proxy.spec.allowedEndpoints = [
|
|
299
|
+
...((_draft_proxy_spec_allowedEndpoints = draft.proxy.spec.allowedEndpoints) === null || _draft_proxy_spec_allowedEndpoints === void 0 ? void 0 : _draft_proxy_spec_allowedEndpoints.filter((item, itemIndex)=>{
|
|
300
|
+
return itemIndex !== i;
|
|
301
|
+
})) || []
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
}));
|
|
305
|
+
},
|
|
306
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Minus.default, {})
|
|
307
|
+
});
|
|
308
|
+
}
|
|
263
309
|
})
|
|
264
310
|
})
|
|
265
311
|
]
|
|
@@ -311,72 +357,102 @@ function PrometheusDatasourceEditor(props) {
|
|
|
311
357
|
spacing: 2,
|
|
312
358
|
mb: 2,
|
|
313
359
|
children: [
|
|
314
|
-
((
|
|
315
|
-
var _value_proxy_spec_headers, _value_proxy;
|
|
360
|
+
((_value_proxy2 = value.proxy) === null || _value_proxy2 === void 0 ? void 0 : _value_proxy2.spec.headers) && Object.keys(value.proxy.spec.headers).map((headerName, i)=>{
|
|
316
361
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
|
|
317
362
|
children: [
|
|
318
363
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
319
364
|
item: true,
|
|
320
365
|
xs: 4,
|
|
321
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
366
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
367
|
+
name: `Header name ${i}`,
|
|
368
|
+
render: ({ field , fieldState })=>{
|
|
369
|
+
var _fieldState_error;
|
|
370
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
371
|
+
...field,
|
|
372
|
+
fullWidth: true,
|
|
373
|
+
label: "Header name",
|
|
374
|
+
value: headerName,
|
|
375
|
+
error: !!fieldState.error,
|
|
376
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
377
|
+
InputProps: {
|
|
378
|
+
readOnly: isReadonly
|
|
379
|
+
},
|
|
380
|
+
InputLabelProps: {
|
|
381
|
+
shrink: isReadonly ? true : undefined
|
|
382
|
+
},
|
|
383
|
+
onChange: (e)=>{
|
|
384
|
+
field.onChange(e);
|
|
385
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
386
|
+
if (draft.proxy !== undefined) {
|
|
387
|
+
draft.proxy.spec.headers = buildNewHeaders(draft.proxy.spec.headers, headerName, e.target.value);
|
|
388
|
+
}
|
|
389
|
+
}));
|
|
334
390
|
}
|
|
335
|
-
})
|
|
391
|
+
});
|
|
392
|
+
}
|
|
336
393
|
})
|
|
337
394
|
}),
|
|
338
395
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
339
396
|
item: true,
|
|
340
397
|
xs: 7,
|
|
341
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
398
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
399
|
+
name: `Header value ${i}`,
|
|
400
|
+
render: ({ field , fieldState })=>{
|
|
401
|
+
var _value_proxy_spec_headers, _value_proxy, _fieldState_error;
|
|
402
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
403
|
+
...field,
|
|
404
|
+
fullWidth: true,
|
|
405
|
+
label: "Header value",
|
|
406
|
+
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],
|
|
407
|
+
error: !!fieldState.error,
|
|
408
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
409
|
+
InputProps: {
|
|
410
|
+
readOnly: isReadonly
|
|
411
|
+
},
|
|
412
|
+
InputLabelProps: {
|
|
413
|
+
shrink: isReadonly ? true : undefined
|
|
414
|
+
},
|
|
415
|
+
onChange: (e)=>{
|
|
416
|
+
field.onChange(e);
|
|
417
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
418
|
+
if (draft.proxy !== undefined) {
|
|
419
|
+
draft.proxy.spec.headers = {
|
|
420
|
+
...draft.proxy.spec.headers,
|
|
421
|
+
[headerName]: e.target.value
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
}));
|
|
357
425
|
}
|
|
358
|
-
})
|
|
426
|
+
});
|
|
427
|
+
}
|
|
359
428
|
})
|
|
360
429
|
}),
|
|
361
430
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
|
|
362
431
|
item: true,
|
|
363
432
|
xs: 1,
|
|
364
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
433
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
434
|
+
name: `Remove Header ${i}`,
|
|
435
|
+
render: ({ field })=>{
|
|
436
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
437
|
+
...field,
|
|
438
|
+
disabled: isReadonly,
|
|
439
|
+
// Remove the given header from the list
|
|
440
|
+
onClick: (e)=>{
|
|
441
|
+
var _value_proxy;
|
|
442
|
+
field.onChange(e);
|
|
443
|
+
const newHeaders = {
|
|
444
|
+
...(_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.headers
|
|
445
|
+
};
|
|
446
|
+
delete newHeaders[headerName];
|
|
447
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
448
|
+
if (draft.proxy !== undefined) {
|
|
449
|
+
draft.proxy.spec.headers = newHeaders;
|
|
450
|
+
}
|
|
451
|
+
}));
|
|
452
|
+
},
|
|
453
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Minus.default, {})
|
|
454
|
+
});
|
|
455
|
+
}
|
|
380
456
|
})
|
|
381
457
|
})
|
|
382
458
|
]
|
|
@@ -405,22 +481,32 @@ function PrometheusDatasourceEditor(props) {
|
|
|
405
481
|
})
|
|
406
482
|
]
|
|
407
483
|
}),
|
|
408
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
484
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
485
|
+
name: "Secret",
|
|
486
|
+
render: ({ field , fieldState })=>{
|
|
487
|
+
var _value_proxy, _fieldState_error;
|
|
488
|
+
/*#__PURE__*/ return (0, _jsxruntime.jsx)(_material.TextField, {
|
|
489
|
+
...field,
|
|
490
|
+
fullWidth: true,
|
|
491
|
+
label: "Secret",
|
|
492
|
+
value: ((_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.secret) || '',
|
|
493
|
+
error: !!fieldState.error,
|
|
494
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
495
|
+
InputProps: {
|
|
496
|
+
readOnly: isReadonly
|
|
497
|
+
},
|
|
498
|
+
InputLabelProps: {
|
|
499
|
+
shrink: isReadonly ? true : undefined
|
|
500
|
+
},
|
|
501
|
+
onChange: (e)=>{
|
|
502
|
+
field.onChange(e);
|
|
503
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
504
|
+
if (draft.proxy !== undefined) {
|
|
505
|
+
draft.proxy.spec.secret = e.target.value;
|
|
506
|
+
}
|
|
507
|
+
}));
|
|
422
508
|
}
|
|
423
|
-
})
|
|
509
|
+
});
|
|
424
510
|
}
|
|
425
511
|
})
|
|
426
512
|
]
|
|
@@ -38,6 +38,10 @@ const _PrometheusDatasourceEditor = require("./PrometheusDatasourceEditor");
|
|
|
38
38
|
options: {
|
|
39
39
|
datasourceUrl
|
|
40
40
|
},
|
|
41
|
+
healthCheck: (0, _model.healthCheck)({
|
|
42
|
+
datasourceUrl,
|
|
43
|
+
headers: specHeaders
|
|
44
|
+
}),
|
|
41
45
|
instantQuery: (params, headers)=>(0, _model.instantQuery)(params, {
|
|
42
46
|
datasourceUrl,
|
|
43
47
|
headers: headers !== null && headers !== void 0 ? headers : specHeaders
|