@perses-dev/plugin-system 0.54.0-beta.7 → 0.54.0-beta.9

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 (68) hide show
  1. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +3 -3
  2. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +8 -22
  3. package/dist/cjs/components/Annotations/constants.js +23 -0
  4. package/dist/cjs/components/Annotations/index.js +1 -0
  5. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +97 -12
  6. package/dist/cjs/components/MultiQueryEditor/index.js +1 -0
  7. package/dist/cjs/components/MultiQueryEditor/utils.js +36 -0
  8. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +3 -6
  9. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +21 -28
  10. package/dist/cjs/runtime/DataQueriesProvider/model.js +3 -119
  11. package/dist/cjs/runtime/index.js +0 -1
  12. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -1
  13. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +1 -1
  14. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -1
  15. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -1
  16. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +8 -22
  17. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -1
  18. package/dist/components/Annotations/constants.d.ts +2 -0
  19. package/dist/components/Annotations/constants.d.ts.map +1 -0
  20. package/dist/{runtime/QueryCountProvider.js → components/Annotations/constants.js} +2 -13
  21. package/dist/components/Annotations/constants.js.map +1 -0
  22. package/dist/components/Annotations/index.d.ts +1 -0
  23. package/dist/components/Annotations/index.d.ts.map +1 -1
  24. package/dist/components/Annotations/index.js +1 -0
  25. package/dist/components/Annotations/index.js.map +1 -1
  26. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +1 -1
  27. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  28. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +1 -1
  29. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  30. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
  31. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +99 -14
  32. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  33. package/dist/components/MultiQueryEditor/index.d.ts +1 -0
  34. package/dist/components/MultiQueryEditor/index.d.ts.map +1 -1
  35. package/dist/components/MultiQueryEditor/index.js +1 -0
  36. package/dist/components/MultiQueryEditor/index.js.map +1 -1
  37. package/dist/components/MultiQueryEditor/utils.d.ts +8 -0
  38. package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -0
  39. package/dist/components/MultiQueryEditor/utils.js +23 -0
  40. package/dist/components/MultiQueryEditor/utils.js.map +1 -0
  41. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  42. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +4 -7
  43. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  44. package/dist/model/annotations.d.ts +1 -1
  45. package/dist/model/annotations.d.ts.map +1 -1
  46. package/dist/model/annotations.js.map +1 -1
  47. package/dist/model/log-queries.d.ts +2 -1
  48. package/dist/model/log-queries.d.ts.map +1 -1
  49. package/dist/model/log-queries.js.map +1 -1
  50. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  51. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +22 -29
  52. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  53. package/dist/runtime/DataQueriesProvider/model.d.ts +4 -4
  54. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  55. package/dist/runtime/DataQueriesProvider/model.js +0 -108
  56. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  57. package/dist/runtime/index.d.ts +0 -1
  58. package/dist/runtime/index.d.ts.map +1 -1
  59. package/dist/runtime/index.js +0 -1
  60. package/dist/runtime/index.js.map +1 -1
  61. package/dist/runtime/plugin-registry.d.ts +1 -2
  62. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  63. package/dist/runtime/plugin-registry.js.map +1 -1
  64. package/package.json +5 -5
  65. package/dist/cjs/runtime/QueryCountProvider.js +0 -83
  66. package/dist/runtime/QueryCountProvider.d.ts +0 -9
  67. package/dist/runtime/QueryCountProvider.d.ts.map +0 -1
  68. package/dist/runtime/QueryCountProvider.js.map +0 -1
@@ -12,14 +12,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  import { produce } from 'immer';
15
- import { Stack, IconButton, Typography, Box, CircularProgress } from '@mui/material';
15
+ import { Stack, IconButton, Typography, Box, CircularProgress, TextField, InputAdornment } from '@mui/material';
16
16
  import DeleteIcon from 'mdi-material-ui/DeleteOutline';
17
17
  import ChevronDown from 'mdi-material-ui/ChevronDown';
18
18
  import ChevronRight from 'mdi-material-ui/ChevronRight';
19
- import { forwardRef } from 'react';
19
+ import { forwardRef, useState } from 'react';
20
20
  import AlertIcon from 'mdi-material-ui/Alert';
21
21
  import { InfoTooltip } from '@perses-dev/components';
22
+ import PencilIcon from 'mdi-material-ui/Pencil';
23
+ import CheckIcon from 'mdi-material-ui/Check';
24
+ import CloseIcon from 'mdi-material-ui/Close';
22
25
  import { PluginEditor } from '../PluginEditor';
26
+ import { defaultQueryName } from './utils';
23
27
  /**
24
28
  * Container for a query editor. This component is responsible for rendering the query editor, and make it collapsible
25
29
  * to not take too much space.
@@ -33,6 +37,16 @@ import { PluginEditor } from '../PluginEditor';
33
37
  * @constructor
34
38
  */ export const QueryEditorContainer = /*#__PURE__*/ forwardRef((props, ref)=>{
35
39
  const { queryTypes, index, query, queryResult, filteredQueryPlugins, isCollapsed, onDelete, onChange, onQueryRun, onCollapseExpand } = props;
40
+ // The displayed name is always derived from props so it stays in sync with the
41
+ // current query/index, even when queries are added, removed or reordered.
42
+ const displayedName = query.spec.name ?? defaultQueryName(index);
43
+ const [isEditingName, setIsEditingName] = useState(false);
44
+ function handleNameSave(name) {
45
+ setIsEditingName(false);
46
+ onChange(index, produce(query, (draft)=>{
47
+ draft.spec.name = name;
48
+ }));
49
+ }
36
50
  return /*#__PURE__*/ _jsxs(Stack, {
37
51
  spacing: 1,
38
52
  children: [
@@ -45,19 +59,40 @@ import { PluginEditor } from '../PluginEditor';
45
59
  children: [
46
60
  /*#__PURE__*/ _jsxs(Stack, {
47
61
  direction: "row",
62
+ gap: 1,
63
+ sx: {
64
+ width: '100%'
65
+ },
48
66
  children: [
49
67
  /*#__PURE__*/ _jsx(IconButton, {
50
68
  size: "small",
69
+ sx: {
70
+ width: 'fit-content',
71
+ height: 'fit-content'
72
+ },
51
73
  onClick: ()=>onCollapseExpand(index),
52
74
  children: isCollapsed ? /*#__PURE__*/ _jsx(ChevronRight, {}) : /*#__PURE__*/ _jsx(ChevronDown, {})
53
75
  }),
54
- /*#__PURE__*/ _jsxs(Typography, {
55
- variant: "overline",
56
- component: "h4",
57
- children: [
58
- "Query #",
59
- index + 1
60
- ]
76
+ /*#__PURE__*/ _jsx(Stack, {
77
+ direction: "row",
78
+ gap: 1,
79
+ alignItems: "center",
80
+ alignContent: "center",
81
+ sx: {
82
+ width: '100%',
83
+ '&:hover button': {
84
+ visibility: 'visible'
85
+ }
86
+ },
87
+ children: isEditingName ? /*#__PURE__*/ _jsx(QueryNameInput, {
88
+ initialName: displayedName,
89
+ onSave: handleNameSave,
90
+ onCancel: ()=>setIsEditingName(false)
91
+ }, displayedName) : /*#__PURE__*/ _jsx(Typography, {
92
+ variant: "overline",
93
+ component: "h4",
94
+ children: displayedName
95
+ })
61
96
  })
62
97
  ]
63
98
  }),
@@ -101,11 +136,24 @@ import { PluginEditor } from '../PluginEditor';
101
136
  ]
102
137
  })
103
138
  }),
104
- onDelete && /*#__PURE__*/ _jsx(IconButton, {
105
- "aria-label": "delete query",
106
- size: "small",
107
- onClick: ()=>onDelete && onDelete(index),
108
- children: /*#__PURE__*/ _jsx(DeleteIcon, {})
139
+ /*#__PURE__*/ _jsxs(Stack, {
140
+ direction: "row",
141
+ children: [
142
+ !isEditingName && /*#__PURE__*/ _jsx(IconButton, {
143
+ "aria-label": "edit query name",
144
+ size: "small",
145
+ onClick: ()=>setIsEditingName(true),
146
+ children: /*#__PURE__*/ _jsx(PencilIcon, {
147
+ fontSize: "small"
148
+ })
149
+ }),
150
+ onDelete && /*#__PURE__*/ _jsx(IconButton, {
151
+ "aria-label": "delete query",
152
+ size: "small",
153
+ onClick: ()=>onDelete && onDelete(index),
154
+ children: /*#__PURE__*/ _jsx(DeleteIcon, {})
155
+ })
156
+ ]
109
157
  })
110
158
  ]
111
159
  })
@@ -123,6 +171,43 @@ import { PluginEditor } from '../PluginEditor';
123
171
  }, index);
124
172
  });
125
173
  QueryEditorContainer.displayName = 'QueryEditorContainer';
