@perses-dev/explore 0.44.0 → 0.45.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/ExploreToolbar/ExploreToolbar.js +8 -2
- package/dist/cjs/components/TimeSeriesExplorer/TimeSeriesExplorer.js +169 -0
- package/dist/cjs/views/ViewExplore/ViewExplore.js +25 -26
- package/dist/cjs/views/ViewExplore/ViewExploreApp.js +8 -20
- package/dist/components/ExploreToolbar/ExploreToolbar.d.ts +2 -2
- package/dist/components/ExploreToolbar/ExploreToolbar.d.ts.map +1 -1
- package/dist/components/ExploreToolbar/ExploreToolbar.js +2 -1
- package/dist/components/ExploreToolbar/ExploreToolbar.js.map +1 -1
- package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.d.ts +11 -0
- package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.d.ts.map +1 -0
- package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.js +112 -0
- package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.js.map +1 -0
- package/dist/views/ViewExplore/ViewExplore.d.ts +2 -4
- package/dist/views/ViewExplore/ViewExplore.d.ts.map +1 -1
- package/dist/views/ViewExplore/ViewExplore.js +21 -27
- package/dist/views/ViewExplore/ViewExplore.js.map +1 -1
- package/dist/views/ViewExplore/ViewExploreApp.d.ts +2 -2
- package/dist/views/ViewExplore/ViewExploreApp.d.ts.map +1 -1
- package/dist/views/ViewExplore/ViewExploreApp.js +3 -20
- package/dist/views/ViewExplore/ViewExploreApp.js.map +1 -1
- package/package.json +8 -9
- package/dist/cjs/components/PanelEditor/PanelEditorForm.js +0 -138
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +0 -51
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +0 -96
- package/dist/cjs/components/TimeSeriesQueryEditor/index.js +0 -30
- package/dist/cjs/context/usePanelEditor.js +0 -89
- package/dist/cjs/context/useTimeSeriesQueryEditorActions.js +0 -132
- package/dist/components/PanelEditor/PanelEditorForm.d.ts +0 -15
- package/dist/components/PanelEditor/PanelEditorForm.d.ts.map +0 -1
- package/dist/components/PanelEditor/PanelEditorForm.js +0 -125
- package/dist/components/PanelEditor/PanelEditorForm.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -11
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +0 -43
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +0 -11
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +0 -83
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/index.d.ts +0 -2
- package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/index.js +0 -15
- package/dist/components/TimeSeriesQueryEditor/index.js.map +0 -1
- package/dist/context/usePanelEditor.d.ts +0 -15
- package/dist/context/usePanelEditor.d.ts.map +0 -1
- package/dist/context/usePanelEditor.js +0 -84
- package/dist/context/usePanelEditor.js.map +0 -1
- package/dist/context/useTimeSeriesQueryEditorActions.d.ts +0 -14
- package/dist/context/useTimeSeriesQueryEditorActions.d.ts.map +0 -1
- package/dist/context/useTimeSeriesQueryEditorActions.js +0 -119
- package/dist/context/useTimeSeriesQueryEditorActions.js.map +0 -1
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { PanelPreview } from '@perses-dev/dashboards';
|
|
15
|
-
import { usePluginEditor } from '@perses-dev/plugin-system';
|
|
16
|
-
import { FormProvider, useForm } from 'react-hook-form';
|
|
17
|
-
import { Button, Grid, Stack, Typography } from '@mui/material';
|
|
18
|
-
import AddIcon from 'mdi-material-ui/Plus';
|
|
19
|
-
import { ErrorAlert, ErrorBoundary } from '@perses-dev/components';
|
|
20
|
-
import { TimeSeriesQueryEditor } from '../TimeSeriesQueryEditor';
|
|
21
|
-
import { ExploreToolbar } from '../ExploreToolbar';
|
|
22
|
-
import { useTimeSeriesQueryEditorActions } from '../../context/useTimeSeriesQueryEditorActions';
|
|
23
|
-
import { usePanelEditor } from '../../context/usePanelEditor';
|
|
24
|
-
export function PanelEditorForm(props) {
|
|
25
|
-
const { exploreTitleComponent, initialValues: { panelDefinition: initialPanelDef } } = props;
|
|
26
|
-
const { setQueries, setPlugin, panelDefinition } = usePanelEditor(initialPanelDef);
|
|
27
|
-
const { plugin } = panelDefinition.spec;
|
|
28
|
-
var _panelDefinition_spec_queries;
|
|
29
|
-
const queries = (_panelDefinition_spec_queries = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries !== void 0 ? _panelDefinition_spec_queries : [];
|
|
30
|
-
// Use common plugin editor logic even though we've split the inputs up in this form
|
|
31
|
-
const pluginEditor = usePluginEditor({
|
|
32
|
-
pluginType: 'Panel',
|
|
33
|
-
value: {
|
|
34
|
-
kind: plugin.kind,
|
|
35
|
-
spec: plugin.spec
|
|
36
|
-
},
|
|
37
|
-
onChange: (plugin)=>{
|
|
38
|
-
setPlugin(plugin);
|
|
39
|
-
},
|
|
40
|
-
onHideQueryEditorChange: (isHidden)=>{
|
|
41
|
-
setQueries(undefined, isHidden);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const onChange = (queries)=>setQueries(queries);
|
|
45
|
-
const { handleQueryChange, handleQueryAdd, handleQueryCollapseExpand, handleQueryDelete, queriesCollapsed, defaultTimeSeriesQueryKind } = useTimeSeriesQueryEditorActions({
|
|
46
|
-
onChange,
|
|
47
|
-
queries
|
|
48
|
-
});
|
|
49
|
-
const form = useForm({
|
|
50
|
-
mode: 'onBlur',
|
|
51
|
-
defaultValues: {
|
|
52
|
-
type: pluginEditor.pendingKind ? pluginEditor.pendingKind : plugin.kind
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
return /*#__PURE__*/ _jsxs(Stack, {
|
|
56
|
-
sx: {
|
|
57
|
-
width: '100%'
|
|
58
|
-
},
|
|
59
|
-
px: 2,
|
|
60
|
-
pb: 2,
|
|
61
|
-
pt: 1.5,
|
|
62
|
-
gap: 2,
|
|
63
|
-
children: [
|
|
64
|
-
/*#__PURE__*/ _jsx(ExploreToolbar, {
|
|
65
|
-
exploreTitleComponent: exploreTitleComponent
|
|
66
|
-
}),
|
|
67
|
-
/*#__PURE__*/ _jsx(FormProvider, {
|
|
68
|
-
...form,
|
|
69
|
-
children: /*#__PURE__*/ _jsxs(Grid, {
|
|
70
|
-
container: true,
|
|
71
|
-
spacing: 2,
|
|
72
|
-
children: [
|
|
73
|
-
/*#__PURE__*/ _jsx(Grid, {
|
|
74
|
-
item: true,
|
|
75
|
-
xs: 12,
|
|
76
|
-
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
77
|
-
gap: 1,
|
|
78
|
-
children: [
|
|
79
|
-
/*#__PURE__*/ _jsx(TimeSeriesQueryEditor, {
|
|
80
|
-
handleQueryChange: handleQueryChange,
|
|
81
|
-
handleQueryCollapseExpand: handleQueryCollapseExpand,
|
|
82
|
-
handleQueryDelete: handleQueryDelete,
|
|
83
|
-
queriesCollapsed: queriesCollapsed,
|
|
84
|
-
queries: queries,
|
|
85
|
-
defaultTimeSeriesQueryKind: defaultTimeSeriesQueryKind
|
|
86
|
-
}),
|
|
87
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
88
|
-
variant: "contained",
|
|
89
|
-
startIcon: /*#__PURE__*/ _jsx(AddIcon, {}),
|
|
90
|
-
sx: {
|
|
91
|
-
marginRight: 'auto'
|
|
92
|
-
},
|
|
93
|
-
onClick: handleQueryAdd,
|
|
94
|
-
children: "Add Query"
|
|
95
|
-
})
|
|
96
|
-
]
|
|
97
|
-
})
|
|
98
|
-
}),
|
|
99
|
-
/*#__PURE__*/ _jsx(Grid, {
|
|
100
|
-
item: true,
|
|
101
|
-
xs: 12,
|
|
102
|
-
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
103
|
-
gap: 1,
|
|
104
|
-
children: [
|
|
105
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
106
|
-
variant: "h4",
|
|
107
|
-
children: "Preview"
|
|
108
|
-
}),
|
|
109
|
-
/*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
110
|
-
FallbackComponent: ErrorAlert,
|
|
111
|
-
children: /*#__PURE__*/ _jsx(PanelPreview, {
|
|
112
|
-
panelDefinition: panelDefinition
|
|
113
|
-
})
|
|
114
|
-
})
|
|
115
|
-
]
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
]
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
]
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
//# sourceMappingURL=PanelEditorForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PanelEditor/PanelEditorForm.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelEditorValues, PanelPreview } from '@perses-dev/dashboards';\nimport { usePluginEditor } from '@perses-dev/plugin-system';\nimport { FormProvider, useForm } from 'react-hook-form';\nimport { Button, Grid, Stack, Typography } from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { Action, Definition, PanelDefinition, QueryDefinition, UnknownSpec } from '@perses-dev/core';\nimport { SetStateAction } from 'react';\nimport { TimeSeriesQueryEditor } from '../TimeSeriesQueryEditor';\nimport { ExploreToolbar } from '../ExploreToolbar';\nimport { useTimeSeriesQueryEditorActions } from '../../context/useTimeSeriesQueryEditorActions';\nimport { usePanelEditor } from '../../context/usePanelEditor';\n\nexport interface PanelEditorProps {\n initialValues: PanelEditorValues;\n initialAction: Action;\n exploreTitleComponent?: JSX.Element;\n}\n\nexport interface PanelSpecEditorProps {\n panelDefinition: PanelDefinition;\n onQueriesChange: (queries: QueryDefinition[]) => void;\n onPluginSpecChange: (spec: UnknownSpec) => void;\n}\n\nexport function PanelEditorForm(props: PanelEditorProps) {\n const {\n exploreTitleComponent,\n initialValues: { panelDefinition: initialPanelDef },\n } = props;\n\n const { setQueries, setPlugin, panelDefinition } = usePanelEditor(initialPanelDef);\n const { plugin } = panelDefinition.spec;\n const queries = panelDefinition.spec.queries ?? [];\n\n // Use common plugin editor logic even though we've split the inputs up in this form\n const pluginEditor = usePluginEditor({\n pluginType: 'Panel',\n value: { kind: plugin.kind, spec: plugin.spec },\n onChange: (plugin: SetStateAction<Definition<UnknownSpec>>) => {\n setPlugin(plugin);\n },\n onHideQueryEditorChange: (isHidden: boolean | undefined) => {\n setQueries(undefined, isHidden);\n },\n });\n\n const onChange = (queries: QueryDefinition[]) => setQueries(queries);\n\n const {\n handleQueryChange,\n handleQueryAdd,\n handleQueryCollapseExpand,\n handleQueryDelete,\n queriesCollapsed,\n defaultTimeSeriesQueryKind,\n } = useTimeSeriesQueryEditorActions({ onChange, queries });\n\n const form = useForm({\n mode: 'onBlur',\n defaultValues: {\n type: pluginEditor.pendingKind ? pluginEditor.pendingKind : plugin.kind,\n },\n });\n\n return (\n <Stack sx={{ width: '100%' }} px={2} pb={2} pt={1.5} gap={2}>\n <ExploreToolbar exploreTitleComponent={exploreTitleComponent} />\n <FormProvider {...form}>\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Stack gap={1}>\n {/* Maybe in the future we should have something like PanelSpecEditor as we have on the Dashboard System */}\n <TimeSeriesQueryEditor\n handleQueryChange={handleQueryChange}\n handleQueryCollapseExpand={handleQueryCollapseExpand}\n handleQueryDelete={handleQueryDelete}\n queriesCollapsed={queriesCollapsed}\n queries={queries}\n defaultTimeSeriesQueryKind={defaultTimeSeriesQueryKind}\n />\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginRight: 'auto' }} onClick={handleQueryAdd}>\n Add Query\n </Button>\n </Stack>\n </Grid>\n <Grid item xs={12}>\n <Stack gap={1}>\n <Typography variant=\"h4\">Preview</Typography>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PanelPreview panelDefinition={panelDefinition} />\n </ErrorBoundary>\n </Stack>\n </Grid>\n </Grid>\n </FormProvider>\n </Stack>\n );\n}\n"],"names":["PanelPreview","usePluginEditor","FormProvider","useForm","Button","Grid","Stack","Typography","AddIcon","ErrorAlert","ErrorBoundary","TimeSeriesQueryEditor","ExploreToolbar","useTimeSeriesQueryEditorActions","usePanelEditor","PanelEditorForm","props","exploreTitleComponent","initialValues","panelDefinition","initialPanelDef","setQueries","setPlugin","plugin","spec","queries","pluginEditor","pluginType","value","kind","onChange","onHideQueryEditorChange","isHidden","undefined","handleQueryChange","handleQueryAdd","handleQueryCollapseExpand","handleQueryDelete","queriesCollapsed","defaultTimeSeriesQueryKind","form","mode","defaultValues","type","pendingKind","sx","width","px","pb","pt","gap","container","spacing","item","xs","variant","startIcon","marginRight","onClick","FallbackComponent"],"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,SAA4BA,YAAY,QAAQ,yBAAyB;AACzE,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,YAAY,EAAEC,OAAO,QAAQ,kBAAkB;AACxD,SAASC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAChE,OAAOC,aAAa,uBAAuB;AAC3C,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAGnE,SAASC,qBAAqB,QAAQ,2BAA2B;AACjE,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,+BAA+B,QAAQ,gDAAgD;AAChG,SAASC,cAAc,QAAQ,+BAA+B;AAc9D,OAAO,SAASC,gBAAgBC,KAAuB;IACrD,MAAM,EACJC,qBAAqB,EACrBC,eAAe,EAAEC,iBAAiBC,eAAe,EAAE,EACpD,GAAGJ;IAEJ,MAAM,EAAEK,UAAU,EAAEC,SAAS,EAAEH,eAAe,EAAE,GAAGL,eAAeM;IAClE,MAAM,EAAEG,MAAM,EAAE,GAAGJ,gBAAgBK,IAAI;QACvBL;IAAhB,MAAMM,UAAUN,CAAAA,gCAAAA,gBAAgBK,IAAI,CAACC,OAAO,cAA5BN,2CAAAA,gCAAgC,EAAE;IAElD,oFAAoF;IACpF,MAAMO,eAAezB,gBAAgB;QACnC0B,YAAY;QACZC,OAAO;YAAEC,MAAMN,OAAOM,IAAI;YAAEL,MAAMD,OAAOC,IAAI;QAAC;QAC9CM,UAAU,CAACP;YACTD,UAAUC;QACZ;QACAQ,yBAAyB,CAACC;YACxBX,WAAWY,WAAWD;QACxB;IACF;IAEA,MAAMF,WAAW,CAACL,UAA+BJ,WAAWI;IAE5D,MAAM,EACJS,iBAAiB,EACjBC,cAAc,EACdC,yBAAyB,EACzBC,iBAAiB,EACjBC,gBAAgB,EAChBC,0BAA0B,EAC3B,GAAG1B,gCAAgC;QAAEiB;QAAUL;IAAQ;IAExD,MAAMe,OAAOrC,QAAQ;QACnBsC,MAAM;QACNC,eAAe;YACbC,MAAMjB,aAAakB,WAAW,GAAGlB,aAAakB,WAAW,GAAGrB,OAAOM,IAAI;QACzE;IACF;IAEA,qBACE,MAACvB;QAAMuC,IAAI;YAAEC,OAAO;QAAO;QAAGC,IAAI;QAAGC,IAAI;QAAGC,IAAI;QAAKC,KAAK;;0BACxD,KAACtC;gBAAeK,uBAAuBA;;0BACvC,KAACf;gBAAc,GAAGsC,IAAI;0BACpB,cAAA,MAACnC;oBAAK8C,SAAS;oBAACC,SAAS;;sCACvB,KAAC/C;4BAAKgD,IAAI;4BAACC,IAAI;sCACb,cAAA,MAAChD;gCAAM4C,KAAK;;kDAEV,KAACvC;wCACCuB,mBAAmBA;wCACnBE,2BAA2BA;wCAC3BC,mBAAmBA;wCACnBC,kBAAkBA;wCAClBb,SAASA;wCACTc,4BAA4BA;;kDAE9B,KAACnC;wCAAOmD,SAAQ;wCAAYC,yBAAW,KAAChD;wCAAYqC,IAAI;4CAAEY,aAAa;wCAAO;wCAAGC,SAASvB;kDAAgB;;;;;sCAK9G,KAAC9B;4BAAKgD,IAAI;4BAACC,IAAI;sCACb,cAAA,MAAChD;gCAAM4C,KAAK;;kDACV,KAAC3C;wCAAWgD,SAAQ;kDAAK;;kDACzB,KAAC7C;wCAAciD,mBAAmBlD;kDAChC,cAAA,KAACT;4CAAamB,iBAAiBA;;;;;;;;;;;AAQ/C"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { QueryDefinition, TimeSeriesQueryDefinition } from '@perses-dev/core';
|
|
2
|
-
export interface TimeSeriesQueryEditorProps {
|
|
3
|
-
queries: QueryDefinition[];
|
|
4
|
-
handleQueryChange: (index: number, queryDef: TimeSeriesQueryDefinition) => void;
|
|
5
|
-
queriesCollapsed: boolean[];
|
|
6
|
-
handleQueryDelete: (index: number) => void;
|
|
7
|
-
handleQueryCollapseExpand: (index: number) => void;
|
|
8
|
-
defaultTimeSeriesQueryKind: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function TimeSeriesQueryEditor(props: TimeSeriesQueryEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
//# sourceMappingURL=TimeSeriesQueryEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TimeSeriesQueryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,yBAAyB,KAAK,IAAI,CAAC;IAChF,gBAAgB,EAAE,OAAO,EAAE,CAAC;IAC5B,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,yBAAyB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,0BAA0B,EAAE,MAAM,CAAC;CACpC;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2CA0CtE"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
import { TimeSeriesQueryInput } from './TimeSeriesQueryInput';
|
|
15
|
-
export function TimeSeriesQueryEditor(props) {
|
|
16
|
-
const { queries, handleQueryChange, handleQueryCollapseExpand, handleQueryDelete, queriesCollapsed, defaultTimeSeriesQueryKind } = props;
|
|
17
|
-
const hasMoreThanOneQuery = queries.length > 1;
|
|
18
|
-
const queryDefinitions = queries.length ? queries : [
|
|
19
|
-
{
|
|
20
|
-
kind: 'TimeSeriesQuery',
|
|
21
|
-
spec: {
|
|
22
|
-
plugin: {
|
|
23
|
-
kind: defaultTimeSeriesQueryKind,
|
|
24
|
-
spec: {
|
|
25
|
-
query: ''
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
32
|
-
children: queryDefinitions.map((query, i)=>/*#__PURE__*/ _jsx(TimeSeriesQueryInput, {
|
|
33
|
-
index: i,
|
|
34
|
-
query: query,
|
|
35
|
-
onChange: handleQueryChange,
|
|
36
|
-
isCollapsed: !!queriesCollapsed[i],
|
|
37
|
-
onDelete: hasMoreThanOneQuery ? handleQueryDelete : undefined,
|
|
38
|
-
onCollapseExpand: handleQueryCollapseExpand
|
|
39
|
-
}, i))
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=TimeSeriesQueryEditor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition, TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { TimeSeriesQueryInput } from './TimeSeriesQueryInput';\n\nexport interface TimeSeriesQueryEditorProps {\n queries: QueryDefinition[];\n handleQueryChange: (index: number, queryDef: TimeSeriesQueryDefinition) => void;\n queriesCollapsed: boolean[];\n handleQueryDelete: (index: number) => void;\n handleQueryCollapseExpand: (index: number) => void;\n defaultTimeSeriesQueryKind: string;\n}\n\nexport function TimeSeriesQueryEditor(props: TimeSeriesQueryEditorProps) {\n const {\n queries,\n handleQueryChange,\n handleQueryCollapseExpand,\n handleQueryDelete,\n queriesCollapsed,\n defaultTimeSeriesQueryKind,\n } = props;\n\n const hasMoreThanOneQuery = queries.length > 1;\n const queryDefinitions: TimeSeriesQueryDefinition[] = queries.length\n ? queries\n : [\n {\n kind: 'TimeSeriesQuery',\n spec: {\n plugin: {\n kind: defaultTimeSeriesQueryKind,\n spec: {\n query: '',\n },\n },\n },\n },\n ];\n\n return (\n <>\n {queryDefinitions.map((query: TimeSeriesQueryDefinition, i: number) => (\n <TimeSeriesQueryInput\n key={i}\n index={i}\n query={query}\n onChange={handleQueryChange}\n isCollapsed={!!queriesCollapsed[i]}\n onDelete={hasMoreThanOneQuery ? handleQueryDelete : undefined}\n onCollapseExpand={handleQueryCollapseExpand}\n />\n ))}\n </>\n );\n}\n"],"names":["TimeSeriesQueryInput","TimeSeriesQueryEditor","props","queries","handleQueryChange","handleQueryCollapseExpand","handleQueryDelete","queriesCollapsed","defaultTimeSeriesQueryKind","hasMoreThanOneQuery","length","queryDefinitions","kind","spec","plugin","query","map","i","index","onChange","isCollapsed","onDelete","undefined","onCollapseExpand"],"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,oBAAoB,QAAQ,yBAAyB;AAW9D,OAAO,SAASC,sBAAsBC,KAAiC;IACrE,MAAM,EACJC,OAAO,EACPC,iBAAiB,EACjBC,yBAAyB,EACzBC,iBAAiB,EACjBC,gBAAgB,EAChBC,0BAA0B,EAC3B,GAAGN;IAEJ,MAAMO,sBAAsBN,QAAQO,MAAM,GAAG;IAC7C,MAAMC,mBAAgDR,QAAQO,MAAM,GAChEP,UACA;QACE;YACES,MAAM;YACNC,MAAM;gBACJC,QAAQ;oBACNF,MAAMJ;oBACNK,MAAM;wBACJE,OAAO;oBACT;gBACF;YACF;QACF;KACD;IAEL,qBACE;kBACGJ,iBAAiBK,GAAG,CAAC,CAACD,OAAkCE,kBACvD,KAACjB;gBAECkB,OAAOD;gBACPF,OAAOA;gBACPI,UAAUf;gBACVgB,aAAa,CAAC,CAACb,gBAAgB,CAACU,EAAE;gBAClCI,UAAUZ,sBAAsBH,oBAAoBgB;gBACpDC,kBAAkBlB;eANbY;;AAWf"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TimeSeriesQueryDefinition } from '@perses-dev/core';
|
|
2
|
-
export interface TimeSeriesQueryInputProps {
|
|
3
|
-
query: TimeSeriesQueryDefinition;
|
|
4
|
-
index: number;
|
|
5
|
-
onChange: (index: number, query: TimeSeriesQueryDefinition) => void;
|
|
6
|
-
onCollapseExpand: (index: number) => void;
|
|
7
|
-
onDelete?: (index: number) => void;
|
|
8
|
-
isCollapsed?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function TimeSeriesQueryInput(props: TimeSeriesQueryInputProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
//# sourceMappingURL=TimeSeriesQueryInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TimeSeriesQueryInput.d.ts","sourceRoot":"","sources":["../../../src/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAc,yBAAyB,EAAe,MAAM,kBAAkB,CAAC;AAKtF,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,yBAAyB,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;IACpE,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,2CAuBpE"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { Box, IconButton, Stack, Typography } from '@mui/material';
|
|
15
|
-
import ChevronDown from 'mdi-material-ui/ChevronDown';
|
|
16
|
-
import ChevronRight from 'mdi-material-ui/ChevronRight';
|
|
17
|
-
import DeleteIcon from 'mdi-material-ui/DeleteOutline';
|
|
18
|
-
import { PluginEditor } from '@perses-dev/plugin-system';
|
|
19
|
-
import produce from 'immer';
|
|
20
|
-
export function TimeSeriesQueryInput(props) {
|
|
21
|
-
const { index, query, isCollapsed, onDelete, onChange, onCollapseExpand } = props;
|
|
22
|
-
return /*#__PURE__*/ _jsxs(Stack, {
|
|
23
|
-
spacing: 1,
|
|
24
|
-
children: [
|
|
25
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
26
|
-
direction: "row",
|
|
27
|
-
alignItems: "center",
|
|
28
|
-
borderBottom: 1,
|
|
29
|
-
borderColor: (theme)=>theme.palette.divider,
|
|
30
|
-
children: [
|
|
31
|
-
/*#__PURE__*/ _jsx(IconButton, {
|
|
32
|
-
size: "small",
|
|
33
|
-
onClick: ()=>onCollapseExpand(index),
|
|
34
|
-
children: isCollapsed ? /*#__PURE__*/ _jsx(ChevronRight, {}) : /*#__PURE__*/ _jsx(ChevronDown, {})
|
|
35
|
-
}),
|
|
36
|
-
/*#__PURE__*/ _jsxs(Typography, {
|
|
37
|
-
variant: "overline",
|
|
38
|
-
component: "h4",
|
|
39
|
-
children: [
|
|
40
|
-
"Query ",
|
|
41
|
-
index + 1
|
|
42
|
-
]
|
|
43
|
-
}),
|
|
44
|
-
/*#__PURE__*/ _jsx(IconButton, {
|
|
45
|
-
size: "small",
|
|
46
|
-
// Use `visibility` to ensure that the row has the same height when delete button is visible or not visible
|
|
47
|
-
sx: {
|
|
48
|
-
marginLeft: 'auto',
|
|
49
|
-
visibility: `${onDelete ? 'visible' : 'hidden'}`
|
|
50
|
-
},
|
|
51
|
-
onClick: ()=>onDelete && onDelete(index),
|
|
52
|
-
children: /*#__PURE__*/ _jsx(DeleteIcon, {})
|
|
53
|
-
})
|
|
54
|
-
]
|
|
55
|
-
}),
|
|
56
|
-
!isCollapsed && /*#__PURE__*/ _jsx(QueryEditor, {
|
|
57
|
-
value: query,
|
|
58
|
-
onChange: (next)=>onChange(index, next)
|
|
59
|
-
})
|
|
60
|
-
]
|
|
61
|
-
}, index);
|
|
62
|
-
}
|
|
63
|
-
function QueryEditor(props) {
|
|
64
|
-
const { value, onChange, ...others } = props;
|
|
65
|
-
const { spec: { plugin } } = value;
|
|
66
|
-
const handlePluginChange = (next)=>{
|
|
67
|
-
onChange(produce(value, (draft)=>{
|
|
68
|
-
draft.spec.plugin = next;
|
|
69
|
-
}));
|
|
70
|
-
};
|
|
71
|
-
return /*#__PURE__*/ _jsx(Box, {
|
|
72
|
-
...others,
|
|
73
|
-
children: /*#__PURE__*/ _jsx(PluginEditor, {
|
|
74
|
-
isExplore: true,
|
|
75
|
-
pluginType: "TimeSeriesQuery",
|
|
76
|
-
pluginKindLabel: "Query Type",
|
|
77
|
-
value: plugin,
|
|
78
|
-
onChange: handlePluginChange
|
|
79
|
-
})
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
//# sourceMappingURL=TimeSeriesQueryInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps, IconButton, Stack, Typography } from '@mui/material';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { Definition, TimeSeriesQueryDefinition, UnknownSpec } from '@perses-dev/core';\nimport { PluginEditor, PluginEditorProps } from '@perses-dev/plugin-system';\nimport produce from 'immer';\nimport { WritableDraft } from 'immer/dist/internal';\n\nexport interface TimeSeriesQueryInputProps {\n query: TimeSeriesQueryDefinition;\n index: number;\n onChange: (index: number, query: TimeSeriesQueryDefinition) => void;\n onCollapseExpand: (index: number) => void;\n onDelete?: (index: number) => void;\n isCollapsed?: boolean;\n}\n\nexport function TimeSeriesQueryInput(props: TimeSeriesQueryInputProps) {\n const { index, query, isCollapsed, onDelete, onChange, onCollapseExpand } = props;\n return (\n <Stack key={index} spacing={1}>\n <Stack direction=\"row\" alignItems=\"center\" borderBottom={1} borderColor={(theme) => theme.palette.divider}>\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 <IconButton\n size=\"small\"\n // Use `visibility` to ensure that the row has the same height when delete button is visible or not visible\n sx={{ marginLeft: 'auto', visibility: `${onDelete ? 'visible' : 'hidden'}` }}\n onClick={() => onDelete && onDelete(index)}\n >\n <DeleteIcon />\n </IconButton>\n </Stack>\n {!isCollapsed && <QueryEditor value={query} onChange={(next) => onChange(index, next)} />}\n </Stack>\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';\n\ninterface QueryEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n value: TimeSeriesQueryDefinition;\n onChange: (next: TimeSeriesQueryDefinition) => void;\n}\n\nfunction QueryEditor(props: QueryEditorProps) {\n const { value, onChange, ...others } = props;\n const {\n spec: { plugin },\n } = value;\n\n const handlePluginChange: PluginEditorProps['onChange'] = (next: WritableDraft<Definition<UnknownSpec>>) => {\n onChange(\n produce(value, (draft) => {\n draft.spec.plugin = next;\n })\n );\n };\n\n return (\n <Box {...others}>\n {/* If TimeSeriesQuery plugins ever have common props on the definition, the inputs could go here */}\n <PluginEditor\n isExplore={true}\n pluginType=\"TimeSeriesQuery\"\n pluginKindLabel=\"Query Type\"\n value={plugin}\n onChange={handlePluginChange}\n />\n </Box>\n );\n}\n"],"names":["Box","IconButton","Stack","Typography","ChevronDown","ChevronRight","DeleteIcon","PluginEditor","produce","TimeSeriesQueryInput","props","index","query","isCollapsed","onDelete","onChange","onCollapseExpand","spacing","direction","alignItems","borderBottom","borderColor","theme","palette","divider","size","onClick","variant","component","sx","marginLeft","visibility","QueryEditor","value","next","others","spec","plugin","handlePluginChange","draft","isExplore","pluginType","pluginKindLabel"],"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,SAASA,GAAG,EAAYC,UAAU,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAC7E,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,kBAAkB,+BAA+B;AACxD,OAAOC,gBAAgB,gCAAgC;AAEvD,SAASC,YAAY,QAA2B,4BAA4B;AAC5E,OAAOC,aAAa,QAAQ;AAY5B,OAAO,SAASC,qBAAqBC,KAAgC;IACnE,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGN;IAC5E,qBACE,MAACR;QAAkBe,SAAS;;0BAC1B,MAACf;gBAAMgB,WAAU;gBAAMC,YAAW;gBAASC,cAAc;gBAAGC,aAAa,CAACC,QAAUA,MAAMC,OAAO,CAACC,OAAO;;kCACvG,KAACvB;wBAAWwB,MAAK;wBAAQC,SAAS,IAAMV,iBAAiBL;kCACtDE,4BAAc,KAACR,kCAAkB,KAACD;;kCAErC,MAACD;wBAAWwB,SAAQ;wBAAWC,WAAU;;4BAAK;4BACrCjB,QAAQ;;;kCAEjB,KAACV;wBACCwB,MAAK;wBACL,2GAA2G;wBAC3GI,IAAI;4BAAEC,YAAY;4BAAQC,YAAY,CAAC,EAAEjB,WAAW,YAAY,SAAS,CAAC;wBAAC;wBAC3EY,SAAS,IAAMZ,YAAYA,SAASH;kCAEpC,cAAA,KAACL;;;;YAGJ,CAACO,6BAAe,KAACmB;gBAAYC,OAAOrB;gBAAOG,UAAU,CAACmB,OAASnB,SAASJ,OAAOuB;;;OAjBtEvB;AAoBhB;AAWA,SAASqB,YAAYtB,KAAuB;IAC1C,MAAM,EAAEuB,KAAK,EAAElB,QAAQ,EAAE,GAAGoB,QAAQ,GAAGzB;IACvC,MAAM,EACJ0B,MAAM,EAAEC,MAAM,EAAE,EACjB,GAAGJ;IAEJ,MAAMK,qBAAoD,CAACJ;QACzDnB,SACEP,QAAQyB,OAAO,CAACM;YACdA,MAAMH,IAAI,CAACC,MAAM,GAAGH;QACtB;IAEJ;IAEA,qBACE,KAAClC;QAAK,GAAGmC,MAAM;kBAEb,cAAA,KAAC5B;YACCiC,WAAW;YACXC,YAAW;YACXC,iBAAgB;YAChBT,OAAOI;YACPtB,UAAUuB;;;AAIlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TimeSeriesQueryEditor/index.ts"],"names":[],"mappings":"AAaA,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
export * from './TimeSeriesQueryEditor';
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TimeSeriesQueryEditor/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './TimeSeriesQueryEditor';\n"],"names":[],"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,cAAc,0BAA0B"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PanelDefinition, QueryDefinition } from '@perses-dev/core';
|
|
3
|
-
/**
|
|
4
|
-
* UsePanelEditor is used in PanelEditorForm
|
|
5
|
-
* This hook stores the states of panel definition and returns the onChange handlers for each state
|
|
6
|
-
*/
|
|
7
|
-
export declare const usePanelEditor: (panelDefinition: PanelDefinition) => {
|
|
8
|
-
panelDefinition: PanelDefinition<import("@perses-dev/core").UnknownSpec>;
|
|
9
|
-
setName: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
10
|
-
setDescription: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
11
|
-
setQueries: (queries?: QueryDefinition[], hideQueryEditor?: boolean) => void;
|
|
12
|
-
setPlugin: import("react").Dispatch<import("react").SetStateAction<import("@perses-dev/core").Definition<import("@perses-dev/core").UnknownSpec>>>;
|
|
13
|
-
setPanelDefinition: (panelDefinition: PanelDefinition) => void;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=usePanelEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePanelEditor.d.ts","sourceRoot":"","sources":["../../src/context/usePanelEditor.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,cAAc,oBAAqB,eAAe;;;;2BAehD,eAAe,EAAE,oBAAoB,OAAO;;0CAarC,eAAe;CA4BpC,CAAC"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
14
|
-
/**
|
|
15
|
-
* UsePanelEditor is used in PanelEditorForm
|
|
16
|
-
* This hook stores the states of panel definition and returns the onChange handlers for each state
|
|
17
|
-
*/ export const usePanelEditor = (panelDefinition)=>{
|
|
18
|
-
const { display, plugin: pluginDefinition, queries: initialQueries } = panelDefinition.spec;
|
|
19
|
-
const [name, setName] = useState(display.name);
|
|
20
|
-
const [description, setDescription] = useState(display.description);
|
|
21
|
-
const [plugin, setPlugin] = useState(pluginDefinition);
|
|
22
|
-
// need to keep track of prevQueries if switching from a panel with no queries (ex: markdown) to one with queries
|
|
23
|
-
const [prevQueries, setPrevQueries] = useState(initialQueries);
|
|
24
|
-
const [currentQueries, setCurrentQueries] = useState(initialQueries);
|
|
25
|
-
/**
|
|
26
|
-
* If hideQueryEditor is true, set panelDefinition.spec.queries to undefined.
|
|
27
|
-
* If hideQueryEditor is false and query is undefined, set panelDefinition.spec.queries to previous queries.
|
|
28
|
-
*/ const setQueries = useCallback((queries, hideQueryEditor)=>{
|
|
29
|
-
if (hideQueryEditor) {
|
|
30
|
-
setPrevQueries(currentQueries);
|
|
31
|
-
setCurrentQueries(undefined);
|
|
32
|
-
} else {
|
|
33
|
-
setCurrentQueries(queries === undefined ? prevQueries : queries);
|
|
34
|
-
}
|
|
35
|
-
}, [
|
|
36
|
-
setCurrentQueries,
|
|
37
|
-
currentQueries,
|
|
38
|
-
setPrevQueries,
|
|
39
|
-
prevQueries
|
|
40
|
-
]);
|
|
41
|
-
// reset panel definition
|
|
42
|
-
const setPanelDefinition = useCallback((panelDefinition)=>{
|
|
43
|
-
const { display, plugin, queries } = panelDefinition.spec;
|
|
44
|
-
setName(display.name);
|
|
45
|
-
setDescription(display.description);
|
|
46
|
-
setPlugin(plugin);
|
|
47
|
-
setQueries(queries);
|
|
48
|
-
}, [
|
|
49
|
-
setName,
|
|
50
|
-
setDescription,
|
|
51
|
-
setPlugin,
|
|
52
|
-
setQueries
|
|
53
|
-
]);
|
|
54
|
-
return useMemo(()=>({
|
|
55
|
-
panelDefinition: {
|
|
56
|
-
kind: 'Panel',
|
|
57
|
-
spec: {
|
|
58
|
-
display: {
|
|
59
|
-
name,
|
|
60
|
-
description
|
|
61
|
-
},
|
|
62
|
-
plugin,
|
|
63
|
-
queries: currentQueries
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
setName,
|
|
67
|
-
setDescription,
|
|
68
|
-
setQueries,
|
|
69
|
-
setPlugin,
|
|
70
|
-
setPanelDefinition
|
|
71
|
-
}), [
|
|
72
|
-
name,
|
|
73
|
-
description,
|
|
74
|
-
plugin,
|
|
75
|
-
currentQueries,
|
|
76
|
-
setName,
|
|
77
|
-
setDescription,
|
|
78
|
-
setQueries,
|
|
79
|
-
setPlugin,
|
|
80
|
-
setPanelDefinition
|
|
81
|
-
]);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
//# sourceMappingURL=usePanelEditor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/usePanelEditor.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useCallback, useMemo, useState } from 'react';\nimport { PanelDefinition, QueryDefinition } from '@perses-dev/core';\n\n/**\n * UsePanelEditor is used in PanelEditorForm\n * This hook stores the states of panel definition and returns the onChange handlers for each state\n */\nexport const usePanelEditor = (panelDefinition: PanelDefinition) => {\n const { display, plugin: pluginDefinition, queries: initialQueries } = panelDefinition.spec;\n const [name, setName] = useState(display.name);\n const [description, setDescription] = useState(display.description);\n const [plugin, setPlugin] = useState(pluginDefinition);\n\n // need to keep track of prevQueries if switching from a panel with no queries (ex: markdown) to one with queries\n const [prevQueries, setPrevQueries] = useState(initialQueries);\n const [currentQueries, setCurrentQueries] = useState(initialQueries);\n\n /**\n * If hideQueryEditor is true, set panelDefinition.spec.queries to undefined.\n * If hideQueryEditor is false and query is undefined, set panelDefinition.spec.queries to previous queries.\n */\n const setQueries = useCallback(\n (queries?: QueryDefinition[], hideQueryEditor?: boolean) => {\n if (hideQueryEditor) {\n setPrevQueries(currentQueries);\n setCurrentQueries(undefined);\n } else {\n setCurrentQueries(queries === undefined ? prevQueries : queries);\n }\n },\n [setCurrentQueries, currentQueries, setPrevQueries, prevQueries]\n );\n\n // reset panel definition\n const setPanelDefinition = useCallback(\n (panelDefinition: PanelDefinition) => {\n const { display, plugin, queries } = panelDefinition.spec;\n setName(display.name);\n setDescription(display.description);\n setPlugin(plugin);\n setQueries(queries);\n },\n [setName, setDescription, setPlugin, setQueries]\n );\n\n return useMemo(\n () => ({\n panelDefinition: {\n kind: 'Panel',\n spec: {\n display: { name, description },\n plugin,\n queries: currentQueries,\n },\n } as PanelDefinition,\n setName,\n setDescription,\n setQueries,\n setPlugin,\n setPanelDefinition,\n }),\n [name, description, plugin, currentQueries, setName, setDescription, setQueries, setPlugin, setPanelDefinition]\n );\n};\n"],"names":["useCallback","useMemo","useState","usePanelEditor","panelDefinition","display","plugin","pluginDefinition","queries","initialQueries","spec","name","setName","description","setDescription","setPlugin","prevQueries","setPrevQueries","currentQueries","setCurrentQueries","setQueries","hideQueryEditor","undefined","setPanelDefinition","kind"],"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,SAASA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAGvD;;;CAGC,GACD,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,OAAO,EAAEC,QAAQC,gBAAgB,EAAEC,SAASC,cAAc,EAAE,GAAGL,gBAAgBM,IAAI;IAC3F,MAAM,CAACC,MAAMC,QAAQ,GAAGV,SAASG,QAAQM,IAAI;IAC7C,MAAM,CAACE,aAAaC,eAAe,GAAGZ,SAASG,QAAQQ,WAAW;IAClE,MAAM,CAACP,QAAQS,UAAU,GAAGb,SAASK;IAErC,iHAAiH;IACjH,MAAM,CAACS,aAAaC,eAAe,GAAGf,SAASO;IAC/C,MAAM,CAACS,gBAAgBC,kBAAkB,GAAGjB,SAASO;IAErD;;;GAGC,GACD,MAAMW,aAAapB,YACjB,CAACQ,SAA6Ba;QAC5B,IAAIA,iBAAiB;YACnBJ,eAAeC;YACfC,kBAAkBG;QACpB,OAAO;YACLH,kBAAkBX,YAAYc,YAAYN,cAAcR;QAC1D;IACF,GACA;QAACW;QAAmBD;QAAgBD;QAAgBD;KAAY;IAGlE,yBAAyB;IACzB,MAAMO,qBAAqBvB,YACzB,CAACI;QACC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEE,OAAO,EAAE,GAAGJ,gBAAgBM,IAAI;QACzDE,QAAQP,QAAQM,IAAI;QACpBG,eAAeT,QAAQQ,WAAW;QAClCE,UAAUT;QACVc,WAAWZ;IACb,GACA;QAACI;QAASE;QAAgBC;QAAWK;KAAW;IAGlD,OAAOnB,QACL,IAAO,CAAA;YACLG,iBAAiB;gBACfoB,MAAM;gBACNd,MAAM;oBACJL,SAAS;wBAAEM;wBAAME;oBAAY;oBAC7BP;oBACAE,SAASU;gBACX;YACF;YACAN;YACAE;YACAM;YACAL;YACAQ;QACF,CAAA,GACA;QAACZ;QAAME;QAAaP;QAAQY;QAAgBN;QAASE;QAAgBM;QAAYL;QAAWQ;KAAmB;AAEnH,EAAE"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { QueryDefinition } from '@perses-dev/core';
|
|
2
|
-
export interface TimeSeriesQueryEditorActionsProps {
|
|
3
|
-
queries: QueryDefinition[];
|
|
4
|
-
onChange: (queries: QueryDefinition[]) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const useTimeSeriesQueryEditorActions: (props: TimeSeriesQueryEditorActionsProps) => {
|
|
7
|
-
handleQueryChange: (index: number, queryDef: QueryDefinition) => void;
|
|
8
|
-
handleQueryAdd: () => void;
|
|
9
|
-
handleQueryDelete: (index: number) => void;
|
|
10
|
-
handleQueryCollapseExpand: (index: number) => void;
|
|
11
|
-
queriesCollapsed: boolean[];
|
|
12
|
-
defaultTimeSeriesQueryKind: string;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=useTimeSeriesQueryEditorActions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTimeSeriesQueryEditorActions.d.ts","sourceRoot":"","sources":["../../src/context/useTimeSeriesQueryEditorActions.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAA6B,MAAM,kBAAkB,CAAC;AAO9E,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAChD;AAED,eAAO,MAAM,+BAA+B,UAAW,iCAAiC;+BAY5E,MAAM,YAAY,eAAe;;+BAuCjC,MAAM;uCAeN,MAAM;;;CA0BjB,CAAC"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
import { usePlugin, usePluginRegistry } from '@perses-dev/plugin-system';
|
|
14
|
-
import produce from 'immer';
|
|
15
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
16
|
-
const DEFAULT_QUERY_PLUGIN_TYPE = 'TimeSeriesQuery';
|
|
17
|
-
export const useTimeSeriesQueryEditorActions = (props)=>{
|
|
18
|
-
const { queries, onChange } = props;
|
|
19
|
-
const { defaultPluginKinds } = usePluginRegistry();
|
|
20
|
-
var _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE;
|
|
21
|
-
const defaultTimeSeriesQueryKind = (_defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds[DEFAULT_QUERY_PLUGIN_TYPE]) !== null && _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE !== void 0 ? _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE : '';
|
|
22
|
-
const { data: defaultQueryPlugin } = usePlugin(DEFAULT_QUERY_PLUGIN_TYPE, defaultTimeSeriesQueryKind, {
|
|
23
|
-
useErrorBoundary: true,
|
|
24
|
-
enabled: true
|
|
25
|
-
});
|
|
26
|
-
const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(()=>false));
|
|
27
|
-
const handleQueryChange = useCallback((index, queryDef)=>{
|
|
28
|
-
onChange(produce(queries, (draft)=>{
|
|
29
|
-
if (draft) {
|
|
30
|
-
draft[index] = queryDef;
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
draft = [
|
|
34
|
-
queryDef
|
|
35
|
-
];
|
|
36
|
-
}));
|
|
37
|
-
}, [
|
|
38
|
-
onChange,
|
|
39
|
-
queries
|
|
40
|
-
]);
|
|
41
|
-
const handleQueryAdd = useCallback(()=>{
|
|
42
|
-
if (!defaultQueryPlugin) return;
|
|
43
|
-
onChange(produce(queries, (draft)=>{
|
|
44
|
-
const queryDef = {
|
|
45
|
-
kind: DEFAULT_QUERY_PLUGIN_TYPE,
|
|
46
|
-
spec: {
|
|
47
|
-
plugin: {
|
|
48
|
-
kind: defaultTimeSeriesQueryKind,
|
|
49
|
-
spec: defaultQueryPlugin.createInitialOptions()
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
if (draft) {
|
|
54
|
-
draft.push(queryDef);
|
|
55
|
-
} else {
|
|
56
|
-
draft = [
|
|
57
|
-
...queries,
|
|
58
|
-
queryDef
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
}));
|
|
62
|
-
setQueriesCollapsed((queriesCollapsed)=>{
|
|
63
|
-
queriesCollapsed.push(false);
|
|
64
|
-
return [
|
|
65
|
-
...queriesCollapsed
|
|
66
|
-
];
|
|
67
|
-
});
|
|
68
|
-
}, [
|
|
69
|
-
defaultQueryPlugin,
|
|
70
|
-
defaultTimeSeriesQueryKind,
|
|
71
|
-
onChange,
|
|
72
|
-
queries,
|
|
73
|
-
setQueriesCollapsed
|
|
74
|
-
]);
|
|
75
|
-
const handleQueryDelete = useCallback((index)=>{
|
|
76
|
-
onChange(produce(queries, (draft)=>{
|
|
77
|
-
draft.splice(index, 1);
|
|
78
|
-
}));
|
|
79
|
-
setQueriesCollapsed((queriesCollapsed)=>{
|
|
80
|
-
queriesCollapsed.splice(index, 1);
|
|
81
|
-
return [
|
|
82
|
-
...queriesCollapsed
|
|
83
|
-
];
|
|
84
|
-
});
|
|
85
|
-
}, [
|
|
86
|
-
onChange,
|
|
87
|
-
setQueriesCollapsed,
|
|
88
|
-
queries
|
|
89
|
-
]);
|
|
90
|
-
const handleQueryCollapseExpand = useCallback((index)=>{
|
|
91
|
-
setQueriesCollapsed((queriesCollapsed)=>{
|
|
92
|
-
queriesCollapsed[index] = !queriesCollapsed[index];
|
|
93
|
-
return [
|
|
94
|
-
...queriesCollapsed
|
|
95
|
-
];
|
|
96
|
-
});
|
|
97
|
-
}, [
|
|
98
|
-
setQueriesCollapsed
|
|
99
|
-
]);
|
|
100
|
-
return useMemo(()=>{
|
|
101
|
-
return {
|
|
102
|
-
handleQueryChange,
|
|
103
|
-
handleQueryAdd,
|
|
104
|
-
handleQueryDelete,
|
|
105
|
-
handleQueryCollapseExpand,
|
|
106
|
-
queriesCollapsed,
|
|
107
|
-
defaultTimeSeriesQueryKind
|
|
108
|
-
};
|
|
109
|
-
}, [
|
|
110
|
-
handleQueryChange,
|
|
111
|
-
handleQueryAdd,
|
|
112
|
-
handleQueryDelete,
|
|
113
|
-
handleQueryCollapseExpand,
|
|
114
|
-
queriesCollapsed,
|
|
115
|
-
defaultTimeSeriesQueryKind
|
|
116
|
-
]);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
//# sourceMappingURL=useTimeSeriesQueryEditorActions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/useTimeSeriesQueryEditorActions.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition, TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { usePlugin, usePluginRegistry } from '@perses-dev/plugin-system';\nimport produce from 'immer';\nimport { useCallback, useMemo, useState } from 'react';\n\nconst DEFAULT_QUERY_PLUGIN_TYPE = 'TimeSeriesQuery';\n\nexport interface TimeSeriesQueryEditorActionsProps {\n queries: QueryDefinition[];\n onChange: (queries: QueryDefinition[]) => void;\n}\n\nexport const useTimeSeriesQueryEditorActions = (props: TimeSeriesQueryEditorActionsProps) => {\n const { queries, onChange } = props;\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultTimeSeriesQueryKind = defaultPluginKinds?.[DEFAULT_QUERY_PLUGIN_TYPE] ?? '';\n const { data: defaultQueryPlugin } = usePlugin(DEFAULT_QUERY_PLUGIN_TYPE, defaultTimeSeriesQueryKind, {\n useErrorBoundary: true,\n enabled: true,\n });\n\n const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(() => false));\n\n const handleQueryChange = useCallback(\n (index: number, queryDef: QueryDefinition) => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft[index] = queryDef;\n return;\n }\n draft = [queryDef];\n })\n );\n },\n [onChange, queries]\n );\n\n const handleQueryAdd = useCallback(() => {\n if (!defaultQueryPlugin) return;\n onChange(\n produce(queries, (draft) => {\n const queryDef: TimeSeriesQueryDefinition = {\n kind: DEFAULT_QUERY_PLUGIN_TYPE,\n spec: {\n plugin: { kind: defaultTimeSeriesQueryKind, spec: defaultQueryPlugin.createInitialOptions() },\n },\n };\n\n if (draft) {\n draft.push(queryDef);\n } else {\n draft = [...queries, queryDef];\n }\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.push(false);\n return [...queriesCollapsed];\n });\n }, [defaultQueryPlugin, defaultTimeSeriesQueryKind, onChange, queries, setQueriesCollapsed]);\n\n const handleQueryDelete = useCallback(\n (index: number) => {\n onChange(\n produce(queries, (draft) => {\n draft.splice(index, 1);\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.splice(index, 1);\n return [...queriesCollapsed];\n });\n },\n [onChange, setQueriesCollapsed, queries]\n );\n\n const handleQueryCollapseExpand = useCallback(\n (index: number) => {\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed[index] = !queriesCollapsed[index];\n return [...queriesCollapsed];\n });\n },\n [setQueriesCollapsed]\n );\n\n return useMemo(() => {\n return {\n handleQueryChange,\n handleQueryAdd,\n handleQueryDelete,\n handleQueryCollapseExpand,\n queriesCollapsed,\n defaultTimeSeriesQueryKind,\n };\n }, [\n handleQueryChange,\n handleQueryAdd,\n handleQueryDelete,\n handleQueryCollapseExpand,\n queriesCollapsed,\n defaultTimeSeriesQueryKind,\n ]);\n};\n"],"names":["usePlugin","usePluginRegistry","produce","useCallback","useMemo","useState","DEFAULT_QUERY_PLUGIN_TYPE","useTimeSeriesQueryEditorActions","props","queries","onChange","defaultPluginKinds","defaultTimeSeriesQueryKind","data","defaultQueryPlugin","useErrorBoundary","enabled","queriesCollapsed","setQueriesCollapsed","map","handleQueryChange","index","queryDef","draft","handleQueryAdd","kind","spec","plugin","createInitialOptions","push","handleQueryDelete","splice","handleQueryCollapseExpand"],"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,iBAAiB,QAAQ,4BAA4B;AACzE,OAAOC,aAAa,QAAQ;AAC5B,SAASC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAEvD,MAAMC,4BAA4B;AAOlC,OAAO,MAAMC,kCAAkC,CAACC;IAC9C,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGF;IAC9B,MAAM,EAAEG,kBAAkB,EAAE,GAAGV;QACIU;IAAnC,MAAMC,6BAA6BD,CAAAA,gDAAAA,+BAAAA,yCAAAA,kBAAoB,CAACL,0BAA0B,cAA/CK,2DAAAA,gDAAmD;IACtF,MAAM,EAAEE,MAAMC,kBAAkB,EAAE,GAAGd,UAAUM,2BAA2BM,4BAA4B;QACpGG,kBAAkB;QAClBC,SAAS;IACX;IAEA,MAAM,CAACC,kBAAkBC,oBAAoB,GAAGb,SAASI,QAAQU,GAAG,CAAC,IAAM;IAE3E,MAAMC,oBAAoBjB,YACxB,CAACkB,OAAeC;QACdZ,SACER,QAAQO,SAAS,CAACc;YAChB,IAAIA,OAAO;gBACTA,KAAK,CAACF,MAAM,GAAGC;gBACf;YACF;YACAC,QAAQ;gBAACD;aAAS;QACpB;IAEJ,GACA;QAACZ;QAAUD;KAAQ;IAGrB,MAAMe,iBAAiBrB,YAAY;QACjC,IAAI,CAACW,oBAAoB;QACzBJ,SACER,QAAQO,SAAS,CAACc;YAChB,MAAMD,WAAsC;gBAC1CG,MAAMnB;gBACNoB,MAAM;oBACJC,QAAQ;wBAAEF,MAAMb;wBAA4Bc,MAAMZ,mBAAmBc,oBAAoB;oBAAG;gBAC9F;YACF;YAEA,IAAIL,OAAO;gBACTA,MAAMM,IAAI,CAACP;YACb,OAAO;gBACLC,QAAQ;uBAAId;oBAASa;iBAAS;YAChC;QACF;QAEFJ,oBAAoB,CAACD;YACnBA,iBAAiBY,IAAI,CAAC;YACtB,OAAO;mBAAIZ;aAAiB;QAC9B;IACF,GAAG;QAACH;QAAoBF;QAA4BF;QAAUD;QAASS;KAAoB;IAE3F,MAAMY,oBAAoB3B,YACxB,CAACkB;QACCX,SACER,QAAQO,SAAS,CAACc;YAChBA,MAAMQ,MAAM,CAACV,OAAO;QACtB;QAEFH,oBAAoB,CAACD;YACnBA,iBAAiBc,MAAM,CAACV,OAAO;YAC/B,OAAO;mBAAIJ;aAAiB;QAC9B;IACF,GACA;QAACP;QAAUQ;QAAqBT;KAAQ;IAG1C,MAAMuB,4BAA4B7B,YAChC,CAACkB;QACCH,oBAAoB,CAACD;YACnBA,gBAAgB,CAACI,MAAM,GAAG,CAACJ,gBAAgB,CAACI,MAAM;YAClD,OAAO;mBAAIJ;aAAiB;QAC9B;IACF,GACA;QAACC;KAAoB;IAGvB,OAAOd,QAAQ;QACb,OAAO;YACLgB;YACAI;YACAM;YACAE;YACAf;YACAL;QACF;IACF,GAAG;QACDQ;QACAI;QACAM;QACAE;QACAf;QACAL;KACD;AACH,EAAE"}
|