@perses-dev/plugin-system 0.51.0 → 0.52.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +27 -27
  2. package/dist/cjs/components/PluginEditor/PluginEditor.js +41 -15
  3. package/dist/cjs/model/index.js +1 -0
  4. package/dist/cjs/model/profile-queries.js +16 -0
  5. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
  6. package/dist/cjs/runtime/DataQueriesProvider/model.js +17 -4
  7. package/dist/cjs/runtime/index.js +1 -0
  8. package/dist/cjs/runtime/profile-queries.js +65 -0
  9. package/dist/cjs/test/mock-data.js +23 -0
  10. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +27 -27
  11. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  12. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  13. package/dist/components/PluginEditor/PluginEditor.js +37 -16
  14. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  15. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +1 -1
  16. package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
  17. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  18. package/dist/model/index.d.ts +1 -0
  19. package/dist/model/index.d.ts.map +1 -1
  20. package/dist/model/index.js +1 -0
  21. package/dist/model/index.js.map +1 -1
  22. package/dist/model/plugins.d.ts +2 -0
  23. package/dist/model/plugins.d.ts.map +1 -1
  24. package/dist/model/plugins.js.map +1 -1
  25. package/dist/model/profile-queries.d.ts +19 -0
  26. package/dist/model/profile-queries.d.ts.map +1 -0
  27. package/dist/model/profile-queries.js +15 -0
  28. package/dist/model/profile-queries.js.map +1 -0
  29. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  30. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +10 -2
  31. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  32. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  33. package/dist/runtime/DataQueriesProvider/model.js +17 -4
  34. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  35. package/dist/runtime/index.d.ts +1 -0
  36. package/dist/runtime/index.d.ts.map +1 -1
  37. package/dist/runtime/index.js +1 -0
  38. package/dist/runtime/index.js.map +1 -1
  39. package/dist/runtime/profile-queries.d.ts +10 -0
  40. package/dist/runtime/profile-queries.d.ts.map +1 -0
  41. package/dist/runtime/profile-queries.js +52 -0
  42. package/dist/runtime/profile-queries.js.map +1 -0
  43. package/dist/test/mock-data.d.ts +2 -1
  44. package/dist/test/mock-data.d.ts.map +1 -1
  45. package/dist/test/mock-data.js +20 -0
  46. package/dist/test/mock-data.js.map +1 -1
  47. package/package.json +3 -3
@@ -79,7 +79,7 @@ function HTTPSettingsEditor(props) {
79
79
  const strDirect = 'Direct access';
80
80
  const strProxy = 'Proxy';
81
81
  // Initialize Proxy mode by default, if neither direct nor proxy mode is selected.
82
- if (!value.directUrl && !value.proxy) {
82
+ if (value.directUrl === undefined && value.proxy === undefined) {
83
83
  Object.assign(value, initialSpecProxy);
84
84
  }
85
85
  // utilitary function used for headers when renaming a property
@@ -100,32 +100,6 @@ function HTTPSettingsEditor(props) {
100
100
  };
101
101
  };
102
102
  const tabs = [
103
- {
104
- label: strDirect,
105
- content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
106
- name: "URL",
107
- render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
108
- ...field,
109
- fullWidth: true,
110
- label: "URL",
111
- value: value.directUrl || '',
112
- error: !!fieldState.error,
113
- helperText: fieldState.error?.message,
114
- InputProps: {
115
- readOnly: isReadonly
116
- },
117
- InputLabelProps: {
118
- shrink: isReadonly ? true : undefined
119
- },
120
- onChange: (e)=>{
121
- field.onChange(e);
122
- onChange((0, _immer.produce)(value, (draft)=>{
123
- draft.directUrl = e.target.value;
124
- }));
125
- }
126
- })
127
- })
128
- },
129
103
  {
130
104
  label: strProxy,
131
105
  content: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
@@ -485,6 +459,32 @@ function HTTPSettingsEditor(props) {
485
459
  })
486
460
  ]
487
461
  })
