@perses-dev/pyroscope-plugin 0.3.0 → 0.3.2

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 (70) hide show
  1. package/__mf/js/Pyroscope.1e9d1b83.js +5 -0
  2. package/__mf/js/async/3391.5c0ed426.js +73 -0
  3. package/__mf/js/async/4368.809601fc.js +2 -0
  4. package/__mf/js/async/4421.d2b623e9.js +1 -0
  5. package/__mf/js/async/4778.c791e281.js +1 -0
  6. package/__mf/js/async/5135.ae4df243.js +1 -0
  7. package/__mf/js/async/5207.04f840e4.js +2 -0
  8. package/__mf/js/async/671.2877c17b.js +7 -0
  9. package/__mf/js/async/6714.98bee612.js +2 -0
  10. package/__mf/js/async/677.58650020.js +1 -0
  11. package/__mf/js/async/{__federation_expose_PyroscopeDatasource.76f63abf.js → __federation_expose_PyroscopeDatasource.936db6be.js} +2 -2
  12. package/__mf/js/async/{__federation_expose_PyroscopeExplorer.d2e8d27c.js → __federation_expose_PyroscopeExplorer.5fcfa90f.js} +2 -2
  13. package/__mf/js/async/__federation_expose_PyroscopeProfileQuery.81b7d9a3.js +2 -0
  14. package/__mf/js/main.5bf6c4b8.js +5 -0
  15. package/lib/cjs/components/DeleteFilterItem.js +9 -4
  16. package/lib/cjs/components/FilterItem.js +57 -24
  17. package/lib/cjs/components/LabelName.js +29 -27
  18. package/lib/cjs/components/LabelValue.js +26 -27
  19. package/lib/cjs/components/Operator.js +7 -3
  20. package/lib/cjs/components/ProfileTypeSelector.js +1 -2
  21. package/lib/cjs/components/Service.js +20 -24
  22. package/lib/cjs/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js +21 -12
  23. package/lib/components/DeleteFilterItem.d.ts.map +1 -1
  24. package/lib/components/DeleteFilterItem.js +9 -4
  25. package/lib/components/DeleteFilterItem.js.map +1 -1
  26. package/lib/components/FilterItem.d.ts.map +1 -1
  27. package/lib/components/FilterItem.js +58 -25
  28. package/lib/components/FilterItem.js.map +1 -1
  29. package/lib/components/LabelName.d.ts.map +1 -1
  30. package/lib/components/LabelName.js +30 -28
  31. package/lib/components/LabelName.js.map +1 -1
  32. package/lib/components/LabelValue.d.ts.map +1 -1
  33. package/lib/components/LabelValue.js +27 -28
  34. package/lib/components/LabelValue.js.map +1 -1
  35. package/lib/components/Operator.d.ts.map +1 -1
  36. package/lib/components/Operator.js +7 -3
  37. package/lib/components/Operator.js.map +1 -1
  38. package/lib/components/ProfileTypeSelector.js +1 -2
  39. package/lib/components/ProfileTypeSelector.js.map +1 -1
  40. package/lib/components/Service.d.ts.map +1 -1
  41. package/lib/components/Service.js +21 -25
  42. package/lib/components/Service.js.map +1 -1
  43. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.d.ts.map +1 -1
  44. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js +19 -10
  45. package/lib/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js.map +1 -1
  46. package/mf-manifest.json +37 -37
  47. package/mf-stats.json +37 -37
  48. package/package.json +7 -7
  49. package/__mf/js/Pyroscope.5ee1a2b0.js +0 -5
  50. package/__mf/js/async/1101.380fb9ae.js +0 -73
  51. package/__mf/js/async/1339.e58b309f.js +0 -1
  52. package/__mf/js/async/424.edb69d58.js +0 -1
  53. package/__mf/js/async/4368.2d817d5d.js +0 -2
  54. package/__mf/js/async/4421.d44d1d6f.js +0 -1
  55. package/__mf/js/async/5215.6fd5cc14.js +0 -1
  56. package/__mf/js/async/5358.40b9537e.js +0 -7
  57. package/__mf/js/async/5876.38b119d5.js +0 -2
  58. package/__mf/js/async/9633.a7997138.js +0 -2
  59. package/__mf/js/async/__federation_expose_PyroscopeProfileQuery.75c9c11b.js +0 -2
  60. package/__mf/js/main.aa3b0acd.js +0 -5
  61. /package/__mf/css/async/{1339.6763d50b.css → 2341.6763d50b.css} +0 -0
  62. /package/__mf/css/async/{9633.6763d50b.css → 5207.6763d50b.css} +0 -0
  63. /package/__mf/js/async/{1101.380fb9ae.js.LICENSE.txt → 3391.5c0ed426.js.LICENSE.txt} +0 -0
  64. /package/__mf/js/async/{4368.2d817d5d.js.LICENSE.txt → 4368.809601fc.js.LICENSE.txt} +0 -0
  65. /package/__mf/js/async/{9633.a7997138.js.LICENSE.txt → 5207.04f840e4.js.LICENSE.txt} +0 -0
  66. /package/__mf/js/async/{5358.40b9537e.js.LICENSE.txt → 671.2877c17b.js.LICENSE.txt} +0 -0
  67. /package/__mf/js/async/{5876.38b119d5.js.LICENSE.txt → 6714.98bee612.js.LICENSE.txt} +0 -0
  68. /package/__mf/js/async/{__federation_expose_PyroscopeDatasource.76f63abf.js.LICENSE.txt → __federation_expose_PyroscopeDatasource.936db6be.js.LICENSE.txt} +0 -0
  69. /package/__mf/js/async/{__federation_expose_PyroscopeExplorer.d2e8d27c.js.LICENSE.txt → __federation_expose_PyroscopeExplorer.5fcfa90f.js.LICENSE.txt} +0 -0
  70. /package/__mf/js/async/{__federation_expose_PyroscopeProfileQuery.75c9c11b.js.LICENSE.txt → __federation_expose_PyroscopeProfileQuery.81b7d9a3.js.LICENSE.txt} +0 -0
