@perses-dev/pyroscope-plugin 0.2.0 → 0.3.1

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 (62) hide show
  1. package/__mf/js/Pyroscope.83a074ec.js +6 -0
  2. package/__mf/js/async/{5358.40b9537e.js → 3105.1ab1c855.js} +5 -5
  3. package/__mf/js/async/{4368.2d817d5d.js → 4368.e6685ebf.js} +2 -2
  4. package/__mf/js/async/4778.c791e281.js +1 -0
  5. package/__mf/js/async/5135.ae4df243.js +1 -0
  6. package/__mf/js/async/5207.04f840e4.js +2 -0
  7. package/__mf/js/async/677.58650020.js +1 -0
  8. package/__mf/js/async/{__federation_expose_PyroscopeExplorer.88d5e4fb.js → __federation_expose_PyroscopeExplorer.d2e8d27c.js} +2 -2
  9. package/__mf/js/async/__federation_expose_PyroscopeProfileQuery.e8a6e53f.js +2 -0
  10. package/__mf/js/main.3f9c055c.js +6 -0
  11. package/lib/cjs/components/DeleteFilterItem.js +9 -4
  12. package/lib/cjs/components/FilterItem.js +57 -24
  13. package/lib/cjs/components/LabelName.js +29 -27
  14. package/lib/cjs/components/LabelValue.js +26 -27
  15. package/lib/cjs/components/Operator.js +7 -3
  16. package/lib/cjs/components/ProfileTypeSelector.js +1 -2
  17. package/lib/cjs/components/Service.js +20 -24
  18. package/lib/cjs/explore/PyroscopeExplorer.js +2 -1
  19. package/lib/cjs/plugins/pyroscope-profile-query/PyroscopeProfileQueryEditor.js +21 -12
  20. package/lib/components/DeleteFilterItem.d.ts.map +1 -1
  21. package/lib/components/DeleteFilterItem.js +9 -4
  22. package/lib/components/DeleteFilterItem.js.map +1 -1
  23. package/lib/components/FilterItem.d.ts.map +1 -1
  24. package/lib/components/FilterItem.js +58 -25
  25. package/lib/components/FilterItem.js.map +1 -1
  26. package/lib/components/LabelName.d.ts.map +1 -1
  27. package/lib/components/LabelName.js +30 -28
  28. package/lib/components/LabelName.js.map +1 -1
  29. package/lib/components/LabelValue.d.ts.map +1 -1
  30. package/lib/components/LabelValue.js +27 -28
  31. package/lib/components/LabelValue.js.map +1 -1
  32. package/lib/components/Operator.d.ts.map +1 -1
  33. package/lib/components/Operator.js +7 -3
  34. package/lib/components/Operator.js.map +1 -1
  35. package/lib/components/ProfileTypeSelector.js +1 -2
  36. package/lib/components/ProfileTypeSelector.js.map +1 -1
  37. package/lib/components/Service.d.ts.map +1 -1
  38. package/lib/components/Service.js +21 -25
  39. package/lib/components/Service.js.map +1 -1
  40. package/lib/explore/PyroscopeExplorer.d.ts.map +1 -1
  41. package/lib/explore/PyroscopeExplorer.js +2 -1
  42. package/lib/explore/PyroscopeExplorer.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 +23 -23
  47. package/mf-stats.json +23 -23
  48. package/package.json +1 -1
  49. package/__mf/js/Pyroscope.24cb38f3.js +0 -5
  50. package/__mf/js/async/1339.e58b309f.js +0 -1
  51. package/__mf/js/async/424.edb69d58.js +0 -1
  52. package/__mf/js/async/5215.6fd5cc14.js +0 -1
  53. package/__mf/js/async/9633.a7997138.js +0 -2
  54. package/__mf/js/async/__federation_expose_PyroscopeProfileQuery.75c9c11b.js +0 -2
  55. package/__mf/js/main.4caf1064.js +0 -5
  56. /package/__mf/css/async/{1339.6763d50b.css → 2341.6763d50b.css} +0 -0
  57. /package/__mf/css/async/{9633.6763d50b.css → 5207.6763d50b.css} +0 -0
  58. /package/__mf/js/async/{5358.40b9537e.js.LICENSE.txt → 3105.1ab1c855.js.LICENSE.txt} +0 -0
  59. /package/__mf/js/async/{4368.2d817d5d.js.LICENSE.txt → 4368.e6685ebf.js.LICENSE.txt} +0 -0
  60. /package/__mf/js/async/{9633.a7997138.js.LICENSE.txt → 5207.04f840e4.js.LICENSE.txt} +0 -0
  61. /package/__mf/js/async/{__federation_expose_PyroscopeExplorer.88d5e4fb.js.LICENSE.txt → __federation_expose_PyroscopeExplorer.d2e8d27c.js.LICENSE.txt} +0 -0
  62. /package/__mf/js/async/{__federation_expose_PyroscopeProfileQuery.75c9c11b.js.LICENSE.txt → __federation_expose_PyroscopeProfileQuery.e8a6e53f.js.LICENSE.txt} +0 -0