462
+ },
463
+ {
464
+ label: strDirect,
465
+ content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
466
+ name: "URL",
467
+ render: ({ field, fieldState })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
468
+ ...field,
469
+ fullWidth: true,
470
+ label: "URL",
471
+ value: value.directUrl || '',
472
+ error: !!fieldState.error,
473
+ helperText: fieldState.error?.message,
474
+ InputProps: {
475
+ readOnly: isReadonly
476
+ },
477
+ InputLabelProps: {
478
+ shrink: isReadonly ? true : undefined
479
+ },
480
+ onChange: (e)=>{
481
+ field.onChange(e);
482
+ onChange((0, _immer.produce)(value, (draft)=>{
483
+ draft.directUrl = e.target.value;
484
+ }));
485
+ }
486
+ })
487
+ })
488
488
  }
489
489
  ];
490
490
  // Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or
@@ -22,10 +22,16 @@ Object.defineProperty(exports, "PluginEditor", {
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
24
  const _material = require("@mui/material");
25
+ const _Reload = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Reload"));
25
26
  const _components = require("@perses-dev/components");
26
27
  const _PluginKindSelect = require("../PluginKindSelect");
27
28
  const _PluginSpecEditor = require("../PluginSpecEditor");
28
29
  const _plugineditorapi = require("./plugin-editor-api");
30
+ function _interop_require_default(obj) {
31
+ return obj && obj.__esModule ? obj : {
32
+ default: obj
33
+ };
34
+ }
29
35
  function PluginEditor(props) {
30
36
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
37
  const { value, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;
@@ -33,23 +39,43 @@ function PluginEditor(props) {
33
39
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
34
40
  ...others,
35
41
  children: [
36
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginKindSelect.PluginKindSelect, {
37
- fullWidth: false,
42
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
38
43
  sx: {
39
- mb: 2,
40
- minWidth: 120
41
- },
42
- margin: "dense",
43
- label: pluginKindLabel,
44
- pluginTypes: pluginTypes,
45
- disabled: isLoading,
46
- value: pendingSelection ? pendingSelection : value.selection,
47
- InputProps: {
48
- readOnly: isReadonly
44
+ display: 'flex',
45
+ flexDirection: 'row'
49
46
  },
50
- error: !!error,
51
- helperText: error?.message,
52
- onChange: onSelectionChange
47
+ children: [
48
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginKindSelect.PluginKindSelect, {
49
+ fullWidth: false,
50
+ sx: {
51
+ mb: 2,
52
+ minWidth: 120
53
+ },
54
+ margin: "dense",
55
+ label: pluginKindLabel,
56
+ pluginTypes: pluginTypes,
57
+ disabled: isLoading,
58
+ value: pendingSelection ? pendingSelection : value.selection,
59
+ InputProps: {
60
+ readOnly: isReadonly
61
+ },
62
+ error: !!error,
63
+ helperText: error?.message,
64
+ onChange: onSelectionChange
65
+ }),
66
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
67
+ variant: "contained",
68
+ sx: {
69
+ marginTop: 1.5,
70
+ marginBottom: 1.5,
71
+ paddingTop: 0.5,
72
+ marginLeft: 'auto'
73
+ },
74
+ startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Reload.default, {}),
75
+ onClick: ()=>onSpecChange(value.spec),
76
+ children: "Run Query"
77
+ })
78
+ ]
53
79
  }),
54
80
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
55
81
  FallbackComponent: _components.ErrorAlert,
@@ -22,6 +22,7 @@ _export_star(require("./plugin-base"), exports);
22
22
  _export_star(require("./plugin-loading"), exports);
23
23
  _export_star(require("./time-series-queries"), exports);
24
24
  _export_star(require("./trace-queries"), exports);
25
+ _export_star(require("./profile-queries"), exports);
25
26
  _export_star(require("./variables"), exports);
26
27
  function _export_star(from, to) {
27
28
  Object.keys(from).forEach(function(k) {
@@ -0,0 +1,16 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -38,6 +38,7 @@ const _jsxruntime = require("react/jsx-runtime");
38
38
  const _react = require("react");
39
39
  const _timeseriesqueries = require("../time-series-queries");
40
40
  const _tracequeries = require("../trace-queries");
41
+ const _profilequeries = require("../profile-queries");
41
42
  const _UsageMetricsProvider = require("../UsageMetricsProvider");
42
43
  const _model = require("./model");
43
44
  const DataQueriesContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
@@ -83,17 +84,22 @@ function DataQueriesProvider(props) {
83
84
  const timeSeriesResults = (0, _timeseriesqueries.useTimeSeriesQueries)(timeSeriesQueries, options, queryOptions);
84
85
  const traceQueries = queryDefinitions.filter((definition)=>definition.kind === 'TraceQuery');
85
86
  const traceResults = (0, _tracequeries.useTraceQueries)(traceQueries);
87
+ const profileQueries = queryDefinitions.filter((definition)=>definition.kind === 'ProfileQuery');
88
+ const profileResults = (0, _profilequeries.useProfileQueries)(profileQueries);
86
89
  const refetchAll = (0, _react.useCallback)(()=>{
87
90
  timeSeriesResults.forEach((result)=>result.refetch());
88
91
  traceResults.forEach((result)=>result.refetch());
92
+ profileResults.forEach((result)=>result.refetch());
89
93
  }, [
90
94
  timeSeriesResults,
91
- traceResults
95
+ traceResults,
96
+ profileResults
92
97
  ]);
93
98
  const ctx = (0, _react.useMemo)(()=>{
94
99
  const mergedQueryResults = [
95
100
  ...(0, _model.transformQueryResults)(timeSeriesResults, timeSeriesQueries),
96
- ...(0, _model.transformQueryResults)(traceResults, traceQueries)
101
+ ...(0, _model.transformQueryResults)(traceResults, traceQueries),
102
+ ...(0, _model.transformQueryResults)(profileResults, profileQueries)
97
103
  ];
98
104
  if (queryOptions?.enabled) {
99
105
  for (const result of mergedQueryResults){
@@ -118,6 +124,8 @@ function DataQueriesProvider(props) {
118
124
  timeSeriesResults,
119
125
  traceQueries,
120
126
  traceResults,
127
+ profileQueries,
128
+ profileResults,
121
129
  refetchAll,
122
130
  queryOptions?.enabled,
123
131
  usageMetrics
@@ -49,11 +49,15 @@ function useQueryType() {
49
49
  const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)([
50
50
  'TraceQuery'
51
51
  ]);
52
+ const { data: profileQueryPlugins, isLoading: isProfileQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)([
53
+ 'ProfileQuery'
54
+ ]);
52
55
  // For example, `map: {"TimeSeriesQuery":["PrometheusTimeSeriesQuery"],"TraceQuery":["TempoTraceQuery"]}`
53
56
  const queryTypeMap = (0, _react.useMemo)(()=>{
54
57
  const map = {
55
58
  TimeSeriesQuery: [],
56
- TraceQuery: []
59
+ TraceQuery: [],
60
+ ProfileQuery: []
57
61
  };
58
62
  if (timeSeriesQueryPlugins) {
59
63
  timeSeriesQueryPlugins.forEach((plugin)=>{
@@ -65,10 +69,16 @@ function useQueryType() {
65
69
  map[plugin.kind]?.push(plugin.spec.name);
66
70
  });
67
71
  }
72
+ if (profileQueryPlugins) {
73
+ profileQueryPlugins.forEach((plugin)=>{
74
+ map[plugin.kind]?.push(plugin.spec.name);
75
+ });
76
+ }
68
77
  return map;
69
78
  }, [
70
79
  timeSeriesQueryPlugins,
71
- traceQueryPlugins
80
+ traceQueryPlugins,
81
+ profileQueryPlugins
72
82
  ]);
73
83
  const getQueryType = (0, _react.useCallback)((pluginKind)=>{
74
84
  const isLoading = (pluginKind)=>{
@@ -77,8 +87,10 @@ function useQueryType() {
77
87
  return isTimeSeriesQueryLoading;
78
88
  case 'TempoTraceQuery':
79
89
  return isTraceQueryPluginLoading;
90
+ case 'PyroscopeProfileQuery':
91
+ return isProfileQueryPluginLoading;
80
92
  }
81
- return isTraceQueryPluginLoading || isTimeSeriesQueryLoading;
93
+ return isTraceQueryPluginLoading || isTimeSeriesQueryLoading || isProfileQueryPluginLoading;
82
94
  };
83
95
  if (isLoading(pluginKind)) {
84
96
  return undefined;
@@ -92,7 +104,8 @@ function useQueryType() {
92
104
  }, [
93
105
  queryTypeMap,
94
106
  isTimeSeriesQueryLoading,
95
- isTraceQueryPluginLoading
107
+ isTraceQueryPluginLoading,
108
+ isProfileQueryPluginLoading
96
109
  ]);
97
110
  return getQueryType;
98
111
  }
@@ -21,6 +21,7 @@ _export_star(require("./variables"), exports);
21
21
  _export_star(require("./TimeRangeProvider"), exports);
22
22
  _export_star(require("./time-series-queries"), exports);
23
23
  _export_star(require("./trace-queries"), exports);
24
+ _export_star(require("./profile-queries"), exports);
24
25
  _export_star(require("./DataQueriesProvider"), exports);
25
26
  _export_star(require("./QueryCountProvider"), exports);
26
27
  _export_star(require("./UsageMetricsProvider"), exports);
@@ -0,0 +1,65 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ PROFILE_QUERY_KEY: function() {
25
+ return PROFILE_QUERY_KEY;
26
+ },
27
+ useProfileQueries: function() {
28
+ return useProfileQueries;
29
+ }
30
+ });
31
+ const _reactquery = require("@tanstack/react-query");
32
+ const _datasources = require("./datasources");
33
+ const _pluginregistry = require("./plugin-registry");
34
+ const _TimeRangeProvider = require("./TimeRangeProvider");
35
+ const PROFILE_QUERY_KEY = 'ProfileQuery';
36
+ function useProfileQueries(definitions) {
37
+ const { getPlugin } = (0, _pluginregistry.usePluginRegistry)();
38
+ const datasourceStore = (0, _datasources.useDatasourceStore)();
39
+ const { absoluteTimeRange } = (0, _TimeRangeProvider.useTimeRange)();
40
+ const context = {
41
+ datasourceStore,
42
+ absoluteTimeRange
43
+ };
44
+ // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)
45
+ // https://tanstack.com/query/v4/docs/react/reference/useQuery
46
+ return (0, _reactquery.useQueries)({
47
+ queries: definitions.map((definition)=>{
48
+ const queryKey = [
49
+ definition,
50
+ datasourceStore,
51
+ absoluteTimeRange
52
+ ]; // `queryKey` watches and reruns `queryFn` if keys in the array change
53
+ const profileQueryKind = definition?.spec?.plugin?.kind;
54
+ return {
55
+ queryKey: queryKey,
56
+ queryFn: async ()=>{
57
+ const plugin = await getPlugin(PROFILE_QUERY_KEY, profileQueryKind);
58
+ const data = await plugin.getProfileData(definition.spec.plugin.spec, context);
59
+ return data;
60
+ },
61
+ structuralSharing: false
62
+ };
63
+ })
64
+ });
65
+ }
@@ -21,6 +21,9 @@ function _export(target, all) {
21
21
  });
22
22
  }
23
23
  _export(exports, {
24
+ MOCK_PROFILE_DATA: function() {
25
+ return MOCK_PROFILE_DATA;
26
+ },
24
27
  MOCK_TIME_SERIES_DATA: function() {
25
28
  return MOCK_TIME_SERIES_DATA;
26
29
  },
@@ -99,3 +102,23 @@ const MOCK_TRACE_DATA = {
99
102
  executedQueryString: '{ duration > 1000ms }'
100
103
  }
101
104
  };
105
+ const MOCK_PROFILE_DATA = {
106
+ profile: {
107
+ stackTrace: {
108
+ id: 0,
109
+ name: 'root',
110
+ level: 0,
111
+ start: 1699916103945861,
112
+ end: 1699916105065861,
113
+ total: 1000,
114
+ self: 500,
115
+ children: []
116
+ }
117
+ },
118
+ metadata: {
119
+ spyName: '',
120
+ sampleRate: 1000000000,
121
+ units: 'samples',
122
+ name: 'cpu'
123
+ }
124
+ };
@@ -23,7 +23,7 @@ export function HTTPSettingsEditor(props) {
23
23
  const strDirect = 'Direct access';
24
24
  const strProxy = 'Proxy';
25
25
  // Initialize Proxy mode by default, if neither direct nor proxy mode is selected.
26
- if (!value.directUrl && !value.proxy) {
26
+ if (value.directUrl === undefined && value.proxy === undefined) {
27
27
  Object.assign(value, initialSpecProxy);
28
28
  }
29
29
  // utilitary function used for headers when renaming a property
@@ -44,32 +44,6 @@ export function HTTPSettingsEditor(props) {
44
44
  };
45
45
  };
46
46
  const tabs = [
47
- {
48
- label: strDirect,
49
- content: /*#__PURE__*/ _jsx(Controller, {
50
- name: "URL",
51
- render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
52
- ...field,
53
- fullWidth: true,
54
- label: "URL",
55
- value: value.directUrl || '',
56
- error: !!fieldState.error,
57
- helperText: 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
47
  {
74
48
  label: strProxy,
75
49
  content: /*#__PURE__*/ _jsxs(_Fragment, {
@@ -429,6 +403,32 @@ export function HTTPSettingsEditor(props) {
429
403
  })
430
404
  ]
431
405
  })
406
+ },
407
+ {
408
+ label: strDirect,
409
+ content: /*#__PURE__*/ _jsx(Controller, {
410
+ name: "URL",
411
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
412
+ ...field,
413
+ fullWidth: true,
414
+ label: "URL",
415
+ value: value.directUrl || '',
416
+ error: !!fieldState.error,
417
+ helperText: fieldState.error?.message,
418
+ InputProps: {
419
+ readOnly: isReadonly
420
+ },
421
+ InputLabelProps: {
422
+ shrink: isReadonly ? true : undefined
423
+ },
424
+ onChange: (e)=>{
425
+ field.onChange(e);
426
+ onChange(produce(value, (draft)=>{
427
+ draft.directUrl = e.target.value;
428
+ }));
429
+ }
430
+ })
431
+ })
432
432
  }
433
433
  ];
434
434
  // Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/HTTPSettingsEditor/HTTPSettingsEditor.tsx"],"sourcesContent":["// Copyright 2024 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 { RequestHeaders, HTTPDatasourceSpec } from '@perses-dev/core';\nimport { Grid, IconButton, MenuItem, TextField, Typography } from '@mui/material';\nimport React, { Fragment, ReactElement, 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 { OptionsEditorRadios } from '../OptionsEditorRadios';\n\nexport interface HTTPSettingsEditor {\n value: HTTPDatasourceSpec;\n onChange: (next: HTTPDatasourceSpec) => void;\n isReadonly?: boolean;\n initialSpecDirect: HTTPDatasourceSpec;\n initialSpecProxy: HTTPDatasourceSpec;\n}\n\nexport function HTTPSettingsEditor(props: HTTPSettingsEditor): ReactElement {\n const { value, onChange, isReadonly, initialSpecDirect, initialSpecProxy } = props;\n const strDirect = 'Direct access';\n const strProxy = 'Proxy';\n\n // Initialize Proxy mode by default, if neither direct nor proxy mode is selected.\n if (!value.directUrl && !value.proxy) {\n Object.assign(value, initialSpecProxy);\n }\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 = (\n oldHeaders: RequestHeaders | undefined,\n oldName: string,\n newName: string\n ): RequestHeaders | undefined => {\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 // Set defaultTab to the mode that this datasource is currently relying on.\n const defaultTab = value.proxy ? proxyModeId : directModeId;\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): void => {\n if (tabs[v]?.label === strDirect) {\n setPreviousSpecProxy(value);\n\n // Copy all settings (for example, scrapeInterval), except 'proxy'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { proxy, ...newValue } = value;\n onChange({ ...newValue, directUrl: previousSpecDirect.directUrl });\n } else if (tabs[v]?.label === strProxy) {\n setPreviousSpecDirect(value);\n\n // Copy all settings (for example, scrapeInterval), except 'directUrl'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { directUrl, ...newValue } = value;\n onChange({ ...newValue, proxy: previousSpecProxy.proxy });\n }\n };\n\n return (\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":["Grid","IconButton","MenuItem","TextField","Typography","React","Fragment","useState","produce","Controller","MinusIcon","PlusIcon","OptionsEditorRadios","HTTPSettingsEditor","props","value","onChange","isReadonly","initialSpecDirect","initialSpecProxy","strDirect","strProxy","directUrl","proxy","Object","assign","buildNewHeaders","oldHeaders","oldName","newName","undefined","keys","newHeaders","reduce","acc","val","tabs","label","content","name","render","field","fieldState","fullWidth","error","helperText","message","InputProps","readOnly","InputLabelProps","shrink","e","draft","target","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","previousSpecDirect","setPreviousSpecDirect","previousSpecProxy","setPreviousSpecProxy","handleModeChange","v","newValue","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,IAAI,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AAClF,OAAOC,SAASC,QAAQ,EAAgBC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,OAAOC,eAAe,wBAAwB;AAC9C,OAAOC,cAAc,uBAAuB;AAC5C,SAASC,mBAAmB,QAAQ,yBAAyB;AAU7D,OAAO,SAASC,mBAAmBC,KAAyB;IAC1D,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAE,GAAGL;IAC7E,MAAMM,YAAY;IAClB,MAAMC,WAAW;IAEjB,kFAAkF;IAClF,IAAI,CAACN,MAAMO,SAAS,IAAI,CAACP,MAAMQ,KAAK,EAAE;QACpCC,OAAOC,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B;IAC3D,MAAM+D,cAAc/C,KAAK6C,SAAS,CAAC,CAACC,MAAQA,IAAI7C,KAAK,KAAKhB;IAE1D,2EAA2E;IAC3E,MAAM+D,aAAarE,MAAMQ,KAAK,GAAG4D,cAAcH;IAE/C,0EAA0E;IAC1E,uEAAuE;IACvE,MAAM,CAACK,oBAAoBC,sBAAsB,GAAG/E,SAASW;IAC7D,MAAM,CAACqE,mBAAmBC,qBAAqB,GAAGjF,SAASY;IAE3D,8FAA8F;IAC9F,MAAMsE,mBAAmB,CAACC;QACxB,IAAItD,IAAI,CAACsD,EAAE,EAAErD,UAAUjB,WAAW;YAChCoE,qBAAqBzE;YAErB,kEAAkE;YAClE,6DAA6D;YAC7D,MAAM,EAAEQ,KAAK,EAAE,GAAGoE,UAAU,GAAG5E;YAC/BC,SAAS;gBAAE,GAAG2E,QAAQ;gBAAErE,WAAW+D,mBAAmB/D,SAAS;YAAC;QAClE,OAAO,IAAIc,IAAI,CAACsD,EAAE,EAAErD,UAAUhB,UAAU;YACtCiE,sBAAsBvE;YAEtB,sEAAsE;YACtE,6DAA6D;YAC7D,MAAM,EAAEO,SAAS,EAAE,GAAGqE,UAAU,GAAG5E;YACnCC,SAAS;gBAAE,GAAG2E,QAAQ;gBAAEpE,OAAOgE,kBAAkBhE,KAAK;YAAC;QACzD;IACF;IAEA,qBACE;;0BACE,KAACnB;gBAAWsD,SAAQ;gBAAKkC,IAAI;0BAAG;;0BAGhC,KAAChF;gBACCK,YAAYA;gBACZmB,MAAMA;gBACNgD,YAAYA;gBACZS,cAAcJ;;;;AAItB"}
1
+ {"version":3,"sources":["../../../src/components/HTTPSettingsEditor/HTTPSettingsEditor.tsx"],"sourcesContent":["// Copyright 2024 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 { RequestHeaders, HTTPDatasourceSpec } from '@perses-dev/core';\nimport { Grid, IconButton, MenuItem, TextField, Typography } from '@mui/material';\nimport React, { Fragment, ReactElement, 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 { OptionsEditorRadios } from '../OptionsEditorRadios';\n\nexport interface HTTPSettingsEditor {\n value: HTTPDatasourceSpec;\n onChange: (next: HTTPDatasourceSpec) => void;\n isReadonly?: boolean;\n initialSpecDirect: HTTPDatasourceSpec;\n initialSpecProxy: HTTPDatasourceSpec;\n}\n\nexport function HTTPSettingsEditor(props: HTTPSettingsEditor): ReactElement {\n const { value, onChange, isReadonly, initialSpecDirect, initialSpecProxy } = props;\n const strDirect = 'Direct access';\n const strProxy = 'Proxy';\n\n // Initialize Proxy mode by default, if neither direct nor proxy mode is selected.\n if (value.directUrl === undefined && value.proxy === undefined) {\n Object.assign(value, initialSpecProxy);\n }\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 = (\n oldHeaders: RequestHeaders | undefined,\n oldName: string,\n newName: string\n ): RequestHeaders | undefined => {\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: 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 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\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 // Set defaultTab to the mode that this datasource is currently relying on.\n const defaultTab = value.proxy ? proxyModeId : directModeId;\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): void => {\n if (tabs[v]?.label === strDirect) {\n setPreviousSpecProxy(value);\n\n // Copy all settings (for example, scrapeInterval), except 'proxy'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { proxy, ...newValue } = value;\n onChange({ ...newValue, directUrl: previousSpecDirect.directUrl });\n } else if (tabs[v]?.label === strProxy) {\n setPreviousSpecDirect(value);\n\n // Copy all settings (for example, scrapeInterval), except 'directUrl'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { directUrl, ...newValue } = value;\n onChange({ ...newValue, proxy: previousSpecProxy.proxy });\n }\n };\n\n return (\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":["Grid","IconButton","MenuItem","TextField","Typography","React","Fragment","useState","produce","Controller","MinusIcon","PlusIcon","OptionsEditorRadios","HTTPSettingsEditor","props","value","onChange","isReadonly","initialSpecDirect","initialSpecProxy","strDirect","strProxy","directUrl","undefined","proxy","Object","assign","buildNewHeaders","oldHeaders","oldName","newName","keys","newHeaders","reduce","acc","val","tabs","label","content","name","render","field","fieldState","fullWidth","spec","url","error","helperText","message","InputProps","readOnly","InputLabelProps","shrink","e","draft","target","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","previousSpecDirect","setPreviousSpecDirect","previousSpecProxy","setPreviousSpecProxy","handleModeChange","v","newValue","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,IAAI,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AAClF,OAAOC,SAASC,QAAQ,EAAgBC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,OAAO,QAAQ,QAAQ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0BACE,KAACpB;gBAAWsD,SAAQ;gBAAKkC,IAAI;0BAAG;;0BAGhC,KAAChF;gBACCK,YAAYA;gBACZmB,MAAMA;gBACNgD,YAAYA;gBACZS,cAAcJ;;;;AAItB"}
@@ -1 +1 @@
1
- {"version":3,"file":"PluginEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA6BnE"}
1
+ {"version":3,"file":"PluginEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAyCnE"}