@@ -52,32 +52,65 @@ function FilterItem(props) {
52
52
  const handleDeleteClick = ()=>{
53
53
  deleteItem?.();
54
54
  };
55
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
55
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
56
56
  direction: "row",
57
57
  spacing: 0,
58
- sx: {
59
- flexWrap: 'wrap',
60
- maxWidth: '100%'
61
- },
62
- children: [
63
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_LabelName.LabelName, {
64
- datasource: datasource,
65
- value: value.labelName,
66
- onChange: handleLabelNameChange
58
+ sx: (theme)=>({
59
+ flexWrap: 'wrap',
60
+ width: 500,
61
+ [theme.breakpoints.down('sm')]: {
62
+ width: '100%'
63
+ }
67
64
  }),
68
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_Operator.Operator, {
69
- value: value.operator,
70
- onChange: handleOperatorChange
71
- }),
72
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_LabelValue.LabelValue, {
73
- datasource: datasource,
74
- value: value.labelValue,
75
- labelName: value.labelName,
76
- onChange: handleLabelValueChange
77
- }),
78
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteFilterItem.DeleteFilterItem, {
79
- onClick: handleDeleteClick
80
- })
81
- ]
65
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid2, {
66
+ container: true,
67
+ sx: {
68
+ width: '100%'
69
+ },
70
+ children: [
71
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
72
+ size: {
73
+ xs: 9.5,
74
+ md: 4.5
75
+ },
76
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_LabelName.LabelName, {
77
+ datasource: datasource,
78
+ value: value.labelName,
79
+ onChange: handleLabelNameChange
80
+ })
81
+ }),
82
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
83
+ size: {
84
+ xs: 2.5,
85
+ md: 1.5
86
+ },
87
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Operator.Operator, {
88
+ value: value.operator,
89
+ onChange: handleOperatorChange
90
+ })
91
+ }),
92
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
93
+ size: {
94
+ xs: 10,
95
+ md: 5
96
+ },
97
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_LabelValue.LabelValue, {
98
+ datasource: datasource,
99
+ value: value.labelValue,
100
+ labelName: value.labelName,
101
+ onChange: handleLabelValueChange
102
+ })
103
+ }),
104
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
105
+ size: {
106
+ xs: 2,
107
+ md: 1
108
+ },
109
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteFilterItem.DeleteFilterItem, {
110
+ onClick: handleDeleteClick
111
+ })
112
+ })
113
+ ]
114
+ })
82
115
  });
83
116
  }
@@ -21,39 +21,41 @@ Object.defineProperty(exports, "LabelName", {
21
21
  }
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
+ const _react = require("react");
24
25
  const _material = require("@mui/material");
25
26
  const _usequery = require("../utils/use-query");
26
27
  function LabelName(props) {
27
28
  const { datasource, value, onChange } = props;
28
29
  const { data: labelNamesOptions, isLoading: isLabelNamesOptionsLoading } = (0, _usequery.useLabelNames)(datasource);
29
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Select, {
30
- sx: {
31
- borderTopRightRadius: '0',
32
- borderBottomRightRadius: '0'
33
- },
30
+ const filteredLabelNamesOptions = (0, _react.useMemo)(()=>(0, _usequery.filterLabelNamesOptions)(labelNamesOptions?.names ?? []), [
31
+ labelNamesOptions
32
+ ]);
33
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Autocomplete, {
34
+ disableClearable: true,
35
+ options: filteredLabelNamesOptions,
34
36
  value: value,
35
- size: "small",
36
- onChange: (event)=>onChange?.(event.target.value),
37
- displayEmpty: true,
38
- renderValue: (selected)=>{
39
- if (selected === '') {
40
- return 'Select label name';
41
- }
42
- return selected;
37
+ sx: (theme)=>({
38
+ width: '100%',
39
+ '& .MuiOutlinedInput-root': {
40
+ borderTopRightRadius: 0,
41
+ borderBottomRightRadius: 0,
42
+ [theme.breakpoints.down('sm')]: {
43
+ borderBottomLeftRadius: 0
44
+ }
45
+ }
46
+ }),
47
+ loading: isLabelNamesOptionsLoading,
48
+ renderInput: (params)=>{
49
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
50
+ ...params,
51
+ placeholder: "Select label name",
52
+ size: "small"
53
+ });
43
54
  },
44
- children: isLabelNamesOptionsLoading ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
45
- width: "100%",
46
- sx: {
47
- alignItems: 'center',
48
- justifyContent: 'center'
49
- },
50
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {
51
- color: "inherit",
52
- size: 20
53
- })
54
- }) : labelNamesOptions?.names && (0, _usequery.filterLabelNamesOptions)(labelNamesOptions?.names).map((labelName)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
55
- value: labelName,
56
- children: labelName
57
- }, labelName))
55
+ onChange: (_event, newValue)=>{
56
+ if (newValue !== null) {
57
+ onChange?.(newValue);
58
+ }
59
+ }
58
60
  });