174
+ /**
175
+ * Self-contained input to edit a query name. The draft value is local state seeded from
176
+ * `initialName`; callers reset it by changing the `key` (remounting) rather than syncing
177
+ * with an useEffect.
178
+ */ function QueryNameInput({ initialName, onSave, onCancel }) {
179
+ const [draftName, setDraftName] = useState(initialName);
180
+ return /*#__PURE__*/ _jsx(TextField, {
181
+ size: "small",
182
+ variant: "outlined",
183
+ label: "Query name",
184
+ "aria-label": "query name",
185
+ value: draftName,
186
+ onChange: (e)=>setDraftName(e.target.value),
187
+ fullWidth: true,
188
+ InputProps: {
189
+ endAdornment: /*#__PURE__*/ _jsxs(InputAdornment, {
190
+ position: "end",
191
+ children: [
192
+ /*#__PURE__*/ _jsx(IconButton, {
193
+ size: "small",
194
+ "aria-label": "cancel edit",
195
+ onClick: onCancel,
196
+ edge: "end",
197
+ children: /*#__PURE__*/ _jsx(CloseIcon, {})
198
+ }),
199
+ /*#__PURE__*/ _jsx(IconButton, {
200
+ size: "small",
201
+ "aria-label": "save query name",
202
+ onClick: ()=>onSave(draftName),
203
+ edge: "end",
204
+ children: /*#__PURE__*/ _jsx(CheckIcon, {})
205
+ })
206
+ ]
207
+ })
208
+ }
209
+ });
210
+ }
126
211
  /**
127
212
  * Editor for a query definition. This component is responsible for rendering the plugin editor for the given query.
128
213
  * This will allow user to select a plugin extending from the given supported query types, and then edit the plugin
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MultiQueryEditor/QueryEditorContainer.tsx"],"sourcesContent":["// Copyright 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 { produce } from 'immer';\nimport { QueryDefinition, QueryPluginType } from '@perses-dev/spec';\nimport { Stack, IconButton, Typography, BoxProps, Box, CircularProgress } from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport { forwardRef, ReactElement } from 'react';\nimport AlertIcon from 'mdi-material-ui/Alert';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { QueryData } from '../../runtime';\nimport { PluginEditor, PluginEditorProps, PluginEditorRef } from '../PluginEditor';\n\n/**\n * Properties for {@link QueryEditorContainer}\n */\ninterface QueryEditorContainerProps {\n queryTypes: QueryPluginType[];\n index: number;\n query: QueryDefinition;\n queryResult?: QueryData;\n filteredQueryPlugins?: string[];\n onChange: (index: number, query: QueryDefinition) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n onCollapseExpand: (index: number) => void;\n isCollapsed?: boolean;\n onDelete?: (index: number) => void;\n}\n\n/**\n * Container for a query editor. This component is responsible for rendering the query editor, and make it collapsible\n * to not take too much space.\n * @param queryTypes the supported query types\n * @param index the index of the query in the list\n * @param query the query definition\n * @param isCollapsed whether the query editor is collapsed or not\n * @param onDelete callback when the query is deleted\n * @param onChange callback when the query is changed\n * @param onCollapseExpand callback when the query is collapsed or expanded\n * @constructor\n */\n\nexport const QueryEditorContainer = forwardRef<PluginEditorRef, QueryEditorContainerProps>(\n (props, ref): ReactElement => {\n const {\n queryTypes,\n index,\n query,\n queryResult,\n filteredQueryPlugins,\n isCollapsed,\n onDelete,\n onChange,\n onQueryRun,\n onCollapseExpand,\n } = props;\n return (\n <Stack key={index} spacing={1}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderBottom={1}\n borderColor={(theme) => theme.palette.divider}\n >\n <Stack direction=\"row\">\n <IconButton size=\"small\" onClick={() => onCollapseExpand(index)}>\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\">\n Query #{index + 1}\n </Typography>\n </Stack>\n <Stack direction=\"row\" alignItems=\"center\">\n {queryResult?.isFetching && <CircularProgress aria-label=\"loading\" size=\"1.125rem\" />}\n {queryResult?.error && (\n <InfoTooltip description={queryResult.error.message}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n >\n <IconButton\n aria-label=\"query error\"\n size=\"small\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n >\n <AlertIcon />\n </IconButton>\n <Typography\n sx={{\n maxWidth: 300,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n '&:hover ::after': { content: '\"Click to copy\"' },\n }}\n >\n {queryResult.error.message}\n </Typography>\n </Stack>\n </InfoTooltip>\n )}\n {onDelete && (\n <IconButton aria-label=\"delete query\" size=\"small\" onClick={() => onDelete && onDelete(index)}>\n <DeleteIcon />\n </IconButton>\n )}\n </Stack>\n </Stack>\n {!isCollapsed && (\n <QueryEditor\n ref={ref}\n queryTypes={queryTypes}\n value={query}\n filteredQueryPlugins={filteredQueryPlugins}\n onChange={(next) => onChange(index, next)}\n onQueryRun={() => onQueryRun(index, query)}\n />\n )}\n </Stack>\n );\n }\n);\n\nQueryEditorContainer.displayName = 'QueryEditorContainer';\n\n// Props on MUI Box that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\ninterface QueryEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n queryTypes: QueryPluginType[];\n value: QueryDefinition;\n filteredQueryPlugins?: string[];\n onChange: (next: QueryDefinition) => void;\n onQueryRun: () => void;\n}\n\n/**\n * Editor for a query definition. This component is responsible for rendering the plugin editor for the given query.\n * This will allow user to select a plugin extending from the given supported query types, and then edit the plugin\n * spec for this plugin.\n * @param props\n * @constructor\n */\n\nconst QueryEditor = forwardRef<PluginEditorRef, QueryEditorProps>((props, ref): ReactElement => {\n const { queryTypes, value, filteredQueryPlugins, onChange, onQueryRun, ...others } = props;\n\n const handlePluginChange: PluginEditorProps['onChange'] = (next) => {\n onChange(\n produce(value, (draft) => {\n draft.kind = next.selection.type;\n draft.spec.plugin.kind = next.selection.kind;\n draft.spec.plugin.spec = next.spec;\n })\n );\n };\n\n return (\n <Box {...others}>\n <PluginEditor\n ref={ref}\n pluginTypes={queryTypes}\n pluginKindLabel=\"Query Type\"\n value={{\n selection: {\n kind: value.spec.plugin.kind,\n type: value.kind,\n },\n spec: value.spec.plugin.spec,\n }}\n filteredQueryPlugins={filteredQueryPlugins}\n withRunQueryButton\n onRunQuery={onQueryRun}\n onChange={handlePluginChange}\n />\n </Box>\n );\n});\n\nQueryEditor.displayName = 'QueryEditor';\n"],"names":["produce","Stack","IconButton","Typography","Box","CircularProgress","DeleteIcon","ChevronDown","ChevronRight","forwardRef","AlertIcon","InfoTooltip","PluginEditor","QueryEditorContainer","props","ref","queryTypes","index","query","queryResult","filteredQueryPlugins","isCollapsed","onDelete","onChange","onQueryRun","onCollapseExpand","spacing","direction","alignItems","justifyContent","borderBottom","borderColor","theme","palette","divider","size","onClick","variant","component","isFetching","aria-label","error","description","message","sx","color","main","maxWidth","whiteSpace","overflow","textOverflow","content","QueryEditor","value","next","displayName","others","handlePluginChange","draft","kind","selection","type","spec","plugin","pluginTypes","pluginKindLabel","withRunQueryButton","onRunQuery"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,OAAO,QAAQ,QAAQ;AAEhC,SAASC,KAAK,EAAEC,UAAU,EAAEC,UAAU,EAAYC,GAAG,EAAEC,gBAAgB,QAAQ,gBAAgB;AAC/F,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,kBAAkB,+BAA+B;AACxD,SAASC,UAAU,QAAsB,QAAQ;AACjD,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,YAAY,QAA4C,kBAAkB;AAkBnF;;;;;;;;;;;CAWC,GAED,OAAO,MAAMC,qCAAuBJ,WAClC,CAACK,OAAOC;IACN,MAAM,EACJC,UAAU,EACVC,KAAK,EACLC,KAAK,EACLC,WAAW,EACXC,oBAAoB,EACpBC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,gBAAgB,EACjB,GAAGX;IACJ,qBACE,MAACb;QAAkByB,SAAS;;0BAC1B,MAACzB;gBACC0B,WAAU;gBACVC,YAAW;gBACXC,gBAAe;gBACfC,cAAc;gBACdC,aAAa,CAACC,QAAUA,MAAMC,OAAO,CAACC,OAAO;;kCA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8C,CAACK,OAAOC;IACxE,MAAM,EAAEC,UAAU,EAAEqC,KAAK,EAAEjC,oBAAoB,EAAEG,QAAQ,EAAEC,UAAU,EAAE,GAAGgC,QAAQ,GAAG1C;IAErF,MAAM2C,qBAAoD,CAACH;QACzD/B,SACEvB,QAAQqD,OAAO,CAACK;YACdA,MAAMC,IAAI,GAAGL,KAAKM,SAAS,CAACC,IAAI;YAChCH,MAAMI,IAAI,CAACC,MAAM,CAACJ,IAAI,GAAGL,KAAKM,SAAS,CAACD,IAAI;YAC5CD,MAAMI,IAAI,CAACC,MAAM,CAACD,IAAI,GAAGR,KAAKQ,IAAI;QACpC;IAEJ;IAEA,qBACE,KAAC1D;QAAK,GAAGoD,MAAM;kBACb,cAAA,KAAC5C;YACCG,KAAKA;YACLiD,aAAahD;YACbiD,iBAAgB;YAChBZ,OAAO;gBACLO,WAAW;oBACTD,MAAMN,MAAMS,IAAI,CAACC,MAAM,CAACJ,IAAI;oBAC5BE,MAAMR,MAAMM,IAAI;gBAClB;gBACAG,MAAMT,MAAMS,IAAI,CAACC,MAAM,CAACD,IAAI;YAC9B;YACA1C,sBAAsBA;YACtB8C,kBAAkB;YAClBC,YAAY3C;YACZD,UAAUkC;;;AAIlB;AAEAL,YAAYG,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../src/components/MultiQueryEditor/QueryEditorContainer.tsx"],"sourcesContent":["// Copyright 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 { produce } from 'immer';\nimport { QueryDefinition, QueryPluginType } from '@perses-dev/spec';\nimport {\n Stack,\n IconButton,\n Typography,\n BoxProps,\n Box,\n CircularProgress,\n TextField,\n InputAdornment,\n} from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport { forwardRef, ReactElement, useState } from 'react';\nimport AlertIcon from 'mdi-material-ui/Alert';\nimport { InfoTooltip } from '@perses-dev/components';\nimport PencilIcon from 'mdi-material-ui/Pencil';\nimport CheckIcon from 'mdi-material-ui/Check';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { QueryData } from '../../runtime';\nimport { PluginEditor, PluginEditorProps, PluginEditorRef } from '../PluginEditor';\nimport { defaultQueryName } from './utils';\n\n/**\n * Properties for {@link QueryEditorContainer}\n */\ninterface QueryEditorContainerProps {\n queryTypes: QueryPluginType[];\n index: number;\n query: QueryDefinition;\n queryResult?: QueryData;\n filteredQueryPlugins?: string[];\n onChange: (index: number, query: QueryDefinition) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n onCollapseExpand: (index: number) => void;\n isCollapsed?: boolean;\n onDelete?: (index: number) => void;\n}\n\n/**\n * Container for a query editor. This component is responsible for rendering the query editor, and make it collapsible\n * to not take too much space.\n * @param queryTypes the supported query types\n * @param index the index of the query in the list\n * @param query the query definition\n * @param isCollapsed whether the query editor is collapsed or not\n * @param onDelete callback when the query is deleted\n * @param onChange callback when the query is changed\n * @param onCollapseExpand callback when the query is collapsed or expanded\n * @constructor\n */\n\nexport const QueryEditorContainer = forwardRef<PluginEditorRef, QueryEditorContainerProps>(\n (props, ref): ReactElement => {\n const {\n queryTypes,\n index,\n query,\n queryResult,\n filteredQueryPlugins,\n isCollapsed,\n onDelete,\n onChange,\n onQueryRun,\n onCollapseExpand,\n } = props;\n\n // The displayed name is always derived from props so it stays in sync with the\n // current query/index, even when queries are added, removed or reordered.\n const displayedName = query.spec.name ?? defaultQueryName(index);\n\n const [isEditingName, setIsEditingName] = useState(false);\n\n function handleNameSave(name: string): void {\n setIsEditingName(false);\n onChange(\n index,\n produce(query, (draft) => {\n draft.spec.name = name;\n })\n );\n }\n\n return (\n <Stack key={index} spacing={1}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderBottom={1}\n borderColor={(theme) => theme.palette.divider}\n >\n <Stack direction=\"row\" gap={1} sx={{ width: '100%' }}>\n <IconButton\n size=\"small\"\n sx={{ width: 'fit-content', height: 'fit-content' }}\n onClick={() => onCollapseExpand(index)}\n >\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Stack\n direction=\"row\"\n gap={1}\n alignItems=\"center\"\n alignContent=\"center\"\n sx={{\n width: '100%',\n '&:hover button': {\n visibility: 'visible',\n },\n }}\n >\n {isEditingName ? (\n <QueryNameInput\n // Remounting on identity change resets the draft so editing always\n // targets the currently displayed query.\n key={displayedName}\n initialName={displayedName}\n onSave={handleNameSave}\n onCancel={() => setIsEditingName(false)}\n />\n ) : (\n <Typography variant=\"overline\" component=\"h4\">\n {displayedName}\n </Typography>\n )}\n </Stack>\n </Stack>\n <Stack direction=\"row\" alignItems=\"center\">\n {queryResult?.isFetching && <CircularProgress aria-label=\"loading\" size=\"1.125rem\" />}\n {queryResult?.error && (\n <InfoTooltip description={queryResult.error.message}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n >\n <IconButton\n aria-label=\"query error\"\n size=\"small\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n >\n <AlertIcon />\n </IconButton>\n <Typography\n sx={{\n maxWidth: 300,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n '&:hover ::after': { content: '\"Click to copy\"' },\n }}\n >\n {queryResult.error.message}\n </Typography>\n </Stack>\n </InfoTooltip>\n )}\n <Stack direction=\"row\">\n {!isEditingName && (\n <IconButton aria-label=\"edit query name\" size=\"small\" onClick={() => setIsEditingName(true)}>\n <PencilIcon fontSize=\"small\" />\n </IconButton>\n )}\n {onDelete && (\n <IconButton aria-label=\"delete query\" size=\"small\" onClick={() => onDelete && onDelete(index)}>\n <DeleteIcon />\n </IconButton>\n )}\n </Stack>\n </Stack>\n </Stack>\n {!isCollapsed && (\n <QueryEditor\n ref={ref}\n queryTypes={queryTypes}\n value={query}\n filteredQueryPlugins={filteredQueryPlugins}\n onChange={(next) => onChange(index, next)}\n onQueryRun={() => onQueryRun(index, query)}\n />\n )}\n </Stack>\n );\n }\n);\n\nQueryEditorContainer.displayName = 'QueryEditorContainer';\n\n/**\n * Properties for {@link QueryNameInput}\n */\ninterface QueryNameInputProps {\n initialName: string;\n onSave: (name: string) => void;\n onCancel: () => void;\n}\n\n/**\n * Self-contained input to edit a query name. The draft value is local state seeded from\n * `initialName`; callers reset it by changing the `key` (remounting) rather than syncing\n * with an useEffect.\n */\nfunction QueryNameInput({ initialName, onSave, onCancel }: QueryNameInputProps): ReactElement {\n const [draftName, setDraftName] = useState(initialName);\n\n return (\n <TextField\n size=\"small\"\n variant=\"outlined\"\n label=\"Query name\"\n aria-label=\"query name\"\n value={draftName}\n onChange={(e) => setDraftName(e.target.value)}\n fullWidth={true}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton size=\"small\" aria-label=\"cancel edit\" onClick={onCancel} edge=\"end\">\n <CloseIcon />\n </IconButton>\n <IconButton size=\"small\" aria-label=\"save query name\" onClick={() => onSave(draftName)} edge=\"end\">\n <CheckIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n );\n}\n\n// Props on MUI Box that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\ninterface QueryEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n queryTypes: QueryPluginType[];\n value: QueryDefinition;\n filteredQueryPlugins?: string[];\n onChange: (next: QueryDefinition) => void;\n onQueryRun: () => void;\n}\n\n/**\n * Editor for a query definition. This component is responsible for rendering the plugin editor for the given query.\n * This will allow user to select a plugin extending from the given supported query types, and then edit the plugin\n * spec for this plugin.\n * @param props\n * @constructor\n */\n\nconst QueryEditor = forwardRef<PluginEditorRef, QueryEditorProps>((props, ref): ReactElement => {\n const { queryTypes, value, filteredQueryPlugins, onChange, onQueryRun, ...others } = props;\n\n const handlePluginChange: PluginEditorProps['onChange'] = (next) => {\n onChange(\n produce(value, (draft) => {\n draft.kind = next.selection.type;\n draft.spec.plugin.kind = next.selection.kind;\n draft.spec.plugin.spec = next.spec;\n })\n );\n };\n\n return (\n <Box {...others}>\n <PluginEditor\n ref={ref}\n pluginTypes={queryTypes}\n pluginKindLabel=\"Query Type\"\n value={{\n selection: {\n kind: value.spec.plugin.kind,\n type: value.kind,\n },\n spec: value.spec.plugin.spec,\n }}\n filteredQueryPlugins={filteredQueryPlugins}\n withRunQueryButton\n onRunQuery={onQueryRun}\n onChange={handlePluginChange}\n />\n </Box>\n );\n});\n\nQueryEditor.displayName = 'QueryEditor';\n"],"names":["produce","Stack","IconButton","Typography","Box","CircularProgress","TextField","InputAdornment","DeleteIcon","ChevronDown","ChevronRight","forwardRef","useState","AlertIcon","InfoTooltip","PencilIcon","CheckIcon","CloseIcon","PluginEditor","defaultQueryName","QueryEditorContainer","props","ref","queryTypes","index","query","queryResult","filteredQueryPlugins","isCollapsed","onDelete","onChange","onQueryRun","onCollapseExpand","displayedName","spec","name","isEditingName","setIsEditingName","handleNameSave","draft","spacing","direction","alignItems","justifyContent","borderBottom","borderColor","theme","palette","divider","gap","sx","width","size","height","onClick","alignContent","visibility","QueryNameInput","initialName","onSave","onCancel","variant","component","isFetching","aria-label","error","description","message","color","main","maxWidth","whiteSpace","overflow","textOverflow","content","fontSize","QueryEditor","value","next","displayName","draftName","setDraftName","label","e","target","fullWidth","InputProps","endAdornment","position","edge","others","handlePluginChange","kind","selection","type","plugin","pluginTypes","pluginKindLabel","withRunQueryButton","onRunQuery"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC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AQ,GAAGrE;IAErF,MAAMsE,qBAAoD,CAACb;QACzDhD,SACE9B,QAAQ6E,OAAO,CAACtC;YACdA,MAAMqD,IAAI,GAAGd,KAAKe,SAAS,CAACC,IAAI;YAChCvD,MAAML,IAAI,CAAC6D,MAAM,CAACH,IAAI,GAAGd,KAAKe,SAAS,CAACD,IAAI;YAC5CrD,MAAML,IAAI,CAAC6D,MAAM,CAAC7D,IAAI,GAAG4C,KAAK5C,IAAI;QACpC;IAEJ;IAEA,qBACE,KAAC9B;QAAK,GAAGsF,MAAM;kBACb,cAAA,KAACxE;YACCI,KAAKA;YACL0E,aAAazE;YACb0E,iBAAgB;YAChBpB,OAAO;gBACLgB,WAAW;oBACTD,MAAMf,MAAM3C,IAAI,CAAC6D,MAAM,CAACH,IAAI;oBAC5BE,MAAMjB,MAAMe,IAAI;gBAClB;gBACA1D,MAAM2C,MAAM3C,IAAI,CAAC6D,MAAM,CAAC7D,IAAI;YAC9B;YACAP,sBAAsBA;YACtBuE,kBAAkB;YAClBC,YAAYpE;YACZD,UAAU6D;;;AAIlB;AAEAf,YAAYG,WAAW,GAAG"}
@@ -1,2 +1,3 @@
1
1
  export * from './MultiQueryEditor';
2
+ export * from './utils';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MultiQueryEditor/index.tsx"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MultiQueryEditor/index.tsx"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
@@ -11,5 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export * from './MultiQueryEditor';
14
+ export * from './utils';
14
15
 
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MultiQueryEditor/index.tsx"],"sourcesContent":["// Copyright 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\nexport * from './MultiQueryEditor';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
1
+ {"version":3,"sources":["../../../src/components/MultiQueryEditor/index.tsx"],"sourcesContent":["// Copyright 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\nexport * from './MultiQueryEditor';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB;AACnC,cAAc,UAAU"}
@@ -0,0 +1,8 @@
1
+ import { QueryDefinition } from '@perses-dev/spec';
2
+ export declare function defaultQueryName(index: number): string;
3
+ /**
4
+ * Returns the display name of each query definition, falling back to a default
5
+ * name based on the query position when no explicit name is set.
6
+ */
7
+ export declare function generateQueryNames(definitions: QueryDefinition[]): string[];
8
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/MultiQueryEditor/utils.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAE3E"}
@@ -0,0 +1,23 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export function defaultQueryName(index) {
14
+ return `Query #${index + 1}`;
15
+ }
16
+ /**
17
+ * Returns the display name of each query definition, falling back to a default
18
+ * name based on the query position when no explicit name is set.
19
+ */ export function generateQueryNames(definitions) {
20
+ return definitions.map((queryDef, index)=>queryDef.spec.name ?? defaultQueryName(index));
21
+ }
22
+
23
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/MultiQueryEditor/utils.tsx"],"sourcesContent":["// Copyright 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 { QueryDefinition } from '@perses-dev/spec';\n\nexport function defaultQueryName(index: number): string {\n return `Query #${index + 1}`;\n}\n\n/**\n * Returns the display name of each query definition, falling back to a default\n * name based on the query position when no explicit name is set.\n */\nexport function generateQueryNames(definitions: QueryDefinition[]): string[] {\n return definitions.map((queryDef: QueryDefinition, index: number) => queryDef.spec.name ?? defaultQueryName(index));\n}\n"],"names":["defaultQueryName","index","generateQueryNames","definitions","map","queryDef","spec","name"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,SAASA,iBAAiBC,KAAa;IAC5C,OAAO,CAAC,OAAO,EAAEA,QAAQ,GAAG;AAC9B;AAEA;;;CAGC,GACD,OAAO,SAASC,mBAAmBC,WAA8B;IAC/D,OAAOA,YAAYC,GAAG,CAAC,CAACC,UAA2BJ,QAAkBI,SAASC,IAAI,CAACC,IAAI,IAAIP,iBAAiBC;AAC9G"}
@@ -1 +1 @@
1
- {"version":3,"file":"PanelSpecEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PanelSpecEditor/PanelSpecEditor.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,OAAO,EAAc,MAAM,iBAAiB,CAAC;AAMtD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACtD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5D,kBAAkB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,YAAY,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,eAAe,kHA0G1B,CAAC"}
1
+ {"version":3,"file":"PanelSpecEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PanelSpecEditor/PanelSpecEditor.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,OAAO,EAAc,MAAM,iBAAiB,CAAC;AAMtD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACtD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5D,kBAAkB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,YAAY,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,eAAe,kHAsG1B,CAAC"}
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { ErrorAlert, JSONEditor, LinksEditor } from '@perses-dev/components';
15
15
  import { Controller } from 'react-hook-form';
16
16
  import { forwardRef } from 'react';
17
- import { QueryCountProvider, useDataQueriesContext, usePlugin } from '../../runtime';
17
+ import { useDataQueriesContext, usePlugin } from '../../runtime';
18
18
  import { OptionsEditorTabs } from '../OptionsEditorTabs';
19
19
  import { MultiQueryEditor } from '../MultiQueryEditor';
20
20
  export const PanelSpecEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
@@ -99,12 +99,9 @@ export const PanelSpecEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
99
99
  })
100
100
  })