@@ -30,7 +30,8 @@ const initialSpec = {
30
30
  showSettings: true,
31
31
  showSeries: true,
32
32
  showTable: true,
33
- showFlameGraph: true
33
+ showFlameGraph: true,
34
+ traceHeight: 25
34
35
  };
35
36
  function FlameGraphPanel({ queries }) {
36
37
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.Panel, {
@@ -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
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/LabelName.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 { Select, MenuItem, CircularProgress, Stack } from '@mui/material';\nimport { PyroscopeDatasourceSelector } from '../model';\nimport { useLabelNames, filterLabelNamesOptions } from '../utils/use-query';\n\nexport interface LabelNameProps {\n datasource: PyroscopeDatasourceSelector;\n value: string;\n onChange?(value: string): void;\n}\n\nexport function LabelName(props: LabelNameProps): ReactElement {\n const { datasource, value, onChange } = props;\n\n const { data: labelNamesOptions, isLoading: isLabelNamesOptionsLoading } = useLabelNames(datasource);\n\n return (\n <Select\n sx={{ borderTopRightRadius: '0', borderBottomRightRadius: '0' }}\n value={value}\n size=\"small\"\n onChange={(event) => onChange?.(event.target.value)}\n displayEmpty\n renderValue={(selected) => {\n if (selected === '') {\n return 'Select label name';\n }\n return selected;\n }}\n >\n {isLabelNamesOptionsLoading ? (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress color=\"inherit\" size={20} />\n </Stack>\n ) : (\n labelNamesOptions?.names &&\n filterLabelNamesOptions(labelNamesOptions?.names).map((labelName) => (\n <MenuItem key={labelName} value={labelName}>\n {labelName}\n </MenuItem>\n ))\n )}\n </Select>\n );\n}\n"],"names":["Select","MenuItem","CircularProgress","Stack","useLabelNames","filterLabelNamesOptions","LabelName","props","datasource","value","onChange","data","labelNamesOptions","isLoading","isLabelNamesOptionsLoading","sx","borderTopRightRadius","borderBottomRightRadius","size","event","target","displayEmpty","renderValue","selected","width","alignItems","justifyContent","color","names","map","labelName"],"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,MAAM,EAAEC,QAAQ,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ,gBAAgB;AAE1E,SAASC,aAAa,EAAEC,uBAAuB,QAAQ,qBAAqB;AAQ5E,OAAO,SAASC,UAAUC,KAAqB;IAC7C,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGH;IAExC,MAAM,EAAEI,MAAMC,iBAAiB,EAAEC,WAAWC,0BAA0B,EAAE,GAAGV,cAAcI;IAEzF,qBACE,KAACR;QACCe,IAAI;YAAEC,sBAAsB;YAAKC,yBAAyB;QAAI;QAC9DR,OAAOA;QACPS,MAAK;QACLR,UAAU,CAACS,QAAUT,WAAWS,MAAMC,MAAM,CAACX,KAAK;QAClDY,YAAY;QACZC,aAAa,CAACC;YACZ,IAAIA,aAAa,IAAI;gBACnB,OAAO;YACT;YACA,OAAOA;QACT;kBAECT,2CACC,KAACX;YAAMqB,OAAM;YAAOT,IAAI;gBAAEU,YAAY;gBAAUC,gBAAgB;YAAS;sBACvE,cAAA,KAACxB;gBAAiByB,OAAM;gBAAUT,MAAM;;aAG1CN,mBAAmBgB,SACnBvB,wBAAwBO,mBAAmBgB,OAAOC,GAAG,CAAC,CAACC,0BACrD,KAAC7B;gBAAyBQ,OAAOqB;0BAC9BA;eADYA;;AAOzB"}
1
+ {"version":3,"sources":["../../../src/components/LabelName.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, useMemo } from 'react';\nimport { TextField, Autocomplete } from '@mui/material';\nimport { PyroscopeDatasourceSelector } from '../model';\nimport { useLabelNames, filterLabelNamesOptions } from '../utils/use-query';\n\nexport interface LabelNameProps {\n datasource: PyroscopeDatasourceSelector;\n value: string;\n onChange?(value: string): void;\n}\n\nexport function LabelName(props: LabelNameProps): ReactElement {\n const { datasource, value, onChange } = props;\n\n const { data: labelNamesOptions, isLoading: isLabelNamesOptionsLoading } = useLabelNames(datasource);\n\n const filteredLabelNamesOptions = useMemo(\n () => filterLabelNamesOptions(labelNamesOptions?.names ?? []),\n [labelNamesOptions]\n );\n\n return (\n <Autocomplete\n disableClearable\n options={filteredLabelNamesOptions}\n value={value}\n sx={(theme) => ({\n width: '100%',\n '& .MuiOutlinedInput-root': {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n [theme.breakpoints.down('sm')]: {\n borderBottomLeftRadius: 0,\n },\n },\n })}\n loading={isLabelNamesOptionsLoading}\n renderInput={(params) => {\n return <TextField {...params} placeholder=\"Select label name\" size=\"small\" />;\n }}\n onChange={(_event, newValue) => {\n if (newValue !== null) {\n onChange?.(newValue);\n }\n }}\n />\n );\n}\n"],"names":["useMemo","TextField","Autocomplete","useLabelNames","filterLabelNamesOptions","LabelName","props","datasource","value","onChange","data","labelNamesOptions","isLoading","isLabelNamesOptionsLoading","filteredLabelNamesOptions","names","disableClearable","options","sx","theme","width","borderTopRightRadius","borderBottomRightRadius","breakpoints","down","borderBottomLeftRadius","loading","renderInput","params","placeholder","size","_event","newValue"],"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;;AAEjC,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,SAAS,EAAEC,YAAY,QAAQ,gBAAgB;AAExD,SAASC,aAAa,EAAEC,uBAAuB,QAAQ,qBAAqB;AAQ5E,OAAO,SAASC,UAAUC,KAAqB;IAC7C,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGH;IAExC,MAAM,EAAEI,MAAMC,iBAAiB,EAAEC,WAAWC,0BAA0B,EAAE,GAAGV,cAAcI;IAEzF,MAAMO,4BAA4Bd,QAChC,IAAMI,wBAAwBO,mBAAmBI,SAAS,EAAE,GAC5D;QAACJ;KAAkB;IAGrB,qBACE,KAACT;QACCc,gBAAgB;QAChBC,SAASH;QACTN,OAAOA;QACPU,IAAI,CAACC,QAAW,CAAA;gBACdC,OAAO;gBACP,4BAA4B;oBAC1BC,sBAAsB;oBACtBC,yBAAyB;oBACzB,CAACH,MAAMI,WAAW,CAACC,IAAI,CAAC,MAAM,EAAE;wBAC9BC,wBAAwB;oBAC1B;gBACF;YACF,CAAA;QACAC,SAASb;QACTc,aAAa,CAACC;YACZ,qBAAO,KAAC3B;gBAAW,GAAG2B,MAAM;gBAAEC,aAAY;gBAAoBC,MAAK;;QACrE;QACArB,UAAU,CAACsB,QAAQC;YACjB,IAAIA,aAAa,MAAM;gBACrBvB,WAAWuB;YACb;QACF;;AAGN"}
@@ -1 +1 @@
1
- {"version":3,"file":"LabelValue.d.ts","sourceRoot":"","sources":["../../../src/components/LabelValue.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGvD,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,2BAA2B,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAkC/D"}
1
+ {"version":3,"file":"LabelValue.d.ts","sourceRoot":"","sources":["../../../src/components/LabelValue.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGvD,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,2BAA2B,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAgC/D"}
@@ -11,40 +11,39 @@
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 { TextField, Autocomplete } from '@mui/material';
15
15
  import { useLabelValues } from '../utils/use-query';
16
16
  export function LabelValue(props) {
17
17
  const { datasource, value, labelName, onChange } = props;
18
18
  const { data: labelValuesOptions, isLoading: isLabelValuesOptionsLoading } = useLabelValues(datasource, labelName);
19
- return /*#__PURE__*/ _jsx(Select, {
20
- sx: {
21
- borderRadius: '0'
22
- },
19
+ return /*#__PURE__*/ _jsx(Autocomplete, {
20
+ freeSolo: true,
21
+ disableClearable: true,
22
+ options: labelValuesOptions?.names ?? [],
23
23
  value: value,
24
- size: "small",
25
- onChange: (event)=>onChange?.(event.target.value),
26
- displayEmpty: true,
27
- disabled: !labelName || labelName === '',
28
- renderValue: (selected)=>{
29
- if (selected === '') {
30
- return 'Select label value';
31
- }
32
- return selected;
24
+ sx: (theme)=>({
25
+ width: '100%',
26
+ '& .MuiOutlinedInput-root': {
27
+ borderRadius: 0,
28
+ width: '100%',
29
+ [theme.breakpoints.down('sm')]: {
30
+ borderBottomLeftRadius: 4
31
+ }
32
+ }
33
+ }),
34
+ loading: isLabelValuesOptionsLoading,
35
+ renderInput: (params)=>{
36
+ return /*#__PURE__*/ _jsx(TextField, {
37
+ ...params,
38
+ placeholder: "Select label value",
39
+ size: "small"
40
+ });
33
41
  },
34
- children: isLabelValuesOptionsLoading ? /*#__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
- }) : labelValuesOptions?.names && labelValuesOptions?.names.map((labelValue)=>/*#__PURE__*/ _jsx(MenuItem, {
45
- value: labelValue,
46
- children: labelValue
47
- }, labelValue))
42
+ onChange: (_event, newInputValue)=>{
43
+ if (newInputValue !== null) {
44
+ onChange?.(newInputValue);
45
+ }
46
+ }
48
47
  });
49
48
  }
50
49
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/LabelValue.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 { Select, MenuItem, CircularProgress, Stack } from '@mui/material';\nimport { PyroscopeDatasourceSelector } from '../model';\nimport { useLabelValues } from '../utils/use-query';\n\nexport interface LabelValueProps {\n datasource: PyroscopeDatasourceSelector;\n value: string;\n labelName: string;\n onChange?(value: string): void;\n}\n\nexport function LabelValue(props: LabelValueProps): ReactElement {\n const { datasource, value, labelName, onChange } = props;\n\n const { data: labelValuesOptions, isLoading: isLabelValuesOptionsLoading } = useLabelValues(datasource, labelName);\n\n return (\n <Select\n sx={{ borderRadius: '0' }}\n value={value}\n size=\"small\"\n onChange={(event) => onChange?.(event.target.value)}\n displayEmpty\n disabled={!labelName || labelName === ''} // Disabled if labelName is not defined yet\n renderValue={(selected) => {\n if (selected === '') {\n return 'Select label value';\n }\n return selected;\n }}\n >\n {isLabelValuesOptionsLoading ? (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress color=\"inherit\" size={20} />\n </Stack>\n ) : (\n labelValuesOptions?.names &&\n labelValuesOptions?.names.map((labelValue) => (\n <MenuItem key={labelValue} value={labelValue}>\n {labelValue}\n </MenuItem>\n ))\n )}\n </Select>\n );\n}\n"],"names":["Select","MenuItem","CircularProgress","Stack","useLabelValues","LabelValue","props","datasource","value","labelName","onChange","data","labelValuesOptions","isLoading","isLabelValuesOptionsLoading","sx","borderRadius","size","event","target","displayEmpty","disabled","renderValue","selected","width","alignItems","justifyContent","color","names","map","labelValue"],"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,MAAM,EAAEC,QAAQ,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ,gBAAgB;AAE1E,SAASC,cAAc,QAAQ,qBAAqB;AASpD,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGJ;IAEnD,MAAM,EAAEK,MAAMC,kBAAkB,EAAEC,WAAWC,2BAA2B,EAAE,GAAGV,eAAeG,YAAYE;IAExG,qBACE,KAACT;QACCe,IAAI;YAAEC,cAAc;QAAI;QACxBR,OAAOA;QACPS,MAAK;QACLP,UAAU,CAACQ,QAAUR,WAAWQ,MAAMC,MAAM,CAACX,KAAK;QAClDY,YAAY;QACZC,UAAU,CAACZ,aAAaA,cAAc;QACtCa,aAAa,CAACC;YACZ,IAAIA,aAAa,IAAI;gBACnB,OAAO;YACT;YACA,OAAOA;QACT;kBAECT,4CACC,KAACX;YAAMqB,OAAM;YAAOT,IAAI;gBAAEU,YAAY;gBAAUC,gBAAgB;YAAS;sBACvE,cAAA,KAACxB;gBAAiByB,OAAM;gBAAUV,MAAM;;aAG1CL,oBAAoBgB,SACpBhB,oBAAoBgB,MAAMC,IAAI,CAACC,2BAC7B,KAAC7B;gBAA0BO,OAAOsB;0BAC/BA;eADYA;;AAOzB"}
1
+ {"version":3,"sources":["../../../src/components/LabelValue.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 { TextField, Autocomplete } from '@mui/material';\nimport { PyroscopeDatasourceSelector } from '../model';\nimport { useLabelValues } from '../utils/use-query';\n\nexport interface LabelValueProps {\n datasource: PyroscopeDatasourceSelector;\n value: string;\n labelName: string;\n onChange?(value: string): void;\n}\n\nexport function LabelValue(props: LabelValueProps): ReactElement {\n const { datasource, value, labelName, onChange } = props;\n\n const { data: labelValuesOptions, isLoading: isLabelValuesOptionsLoading } = useLabelValues(datasource, labelName);\n\n return (\n <Autocomplete\n freeSolo\n disableClearable\n options={labelValuesOptions?.names ?? []}\n value={value}\n sx={(theme) => ({\n width: '100%',\n '& .MuiOutlinedInput-root': {\n borderRadius: 0,\n width: '100%',\n [theme.breakpoints.down('sm')]: {\n borderBottomLeftRadius: 4,\n },\n },\n })}\n loading={isLabelValuesOptionsLoading}\n renderInput={(params) => {\n return <TextField {...params} placeholder=\"Select label value\" size=\"small\" />;\n }}\n onChange={(_event, newInputValue) => {\n if (newInputValue !== null) {\n onChange?.(newInputValue);\n }\n }}\n />\n );\n}\n"],"names":["TextField","Autocomplete","useLabelValues","LabelValue","props","datasource","value","labelName","onChange","data","labelValuesOptions","isLoading","isLabelValuesOptionsLoading","freeSolo","disableClearable","options","names","sx","theme","width","borderRadius","breakpoints","down","borderBottomLeftRadius","loading","renderInput","params","placeholder","size","_event","newInputValue"],"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,SAAS,EAAEC,YAAY,QAAQ,gBAAgB;AAExD,SAASC,cAAc,QAAQ,qBAAqB;AASpD,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGJ;IAEnD,MAAM,EAAEK,MAAMC,kBAAkB,EAAEC,WAAWC,2BAA2B,EAAE,GAAGV,eAAeG,YAAYE;IAExG,qBACE,KAACN;QACCY,QAAQ;QACRC,gBAAgB;QAChBC,SAASL,oBAAoBM,SAAS,EAAE;QACxCV,OAAOA;QACPW,IAAI,CAACC,QAAW,CAAA;gBACdC,OAAO;gBACP,4BAA4B;oBAC1BC,cAAc;oBACdD,OAAO;oBACP,CAACD,MAAMG,WAAW,CAACC,IAAI,CAAC,MAAM,EAAE;wBAC9BC,wBAAwB;oBAC1B;gBACF;YACF,CAAA;QACAC,SAASZ;QACTa,aAAa,CAACC;YACZ,qBAAO,KAAC1B;gBAAW,GAAG0B,MAAM;gBAAEC,aAAY;gBAAqBC,MAAK;;QACtE;QACApB,UAAU,CAACqB,QAAQC;YACjB,IAAIA,kBAAkB,MAAM;gBAC1BtB,WAAWsB;YACb;QACF;;AAGN"}
@@ -1 +1 @@
1
- {"version":3,"file":"Operator.d.ts","sourceRoot":"","sources":["../../../src/components/Operator.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAc3D"}
1
+ {"version":3,"file":"Operator.d.ts","sourceRoot":"","sources":["../../../src/components/Operator.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAyB3D"}
@@ -21,9 +21,13 @@ export function Operator(props) {
21
21
  '!~'
22
22
  ];
23
23
  return /*#__PURE__*/ _jsx(Select, {
24
- sx: {
25
- borderRadius: '0'
26
- },
24
+ sx: (theme)=>({
25
+ borderRadius: 0,
26
+ width: '100%',
27
+ [theme.breakpoints.down('sm')]: {
28
+ borderTopRightRadius: 4
29
+ }
30
+ }),
27
31
  value: value,
28
32
  size: "small",
29
33
  onChange: (event)=>onChange?.(event.target.value),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Operator.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 { Select, MenuItem } from '@mui/material';\n\nexport interface OperatorProps {\n value: string;\n onChange?(value: string): void;\n}\n\nexport function Operator(props: OperatorProps): ReactElement {\n const { value, onChange } = props;\n\n const operators = ['=', '!=', '=~', '!~'];\n\n return (\n <Select sx={{ borderRadius: '0' }} value={value} size=\"small\" onChange={(event) => onChange?.(event.target.value)}>\n {operators.map((op) => (\n <MenuItem key={op} value={op}>\n {op}\n </MenuItem>\n ))}\n </Select>\n );\n}\n"],"names":["Select","MenuItem","Operator","props","value","onChange","operators","sx","borderRadius","size","event","target","map","op"],"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,MAAM,EAAEC,QAAQ,QAAQ,gBAAgB;AAOjD,OAAO,SAASC,SAASC,KAAoB;IAC3C,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;IAE5B,MAAMG,YAAY;QAAC;QAAK;QAAM;QAAM;KAAK;IAEzC,qBACE,KAACN;QAAOO,IAAI;YAAEC,cAAc;QAAI;QAAGJ,OAAOA;QAAOK,MAAK;QAAQJ,UAAU,CAACK,QAAUL,WAAWK,MAAMC,MAAM,CAACP,KAAK;kBAC7GE,UAAUM,GAAG,CAAC,CAACC,mBACd,KAACZ;gBAAkBG,OAAOS;0BACvBA;eADYA;;AAMvB"}
1
+ {"version":3,"sources":["../../../src/components/Operator.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 { Select, MenuItem } from '@mui/material';\n\nexport interface OperatorProps {\n value: string;\n onChange?(value: string): void;\n}\n\nexport function Operator(props: OperatorProps): ReactElement {\n const { value, onChange } = props;\n\n const operators = ['=', '!=', '=~', '!~'];\n\n return (\n <Select\n sx={(theme) => ({\n borderRadius: 0,\n width: '100%',\n [theme.breakpoints.down('sm')]: {\n borderTopRightRadius: 4,\n },\n })}\n value={value}\n size=\"small\"\n onChange={(event) => onChange?.(event.target.value)}\n >\n {operators.map((op) => (\n <MenuItem key={op} value={op}>\n {op}\n </MenuItem>\n ))}\n </Select>\n );\n}\n"],"names":["Select","MenuItem","Operator","props","value","onChange","operators","sx","theme","borderRadius","width","breakpoints","down","borderTopRightRadius","size","event","target","map","op"],"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,MAAM,EAAEC,QAAQ,QAAQ,gBAAgB;AAOjD,OAAO,SAASC,SAASC,KAAoB;IAC3C,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;IAE5B,MAAMG,YAAY;QAAC;QAAK;QAAM;QAAM;KAAK;IAEzC,qBACE,KAACN;QACCO,IAAI,CAACC,QAAW,CAAA;gBACdC,cAAc;gBACdC,OAAO;gBACP,CAACF,MAAMG,WAAW,CAACC,IAAI,CAAC,MAAM,EAAE;oBAC9BC,sBAAsB;gBACxB;YACF,CAAA;QACAT,OAAOA;QACPU,MAAK;QACLT,UAAU,CAACU,QAAUV,WAAWU,MAAMC,MAAM,CAACZ,KAAK;kBAEjDE,UAAUW,GAAG,CAAC,CAACC,mBACd,KAACjB;gBAAkBG,OAAOc;0BACvBA;eADYA;;AAMvB"}
@@ -19,8 +19,7 @@ export function ProfileTypeSelector(props) {
19
19
  return /*#__PURE__*/ _jsx(Stack, {
20
20
  position: "relative",
21
21
  sx: {
22
- flexGrow: 1,
23
- maxWidth: '100%'
22
+ width: '100%'
24
23
  },
25
24
  children: /*#__PURE__*/ _jsx(TextField, {
26
25
  select: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ProfileTypeSelector.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, TextField, MenuItem, CircularProgress } from '@mui/material';\nimport { PyroscopeDatasourceSelector } from '../model';\nimport { useProfileTypes } from '../utils/use-query';\n\nexport interface ProfileTypeSelectorProps {\n datasource: PyroscopeDatasourceSelector;\n value: string;\n onChange?(value: string): void;\n}\n\nexport function ProfileTypeSelector(props: ProfileTypeSelectorProps): ReactElement {\n const { datasource, value, onChange } = props;\n\n const { data: profileTypesOptions, isLoading: isProfileTypesOptionsLoading } = useProfileTypes(datasource);\n\n return (\n <Stack position=\"relative\" sx={{ flexGrow: 1, maxWidth: '100%' }}>\n <TextField\n select\n label=\"Profile Type\"\n value={value}\n size=\"small\"\n onChange={(event) => onChange?.(event.target.value)}\n >\n {isProfileTypesOptionsLoading ? (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress color=\"inherit\" size={20} />\n </Stack>\n ) : (\n profileTypesOptions?.profileTypes &&\n profileTypesOptions?.profileTypes.map((type) => (\n <MenuItem key={type.ID} value={type.ID}>\n {type.name + '/' + type.sampleType}\n </MenuItem>\n ))\n )}\n </TextField>\n </Stack>\n );\n}\n"],"names":["Stack","TextField","MenuItem","CircularProgress","useProfileTypes","ProfileTypeSelector","props","datasource","value","onChange","data","profileTypesOptions","isLoading","isProfileTypesOptionsLoading","position","sx","flexGrow","maxWidth","select","label","size","event","target","width","alignItems","justifyContent","color","profileTypes","map","type","ID","name","sampleType"],"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,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,gBAAgB,QAAQ,gBAAgB;AAE7E,SAASC,eAAe,QAAQ,qBAAqB;AAQrD,OAAO,SAASC,oBAAoBC,KAA+B;IACjE,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGH;IAExC,MAAM,EAAEI,MAAMC,mBAAmB,EAAEC,WAAWC,4BAA4B,EAAE,GAAGT,gBAAgBG;IAE/F,qBACE,KAACP;QAAMc,UAAS;QAAWC,IAAI;YAAEC,UAAU;YAAGC,UAAU;QAAO;kBAC7D,cAAA,KAAChB;YACCiB,MAAM;YACNC,OAAM;YACNX,OAAOA;YACPY,MAAK;YACLX,UAAU,CAACY,QAAUZ,WAAWY,MAAMC,MAAM,CAACd,KAAK;sBAEjDK,6CACC,KAACb;gBAAMuB,OAAM;gBAAOR,IAAI;oBAAES,YAAY;oBAAUC,gBAAgB;gBAAS;0BACvE,cAAA,KAACtB;oBAAiBuB,OAAM;oBAAUN,MAAM;;iBAG1CT,qBAAqBgB,gBACrBhB,qBAAqBgB,aAAaC,IAAI,CAACC,qBACrC,KAAC3B;oBAAuBM,OAAOqB,KAAKC,EAAE;8BACnCD,KAAKE,IAAI,GAAG,MAAMF,KAAKG,UAAU;mBADrBH,KAAKC,EAAE;;;AAQlC"}
1
+ {"version":3,"sources":["../../../src/components/ProfileTypeSelector.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, TextField, MenuItem, CircularProgress } from '@mui/material';\nimport { PyroscopeDatasourceSelector } from '../model';\nimport { useProfileTypes } from '../utils/use-query';\n\nexport interface ProfileTypeSelectorProps {\n datasource: PyroscopeDatasourceSelector;\n value: string;\n onChange?(value: string): void;\n}\n\nexport function ProfileTypeSelector(props: ProfileTypeSelectorProps): ReactElement {\n const { datasource, value, onChange } = props;\n\n const { data: profileTypesOptions, isLoading: isProfileTypesOptionsLoading } = useProfileTypes(datasource);\n\n return (\n <Stack position=\"relative\" sx={{ width: '100%' }}>\n <TextField\n select\n label=\"Profile Type\"\n value={value}\n size=\"small\"\n onChange={(event) => onChange?.(event.target.value)}\n >\n {isProfileTypesOptionsLoading ? (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress color=\"inherit\" size={20} />\n </Stack>\n ) : (\n profileTypesOptions?.profileTypes &&\n profileTypesOptions?.profileTypes.map((type) => (\n <MenuItem key={type.ID} value={type.ID}>\n {type.name + '/' + type.sampleType}\n </MenuItem>\n ))\n )}\n </TextField>\n </Stack>\n );\n}\n"],"names":["Stack","TextField","MenuItem","CircularProgress","useProfileTypes","ProfileTypeSelector","props","datasource","value","onChange","data","profileTypesOptions","isLoading","isProfileTypesOptionsLoading","position","sx","width","select","label","size","event","target","alignItems","justifyContent","color","profileTypes","map","type","ID","name","sampleType"],"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,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,gBAAgB,QAAQ,gBAAgB;AAE7E,SAASC,eAAe,QAAQ,qBAAqB;AAQrD,OAAO,SAASC,oBAAoBC,KAA+B;IACjE,MAAM,EAAEC,UAAU,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGH;IAExC,MAAM,EAAEI,MAAMC,mBAAmB,EAAEC,WAAWC,4BAA4B,EAAE,GAAGT,gBAAgBG;IAE/F,qBACE,KAACP;QAAMc,UAAS;QAAWC,IAAI;YAAEC,OAAO;QAAO;kBAC7C,cAAA,KAACf;YACCgB,MAAM;YACNC,OAAM;YACNV,OAAOA;YACPW,MAAK;YACLV,UAAU,CAACW,QAAUX,WAAWW,MAAMC,MAAM,CAACb,KAAK;sBAEjDK,6CACC,KAACb;gBAAMgB,OAAM;gBAAOD,IAAI;oBAAEO,YAAY;oBAAUC,gBAAgB;gBAAS;0BACvE,cAAA,KAACpB;oBAAiBqB,OAAM;oBAAUL,MAAM;;iBAG1CR,qBAAqBc,gBACrBd,qBAAqBc,aAAaC,IAAI,CAACC,qBACrC,KAACzB;oBAAuBM,OAAOmB,KAAKC,EAAE;8BACnCD,KAAKE,IAAI,GAAG,MAAMF,KAAKG,UAAU;mBADrBH,KAAKC,EAAE;;;AAQlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../../../src/components/Service.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGvD,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,2BAA2B,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAgCzD"}
1
+ {"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../../../src/components/Service.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAkB,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGvD,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,2BAA2B,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CA8BzD"}
@@ -11,40 +11,36 @@
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 { Stack, TextField, MenuItem, CircularProgress, useTheme } from '@mui/material';
14
+ import { Stack, TextField, Autocomplete } from '@mui/material';
15
15
  import { useServices } from '../utils/use-query';
16
16
  export function Service(props) {
17
17
  const { datasource, value, onChange } = props;
18
18
  const { data: servicesOptions, isLoading: isServicesOptionsLoading } = useServices(datasource);
19
+ function handleServiceChange(_event, newValue) {
20
+ if (newValue !== null) {
21
+ onChange?.(newValue);
22
+ }
23
+ }
19
24
  return /*#__PURE__*/ _jsx(Stack, {
20
25
  position: "relative",
21
26
  sx: {
22
- flexGrow: 1,
23
- maxWidth: '100%',
24
- [useTheme().breakpoints.down('sm')]: {
25
- width: '100%'
26
- }
27
+ width: '100%'
27
28
  },
28
- children: /*#__PURE__*/ _jsx(TextField, {
29
- select: true,
30
- label: "Service",
29
+ children: /*#__PURE__*/ _jsx(Autocomplete, {
30
+ options: servicesOptions?.names ?? [],
31
31
  value: value,
32
- size: "small",
33
- onChange: (event)=>onChange?.(event.target.value),
34
- children: isServicesOptionsLoading ? /*#__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
- }) : servicesOptions?.names && servicesOptions?.names.map((service)=>/*#__PURE__*/ _jsx(MenuItem, {
45
- value: service,
46
- children: service
47
- }, service))
32
+ sx: {
33
+ minWidth: 200
34
+ },
35
+ loading: isServicesOptionsLoading,
36
+ renderInput: (params)=>{
37
+ return /*#__PURE__*/ _jsx(TextField, {
38
+ ...params,
39
+ label: "Service",
40
+ size: "small"
41
+ });
42
+ },
43
+ onChange: handleServiceChange
48
44
  })
49
45
  });
50
46
  }