@perses-dev/prometheus-plugin 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59
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/PromQL.js +10 -8
- package/dist/cjs/components/index.js +10 -8
- package/dist/cjs/index.js +33 -19
- package/dist/cjs/model/index.js +14 -13
- package/dist/cjs/model/parse-sample-values.js +6 -2
- package/dist/cjs/model/prometheus-client.js +43 -8
- package/dist/cjs/model/prometheus-selectors.js +12 -4
- package/dist/cjs/model/time.js +15 -9
- package/dist/cjs/plugins/MatcherEditor.js +14 -12
- package/dist/cjs/plugins/PrometheusDatasourceEditor.js +610 -0
- package/dist/cjs/plugins/prometheus-datasource.js +59 -8
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +10 -8
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +49 -24
- package/dist/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +44 -24
- package/dist/cjs/plugins/prometheus-time-series-query/index.js +10 -8
- package/dist/cjs/plugins/prometheus-time-series-query/query-editor-model.js +44 -11
- package/dist/cjs/plugins/prometheus-variables.js +69 -63
- package/dist/cjs/plugins/types.js +7 -0
- package/dist/cjs/plugins/variable.js +9 -7
- package/dist/cjs/utils/index.js +10 -8
- package/dist/cjs/utils/utils.js +13 -7
- package/dist/components/PromQL.d.ts +2 -3
- package/dist/components/PromQL.d.ts.map +1 -1
- package/dist/components/PromQL.js +1 -1
- package/dist/components/PromQL.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/api-types.d.ts +11 -11
- package/dist/model/api-types.d.ts.map +1 -1
- package/dist/model/api-types.js.map +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +0 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/parse-sample-values.d.ts +1 -1
- package/dist/model/parse-sample-values.d.ts.map +1 -1
- package/dist/model/parse-sample-values.js.map +1 -1
- 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 +27 -3
- package/dist/model/prometheus-client.js.map +1 -1
- package/dist/model/prometheus-selectors.js.map +1 -1
- package/dist/model/time.js +2 -2
- package/dist/model/time.js.map +1 -1
- package/dist/plugins/MatcherEditor.d.ts +2 -3
- package/dist/plugins/MatcherEditor.d.ts.map +1 -1
- package/dist/plugins/MatcherEditor.js +1 -1
- package/dist/plugins/MatcherEditor.js.map +1 -1
- package/dist/plugins/{PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts → PrometheusDatasourceEditor.d.ts} +1 -2
- package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +1 -0
- package/dist/plugins/PrometheusDatasourceEditor.js +556 -0
- package/dist/plugins/PrometheusDatasourceEditor.js.map +1 -0
- package/dist/plugins/prometheus-datasource.d.ts +2 -7
- package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
- package/dist/plugins/prometheus-datasource.js +55 -6
- package/dist/plugins/prometheus-datasource.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts +1 -2
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +41 -18
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js +37 -19
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/index.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/query-editor-model.d.ts +11 -2
- package/dist/plugins/prometheus-time-series-query/query-editor-model.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/query-editor-model.js +38 -10
- package/dist/plugins/prometheus-time-series-query/query-editor-model.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.d.ts +4 -4
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.js +3 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.js.map +1 -1
- package/dist/plugins/prometheus-variables.d.ts.map +1 -1
- package/dist/plugins/prometheus-variables.js +37 -37
- package/dist/plugins/prometheus-variables.js.map +1 -1
- package/dist/plugins/types.d.ts +12 -5
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +1 -1
- package/dist/plugins/types.js.map +1 -1
- package/dist/plugins/variable.d.ts +2 -2
- package/dist/plugins/variable.d.ts.map +1 -1
- package/dist/plugins/variable.js +2 -2
- package/dist/plugins/variable.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/utils.d.ts +2 -2
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +4 -4
- package/dist/utils/utils.js.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/model/templating.js +0 -26
- package/dist/cjs/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js +0 -392
- package/dist/cjs/plugins/PrometheusDatasourceEditor/index.js +0 -29
- package/dist/cjs/plugins/PrometheusDatasourceEditor/types.js +0 -16
- package/dist/model/templating.d.ts +0 -6
- package/dist/model/templating.d.ts.map +0 -1
- package/dist/model/templating.js +0 -20
- package/dist/model/templating.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js +0 -342
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.d.ts +0 -3
- package/dist/plugins/PrometheusDatasourceEditor/index.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.js +0 -16
- package/dist/plugins/PrometheusDatasourceEditor/index.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts +0 -20
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.js +0 -15
- package/dist/plugins/PrometheusDatasourceEditor/types.js.map +0 -1
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { OptionsEditorRadios } from '@perses-dev/plugin-system';
|
|
15
|
+
import { Grid, IconButton, MenuItem, TextField, Typography } from '@mui/material';
|
|
16
|
+
import React, { Fragment, useState } from 'react';
|
|
17
|
+
import { produce } from 'immer';
|
|
18
|
+
import { Controller } from 'react-hook-form';
|
|
19
|
+
import MinusIcon from 'mdi-material-ui/Minus';
|
|
20
|
+
import PlusIcon from 'mdi-material-ui/Plus';
|
|
21
|
+
import { DEFAULT_SCRAPE_INTERVAL } from './types';
|
|
22
|
+
export function PrometheusDatasourceEditor(props) {
|
|
23
|
+
var _value_proxy, _value_proxy1, _value_proxy2;
|
|
24
|
+
const { value, onChange, isReadonly } = props;
|
|
25
|
+
const strDirect = 'Direct access';
|
|
26
|
+
const strProxy = 'Proxy';
|
|
27
|
+
// utilitary function used for headers when renaming a property
|
|
28
|
+
// -> TODO it would be cleaner to manipulate headers as an intermediary list instead, to avoid doing this.
|
|
29
|
+
const buildNewHeaders = (oldHeaders, oldName, newName)=>{
|
|
30
|
+
if (oldHeaders === undefined) return oldHeaders;
|
|
31
|
+
const keys = Object.keys(oldHeaders);
|
|
32
|
+
const newHeaders = keys.reduce((acc, val)=>{
|
|
33
|
+
if (val === oldName) {
|
|
34
|
+
acc[newName] = oldHeaders[oldName] || '';
|
|
35
|
+
} else {
|
|
36
|
+
acc[val] = oldHeaders[val] || '';
|
|
37
|
+
}
|
|
38
|
+
return acc;
|
|
39
|
+
}, {});
|
|
40
|
+
return {
|
|
41
|
+
...newHeaders
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const tabs = [
|
|
45
|
+
{
|
|
46
|
+
label: strDirect,
|
|
47
|
+
content: /*#__PURE__*/ _jsx(Controller, {
|
|
48
|
+
name: "URL",
|
|
49
|
+
render: ({ field, fieldState })=>{
|
|
50
|
+
var _fieldState_error;
|
|
51
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
52
|
+
...field,
|
|
53
|
+
fullWidth: true,
|
|
54
|
+
label: "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,
|
|
58
|
+
InputProps: {
|
|
59
|
+
readOnly: isReadonly
|
|
60
|
+
},
|
|
61
|
+
InputLabelProps: {
|
|
62
|
+
shrink: isReadonly ? true : undefined
|
|
63
|
+
},
|
|
64
|
+
onChange: (e)=>{
|
|
65
|
+
field.onChange(e);
|
|
66
|
+
onChange(produce(value, (draft)=>{
|
|
67
|
+
draft.directUrl = e.target.value;
|
|
68
|
+
}));
|
|
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
|
+
return /*#__PURE__*/ _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
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
110
|
+
variant: "h4",
|
|
111
|
+
mb: 2,
|
|
112
|
+
children: "Allowed endpoints"
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ _jsxs(Grid, {
|
|
115
|
+
container: true,
|
|
116
|
+
spacing: 2,
|
|
117
|
+
mb: 2,
|
|
118
|
+
children: [
|
|
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)=>{
|
|
120
|
+
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
121
|
+
children: [
|
|
122
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
123
|
+
item: true,
|
|
124
|
+
xs: 8,
|
|
125
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
126
|
+
name: `Endpoint pattern ${i}`,
|
|
127
|
+
render: ({ field, fieldState })=>{
|
|
128
|
+
var _fieldState_error;
|
|
129
|
+
return /*#__PURE__*/ _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
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
}),
|
|
164
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
165
|
+
item: true,
|
|
166
|
+
xs: 3,
|
|
167
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
168
|
+
name: `Method ${i}`,
|
|
169
|
+
render: ({ field, fieldState })=>{
|
|
170
|
+
var _fieldState_error;
|
|
171
|
+
return /*#__PURE__*/ _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
|
+
});
|
|
200
|
+
}
|
|
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
|
+
}
|
|
227
|
+
})
|
|
228
|
+
}),
|
|
229
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
230
|
+
item: true,
|
|
231
|
+
xs: 1,
|
|
232
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
233
|
+
name: `Remove Endpoint ${i}`,
|
|
234
|
+
render: ({ field })=>/*#__PURE__*/ _jsx(IconButton, {
|
|
235
|
+
...field,
|
|
236
|
+
disabled: isReadonly,
|
|
237
|
+
// Remove the given allowed endpoint from the list
|
|
238
|
+
onClick: (e)=>{
|
|
239
|
+
field.onChange(e);
|
|
240
|
+
onChange(produce(value, (draft)=>{
|
|
241
|
+
if (draft.proxy !== undefined) {
|
|
242
|
+
var _draft_proxy_spec_allowedEndpoints;
|
|
243
|
+
draft.proxy.spec.allowedEndpoints = [
|
|
244
|
+
...((_draft_proxy_spec_allowedEndpoints = draft.proxy.spec.allowedEndpoints) === null || _draft_proxy_spec_allowedEndpoints === void 0 ? void 0 : _draft_proxy_spec_allowedEndpoints.filter((item, itemIndex)=>{
|
|
245
|
+
return itemIndex !== i;
|
|
246
|
+
})) || []
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
250
|
+
},
|
|
251
|
+
children: /*#__PURE__*/ _jsx(MinusIcon, {})
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
})
|
|
255
|
+
]
|
|
256
|
+
}, i);
|
|
257
|
+
}) : /*#__PURE__*/ _jsx(Grid, {
|
|
258
|
+
item: true,
|
|
259
|
+
xs: 4,
|
|
260
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
261
|
+
sx: {
|
|
262
|
+
fontStyle: 'italic'
|
|
263
|
+
},
|
|
264
|
+
children: "None"
|
|
265
|
+
})
|
|
266
|
+
}),
|
|
267
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
268
|
+
item: true,
|
|
269
|
+
xs: 12,
|
|
270
|
+
sx: {
|
|
271
|
+
paddingTop: '0px !important',
|
|
272
|
+
paddingLeft: '5px !important'
|
|
273
|
+
},
|
|
274
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
275
|
+
disabled: isReadonly,
|
|
276
|
+
// Add a new (empty) allowed endpoint to the list
|
|
277
|
+
onClick: ()=>onChange(produce(value, (draft)=>{
|
|
278
|
+
if (draft.proxy !== undefined) {
|
|
279
|
+
var _draft_proxy_spec_allowedEndpoints;
|
|
280
|
+
draft.proxy.spec.allowedEndpoints = [
|
|
281
|
+
...(_draft_proxy_spec_allowedEndpoints = draft.proxy.spec.allowedEndpoints) !== null && _draft_proxy_spec_allowedEndpoints !== void 0 ? _draft_proxy_spec_allowedEndpoints : [],
|
|
282
|
+
{
|
|
283
|
+
endpointPattern: '',
|
|
284
|
+
method: ''
|
|
285
|
+
}
|
|
286
|
+
];
|
|
287
|
+
}
|
|
288
|
+
})),
|
|
289
|
+
children: /*#__PURE__*/ _jsx(PlusIcon, {})
|
|
290
|
+
})
|
|
291
|
+
})
|
|
292
|
+
]
|
|
293
|
+
}),
|
|
294
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
295
|
+
variant: "h4",
|
|
296
|
+
mb: 2,
|
|
297
|
+
children: "Request Headers"
|
|
298
|
+
}),
|
|
299
|
+
/*#__PURE__*/ _jsxs(Grid, {
|
|
300
|
+
container: true,
|
|
301
|
+
spacing: 2,
|
|
302
|
+
mb: 2,
|
|
303
|
+
children: [
|
|
304
|
+
((_value_proxy2 = value.proxy) === null || _value_proxy2 === void 0 ? void 0 : _value_proxy2.spec.headers) && Object.keys(value.proxy.spec.headers).map((headerName, i)=>{
|
|
305
|
+
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
306
|
+
children: [
|
|
307
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
308
|
+
item: true,
|
|
309
|
+
xs: 4,
|
|
310
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
311
|
+
name: `Header name ${i}`,
|
|
312
|
+
render: ({ field, fieldState })=>{
|
|
313
|
+
var _fieldState_error;
|
|
314
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
315
|
+
...field,
|
|
316
|
+
fullWidth: true,
|
|
317
|
+
label: "Header name",
|
|
318
|
+
value: headerName,
|
|
319
|
+
error: !!fieldState.error,
|
|
320
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
321
|
+
InputProps: {
|
|
322
|
+
readOnly: isReadonly
|
|
323
|
+
},
|
|
324
|
+
InputLabelProps: {
|
|
325
|
+
shrink: isReadonly ? true : undefined
|
|
326
|
+
},
|
|
327
|
+
onChange: (e)=>{
|
|
328
|
+
field.onChange(e);
|
|
329
|
+
onChange(produce(value, (draft)=>{
|
|
330
|
+
if (draft.proxy !== undefined) {
|
|
331
|
+
draft.proxy.spec.headers = buildNewHeaders(draft.proxy.spec.headers, headerName, e.target.value);
|
|
332
|
+
}
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
})
|
|
338
|
+
}),
|
|
339
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
340
|
+
item: true,
|
|
341
|
+
xs: 7,
|
|
342
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
343
|
+
name: `Header value ${i}`,
|
|
344
|
+
render: ({ field, fieldState })=>{
|
|
345
|
+
var _value_proxy_spec_headers, _value_proxy, _fieldState_error;
|
|
346
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
347
|
+
...field,
|
|
348
|
+
fullWidth: true,
|
|
349
|
+
label: "Header value",
|
|
350
|
+
value: (_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : (_value_proxy_spec_headers = _value_proxy.spec.headers) === null || _value_proxy_spec_headers === void 0 ? void 0 : _value_proxy_spec_headers[headerName],
|
|
351
|
+
error: !!fieldState.error,
|
|
352
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
353
|
+
InputProps: {
|
|
354
|
+
readOnly: isReadonly
|
|
355
|
+
},
|
|
356
|
+
InputLabelProps: {
|
|
357
|
+
shrink: isReadonly ? true : undefined
|
|
358
|
+
},
|
|
359
|
+
onChange: (e)=>{
|
|
360
|
+
field.onChange(e);
|
|
361
|
+
onChange(produce(value, (draft)=>{
|
|
362
|
+
if (draft.proxy !== undefined) {
|
|
363
|
+
draft.proxy.spec.headers = {
|
|
364
|
+
...draft.proxy.spec.headers,
|
|
365
|
+
[headerName]: e.target.value
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
}));
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
})
|
|
373
|
+
}),
|
|
374
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
375
|
+
item: true,
|
|
376
|
+
xs: 1,
|
|
377
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
378
|
+
name: `Remove Header ${i}`,
|
|
379
|
+
render: ({ field })=>/*#__PURE__*/ _jsx(IconButton, {
|
|
380
|
+
...field,
|
|
381
|
+
disabled: isReadonly,
|
|
382
|
+
// Remove the given header from the list
|
|
383
|
+
onClick: (e)=>{
|
|
384
|
+
var _value_proxy;
|
|
385
|
+
field.onChange(e);
|
|
386
|
+
const newHeaders = {
|
|
387
|
+
...(_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.headers
|
|
388
|
+
};
|
|
389
|
+
delete newHeaders[headerName];
|
|
390
|
+
onChange(produce(value, (draft)=>{
|
|
391
|
+
if (draft.proxy !== undefined) {
|
|
392
|
+
draft.proxy.spec.headers = newHeaders;
|
|
393
|
+
}
|
|
394
|
+
}));
|
|
395
|
+
},
|
|
396
|
+
children: /*#__PURE__*/ _jsx(MinusIcon, {})
|
|
397
|
+
})
|
|
398
|
+
})
|
|
399
|
+
})
|
|
400
|
+
]
|
|
401
|
+
}, i);
|
|
402
|
+
}),
|
|
403
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
404
|
+
item: true,
|
|
405
|
+
xs: 12,
|
|
406
|
+
sx: {
|
|
407
|
+
paddingTop: '0px !important',
|
|
408
|
+
paddingLeft: '5px !important'
|
|
409
|
+
},
|
|
410
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
411
|
+
disabled: isReadonly,
|
|
412
|
+
// Add a new (empty) header to the list
|
|
413
|
+
onClick: ()=>onChange(produce(value, (draft)=>{
|
|
414
|
+
if (draft.proxy !== undefined) {
|
|
415
|
+
draft.proxy.spec.headers = {
|
|
416
|
+
...draft.proxy.spec.headers,
|
|
417
|
+
'': ''
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
})),
|
|
421
|
+
children: /*#__PURE__*/ _jsx(PlusIcon, {})
|
|
422
|
+
})
|
|
423
|
+
})
|
|
424
|
+
]
|
|
425
|
+
}),
|
|
426
|
+
/*#__PURE__*/ _jsx(Controller, {
|
|
427
|
+
name: "Secret",
|
|
428
|
+
render: ({ field, fieldState })=>{
|
|
429
|
+
var _value_proxy, _fieldState_error;
|
|
430
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
431
|
+
...field,
|
|
432
|
+
fullWidth: true,
|
|
433
|
+
label: "Secret",
|
|
434
|
+
value: ((_value_proxy = value.proxy) === null || _value_proxy === void 0 ? void 0 : _value_proxy.spec.secret) || '',
|
|
435
|
+
error: !!fieldState.error,
|
|
436
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
437
|
+
InputProps: {
|
|
438
|
+
readOnly: isReadonly
|
|
439
|
+
},
|
|
440
|
+
InputLabelProps: {
|
|
441
|
+
shrink: isReadonly ? true : undefined
|
|
442
|
+
},
|
|
443
|
+
onChange: (e)=>{
|
|
444
|
+
field.onChange(e);
|
|
445
|
+
onChange(produce(value, (draft)=>{
|
|
446
|
+
if (draft.proxy !== undefined) {
|
|
447
|
+
draft.proxy.spec.secret = e.target.value;
|
|
448
|
+
}
|
|
449
|
+
}));
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
})
|
|
454
|
+
]
|
|
455
|
+
})
|
|
456
|
+
}
|
|
457
|
+
];
|
|
458
|
+
// Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or
|
|
459
|
+
// bug in case the tabs get eventually swapped in the future.
|
|
460
|
+
const directModeId = tabs.findIndex((tab)=>tab.label == strDirect);
|
|
461
|
+
const proxyModeId = tabs.findIndex((tab)=>tab.label == strProxy);
|
|
462
|
+
// In "update datasource" case, set defaultTab to the mode that this datasource is currently relying on.
|
|
463
|
+
// Otherwise (create datasource), set defaultTab to Direct access.
|
|
464
|
+
const defaultTab = value.proxy ? proxyModeId : directModeId;
|
|
465
|
+
const initialSpecDirect = {
|
|
466
|
+
directUrl: ''
|
|
467
|
+
};
|
|
468
|
+
const initialSpecProxy = {
|
|
469
|
+
proxy: {
|
|
470
|
+
kind: 'HTTPProxy',
|
|
471
|
+
spec: {
|
|
472
|
+
allowedEndpoints: [
|
|
473
|
+
// list of standard endpoints suggested by default
|
|
474
|
+
{
|
|
475
|
+
endpointPattern: '/api/v1/labels',
|
|
476
|
+
method: 'POST'
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
endpointPattern: '/api/v1/series',
|
|
480
|
+
method: 'POST'
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
endpointPattern: '/api/v1/metadata',
|
|
484
|
+
method: 'GET'
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
endpointPattern: '/api/v1/query',
|
|
488
|
+
method: 'POST'
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
endpointPattern: '/api/v1/query_range',
|
|
492
|
+
method: 'POST'
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
endpointPattern: '/api/v1/label/([a-zA-Z0-9_-]+)/values',
|
|
496
|
+
method: 'GET'
|
|
497
|
+
}
|
|
498
|
+
],
|
|
499
|
+
url: ''
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
// For better user experience, save previous states in mind for both mode.
|
|
504
|
+
// This avoids losing everything when the user changes their mind back.
|
|
505
|
+
const [previousSpecDirect, setPreviousSpecDirect] = useState(initialSpecDirect);
|
|
506
|
+
const [previousSpecProxy, setPreviousSpecProxy] = useState(initialSpecProxy);
|
|
507
|
+
// When changing mode, remove previous mode's config + append default values for the new mode.
|
|
508
|
+
const handleModeChange = (v)=>{
|
|
509
|
+
var _tabs_v, _tabs_v1;
|
|
510
|
+
if (((_tabs_v = tabs[v]) === null || _tabs_v === void 0 ? void 0 : _tabs_v.label) == strDirect) {
|
|
511
|
+
setPreviousSpecProxy(value);
|
|
512
|
+
onChange(previousSpecDirect);
|
|
513
|
+
} else if (((_tabs_v1 = tabs[v]) === null || _tabs_v1 === void 0 ? void 0 : _tabs_v1.label) == strProxy) {
|
|
514
|
+
setPreviousSpecDirect(value);
|
|
515
|
+
onChange(previousSpecProxy);
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
519
|
+
children: [
|
|
520
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
521
|
+
variant: "h4",
|
|
522
|
+
mb: 2,
|
|
523
|
+
children: "General Settings"
|
|
524
|
+
}),
|
|
525
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
526
|
+
fullWidth: true,
|
|
527
|
+
label: "Scrape Interval",
|
|
528
|
+
value: value.scrapeInterval || '',
|
|
529
|
+
placeholder: `Default: ${DEFAULT_SCRAPE_INTERVAL}`,
|
|
530
|
+
InputProps: {
|
|
531
|
+
readOnly: isReadonly
|
|
532
|
+
},
|
|
533
|
+
InputLabelProps: {
|
|
534
|
+
shrink: isReadonly ? true : undefined
|
|
535
|
+
},
|
|
536
|
+
onChange: (e)=>onChange({
|
|
537
|
+
...value,
|
|
538
|
+
scrapeInterval: e.target.value
|
|
539
|
+
})
|
|
540
|
+
}),
|
|
541
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
542
|
+
variant: "h4",
|
|
543
|
+
mt: 2,
|
|
544
|
+
children: "HTTP Settings"
|
|
545
|
+
}),
|
|
546
|
+
/*#__PURE__*/ _jsx(OptionsEditorRadios, {
|
|
547
|
+
isReadonly: isReadonly,
|
|
548
|
+
tabs: tabs,
|
|
549
|
+
defaultTab: defaultTab,
|
|
550
|
+
onModeChange: handleModeChange
|
|
551
|
+
})
|
|
552
|
+
]
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
//# sourceMappingURL=PrometheusDatasourceEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/PrometheusDatasourceEditor.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DurationString, RequestHeaders } from '@perses-dev/core';\nimport { OptionsEditorRadios } from '@perses-dev/plugin-system';\nimport { Grid, IconButton, MenuItem, TextField, Typography } from '@mui/material';\nimport React, { Fragment, useState } from 'react';\nimport { produce } from 'immer';\nimport { Controller } from 'react-hook-form';\nimport MinusIcon from 'mdi-material-ui/Minus';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { DEFAULT_SCRAPE_INTERVAL, PrometheusDatasourceSpec } from './types';\n\nexport interface PrometheusDatasourceEditorProps {\n value: PrometheusDatasourceSpec;\n onChange: (next: PrometheusDatasourceSpec) => void;\n isReadonly?: boolean;\n}\n\nexport function PrometheusDatasourceEditor(props: PrometheusDatasourceEditorProps) {\n const { value, onChange, isReadonly } = props;\n const strDirect = 'Direct access';\n const strProxy = 'Proxy';\n\n // utilitary function used for headers when renaming a property\n // -> TODO it would be cleaner to manipulate headers as an intermediary list instead, to avoid doing this.\n const buildNewHeaders = (oldHeaders: RequestHeaders | undefined, oldName: string, newName: string) => {\n if (oldHeaders === undefined) return oldHeaders;\n const keys = Object.keys(oldHeaders);\n const newHeaders = keys.reduce<Record<string, string>>((acc, val) => {\n if (val === oldName) {\n acc[newName] = oldHeaders[oldName] || '';\n } else {\n acc[val] = oldHeaders[val] || '';\n }\n return acc;\n }, {});\n\n return { ...newHeaders };\n };\n\n const tabs = [\n {\n label: strDirect,\n content: (\n <Controller\n name=\"URL\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"URL\"\n value={value.directUrl || ''}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n draft.directUrl = e.target.value;\n })\n );\n }}\n />\n )}\n />\n ),\n },\n {\n label: strProxy,\n content: (\n <>\n <Controller\n name=\"URL\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"URL\"\n value={value.proxy?.spec.url || ''}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.url = e.target.value;\n }\n })\n );\n }}\n sx={{ mb: 2 }}\n />\n )}\n />\n <Typography variant=\"h4\" mb={2}>\n Allowed endpoints\n </Typography>\n <Grid container spacing={2} mb={2}>\n {value.proxy?.spec.allowedEndpoints && value.proxy?.spec.allowedEndpoints.length != 0 ? (\n value.proxy.spec.allowedEndpoints.map(({ endpointPattern, method }, i) => {\n return (\n <Fragment key={i}>\n <Grid item xs={8}>\n <Controller\n name={`Endpoint pattern ${i}`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Endpoint pattern\"\n value={endpointPattern}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.allowedEndpoints = draft.proxy.spec.allowedEndpoints?.map(\n (item, itemIndex) => {\n if (i === itemIndex) {\n return {\n endpointPattern: e.target.value,\n method: item.method,\n };\n } else {\n return item;\n }\n }\n );\n }\n })\n );\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={3}>\n <Controller\n name={`Method ${i}`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n select\n fullWidth\n label=\"Method\"\n value={method}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.allowedEndpoints = draft.proxy.spec.allowedEndpoints?.map(\n (item, itemIndex) => {\n if (i === itemIndex) {\n return {\n endpointPattern: item.endpointPattern,\n method: e.target.value,\n };\n } else {\n return item;\n }\n }\n );\n }\n })\n );\n }}\n >\n <MenuItem value=\"GET\">GET</MenuItem>\n <MenuItem value=\"POST\">POST</MenuItem>\n <MenuItem value=\"PUT\">PUT</MenuItem>\n <MenuItem value=\"PATCH\">PATCH</MenuItem>\n <MenuItem value=\"DELETE\">DELETE</MenuItem>\n </TextField>\n )}\n />\n </Grid>\n <Grid item xs={1}>\n <Controller\n name={`Remove Endpoint ${i}`}\n render={({ field }) => (\n <IconButton\n {...field}\n disabled={isReadonly}\n // Remove the given allowed endpoint from the list\n onClick={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.allowedEndpoints = [\n ...(draft.proxy.spec.allowedEndpoints?.filter((item, itemIndex) => {\n return itemIndex !== i;\n }) || []),\n ];\n }\n })\n );\n }}\n >\n <MinusIcon />\n </IconButton>\n )}\n />\n </Grid>\n </Fragment>\n );\n })\n ) : (\n <Grid item xs={4}>\n <Typography sx={{ fontStyle: 'italic' }}>None</Typography>\n </Grid>\n )}\n <Grid item xs={12} sx={{ paddingTop: '0px !important', paddingLeft: '5px !important' }}>\n <IconButton\n disabled={isReadonly}\n // Add a new (empty) allowed endpoint to the list\n onClick={() =>\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.allowedEndpoints = [\n ...(draft.proxy.spec.allowedEndpoints ?? []),\n { endpointPattern: '', method: '' },\n ];\n }\n })\n )\n }\n >\n <PlusIcon />\n </IconButton>\n </Grid>\n </Grid>\n <Typography variant=\"h4\" mb={2}>\n Request Headers\n </Typography>\n <Grid container spacing={2} mb={2}>\n {value.proxy?.spec.headers &&\n Object.keys(value.proxy.spec.headers).map((headerName, i) => {\n return (\n <Fragment key={i}>\n <Grid item xs={4}>\n <Controller\n name={`Header name ${i}`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Header name\"\n value={headerName}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.headers = buildNewHeaders(\n draft.proxy.spec.headers,\n headerName,\n e.target.value\n );\n }\n })\n );\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={7}>\n <Controller\n name={`Header value ${i}`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Header value\"\n value={value.proxy?.spec.headers?.[headerName]}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.headers = {\n ...draft.proxy.spec.headers,\n [headerName]: e.target.value,\n };\n }\n })\n );\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={1}>\n <Controller\n name={`Remove Header ${i}`}\n render={({ field }) => (\n <IconButton\n {...field}\n disabled={isReadonly}\n // Remove the given header from the list\n onClick={(e) => {\n field.onChange(e);\n const newHeaders = { ...value.proxy?.spec.headers };\n delete newHeaders[headerName];\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.headers = newHeaders;\n }\n })\n );\n }}\n >\n <MinusIcon />\n </IconButton>\n )}\n />\n </Grid>\n </Fragment>\n );\n })}\n <Grid item xs={12} sx={{ paddingTop: '0px !important', paddingLeft: '5px !important' }}>\n <IconButton\n disabled={isReadonly}\n // Add a new (empty) header to the list\n onClick={() =>\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.headers = { ...draft.proxy.spec.headers, '': '' };\n }\n })\n )\n }\n >\n <PlusIcon />\n </IconButton>\n </Grid>\n </Grid>\n\n <Controller\n name=\"Secret\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Secret\"\n value={value.proxy?.spec.secret || ''}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.secret = e.target.value;\n }\n })\n );\n }}\n />\n )}\n />\n </>\n ),\n },\n ];\n\n // Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or\n // bug in case the tabs get eventually swapped in the future.\n const directModeId = tabs.findIndex((tab) => tab.label == strDirect);\n const proxyModeId = tabs.findIndex((tab) => tab.label == strProxy);\n\n // In \"update datasource\" case, set defaultTab to the mode that this datasource is currently relying on.\n // Otherwise (create datasource), set defaultTab to Direct access.\n const defaultTab = value.proxy ? proxyModeId : directModeId;\n\n const initialSpecDirect: PrometheusDatasourceSpec = {\n directUrl: '',\n };\n\n const initialSpecProxy: PrometheusDatasourceSpec = {\n proxy: {\n kind: 'HTTPProxy',\n spec: {\n allowedEndpoints: [\n // list of standard endpoints suggested by default\n {\n endpointPattern: '/api/v1/labels',\n method: 'POST',\n },\n {\n endpointPattern: '/api/v1/series',\n method: 'POST',\n },\n {\n endpointPattern: '/api/v1/metadata',\n method: 'GET',\n },\n {\n endpointPattern: '/api/v1/query',\n method: 'POST',\n },\n {\n endpointPattern: '/api/v1/query_range',\n method: 'POST',\n },\n {\n endpointPattern: '/api/v1/label/([a-zA-Z0-9_-]+)/values',\n method: 'GET',\n },\n ],\n url: '',\n },\n },\n };\n\n // For better user experience, save previous states in mind for both mode.\n // This avoids losing everything when the user changes their mind back.\n const [previousSpecDirect, setPreviousSpecDirect] = useState(initialSpecDirect);\n const [previousSpecProxy, setPreviousSpecProxy] = useState(initialSpecProxy);\n\n // When changing mode, remove previous mode's config + append default values for the new mode.\n const handleModeChange = (v: number) => {\n if (tabs[v]?.label == strDirect) {\n setPreviousSpecProxy(value);\n onChange(previousSpecDirect);\n } else if (tabs[v]?.label == strProxy) {\n setPreviousSpecDirect(value);\n onChange(previousSpecProxy);\n }\n };\n\n return (\n <>\n <Typography variant=\"h4\" mb={2}>\n General Settings\n </Typography>\n <TextField\n fullWidth\n label=\"Scrape Interval\"\n value={value.scrapeInterval || ''}\n placeholder={`Default: ${DEFAULT_SCRAPE_INTERVAL}`}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => onChange({ ...value, scrapeInterval: e.target.value as DurationString })}\n />\n <Typography variant=\"h4\" mt={2}>\n HTTP Settings\n </Typography>\n <OptionsEditorRadios\n isReadonly={isReadonly}\n tabs={tabs}\n defaultTab={defaultTab}\n onModeChange={handleModeChange}\n />\n </>\n );\n}\n"],"names":["OptionsEditorRadios","Grid","IconButton","MenuItem","TextField","Typography","React","Fragment","useState","produce","Controller","MinusIcon","PlusIcon","DEFAULT_SCRAPE_INTERVAL","PrometheusDatasourceEditor","props","value","onChange","isReadonly","strDirect","strProxy","buildNewHeaders","oldHeaders","oldName","newName","undefined","keys","Object","newHeaders","reduce","acc","val","tabs","label","content","name","render","field","fieldState","fullWidth","directUrl","error","helperText","message","InputProps","readOnly","InputLabelProps","shrink","e","draft","target","proxy","spec","url","sx","mb","variant","container","spacing","allowedEndpoints","length","map","endpointPattern","method","i","item","xs","itemIndex","select","disabled","onClick","filter","fontStyle","paddingTop","paddingLeft","headers","headerName","secret","directModeId","findIndex","tab","proxyModeId","defaultTab","initialSpecDirect","initialSpecProxy","kind","previousSpecDirect","setPreviousSpecDirect","previousSpecProxy","setPreviousSpecProxy","handleModeChange","v","scrapeInterval","placeholder","mt","onModeChange"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,IAAI,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AAClF,OAAOC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,OAAOC,eAAe,wBAAwB;AAC9C,OAAOC,cAAc,uBAAuB;AAC5C,SAASC,uBAAuB,QAAkC,UAAU;AAQ5E,OAAO,SAASC,2BAA2BC,KAAsC;QAyFpEC,cAAsCA,eAwJtCA;IAhPX,MAAM,EAAEA,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGH;IACxC,MAAMI,YAAY;IAClB,MAAMC,WAAW;IAEjB,+DAA+D;IAC/D,0GAA0G;IAC1G,MAAMC,kBAAkB,CAACC,YAAwCC,SAAiBC;QAChF,IAAIF,eAAeG,WAAW,OAAOH;QACrC,MAAMI,OAAOC,OAAOD,IAAI,CAACJ;QACzB,MAAMM,aAAaF,KAAKG,MAAM,CAAyB,CAACC,KAAKC;YAC3D,IAAIA,QAAQR,SAAS;gBACnBO,GAAG,CAACN,QAAQ,GAAGF,UAAU,CAACC,QAAQ,IAAI;YACxC,OAAO;gBACLO,GAAG,CAACC,IAAI,GAAGT,UAAU,CAACS,IAAI,IAA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,IAAIA,EAAAA,UAAAA,IAAI,CAAC2D,EAAE,cAAP3D,8BAAAA,QAASC,KAAK,KAAId,WAAW;YAC/BsE,qBAAqBzE;YACrBC,SAASqE;QACX,OAAO,IAAItD,EAAAA,WAAAA,IAAI,CAAC2D,EAAE,cAAP3D,+BAAAA,SAASC,KAAK,KAAIb,UAAU;YACrCmE,sBAAsBvE;YACtBC,SAASuE;QACX;IACF;IAEA,qBACE;;0BACE,KAACnF;gBAAWmD,SAAQ;gBAAKD,IAAI;0BAAG;;0BAGhC,KAACnD;gBACCmC,SAAS;gBACTN,OAAM;gBACNjB,OAAOA,MAAM4E,cAAc,IAAI;gBAC/BC,aAAa,CAAC,SAAS,EAAEhF,wBAAwB,CAAC;gBAClD+B,YAAY;oBACVC,UAAU3B;gBACZ;gBACA4B,iBAAiB;oBAAEC,QAAQ7B,aAAa,OAAOO;gBAAU;gBACzDR,UAAU,CAAC+B,IAAM/B,SAAS;wBAAE,GAAGD,KAAK;wBAAE4E,gBAAgB5C,EAAEE,MAAM,CAAClC,KAAK;oBAAmB;;0BAEzF,KAACX;gBAAWmD,SAAQ;gBAAKsC,IAAI;0BAAG;;0BAGhC,KAAC9F;gBACCkB,YAAYA;gBACZc,MAAMA;gBACNkD,YAAYA;gBACZa,cAAcL;;;;AAItB"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { RequestHeaders } from '@perses-dev/core';
|
|
2
1
|
import { DatasourcePlugin } from '@perses-dev/plugin-system';
|
|
3
2
|
import { PrometheusClient } from '../model';
|
|
4
|
-
import { PrometheusDatasourceSpec
|
|
5
|
-
export
|
|
6
|
-
direct_url?: string;
|
|
7
|
-
headers?: RequestHeaders;
|
|
8
|
-
}
|
|
9
|
-
export declare const PrometheusDatasource: DatasourcePlugin<PrometheusDatasourceSpecFull, PrometheusClient>;
|
|
3
|
+
import { PrometheusDatasourceSpec } from './types';
|
|
4
|
+
export declare const PrometheusDatasource: DatasourcePlugin<PrometheusDatasourceSpec, PrometheusClient>;
|
|
10
5
|
//# sourceMappingURL=prometheus-datasource.d.ts.map
|