101
101
  });
102
- return /*#__PURE__*/ _jsx(QueryCountProvider, {
103
- queryCount: (panelDefinition.spec.queries ?? []).length,
104
- children: /*#__PURE__*/ _jsx(OptionsEditorTabs, {
105
- tabs: tabs
106
- }, tabs.length)
107
- });
102
+ return /*#__PURE__*/ _jsx(OptionsEditorTabs, {
103
+ tabs: tabs
104
+ }, tabs.length);
108
105
  });
109
106
  PanelSpecEditor.displayName = 'PanelSpecEditor';
110
107
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PanelSpecEditor/PanelSpecEditor.tsx"],"sourcesContent":["// Copyright 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 { ErrorAlert, JSONEditor, LinksEditor } from '@perses-dev/components';\nimport { PanelDefinition, PanelEditorValues, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport { Control, Controller } from 'react-hook-form';\nimport { forwardRef, ReactElement } from 'react';\nimport { QueryCountProvider, useDataQueriesContext, usePlugin } from '../../runtime';\nimport { PanelPlugin } from '../../model';\nimport { OptionsEditorTabsProps, OptionsEditorTabs } from '../OptionsEditorTabs';\nimport { MultiQueryEditor } from '../MultiQueryEditor';\nimport { PluginEditorRef } from '../PluginEditor';\n\nexport interface PanelSpecEditorProps {\n control: Control<PanelEditorValues>;\n panelDefinition: PanelDefinition;\n onQueriesChange: (queries: QueryDefinition[]) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n onPluginSpecChange: (spec: UnknownSpec) => void;\n onJSONChange: (panelDefinitionStr: string) => void;\n}\n\nexport const PanelSpecEditor = forwardRef<PluginEditorRef, PanelSpecEditorProps>((props, ref): ReactElement | null => {\n const { control, panelDefinition, onQueriesChange, onQueryRun, onPluginSpecChange, onJSONChange } = props;\n const { kind } = panelDefinition.spec.plugin;\n const { data: plugin, isLoading, error } = usePlugin('Panel', kind);\n\n const { queryResults } = useDataQueriesContext();\n\n if (error) {\n return <ErrorAlert error={error} />;\n }\n\n if (isLoading) {\n return null;\n }\n\n if (!plugin) {\n throw new Error(`Missing implementation for panel plugin with kind '${kind}'`);\n }\n\n const { panelOptionsEditorComponents, hideQueryEditor } = plugin as PanelPlugin;\n let tabs: OptionsEditorTabsProps['tabs'] = [];\n\n if (!hideQueryEditor) {\n tabs.push({\n label: 'Query',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.queries\"\n render={({ field }) => (\n <MultiQueryEditor\n ref={ref}\n queryTypes={plugin.supportedQueryTypes ?? []}\n queries={panelDefinition.spec.queries ?? []}\n queryResults={queryResults}\n onChange={(queries) => {\n field.onChange(queries);\n onQueriesChange(queries);\n }}\n onQueryRun={(index, query) => {\n onQueryRun(index, query);\n // If spec has not changed, refetch to update the data\n if (JSON.stringify(panelDefinition.spec.queries?.[index]) === JSON.stringify(query)) {\n queryResults[index]?.refetch?.();\n }\n }}\n />\n )}\n />\n ),\n });\n }\n\n if (panelOptionsEditorComponents) {\n tabs = tabs.concat(\n panelOptionsEditorComponents.map(({ label, content: OptionsEditorComponent }) => ({\n label,\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.plugin.spec\"\n render={({ field }) => (\n <OptionsEditorComponent\n value={panelDefinition.spec.plugin.spec}\n onChange={(spec) => {\n field.onChange(spec);\n onPluginSpecChange(spec);\n }}\n />\n )}\n />\n ),\n }))\n );\n }\n\n // always show json editor and links editor by default\n tabs.push({\n label: 'Links',\n content: <LinksEditor control={control} />,\n });\n tabs.push({\n label: 'JSON',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition\"\n render={({ field }) => (\n <JSONEditor\n maxHeight=\"80vh\"\n value={panelDefinition}\n onChange={(json) => {\n field.onChange(JSON.parse(json));\n onJSONChange(json);\n }}\n />\n )}\n />\n ),\n });\n\n return (\n <QueryCountProvider queryCount={(panelDefinition.spec.queries ?? []).length}>\n <OptionsEditorTabs key={tabs.length} tabs={tabs} />\n </QueryCountProvider>\n );\n});\n\nPanelSpecEditor.displayName = 'PanelSpecEditor';\n"],"names":["ErrorAlert","JSONEditor","LinksEditor","Controller","forwardRef","QueryCountProvider","useDataQueriesContext","usePlugin","OptionsEditorTabs","MultiQueryEditor","PanelSpecEditor","props","ref","control","panelDefinition","onQueriesChange","onQueryRun","onPluginSpecChange","onJSONChange","kind","spec","plugin","data","isLoading","error","queryResults","Error","panelOptionsEditorComponents","hideQueryEditor","tabs","push","label","content","name","render","field","queryTypes","supportedQueryTypes","queries","onChange","index","query","JSON","stringify","refetch","concat","map","OptionsEditorComponent","value","maxHeight","json","parse","queryCount","length","displayName"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,UAAU,EAAEC,UAAU,EAAEC,WAAW,QAAQ,yBAAyB;AAE7E,SAAkBC,UAAU,QAAQ,kBAAkB;AACtD,SAASC,UAAU,QAAsB,QAAQ;AACjD,SAASC,kBAAkB,EAAEC,qBAAqB,EAAEC,SAAS,QAAQ,gBAAgB;AAErF,SAAiCC,iBAAiB,QAAQ,uBAAuB;AACjF,SAASC,gBAAgB,QAAQ,sBAAsB;AAYvD,OAAO,MAAMC,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F;IAEA,IAAIjB,8BAA8B;QAChCE,OAAOA,KAAKgB,MAAM,CAChBlB,6BAA6BmB,GAAG,CAAC,CAAC,EAAEf,KAAK,EAAEC,SAASe,sBAAsB,EAAE,GAAM,CAAA;gBAChFhB;gBACAC,uBACE,KAAC7B;oBACCU,SAASA;oBACToB,MAAK;oBACLC,QAAQ,CAAC,EAAEC,KAAK,EAAE,iBAChB,KAACY;4BACCC,OAAOlC,gBAAgBM,IAAI,CAACC,MAAM,CAACD,IAAI;4BACvCmB,UAAU,CAACnB;gCACTe,MAAMI,QAAQ,CAACnB;gCACfH,mBAAmBG;4BACrB;;;YAKV,CAAA;IAEJ;IAEA,sDAAsD;IACtDS,KAAKC,IAAI,CAAC;QACRC,OAAO;QACPC,uBAAS,KAAC9B;YAAYW,SAASA;;IACjC;IACAgB,KAAKC,IAAI,CAAC;QACRC,OAAO;QACPC,uBACE,KAAC7B;YACCU,SAASA;YACToB,MAAK;YACLC,QAAQ,CAAC,EAAEC,KAAK,EAAE,iBAChB,KAAClC;oBACCgD,WAAU;oBACVD,OAAOlC;oBACPyB,UAAU,CAACW;wBACTf,MAAMI,QAAQ,CAACG,KAAKS,KAAK,CAACD;wBAC1BhC,aAAagC;oBACf;;;IAKV;IAEA,qBACE,KAAC7C;QAAmB+C,YAAY,AAACtC,CAAAA,gBAAgBM,IAAI,CAACkB,OAAO,IAAI,EAAE,AAAD,EAAGe,MAAM;kBACzE,cAAA,KAAC7C;YAAoCqB,MAAMA;WAAnBA,KAAKwB,MAAM;;AAGzC,GAAG;AAEH3C,gBAAgB4C,WAAW,GAAG"}
1
+ {"version":3,"sources":["../../../src/components/PanelSpecEditor/PanelSpecEditor.tsx"],"sourcesContent":["// Copyright 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 { ErrorAlert, JSONEditor, LinksEditor } from '@perses-dev/components';\nimport { PanelDefinition, PanelEditorValues, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport { Control, Controller } from 'react-hook-form';\nimport { forwardRef, ReactElement } from 'react';\nimport { useDataQueriesContext, usePlugin } from '../../runtime';\nimport { PanelPlugin } from '../../model';\nimport { OptionsEditorTabsProps, OptionsEditorTabs } from '../OptionsEditorTabs';\nimport { MultiQueryEditor } from '../MultiQueryEditor';\nimport { PluginEditorRef } from '../PluginEditor';\n\nexport interface PanelSpecEditorProps {\n control: Control<PanelEditorValues>;\n panelDefinition: PanelDefinition;\n onQueriesChange: (queries: QueryDefinition[]) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n onPluginSpecChange: (spec: UnknownSpec) => void;\n onJSONChange: (panelDefinitionStr: string) => void;\n}\n\nexport const PanelSpecEditor = forwardRef<PluginEditorRef, PanelSpecEditorProps>((props, ref): ReactElement | null => {\n const { control, panelDefinition, onQueriesChange, onQueryRun, onPluginSpecChange, onJSONChange } = props;\n const { kind } = panelDefinition.spec.plugin;\n const { data: plugin, isLoading, error } = usePlugin('Panel', kind);\n\n const { queryResults } = useDataQueriesContext();\n\n if (error) {\n return <ErrorAlert error={error} />;\n }\n\n if (isLoading) {\n return null;\n }\n\n if (!plugin) {\n throw new Error(`Missing implementation for panel plugin with kind '${kind}'`);\n }\n\n const { panelOptionsEditorComponents, hideQueryEditor } = plugin as PanelPlugin;\n let tabs: OptionsEditorTabsProps['tabs'] = [];\n\n if (!hideQueryEditor) {\n tabs.push({\n label: 'Query',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.queries\"\n render={({ field }) => (\n <MultiQueryEditor\n ref={ref}\n queryTypes={plugin.supportedQueryTypes ?? []}\n queries={panelDefinition.spec.queries ?? []}\n queryResults={queryResults}\n onChange={(queries) => {\n field.onChange(queries);\n onQueriesChange(queries);\n }}\n onQueryRun={(index, query) => {\n onQueryRun(index, query);\n // If spec has not changed, refetch to update the data\n if (JSON.stringify(panelDefinition.spec.queries?.[index]) === JSON.stringify(query)) {\n queryResults[index]?.refetch?.();\n }\n }}\n />\n )}\n />\n ),\n });\n }\n\n if (panelOptionsEditorComponents) {\n tabs = tabs.concat(\n panelOptionsEditorComponents.map(({ label, content: OptionsEditorComponent }) => ({\n label,\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.plugin.spec\"\n render={({ field }) => (\n <OptionsEditorComponent\n value={panelDefinition.spec.plugin.spec}\n onChange={(spec) => {\n field.onChange(spec);\n onPluginSpecChange(spec);\n }}\n />\n )}\n />\n ),\n }))\n );\n }\n\n // always show json editor and links editor by default\n tabs.push({\n label: 'Links',\n content: <LinksEditor control={control} />,\n });\n tabs.push({\n label: 'JSON',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition\"\n render={({ field }) => (\n <JSONEditor\n maxHeight=\"80vh\"\n value={panelDefinition}\n onChange={(json) => {\n field.onChange(JSON.parse(json));\n onJSONChange(json);\n }}\n />\n )}\n />\n ),\n });\n\n return <OptionsEditorTabs key={tabs.length} tabs={tabs} />;\n});\n\nPanelSpecEditor.displayName = 'PanelSpecEditor';\n"],"names":["ErrorAlert","JSONEditor","LinksEditor","Controller","forwardRef","useDataQueriesContext","usePlugin","OptionsEditorTabs","MultiQueryEditor","PanelSpecEditor","props","ref","control","panelDefinition","onQueriesChange","onQueryRun","onPluginSpecChange","onJSONChange","kind","spec","plugin","data","isLoading","error","queryResults","Error","panelOptionsEditorComponents","hideQueryEditor","tabs","push","label","content","name","render","field","queryTypes","supportedQueryTypes","queries","onChange","index","query","JSON","stringify","refetch","concat","map","OptionsEditorComponent","value","maxHeight","json","parse","length","displayName"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6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,GAAG"}
@@ -1,5 +1,5 @@
1
1
  import { AbsoluteTimeRange, AnnotationData, UnknownSpec } from '@perses-dev/spec';
2
- import { DatasourceStore, VariableStateMap } from '@perses-dev/plugin-system';
2
+ import { DatasourceStore, VariableStateMap } from '../runtime';
3
3
  import { Plugin } from './plugin-base';
4
4
  /**
5
5
  * An object containing all the dependencies of a AnnotationQuery.
@@ -1 +1 @@
1
- {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/model/annotations.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACxE,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAChH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,KAAK,iCAAiC,CAAC;CACvF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,aAAa,EAAE,gBAAgB,CAAC;CACjC"}
1
+ {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/model/annotations.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACxE,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAChH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,KAAK,iCAAiC,CAAC;CACvF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,aAAa,EAAE,gBAAgB,CAAC;CACjC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/annotations.ts"],"sourcesContent":["// Copyright 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 { AbsoluteTimeRange, AnnotationData, UnknownSpec } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '@perses-dev/plugin-system';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a AnnotationQuery.\n */\nexport type AnnotationQueryPluginDependencies = {\n /**\n * Returns a list of variables name this annotation query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running annotation queries.\n */\nexport interface AnnotationPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getAnnotationData: (spec: Spec, ctx: AnnotationContext, abortSignal?: AbortSignal) => Promise<AnnotationData[]>;\n dependsOn?: (spec: Spec, ctx: AnnotationContext) => AnnotationQueryPluginDependencies;\n}\n\n/**\n * Context available to AnnotationQuery plugins at runtime.\n */\nexport interface AnnotationContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC;;CAEC,GACD,WAIC"}
1
+ {"version":3,"sources":["../../src/model/annotations.ts"],"sourcesContent":["// Copyright 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 { AbsoluteTimeRange, AnnotationData, UnknownSpec } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a AnnotationQuery.\n */\nexport type AnnotationQueryPluginDependencies = {\n /**\n * Returns a list of variables name this annotation query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running annotation queries.\n */\nexport interface AnnotationPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getAnnotationData: (spec: Spec, ctx: AnnotationContext, abortSignal?: AbortSignal) => Promise<AnnotationData[]>;\n dependsOn?: (spec: Spec, ctx: AnnotationContext) => AnnotationQueryPluginDependencies;\n}\n\n/**\n * Context available to AnnotationQuery plugins at runtime.\n */\nexport interface AnnotationContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC;;CAEC,GACD,WAIC"}
@@ -1,5 +1,6 @@
1
1
  import { AbsoluteTimeRange, UnknownSpec, LogData, QueryDefinition } from '@perses-dev/spec';
2
- import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
2
+ import { DatasourceStore, VariableStateMap } from '../runtime';
3
+ import { Plugin } from './plugin-base';
3
4
  export interface LogQueryResult {
4
5
  logs: LogData;
5
6
  timeRange: AbsoluteTimeRange;
@@ -1 +1 @@
1
- {"version":3,"file":"log-queries.d.ts","sourceRoot":"","sources":["../../src/model/log-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAA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,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACrG,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,0BAA0B,CAAC;IAC7E,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,eAAe,GAAG,IAAI,CAAC;CAClF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/log-queries.ts"],"sourcesContent":["// Copyright 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 { AbsoluteTimeRange, UnknownSpec, LogData, QueryDefinition } from '@perses-dev/spec';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface LogQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: LogQueryContext, abortSignal?: AbortSignal) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n createVolumeQuery?: (spec: Spec, ctx: LogQueryContext) => QueryDefinition | null;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC,WAIC"}
1
+ {"version":3,"sources":["../../src/model/log-queries.ts"],"sourcesContent":["// Copyright 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 { AbsoluteTimeRange, UnknownSpec, LogData, QueryDefinition } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface LogQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: LogQueryContext, abortSignal?: AbortSignal) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n createVolumeQuery?: (spec: Spec, ctx: LogQueryContext) => QueryDefinition | null;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAyBjC,WAIC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataQueriesProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAoC,MAAM,OAAO,CAAC;AACtF,OAAO,EAAE,SAAS,EAA6B,MAAM,kBAAkB,CAAC;AASxE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAEnB,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,6DAA+D,CAAC;AAE/F,wBAAgB,qBAAqB,IAAI,sBAAsB,CAM9D;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAqBzG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,CAwGjF"}
1
+ {"version":3,"file":"DataQueriesProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAoC,MAAM,OAAO,CAAC;AACtF,OAAO,EAAE,SAAS,EAA6B,MAAM,kBAAkB,CAAC;AASxE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAEnB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,6DAA+D,CAAC;AAE/F,wBAAgB,qBAAqB,IAAI,sBAAsB,CAM9D;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAuBzG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,YAAY,CA2FjF"}
@@ -19,7 +19,7 @@ import { useAlertsQueries } from '../alerts-queries';
19
19
  import { useSilencesQueries } from '../silences-queries';
20
20
  import { useUsageMetrics } from '../UsageMetricsProvider';
21
21
  import { useLogQueries } from '../log-queries';
22
- import { transformQueryResults, useQueryType } from './model';
22
+ import { transformQueryResults } from './model';
23
23
  export const DataQueriesContext = /*#__PURE__*/ createContext(undefined);
24
24
  export function useDataQueriesContext() {
25
25
  const ctx = useContext(DataQueriesContext);
@@ -30,46 +30,37 @@ export function useDataQueriesContext() {
30
30
  }
31
31
  export function useDataQueries(queryType) {
32
32
  const ctx = useDataQueriesContext();
33
+ // Filter query definitions based on the specified query type
34
+ const filteredQueryDefinitions = ctx.queryDefinitions.filter((definition)=>definition.kind === queryType);
33
35
  // Filter the query results based on the specified query type
34
36
  const filteredQueryResults = ctx.queryResults.filter((queryResult)=>queryResult?.definition?.kind === queryType);
35
37
  // Filter the errors based on the specified query type
36
38
  const filteredErrors = ctx.errors.filter((errors, index)=>ctx.queryResults[index]?.definition?.kind === queryType);
37
39
  // Create a new context object with the filtered results and errors
38
- const filteredCtx = {
40
+ return {
41
+ queryDefinitions: filteredQueryDefinitions,
39
42
  queryResults: filteredQueryResults,
40
43
  isFetching: filteredQueryResults.some((result)=>result.isFetching),
41
44
  isLoading: filteredQueryResults.some((result)=>result.isLoading),
42
45
  refetchAll: ctx.refetchAll,
43
46
  errors: filteredErrors
44
47
  };
45
- return filteredCtx;
46
48
  }
47
49
  export function DataQueriesProvider(props) {
48
50
  const { definitions, options, children, queryOptions } = props;
49
- // Returns a query kind, for example "TimeSeriesQuery" = getQueryType("PrometheusTimeSeriesQuery")
50
- const getQueryType = useQueryType();
51
- const queryDefinitions = definitions.map((definition)=>{
52
- const type = getQueryType(definition.kind);
53
- return {
54
- kind: type,
55
- spec: {
56
- plugin: definition
57
- }
58
- };
59
- });
60
51
  const usageMetrics = useUsageMetrics();
61
52
  // Filter definitions for time series query and other future query plugins
62
- const timeSeriesQueries = queryDefinitions.filter((definition)=>definition.kind === 'TimeSeriesQuery');
53
+ const timeSeriesQueries = definitions.filter((definition)=>definition.kind === 'TimeSeriesQuery');
63
54
  const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options, queryOptions);
64
- const traceQueries = queryDefinitions.filter((definition)=>definition.kind === 'TraceQuery');
55
+ const traceQueries = definitions.filter((definition)=>definition.kind === 'TraceQuery');
65
56
  const traceResults = useTraceQueries(traceQueries);
66
- const profileQueries = queryDefinitions.filter((definition)=>definition.kind === 'ProfileQuery');
57
+ const profileQueries = definitions.filter((definition)=>definition.kind === 'ProfileQuery');
67
58
  const profileResults = useProfileQueries(profileQueries);
68
- const logQueries = queryDefinitions.filter((definition)=>definition.kind === 'LogQuery');
59
+ const logQueries = definitions.filter((definition)=>definition.kind === 'LogQuery');
69
60
  const logResults = useLogQueries(logQueries);
70
- const alertsQueries = queryDefinitions.filter((definition)=>definition.kind === 'AlertsQuery');
61
+ const alertsQueries = definitions.filter((definition)=>definition.kind === 'AlertsQuery');
71
62
  const alertsResults = useAlertsQueries(alertsQueries);
72
- const silencesQueries = queryDefinitions.filter((definition)=>definition.kind === 'SilencesQuery');
63
+ const silencesQueries = definitions.filter((definition)=>definition.kind === 'SilencesQuery');
73
64
  const silencesResults = useSilencesQueries(silencesQueries);
74
65
  const refetchAll = useCallback(()=>{
75
66
  timeSeriesResults.forEach((result)=>result.refetch());
@@ -107,6 +98,7 @@ export function DataQueriesProvider(props) {
107
98
  }
108
99
  }
109
100
  return {
101
+ queryDefinitions: definitions,
110
102
  queryResults: mergedQueryResults,
111
103
  isFetching: mergedQueryResults.some((result)=>result.isFetching),
112
104
  isLoading: mergedQueryResults.some((result)=>result.isLoading),
@@ -114,20 +106,21 @@ export function DataQueriesProvider(props) {
114
106
  errors: mergedQueryResults.map((result)=>result.error)
115
107
  };
116
108
  }, [
117
- timeSeriesQueries,
118
- timeSeriesResults,
119
- traceQueries,
120
- traceResults,
121
- profileQueries,
122
- profileResults,
123
- logQueries,
124
- logResults,
125
109
  alertsQueries,
126
110
  alertsResults,
111
+ logQueries,
112
+ logResults,
113
+ profileQueries,
114
+ profileResults,
127
115
  silencesQueries,
128
116
  silencesResults,
129
- refetchAll,
117
+ timeSeriesQueries,
118
+ timeSeriesResults,
119
+ traceQueries,
120
+ traceResults,
121
+ definitions,
130
122
  queryOptions?.enabled,
123
+ refetchAll,
131
124
  usageMetrics
132
125
  ]);
133
126
  return /*#__PURE__*/ _jsx(DataQueriesContext.Provider, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"sourcesContent":["// Copyright 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 { createContext, ReactElement, useCallback, useContext, useMemo } from 'react';\nimport { QueryType, TimeSeriesQueryDefinition } from '@perses-dev/spec';\nimport { useTimeSeriesQueries } from '../time-series-queries';\nimport { useTraceQueries, TraceQueryDefinition } from '../trace-queries';\nimport { useProfileQueries, ProfileQueryDefinition } from '../profile-queries';\nimport { useAlertsQueries, AlertsQueryDefinition } from '../alerts-queries';\nimport { useSilencesQueries, SilencesQueryDefinition } from '../silences-queries';\n\nimport { useUsageMetrics } from '../UsageMetricsProvider';\nimport { LogQueryDefinition, useLogQueries } from '../log-queries';\nimport {\n DataQueriesProviderProps,\n UseDataQueryResults,\n transformQueryResults,\n DataQueriesContextType,\n QueryData,\n useQueryType,\n} from './model';\n\nexport const DataQueriesContext = createContext<DataQueriesContextType | undefined>(undefined);\n\nexport function useDataQueriesContext(): DataQueriesContextType {\n const ctx = useContext(DataQueriesContext);\n if (ctx === undefined) {\n throw new Error('No DataQueriesContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useDataQueries<T extends keyof QueryType>(queryType: T): UseDataQueryResults<QueryType[T]> {\n const ctx = useDataQueriesContext();\n\n // Filter the query results based on the specified query type\n const filteredQueryResults = ctx.queryResults.filter(\n (queryResult) => queryResult?.definition?.kind === queryType\n ) as Array<QueryData<QueryType[T]>>;\n\n // Filter the errors based on the specified query type\n const filteredErrors = ctx.errors.filter((errors, index) => ctx.queryResults[index]?.definition?.kind === queryType);\n\n // Create a new context object with the filtered results and errors\n const filteredCtx = {\n queryResults: filteredQueryResults,\n isFetching: filteredQueryResults.some((result) => result.isFetching),\n isLoading: filteredQueryResults.some((result) => result.isLoading),\n refetchAll: ctx.refetchAll,\n errors: filteredErrors,\n };\n\n return filteredCtx;\n}\n\nexport function DataQueriesProvider(props: DataQueriesProviderProps): ReactElement {\n const { definitions, options, children, queryOptions } = props;\n\n // Returns a query kind, for example \"TimeSeriesQuery\" = getQueryType(\"PrometheusTimeSeriesQuery\")\n const getQueryType = useQueryType();\n\n const queryDefinitions = definitions.map((definition) => {\n const type = getQueryType(definition.kind);\n return {\n kind: type,\n spec: {\n plugin: definition,\n },\n };\n });\n\n const usageMetrics = useUsageMetrics();\n\n // Filter definitions for time series query and other future query plugins\n const timeSeriesQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TimeSeriesQuery'\n ) as TimeSeriesQueryDefinition[];\n const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options, queryOptions);\n\n const traceQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TraceQuery'\n ) as TraceQueryDefinition[];\n const traceResults = useTraceQueries(traceQueries);\n\n const profileQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'ProfileQuery'\n ) as ProfileQueryDefinition[];\n const profileResults = useProfileQueries(profileQueries);\n\n const logQueries = queryDefinitions.filter((definition) => definition.kind === 'LogQuery') as LogQueryDefinition[];\n const logResults = useLogQueries(logQueries);\n\n const alertsQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'AlertsQuery'\n ) as AlertsQueryDefinition[];\n const alertsResults = useAlertsQueries(alertsQueries);\n\n const silencesQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'SilencesQuery'\n ) as SilencesQueryDefinition[];\n const silencesResults = useSilencesQueries(silencesQueries);\n\n const refetchAll = useCallback(() => {\n timeSeriesResults.forEach((result) => result.refetch());\n traceResults.forEach((result) => result.refetch());\n profileResults.forEach((result) => result.refetch());\n logResults.forEach((result) => result.refetch());\n alertsResults.forEach((result) => result.refetch());\n silencesResults.forEach((result) => result.refetch());\n }, [timeSeriesResults, traceResults, profileResults, logResults, alertsResults, silencesResults]);\n\n const ctx = useMemo(() => {\n const mergedQueryResults = [\n ...transformQueryResults(timeSeriesResults, timeSeriesQueries),\n ...transformQueryResults(traceResults, traceQueries),\n ...transformQueryResults(profileResults, profileQueries),\n ...transformQueryResults(logResults, logQueries),\n ...transformQueryResults(alertsResults, alertsQueries),\n ...transformQueryResults(silencesResults, silencesQueries),\n ];\n\n if (queryOptions?.enabled) {\n for (const result of mergedQueryResults) {\n if (!result.isLoading && !result.isFetching && !result.error) {\n usageMetrics.markQuery(result.definition, 'success');\n } else if (result.error) {\n usageMetrics.markQuery(result.definition, 'error');\n } else {\n usageMetrics.markQuery(result.definition, 'pending');\n }\n }\n }\n\n return {\n queryResults: mergedQueryResults,\n isFetching: mergedQueryResults.some((result) => result.isFetching),\n isLoading: mergedQueryResults.some((result) => result.isLoading),\n refetchAll,\n errors: mergedQueryResults.map((result) => result.error),\n };\n }, [\n timeSeriesQueries,\n timeSeriesResults,\n traceQueries,\n traceResults,\n profileQueries,\n profileResults,\n logQueries,\n logResults,\n alertsQueries,\n alertsResults,\n silencesQueries,\n silencesResults,\n refetchAll,\n queryOptions?.enabled,\n usageMetrics,\n ]);\n\n return <DataQueriesContext.Provider value={ctx}>{children}</DataQueriesContext.Provider>;\n}\n"],"names":["createContext","useCallback","useContext","useMemo","useTimeSeriesQueries","useTraceQueries","useProfileQueries","useAlertsQueries","useSilencesQueries","useUsageMetrics","useLogQueries","transformQueryResults","useQueryType","DataQueriesContext","undefined","useDataQueriesContext","ctx","Error","useDataQueries","queryType","filteredQueryResults","queryResults","filter","queryResult","definition","kind","filteredErrors","errors","index","filteredCtx","isFetching","some","result","isLoading","refetchAll","DataQueriesProvider","props","definitions","options","children","queryOptions","getQueryType","queryDefinitions","map","type","spec","plugin","usageMetrics","timeSeriesQueries","timeSeriesResults","traceQueries","traceResults","profileQueries","profileResults","logQueries","logResults","alertsQueries","alertsResults","silencesQueries","silencesResults","forEach","refetch","mergedQueryResults","enabled","error","markQuery","Provider","value"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAAgBC,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AAEtF,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,eAAe,QAA8B,mBAAmB;AACzE,SAASC,iBAAiB,QAAgC,qBAAqB;AAC/E,SAASC,gBAAgB,QAA+B,oBAAoB;AAC5E,SAASC,kBAAkB,QAAiC,sBAAsB;AAElF,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAA6BC,aAAa,QAAQ,iBAAiB;AACnE,SAGEC,qBAAqB,EAGrBC,YAAY,QACP,UAAU;AAEjB,OAAO,MAAMC,mCAAqBb,cAAkDc,WAAW;AAE/F,OAAO,SAASC;IACd,MAAMC,MAAMd,WAAWW;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAEA,OAAO,SAASE,eAA0C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O,IAAIQ,OAAOgC,KAAK,EAAE;oBACvBjB,aAAakB,SAAS,CAACjC,OAAOR,UAAU,EAAE;gBAC5C,OAAO;oBACLuB,aAAakB,SAAS,CAACjC,OAAOR,UAAU,EAAE;gBAC5C;YACF;QACF;QAEA,OAAO;YACLH,cAAcyC;YACdhC,YAAYgC,mBAAmB/B,IAAI,CAAC,CAACC,SAAWA,OAAOF,UAAU;YACjEG,WAAW6B,mBAAmB/B,IAAI,CAAC,CAACC,SAAWA,OAAOC,SAAS;YAC/DC;YACAP,QAAQmC,mBAAmBnB,GAAG,CAAC,CAACX,SAAWA,OAAOgC,KAAK;QACzD;IACF,GAAG;QACDhB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAzB;QACAM,cAAcuB;QACdhB;KACD;IAED,qBAAO,KAAClC,mBAAmBqD,QAAQ;QAACC,OAAOnD;kBAAMuB;;AACnD"}
1
+ {"version":3,"sources":["../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"sourcesContent":["// Copyright 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 { createContext, ReactElement, useCallback, useContext, useMemo } from 'react';\nimport { QueryType, TimeSeriesQueryDefinition } from '@perses-dev/spec';\nimport { useTimeSeriesQueries } from '../time-series-queries';\nimport { useTraceQueries, TraceQueryDefinition } from '../trace-queries';\nimport { useProfileQueries, ProfileQueryDefinition } from '../profile-queries';\nimport { useAlertsQueries, AlertsQueryDefinition } from '../alerts-queries';\nimport { useSilencesQueries, SilencesQueryDefinition } from '../silences-queries';\n\nimport { useUsageMetrics } from '../UsageMetricsProvider';\nimport { LogQueryDefinition, useLogQueries } from '../log-queries';\nimport {\n DataQueriesProviderProps,\n UseDataQueryResults,\n transformQueryResults,\n DataQueriesContextType,\n QueryData,\n} from './model';\n\nexport const DataQueriesContext = createContext<DataQueriesContextType | undefined>(undefined);\n\nexport function useDataQueriesContext(): DataQueriesContextType {\n const ctx = useContext(DataQueriesContext);\n if (ctx === undefined) {\n throw new Error('No DataQueriesContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useDataQueries<T extends keyof QueryType>(queryType: T): UseDataQueryResults<QueryType[T]> {\n const ctx = useDataQueriesContext();\n\n // Filter query definitions based on the specified query type\n const filteredQueryDefinitions = ctx.queryDefinitions.filter((definition) => definition.kind === queryType);\n\n // Filter the query results based on the specified query type\n const filteredQueryResults = ctx.queryResults.filter(\n (queryResult) => queryResult?.definition?.kind === queryType\n ) as Array<QueryData<QueryType[T]>>;\n\n // Filter the errors based on the specified query type\n const filteredErrors = ctx.errors.filter((errors, index) => ctx.queryResults[index]?.definition?.kind === queryType);\n\n // Create a new context object with the filtered results and errors\n return {\n queryDefinitions: filteredQueryDefinitions,\n queryResults: filteredQueryResults,\n isFetching: filteredQueryResults.some((result) => result.isFetching),\n isLoading: filteredQueryResults.some((result) => result.isLoading),\n refetchAll: ctx.refetchAll,\n errors: filteredErrors,\n };\n}\n\nexport function DataQueriesProvider(props: DataQueriesProviderProps): ReactElement {\n const { definitions, options, children, queryOptions } = props;\n\n const usageMetrics = useUsageMetrics();\n\n // Filter definitions for time series query and other future query plugins\n const timeSeriesQueries = definitions.filter(\n (definition) => definition.kind === 'TimeSeriesQuery'\n ) as TimeSeriesQueryDefinition[];\n const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options, queryOptions);\n\n const traceQueries = definitions.filter((definition) => definition.kind === 'TraceQuery') as TraceQueryDefinition[];\n const traceResults = useTraceQueries(traceQueries);\n\n const profileQueries = definitions.filter(\n (definition) => definition.kind === 'ProfileQuery'\n ) as ProfileQueryDefinition[];\n const profileResults = useProfileQueries(profileQueries);\n\n const logQueries = definitions.filter((definition) => definition.kind === 'LogQuery') as LogQueryDefinition[];\n const logResults = useLogQueries(logQueries);\n\n const alertsQueries = definitions.filter(\n (definition) => definition.kind === 'AlertsQuery'\n ) as AlertsQueryDefinition[];\n const alertsResults = useAlertsQueries(alertsQueries);\n\n const silencesQueries = definitions.filter(\n (definition) => definition.kind === 'SilencesQuery'\n ) as SilencesQueryDefinition[];\n const silencesResults = useSilencesQueries(silencesQueries);\n\n const refetchAll = useCallback(() => {\n timeSeriesResults.forEach((result) => result.refetch());\n traceResults.forEach((result) => result.refetch());\n profileResults.forEach((result) => result.refetch());\n logResults.forEach((result) => result.refetch());\n alertsResults.forEach((result) => result.refetch());\n silencesResults.forEach((result) => result.refetch());\n }, [timeSeriesResults, traceResults, profileResults, logResults, alertsResults, silencesResults]);\n\n const ctx = useMemo(() => {\n const mergedQueryResults = [\n ...transformQueryResults(timeSeriesResults, timeSeriesQueries),\n ...transformQueryResults(traceResults, traceQueries),\n ...transformQueryResults(profileResults, profileQueries),\n ...transformQueryResults(logResults, logQueries),\n ...transformQueryResults(alertsResults, alertsQueries),\n ...transformQueryResults(silencesResults, silencesQueries),\n ];\n\n if (queryOptions?.enabled) {\n for (const result of mergedQueryResults) {\n if (!result.isLoading && !result.isFetching && !result.error) {\n usageMetrics.markQuery(result.definition, 'success');\n } else if (result.error) {\n usageMetrics.markQuery(result.definition, 'error');\n } else {\n usageMetrics.markQuery(result.definition, 'pending');\n }\n }\n }\n\n return {\n queryDefinitions: definitions,\n queryResults: mergedQueryResults,\n isFetching: mergedQueryResults.some((result) => result.isFetching),\n isLoading: mergedQueryResults.some((result) => result.isLoading),\n refetchAll,\n errors: mergedQueryResults.map((result) => result.error),\n };\n }, [\n alertsQueries,\n alertsResults,\n logQueries,\n logResults,\n profileQueries,\n profileResults,\n silencesQueries,\n silencesResults,\n timeSeriesQueries,\n timeSeriesResults,\n traceQueries,\n traceResults,\n definitions,\n queryOptions?.enabled,\n refetchAll,\n usageMetrics,\n ]);\n\n return <DataQueriesContext.Provider value={ctx}>{children}</DataQueriesContext.Provider>;\n}\n"],"names":["createContext","useCallback","useContext","useMemo","useTimeSeriesQueries","useTraceQueries","useProfileQueries","useAlertsQueries","useSilencesQueries","useUsageMetrics","useLogQueries","transformQueryResults","DataQueriesContext","undefined","useDataQueriesContext","ctx","Error","useDataQueries","queryType","filteredQueryDefinitions","queryDefinitions","filter","definition","kind","filteredQueryResults","queryResults","queryResult","filteredErrors","errors","index","isFetching","some","result","isLoading","refetchAll","DataQueriesProvider","props","definitions","options","children","queryOptions","usageMetrics","timeSeriesQueries","timeSeriesResults","traceQueries","traceResults","profileQueries","profileResults","logQueries","logResults","alertsQueries","alertsResults","silencesQueries","silencesResults","forEach","refetch","mergedQueryResults","enabled","error","markQuery","map","Provider","value"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAAgBC,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AAEtF,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,eAAe,QAA8B,mBAAmB;AACzE,SAASC,iBAAiB,QAAgC,qBAAqB;AAC/E,SAASC,gBAAgB,QAA+B,oBAAoB;AAC5E,SAASC,kBAAkB,QAAiC,sBAAsB;AAElF,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAA6BC,aAAa,QAAQ,iBAAiB;AACnE,SAGEC,qBAAqB,QAGhB,UAAU;AAEjB,OAAO,MAAMC,mCAAqBZ,cAAkDa,WAAW;AAE/F,OAAO,SAASC;IACd,MAAMC,MAAMb,WAAWU;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IAC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