59
61
  }
@@ -26,34 +26,33 @@ const _usequery = require("../utils/use-query");
26
26
  function LabelValue(props) {
27
27
  const { datasource, value, labelName, onChange } = props;
28
28
  const { data: labelValuesOptions, isLoading: isLabelValuesOptionsLoading } = (0, _usequery.useLabelValues)(datasource, labelName);
29
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Select, {
30
- sx: {
31
- borderRadius: '0'
32
- },
29
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Autocomplete, {
30
+ freeSolo: true,
31
+ disableClearable: true,
32
+ options: labelValuesOptions?.names ?? [],
33
33
  value: value,
34
- size: "small",
35
- onChange: (event)=>onChange?.(event.target.value),
36
- displayEmpty: true,
37
- disabled: !labelName || labelName === '',
38
- renderValue: (selected)=>{
39
- if (selected === '') {
40
- return 'Select label value';
41
- }
42
- return selected;
34
+ sx: (theme)=>({
35
+ width: '100%',
36
+ '& .MuiOutlinedInput-root': {
37
+ borderRadius: 0,
38
+ width: '100%',
39
+ [theme.breakpoints.down('sm')]: {
40
+ borderBottomLeftRadius: 4
41
+ }
42
+ }
43
+ }),
44
+ loading: isLabelValuesOptionsLoading,
45
+ renderInput: (params)=>{
46
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
47
+ ...params,
48
+ placeholder: "Select label value",
49
+ size: "small"
50
+ });
43
51
  },
44
- children: isLabelValuesOptionsLoading ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
45
- width: "100%",
46
- sx: {
47
- alignItems: 'center',
48
- justifyContent: 'center'
49
- },
50
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {
51
- color: "inherit",
52
- size: 20
53
- })
54
- }) : labelValuesOptions?.names && labelValuesOptions?.names.map((labelValue)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
55
- value: labelValue,
56
- children: labelValue
57
- }, labelValue))
52
+ onChange: (_event, newInputValue)=>{
53
+ if (newInputValue !== null) {
54
+ onChange?.(newInputValue);
55
+ }
56
+ }
58
57
  });
59
58
  }
@@ -31,9 +31,13 @@ function Operator(props) {
31
31
  '!~'
32
32
  ];
33
33
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Select, {
34
- sx: {
35
- borderRadius: '0'
36
- },
34
+ sx: (theme)=>({
35
+ borderRadius: 0,
36
+ width: '100%',
37
+ [theme.breakpoints.down('sm')]: {
38
+ borderTopRightRadius: 4
39
+ }
40
+ }),
37
41
  value: value,
38
42
  size: "small",
39
43
  onChange: (event)=>onChange?.(event.target.value),
@@ -29,8 +29,7 @@ function ProfileTypeSelector(props) {
29
29
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
30
30
  position: "relative",
31
31
  sx: {
32
- flexGrow: 1,
33
- maxWidth: '100%'
32
+ width: '100%'
34
33
  },
35
34
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
36
35
  select: true,
@@ -26,35 +26,31 @@ const _usequery = require("../utils/use-query");
26
26
  function Service(props) {
27
27
  const { datasource, value, onChange } = props;
28
28
  const { data: servicesOptions, isLoading: isServicesOptionsLoading } = (0, _usequery.useServices)(datasource);
29
+ function handleServiceChange(_event, newValue) {
30
+ if (newValue !== null) {
31
+ onChange?.(newValue);
32
+ }
33
+ }
29
34
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
30
35
  position: "relative",
31
36
  sx: {
32
- flexGrow: 1,
33
- maxWidth: '100%',
34
- [(0, _material.useTheme)().breakpoints.down('sm')]: {
35
- width: '100%'
36
- }
37
+ width: '100%'
37
38
  },
38
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
39
- select: true,
40
- label: "Service",
39
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Autocomplete, {
40
+ options: servicesOptions?.names ?? [],
41
41
  value: value,
42
- size: "small",
43
- onChange: (event)=>onChange?.(event.target.value),
44
- children: isServicesOptionsLoading ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
45
- width: "100%",
46
- sx: {
47
- alignItems: 'center',
48
- justifyContent: 'center'
49
- },
50
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {
51
- color: "inherit",
52
- size: 20
53
- })
54
- }) : servicesOptions?.names && servicesOptions?.names.map((service)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
55
- value: service,
56
- children: service
57
- }, service))
42
+ sx: {
43
+ minWidth: 200
44
+ },
45
+ loading: isServicesOptionsLoading,
46
+ renderInput: (params)=>{
47
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
48
+ ...params,
49
+ label: "Service",
50
+ size: "small"
51
+ });
52
+ },
53
+ onChange: handleServiceChange
58
54
  })
59
55
  });
60
56
  }
@@ -25,13 +25,13 @@ const _pluginsystem = require("@perses-dev/plugin-system");
25
25
  const _components = require("@perses-dev/components");
26
26
  const _immer = require("immer");
27
27
  const _material = require("@mui/material");
28
- const _pyroscopeselectors = require("../../model/pyroscope-selectors");
28
+ const _model = require("../../model");
29
29
  const _components1 = require("../../components");
30
30
  const _queryeditormodel = require("./query-editor-model");
31
31
  function PyroscopeProfileQueryEditor(props) {
32
32
  const { onChange, value } = props;
33
33
  const { datasource } = value;
34
- const selectedDatasource = datasource ?? _pyroscopeselectors.DEFAULT_PYROSCOPE;
34
+ const selectedDatasource = datasource ?? _model.DEFAULT_PYROSCOPE;
35
35
  const datasourceSelectLabelID = (0, _components.useId)('pyroscope-datasource-label');
36
36
  const { maxNodes, handleMaxNodesChange, maxNodesHasError } = (0, _queryeditormodel.useMaxNodesState)(props);
37
37
  const { profileType, handleProfileTypeChange } = (0, _queryeditormodel.useProfileTypeState)(props);
@@ -40,11 +40,10 @@ function PyroscopeProfileQueryEditor(props) {
40
40
  const handleDatasourceChange = (next)=>{
41
41
  // Check if the next value is a DatasourceSelector
42
42
  if (typeof next === 'object' && 'kind' in next && 'name' in next) {
43
- if ((0, _pyroscopeselectors.isPyroscopeDatasourceSelector)(next)) {
43
+ if ((0, _model.isPyroscopeDatasourceSelector)(next)) {
44
44
  onChange((0, _immer.produce)(value, (draft)=>{
45
45
  // If they're using the default, just omit the datasource prop (i.e. set to undefined)
46
- const nextDatasource = (0, _pyroscopeselectors.isDefaultPyroscopeSelector)(next) ? undefined : next;
47
- draft.datasource = nextDatasource;
46
+ draft.datasource = (0, _model.isDefaultPyroscopeSelector)(next) ? undefined : next;
48
47
  }));
49
48
  return;
50
49
  }
@@ -64,7 +63,7 @@ function PyroscopeProfileQueryEditor(props) {
64
63
  children: "Pyroscope Datasource"
65
64
  }),
66
65
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
67
- datasourcePluginKind: _pyroscopeselectors.PYROSCOPE_DATASOURCE_KIND,
66
+ datasourcePluginKind: _model.PYROSCOPE_DATASOURCE_KIND,
68
67
  value: selectedDatasource,
69
68
  onChange: handleDatasourceChange,
70
69
  labelId: datasourceSelectLabelID,
@@ -75,11 +74,12 @@ function PyroscopeProfileQueryEditor(props) {
75
74
  }),
76
75
  /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
77
76
  direction: "row",
78
- spacing: 0,
79
77
  sx: {
80
- flexWrap: 'wrap',
81
- rowGap: 1,
82
- gap: 2
78
+ [(0, _material.useTheme)().breakpoints.down('sm')]: {
79
+ flexWrap: 'wrap'
80
+ },
81
+ gap: 2,
82
+ rowGap: 1
83
83
  },
84
84
  children: [
85
85
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.Service, {
@@ -93,13 +93,22 @@ function PyroscopeProfileQueryEditor(props) {
93
93
  onChange: handleProfileTypeChange
94
94
  }),
95
95
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
96
+ type: "number",
96
97
  size: "small",
97
98
  label: "Max Nodes",
98
99
  value: maxNodes,
99
100
  error: maxNodesHasError,
100
101
  onChange: (e)=>handleMaxNodesChange(e.target.value),
101
- sx: {
102
- width: '110px'
102
+ sx: (theme)=>({
103
+ width: 250,
104
+ [theme.breakpoints.down('sm')]: {
105
+ width: '100%'
106
+ }
107
+ }),
108
+ slotProps: {
109
+ htmlInput: {
110
+ step: 1
111
+ }
103
112
  }
104
113
  })
105
114
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"DeleteFilterItem.d.ts","sourceRoot":"","sources":["../../../src/components/DeleteFilterItem.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAe3E"}
1
+ {"version":3,"file":"DeleteFilterItem.d.ts","sourceRoot":"","sources":["../../../src/components/DeleteFilterItem.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAoB3E"}
@@ -16,10 +16,15 @@ import { ToolbarIconButton } from '@perses-dev/components';
16
16
  export function DeleteFilterItem(props) {
17
17
  const { onClick } = props;
18
18
  return /*#__PURE__*/ _jsx(ToolbarIconButton, {
19
- sx: {
20
- borderTopLeftRadius: '0',
21
- borderBottomLeftRadius: '0'
22
- },
19
+ sx: (theme)=>({
20
+ borderTopLeftRadius: 0,
21
+ borderBottomLeftRadius: 0,
22
+ width: '100%',
23
+ height: '100%',
24
+ [theme.breakpoints.down('sm')]: {
25
+ borderTopRightRadius: 0
26
+ }
27
+ }),
23
28
  "aria-label": "delete filter",
24
29
  onClick: onClick,
25
30
  children: /*#__PURE__*/ _jsx(CloseIcon, {})
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/DeleteFilterItem.tsx"],"sourcesContent":["// Copyright 2025 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 { ReactElement } from 'react';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { ToolbarIconButton } from '@perses-dev/components';\n\nexport interface DeleteFilterItemProps {\n onClick: () => void;\n}\n\nexport function DeleteFilterItem(props: DeleteFilterItemProps): ReactElement {\n const { onClick } = props;\n\n return (\n <ToolbarIconButton\n sx={{\n borderTopLeftRadius: '0',\n borderBottomLeftRadius: '0',\n }}\n aria-label=\"delete filter\"\n onClick={onClick}\n >\n <CloseIcon />\n </ToolbarIconButton>\n );\n}\n"],"names":["CloseIcon","ToolbarIconButton","DeleteFilterItem","props","onClick","sx","borderTopLeftRadius","borderBottomLeftRadius","aria-label"],"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,OAAOA,eAAe,wBAAwB;AAC9C,SAASC,iBAAiB,QAAQ,yBAAyB;AAM3D,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,qBACE,KAACF;QACCI,IAAI;YACFC,qBAAqB;YACrBC,wBAAwB;QAC1B;QACAC,cAAW;QACXJ,SAASA;kBAET,cAAA,KAACJ;;AAGP"}
1
+ {"version":3,"sources":["../../../src/components/DeleteFilterItem.tsx"],"sourcesContent":["// Copyright 2025 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 { ReactElement } from 'react';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { ToolbarIconButton } from '@perses-dev/components';\n\nexport interface DeleteFilterItemProps {\n onClick: () => void;\n}\n\nexport function DeleteFilterItem(props: DeleteFilterItemProps): ReactElement {\n const { onClick } = props;\n\n return (\n <ToolbarIconButton\n sx={(theme) => ({\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n width: '100%',\n height: '100%',\n [theme.breakpoints.down('sm')]: {\n borderTopRightRadius: 0,\n },\n })}\n aria-label=\"delete filter\"\n onClick={onClick}\n >\n <CloseIcon />\n </ToolbarIconButton>\n );\n}\n"],"names":["CloseIcon","ToolbarIconButton","DeleteFilterItem","props","onClick","sx","theme","borderTopLeftRadius","borderBottomLeftRadius","width","height","breakpoints","down","borderTopRightRadius","aria-label"],"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,OAAOA,eAAe,wBAAwB;AAC9C,SAASC,iBAAiB,QAAQ,yBAAyB;AAM3D,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,qBACE,KAACF;QACCI,IAAI,CAACC,QAAW,CAAA;gBACdC,qBAAqB;gBACrBC,wBAAwB;gBACxBC,OAAO;gBACPC,QAAQ;gBACR,CAACJ,MAAMK,WAAW,CAACC,IAAI,CAAC,MAAM,EAAE;oBAC9BC,sBAAsB;gBACxB;YACF,CAAA;QACAC,cAAW;QACXV,SAASA;kBAET,cAAA,KAACJ;;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"file":"FilterItem.d.ts","sourceRoot":"","sources":["../../../src/components/FilterItem.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,WAAW,EAAgB,MAAM,gBAAgB,CAAC;AAM3D,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,2BAA2B,CAAC;IACxC,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAgC/D"}
1
+ {"version":3,"file":"FilterItem.d.ts","sourceRoot":"","sources":["../../../src/components/FilterItem.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,WAAW,EAAgB,MAAM,gBAAgB,CAAC;AAM3D,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,2BAA2B,CAAC;IACxC,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CA8C/D"}
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { Stack } from '@mui/material';
14
+ import { Grid2 as Grid, Stack } from '@mui/material';
15
15
  import { LabelName } from './LabelName';
16
16
  import { Operator } from './Operator';
17
17
  import { LabelValue } from './LabelValue';
@@ -42,33 +42,66 @@ export function FilterItem(props) {
42
42
  const handleDeleteClick = ()=>{
43
43
  deleteItem?.();
44
44
  };
45
- return /*#__PURE__*/ _jsxs(Stack, {
45
+ return /*#__PURE__*/ _jsx(Stack, {
46
46
  direction: "row",
47
47
  spacing: 0,
48
- sx: {
49
- flexWrap: 'wrap',
50
- maxWidth: '100%'
51
- },
52
- children: [
53
- /*#__PURE__*/ _jsx(LabelName, {
54
- datasource: datasource,
55
- value: value.labelName,
56
- onChange: handleLabelNameChange
48
+ sx: (theme)=>({
49
+ flexWrap: 'wrap',
50
+ width: 500,
51
+ [theme.breakpoints.down('sm')]: {
52
+ width: '100%'
53
+ }
57
54
  }),
58
- /*#__PURE__*/ _jsx(Operator, {
59
- value: value.operator,
60
- onChange: handleOperatorChange
61
- }),
62
- /*#__PURE__*/ _jsx(LabelValue, {
63
- datasource: datasource,
64
- value: value.labelValue,
65
- labelName: value.labelName,
66
- onChange: handleLabelValueChange
67
- }),
68
- /*#__PURE__*/ _jsx(DeleteFilterItem, {
69
- onClick: handleDeleteClick
70
- })
71
- ]
55
+ children: /*#__PURE__*/ _jsxs(Grid, {
56
+ container: true,
57
+ sx: {
58
+ width: '100%'
59
+ },
60
+ children: [
61
+ /*#__PURE__*/ _jsx(Grid, {
62
+ size: {
63
+ xs: 9.5,
64
+ md: 4.5
65
+ },
66
+ children: /*#__PURE__*/ _jsx(LabelName, {
67
+ datasource: datasource,
68
+ value: value.labelName,
69
+ onChange: handleLabelNameChange
70
+ })
71
+ }),
72
+ /*#__PURE__*/ _jsx(Grid, {
73
+ size: {
74
+ xs: 2.5,
75
+ md: 1.5
76
+ },
77
+ children: /*#__PURE__*/ _jsx(Operator, {
78
+ value: value.operator,
79
+ onChange: handleOperatorChange
80
+ })
81
+ }),
82
+ /*#__PURE__*/ _jsx(Grid, {
83
+ size: {
84
+ xs: 10,
85
+ md: 5
86
+ },
87
+ children: /*#__PURE__*/ _jsx(LabelValue, {
88
+ datasource: datasource,
89
+ value: value.labelValue,
90
+ labelName: value.labelName,
91
+ onChange: handleLabelValueChange
92
+ })
93
+ }),
94
+ /*#__PURE__*/ _jsx(Grid, {
95
+ size: {
96
+ xs: 2,
97
+ md: 1
98
+ },
99
+ children: /*#__PURE__*/ _jsx(DeleteFilterItem, {
100
+ onClick: handleDeleteClick
101
+ })
102
+ })
103
+ ]
104
+ })
72
105
  });
73
106
  }
74
107
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/FilterItem.tsx"],"sourcesContent":["// Copyright 2025 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 { ReactElement } from 'react';\nimport { Stack } from '@mui/material';\nimport { PyroscopeDatasourceSelector } from '../model';\nimport { LabelFilter, OperatorType } from '../utils/types';\nimport { LabelName } from './LabelName';\nimport { Operator } from './Operator';\nimport { LabelValue } from './LabelValue';\nimport { DeleteFilterItem } from './DeleteFilterItem';\n\nexport interface FilterItemProps {\n datasource: PyroscopeDatasourceSelector;\n value: LabelFilter;\n onChange?: (value: LabelFilter) => void;\n deleteItem?: () => void; // this function is used to delete the current filter\n}\n\nexport function FilterItem(props: FilterItemProps): ReactElement {\n const { datasource, value, onChange, deleteItem } = props;\n\n const handleLabelNameChange = (label: string) => {\n onChange?.({ labelName: label, labelValue: '', operator: value.operator });\n };\n\n const handleOperatorChange = (op: OperatorType) => {\n onChange?.({ labelName: value.labelName, labelValue: value.labelValue, operator: op });\n };\n\n const handleLabelValueChange = (val: string) => {\n onChange?.({ labelName: value.labelName, labelValue: val, operator: value.operator });\n };\n\n const handleDeleteClick = () => {\n deleteItem?.();\n };\n\n return (\n <Stack direction=\"row\" spacing={0} sx={{ flexWrap: 'wrap', maxWidth: '100%' }}>\n <LabelName datasource={datasource} value={value.labelName} onChange={handleLabelNameChange} />\n <Operator value={value.operator} onChange={handleOperatorChange} />\n <LabelValue\n datasource={datasource}\n value={value.labelValue}\n labelName={value.labelName}\n onChange={handleLabelValueChange}\n />\n <DeleteFilterItem onClick={handleDeleteClick} />\n </Stack>\n );\n}\n"],"names":["Stack","LabelName","Operator","LabelValue","DeleteFilterItem","FilterItem","props","datasource","value","onChange","deleteItem","handleLabelNameChange","label","labelName","labelValue","operator","handleOperatorChange","op","handleLabelValueChange","val","handleDeleteClick","direction","spacing","sx","flexWrap","maxWidth","onClick"],"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,KAAK,QAAQ,gBAAgB;AAGtC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,gBAAgB,QAAQ,qBAAqB;AAStD,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGJ;IAEpD,MAAMK,wBAAwB,CAACC;QAC7BH,WAAW;YAAEI,WAAWD;YAAOE,YAAY;YAAIC,UAAUP,MAAMO,QAAQ;QAAC;IAC1E;IAEA,MAAMC,uBAAuB,CAACC;QAC5BR,WAAW;YAAEI,WAAWL,MAAMK,SAAS;YAAEC,YAAYN,MAAMM,UAAU;YAAEC,UAAUE;QAAG;IACtF;IAEA,MAAMC,yBAAyB,CAACC;QAC9BV,WAAW;YAAEI,WAAWL,MAAMK,SAAS;YAAEC,YAAYK;YAAKJ,UAAUP,MAAMO,QAAQ;QAAC;IACrF;IAEA,MAAMK,oBAAoB;QACxBV;IACF;IAEA,qBACE,MAACV;QAAMqB,WAAU;QAAMC,SAAS;QAAGC,IAAI;YAAEC,UAAU;YAAQC,UAAU;QAAO;;0BAC1E,KAACxB;gBAAUM,YAAYA;gBAAYC,OAAOA,MAAMK,SAAS;gBAAEJ,UAAUE;;0BACrE,KAACT;gBAASM,OAAOA,MAAMO,QAAQ;gBAAEN,UAAUO;;0BAC3C,KAACb;gBACCI,YAAYA;gBACZC,OAAOA,MAAMM,UAAU;gBACvBD,WAAWL,MAAMK,SAAS;gBAC1BJ,UAAUS;;0BAEZ,KAACd;gBAAiBsB,SAASN;;;;AAGjC"}
1
+ {"version":3,"sources":["../../../src/components/FilterItem.tsx"],"sourcesContent":["// Copyright 2025 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 { ReactElement } from 'react';\nimport { Grid2 as Grid, Stack } from '@mui/material';\nimport { PyroscopeDatasourceSelector } from '../model';\nimport { LabelFilter, OperatorType } from '../utils/types';\nimport { LabelName } from './LabelName';\nimport { Operator } from './Operator';\nimport { LabelValue } from './LabelValue';\nimport { DeleteFilterItem } from './DeleteFilterItem';\n\nexport interface FilterItemProps {\n datasource: PyroscopeDatasourceSelector;\n value: LabelFilter;\n onChange?: (value: LabelFilter) => void;\n deleteItem?: () => void; // this function is used to delete the current filter\n}\n\nexport function FilterItem(props: FilterItemProps): ReactElement {\n const { datasource, value, onChange, deleteItem } = props;\n\n const handleLabelNameChange = (label: string) => {\n onChange?.({ labelName: label, labelValue: '', operator: value.operator });\n };\n\n const handleOperatorChange = (op: OperatorType) => {\n onChange?.({ labelName: value.labelName, labelValue: value.labelValue, operator: op });\n };\n\n const handleLabelValueChange = (val: string) => {\n onChange?.({ labelName: value.labelName, labelValue: val, operator: value.operator });\n };\n\n const handleDeleteClick = () => {\n deleteItem?.();\n };\n\n return (\n <Stack\n direction=\"row\"\n spacing={0}\n sx={(theme) => ({ flexWrap: 'wrap', width: 500, [theme.breakpoints.down('sm')]: { width: '100%' } })}\n >\n <Grid container sx={{ width: '100%' }}>\n <Grid size={{ xs: 9.5, md: 4.5 }}>\n <LabelName datasource={datasource} value={value.labelName} onChange={handleLabelNameChange} />\n </Grid>\n <Grid size={{ xs: 2.5, md: 1.5 }}>\n <Operator value={value.operator} onChange={handleOperatorChange} />\n </Grid>\n <Grid size={{ xs: 10, md: 5 }}>\n <LabelValue\n datasource={datasource}\n value={value.labelValue}\n labelName={value.labelName}\n onChange={handleLabelValueChange}\n />\n </Grid>\n <Grid size={{ xs: 2, md: 1 }}>\n <DeleteFilterItem onClick={handleDeleteClick} />\n </Grid>\n </Grid>\n </Stack>\n );\n}\n"],"names":["Grid2","Grid","Stack","LabelName","Operator","LabelValue","DeleteFilterItem","FilterItem","props","datasource","value","onChange","deleteItem","handleLabelNameChange","label","labelName","labelValue","operator","handleOperatorChange","op","handleLabelValueChange","val","handleDeleteClick","direction","spacing","sx","theme","flexWrap","width","breakpoints","down","container","size","xs","md","onClick"],"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,SAASC,IAAI,EAAEC,KAAK,QAAQ,gBAAgB;AAGrD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,gBAAgB,QAAQ,qBAAqB;AAStD,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGJ;IAEpD,MAAMK,wBAAwB,CAACC;QAC7BH,WAAW;YAAEI,WAAWD;YAAOE,YAAY;YAAIC,UAAUP,MAAMO,QAAQ;QAAC;IAC1E;IAEA,MAAMC,uBAAuB,CAACC;QAC5BR,WAAW;YAAEI,WAAWL,MAAMK,SAAS;YAAEC,YAAYN,MAAMM,UAAU;YAAEC,UAAUE;QAAG;IACtF;IAEA,MAAMC,yBAAyB,CAACC;QAC9BV,WAAW;YAAEI,WAAWL,MAAMK,SAAS;YAAEC,YAAYK;YAAKJ,UAAUP,MAAMO,QAAQ;QAAC;IACrF;IAEA,MAAMK,oBAAoB;QACxBV;IACF;IAEA,qBACE,KAACV;QACCqB,WAAU;QACVC,SAAS;QACTC,IAAI,CAACC,QAAW,CAAA;gBAAEC,UAAU;gBAAQC,OAAO;gBAAK,CAACF,MAAMG,WAAW,CAACC,IAAI,CAAC,MAAM,EAAE;oBAAEF,OAAO;gBAAO;YAAE,CAAA;kBAElG,cAAA,MAAC3B;YAAK8B,SAAS;YAACN,IAAI;gBAAEG,OAAO;YAAO;;8BAClC,KAAC3B;oBAAK+B,MAAM;wBAAEC,IAAI;wBAAKC,IAAI;oBAAI;8BAC7B,cAAA,KAAC/B;wBAAUM,YAAYA;wBAAYC,OAAOA,MAAMK,SAAS;wBAAEJ,UAAUE;;;8BAEvE,KAACZ;oBAAK+B,MAAM;wBAAEC,IAAI;wBAAKC,IAAI;oBAAI;8BAC7B,cAAA,KAAC9B;wBAASM,OAAOA,MAAMO,QAAQ;wBAAEN,UAAUO;;;8BAE7C,KAACjB;oBAAK+B,MAAM;wBAAEC,IAAI;wBAAIC,IAAI;oBAAE;8BAC1B,cAAA,KAAC7B;wBACCI,YAAYA;wBACZC,OAAOA,MAAMM,UAAU;wBACvBD,WAAWL,MAAMK,SAAS;wBAC1BJ,UAAUS;;;8BAGd,KAACnB;oBAAK+B,MAAM;wBAAEC,IAAI;wBAAGC,IAAI;oBAAE;8BACzB,cAAA,KAAC5B;wBAAiB6B,SAASb;;;;;;AAKrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"LabelName.d.ts","sourceRoot":"","sources":["../../../src/components/LabelName.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGvD,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,2BAA2B,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAiC7D"}
1
+ {"version":3,"file":"LabelName.d.ts","sourceRoot":"","sources":["../../../src/components/LabelName.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGvD,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,2BAA2B,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CAoC7D"}
@@ -11,40 +11,42 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
- import { Select, MenuItem, CircularProgress, Stack } from '@mui/material';
14
+ import { useMemo } from 'react';
15
+ import { TextField, Autocomplete } from '@mui/material';
15
16
  import { useLabelNames, filterLabelNamesOptions } from '../utils/use-query';
16
17
  export function LabelName(props) {
17
18
  const { datasource, value, onChange } = props;
18
19
  const { data: labelNamesOptions, isLoading: isLabelNamesOptionsLoading } = useLabelNames(datasource);
19
- return /*#__PURE__*/ _jsx(Select, {
20
- sx: {
21
- borderTopRightRadius: '0',
22
- borderBottomRightRadius: '0'
23
- },
20
+ const filteredLabelNamesOptions = useMemo(()=>filterLabelNamesOptions(labelNamesOptions?.names ?? []), [
21
+ labelNamesOptions
22
+ ]);
23
+ return /*#__PURE__*/ _jsx(Autocomplete, {
24
+ disableClearable: true,
25
+ options: filteredLabelNamesOptions,
24
26
  value: value,
25
- size: "small",
26
- onChange: (event)=>onChange?.(event.target.value),
27
- displayEmpty: true,
28
- renderValue: (selected)=>{
29
- if (selected === '') {
30
- return 'Select label name';
31
- }
32
- return selected;
27
+ sx: (theme)=>({
28
+ width: '100%',
29
+ '& .MuiOutlinedInput-root': {
30
+ borderTopRightRadius: 0,
31
+ borderBottomRightRadius: 0,
32
+ [theme.breakpoints.down('sm')]: {
33
+ borderBottomLeftRadius: 0
34
+ }
35
+ }
36
+ }),
37
+ loading: isLabelNamesOptionsLoading,
38
+ renderInput: (params)=>{
39
+ return /*#__PURE__*/ _jsx(TextField, {
40
+ ...params,
41
+ placeholder: "Select label name",
42
+ size: "small"
43
+ });
33
44
  },
34
- children: isLabelNamesOptionsLoading ? /*#__PURE__*/ _jsx(Stack, {
35
- width: "100%",
36
- sx: {
37
- alignItems: 'center',
38
- justifyContent: 'center'
39
- },
40
- children: /*#__PURE__*/ _jsx(CircularProgress, {
41
- color: "inherit",
42
- size: 20
43
- })
44
- }) : labelNamesOptions?.names && filterLabelNamesOptions(labelNamesOptions?.names).map((labelName)=>/*#__PURE__*/ _jsx(MenuItem, {
45
- value: labelName,
46
- children: labelName
47
- }, labelName))
45
+ onChange: (_event, newValue)=>{
46
+ if (newValue !== null) {
47
+ onChange?.(newValue);
48
+ }
49
+ }
48
50
  });
49
51
  }
50
52