@perses-dev/explore 0.45.0 → 0.46.0-rc0

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 (46) hide show
  1. package/dist/cjs/components/ExploreManager/ExploreManager.js +86 -0
  2. package/dist/cjs/components/ExploreManager/ExplorerManagerProvider.js +163 -0
  3. package/dist/cjs/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js +64 -0
  4. package/dist/cjs/components/ExploreManager/MetricsExplorer.js +158 -0
  5. package/dist/cjs/components/ExploreManager/TracesExplorer.js +103 -0
  6. package/dist/cjs/components/ExploreManager/constants.js +32 -0
  7. package/dist/cjs/components/ExploreManager/index.js +30 -0
  8. package/dist/cjs/views/ViewExplore/ViewExploreApp.js +6 -9
  9. package/dist/components/ExploreManager/ExploreManager.d.ts +6 -0
  10. package/dist/components/ExploreManager/ExploreManager.d.ts.map +1 -0
  11. package/dist/components/ExploreManager/ExploreManager.js +78 -0
  12. package/dist/components/ExploreManager/ExploreManager.js.map +1 -0
  13. package/dist/components/ExploreManager/ExplorerManagerProvider.d.ts +26 -0
  14. package/dist/components/ExploreManager/ExplorerManagerProvider.d.ts.map +1 -0
  15. package/dist/components/ExploreManager/ExplorerManagerProvider.js +106 -0
  16. package/dist/components/ExploreManager/ExplorerManagerProvider.js.map +1 -0
  17. package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.d.ts +7 -0
  18. package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.d.ts.map +1 -0
  19. package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js +51 -0
  20. package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js.map +1 -0
  21. package/dist/components/ExploreManager/MetricsExplorer.d.ts +2 -0
  22. package/dist/components/ExploreManager/MetricsExplorer.d.ts.map +1 -0
  23. package/dist/components/ExploreManager/MetricsExplorer.js +145 -0
  24. package/dist/components/ExploreManager/MetricsExplorer.js.map +1 -0
  25. package/dist/components/ExploreManager/TracesExplorer.d.ts +2 -0
  26. package/dist/components/ExploreManager/TracesExplorer.d.ts.map +1 -0
  27. package/dist/components/ExploreManager/TracesExplorer.js +90 -0
  28. package/dist/components/ExploreManager/TracesExplorer.js.map +1 -0
  29. package/dist/components/ExploreManager/constants.d.ts +3 -0
  30. package/dist/components/ExploreManager/constants.d.ts.map +1 -0
  31. package/dist/components/ExploreManager/constants.js +16 -0
  32. package/dist/components/ExploreManager/constants.js.map +1 -0
  33. package/dist/components/ExploreManager/index.d.ts +2 -0
  34. package/dist/components/ExploreManager/index.d.ts.map +1 -0
  35. package/dist/components/ExploreManager/index.js +15 -0
  36. package/dist/components/ExploreManager/index.js.map +1 -0
  37. package/dist/views/ViewExplore/ViewExploreApp.d.ts +2 -2
  38. package/dist/views/ViewExplore/ViewExploreApp.d.ts.map +1 -1
  39. package/dist/views/ViewExplore/ViewExploreApp.js +6 -4
  40. package/dist/views/ViewExplore/ViewExploreApp.js.map +1 -1
  41. package/package.json +8 -8
  42. package/dist/cjs/components/TimeSeriesExplorer/TimeSeriesExplorer.js +0 -169
  43. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.d.ts +0 -11
  44. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.d.ts.map +0 -1
  45. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.js +0 -112
  46. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.js.map +0 -1
@@ -0,0 +1,78 @@
1
+ // Copyright 2024 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 { Card, Stack, Tab, Tabs, useMediaQuery } from '@mui/material';
15
+ import { ExploreToolbar } from '../ExploreToolbar';
16
+ import { TracesExplorer } from './TracesExplorer';
17
+ import { MetricsExplorer } from './MetricsExplorer';
18
+ import { useExplorerManagerContext } from './ExplorerManagerProvider';
19
+ export function ExploreManager(props) {
20
+ const { exploreTitleComponent } = props;
21
+ const { explorer, setExplorer } = useExplorerManagerContext();
22
+ const smallScreen = useMediaQuery('(max-width: 768px)');
23
+ return /*#__PURE__*/ _jsxs(Stack, {
24
+ sx: {
25
+ width: '100%'
26
+ },
27
+ px: 2,
28
+ pb: 2,
29
+ pt: 1.5,
30
+ gap: 3,
31
+ children: [
32
+ /*#__PURE__*/ _jsx(ExploreToolbar, {
33
+ exploreTitleComponent: exploreTitleComponent
34
+ }),
35
+ /*#__PURE__*/ _jsxs(Stack, {
36
+ direction: smallScreen ? 'column' : 'row',
37
+ gap: 2,
38
+ sx: {
39
+ width: '100%'
40
+ },
41
+ children: [
42
+ /*#__PURE__*/ _jsxs(Tabs, {
43
+ orientation: smallScreen ? 'horizontal' : 'vertical',
44
+ value: explorer,
45
+ onChange: (_, state)=>setExplorer(state),
46
+ variant: smallScreen ? 'fullWidth' : 'scrollable',
47
+ sx: {
48
+ borderRight: smallScreen ? 0 : 1,
49
+ borderBottom: smallScreen ? 1 : 0,
50
+ borderColor: 'divider',
51
+ minWidth: '100px'
52
+ },
53
+ children: [
54
+ /*#__PURE__*/ _jsx(Tab, {
55
+ label: "Metrics"
56
+ }),
57
+ /*#__PURE__*/ _jsx(Tab, {
58
+ label: "Traces"
59
+ })
60
+ ]
61
+ }),
62
+ /*#__PURE__*/ _jsxs(Card, {
63
+ sx: {
64
+ padding: '10px',
65
+ width: '100%'
66
+ },
67
+ children: [
68
+ explorer === 0 && /*#__PURE__*/ _jsx(MetricsExplorer, {}),
69
+ explorer === 1 && /*#__PURE__*/ _jsx(TracesExplorer, {})
70
+ ]
71
+ })
72
+ ]
73
+ })
74
+ ]
75
+ });
76
+ }
77
+
78
+ //# sourceMappingURL=ExploreManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/ExploreManager.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Card, Stack, Tab, Tabs, useMediaQuery } from '@mui/material';\nimport { ReactNode } from 'react';\nimport { ExploreToolbar } from '../ExploreToolbar';\nimport { TracesExplorer } from './TracesExplorer';\nimport { MetricsExplorer } from './MetricsExplorer';\nimport { useExplorerManagerContext } from './ExplorerManagerProvider';\n\nexport interface ExploreManagerProps {\n exploreTitleComponent?: ReactNode;\n}\n\nexport function ExploreManager(props: ExploreManagerProps) {\n const { exploreTitleComponent } = props;\n const { explorer, setExplorer } = useExplorerManagerContext();\n\n const smallScreen = useMediaQuery('(max-width: 768px)');\n return (\n <Stack sx={{ width: '100%' }} px={2} pb={2} pt={1.5} gap={3}>\n <ExploreToolbar exploreTitleComponent={exploreTitleComponent} />\n\n <Stack direction={smallScreen ? 'column' : 'row'} gap={2} sx={{ width: '100%' }}>\n <Tabs\n orientation={smallScreen ? 'horizontal' : 'vertical'}\n value={explorer}\n onChange={(_, state) => setExplorer(state)}\n variant={smallScreen ? 'fullWidth' : 'scrollable'}\n sx={{\n borderRight: smallScreen ? 0 : 1,\n borderBottom: smallScreen ? 1 : 0,\n borderColor: 'divider',\n minWidth: '100px',\n }}\n >\n <Tab label=\"Metrics\" />\n <Tab label=\"Traces\" />\n </Tabs>\n <Card sx={{ padding: '10px', width: '100%' }}>\n {explorer === 0 && <MetricsExplorer />}\n {explorer === 1 && <TracesExplorer />}\n </Card>\n </Stack>\n </Stack>\n );\n}\n"],"names":["Card","Stack","Tab","Tabs","useMediaQuery","ExploreToolbar","TracesExplorer","MetricsExplorer","useExplorerManagerContext","ExploreManager","props","exploreTitleComponent","explorer","setExplorer","smallScreen","sx","width","px","pb","pt","gap","direction","orientation","value","onChange","_","state","variant","borderRight","borderBottom","borderColor","minWidth","label","padding"],"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,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,aAAa,QAAQ,gBAAgB;AAEtE,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,yBAAyB,QAAQ,4BAA4B;AAMtE,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAClC,MAAM,EAAEE,QAAQ,EAAEC,WAAW,EAAE,GAAGL;IAElC,MAAMM,cAAcV,cAAc;IAClC,qBACE,MAACH;QAAMc,IAAI;YAAEC,OAAO;QAAO;QAAGC,IAAI;QAAGC,IAAI;QAAGC,IAAI;QAAKC,KAAK;;0BACxD,KAACf;gBAAeM,uBAAuBA;;0BAEvC,MAACV;gBAAMoB,WAAWP,cAAc,WAAW;gBAAOM,KAAK;gBAAGL,IAAI;oBAAEC,OAAO;gBAAO;;kCAC5E,MAACb;wBACCmB,aAAaR,cAAc,eAAe;wBAC1CS,OAAOX;wBACPY,UAAU,CAACC,GAAGC,QAAUb,YAAYa;wBACpCC,SAASb,cAAc,cAAc;wBACrCC,IAAI;4BACFa,aAAad,cAAc,IAAI;4BAC/Be,cAAcf,cAAc,IAAI;4BAChCgB,aAAa;4BACbC,UAAU;wBACZ;;0CAEA,KAAC7B;gCAAI8B,OAAM;;0CACX,KAAC9B;gCAAI8B,OAAM;;;;kCAEb,MAAChC;wBAAKe,IAAI;4BAAEkB,SAAS;4BAAQjB,OAAO;wBAAO;;4BACxCJ,aAAa,mBAAK,KAACL;4BACnBK,aAAa,mBAAK,KAACN;;;;;;;AAK9B"}
@@ -0,0 +1,26 @@
1
+ import { ReactNode } from 'react';
2
+ import { QueryDefinition } from '@perses-dev/core';
3
+ interface ExplorerManagerContextType {
4
+ explorer: number;
5
+ tab: number;
6
+ queries: QueryDefinition[];
7
+ setExplorer: (explorer: number) => void;
8
+ setTab: (tab: number) => void;
9
+ setQueries: (queries: QueryDefinition[]) => void;
10
+ }
11
+ interface ExplorerManagerInitialState {
12
+ explorer?: number;
13
+ tab?: number;
14
+ queries?: QueryDefinition[];
15
+ setExplorer: (explorer: number | undefined) => void;
16
+ setTab: (tab: number | undefined) => void;
17
+ setQueries: (queries: QueryDefinition[] | undefined) => void;
18
+ }
19
+ interface ExplorerManagerProviderProps {
20
+ children: ReactNode;
21
+ initialState?: ExplorerManagerInitialState;
22
+ }
23
+ export declare function ExplorerManagerProvider({ children, initialState }: ExplorerManagerProviderProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function useExplorerManagerContext(): ExplorerManagerContextType;
25
+ export {};
26
+ //# sourceMappingURL=ExplorerManagerProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExplorerManagerProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAiB,SAAS,EAAiC,MAAM,OAAO,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOnD,UAAU,0BAA0B;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,UAAU,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAClD;AAED,UAAU,2BAA2B;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACpD,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1C,UAAU,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS,KAAK,IAAI,CAAC;CAC9D;AAID,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,2BAA2B,CAAC;CAC5C;AAaD,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,4BAA4B,2CAsC/F;AAED,wBAAgB,yBAAyB,IAAI,0BAA0B,CAMtE"}
@@ -0,0 +1,106 @@
1
+ // Copyright 2024 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 } from "react/jsx-runtime";
14
+ import React, { createContext, useContext, useMemo, useState } from 'react';
15
+ const ExplorerManagerContext = /*#__PURE__*/ createContext(undefined);
16
+ function initExplorerStates(initialState) {
17
+ const result = [];
18
+ if ((initialState === null || initialState === void 0 ? void 0 : initialState.explorer) !== undefined) {
19
+ var _initialState_tab, _initialState_queries;
20
+ result[initialState.explorer] = {
21
+ tab: (_initialState_tab = initialState.tab) !== null && _initialState_tab !== void 0 ? _initialState_tab : 0,
22
+ queries: (_initialState_queries = initialState.queries) !== null && _initialState_queries !== void 0 ? _initialState_queries : []
23
+ };
24
+ }
25
+ return result;
26
+ }
27
+ export function ExplorerManagerProvider({ children, initialState }) {
28
+ const [explorerStates, setExplorerStates] = useState(initExplorerStates(initialState));
29
+ var _initialState_explorer;
30
+ const [explorer, setInternalExplorer] = useState((_initialState_explorer = initialState === null || initialState === void 0 ? void 0 : initialState.explorer) !== null && _initialState_explorer !== void 0 ? _initialState_explorer : 0);
31
+ const tab = useMemo(()=>{
32
+ var _explorerStates_explorer;
33
+ var _explorerStates_explorer_tab;
34
+ return (_explorerStates_explorer_tab = (_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.tab) !== null && _explorerStates_explorer_tab !== void 0 ? _explorerStates_explorer_tab : 0;
35
+ }, [
36
+ explorer,
37
+ explorerStates
38
+ ]);
39
+ const queries = useMemo(()=>{
40
+ var _explorerStates_explorer;
41
+ var _explorerStates_explorer_queries;
42
+ return (_explorerStates_explorer_queries = (_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.queries) !== null && _explorerStates_explorer_queries !== void 0 ? _explorerStates_explorer_queries : [];
43
+ }, [
44
+ explorer,
45
+ explorerStates
46
+ ]);
47
+ function setExplorer(explorer) {
48
+ setInternalExplorer(explorer);
49
+ if (initialState === null || initialState === void 0 ? void 0 : initialState.setExplorer) {
50
+ var _explorerStates_explorer, _explorerStates_explorer1;
51
+ initialState.setExplorer(explorer);
52
+ initialState.setTab((_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.tab);
53
+ initialState.setQueries((_explorerStates_explorer1 = explorerStates[explorer]) === null || _explorerStates_explorer1 === void 0 ? void 0 : _explorerStates_explorer1.queries);
54
+ }
55
+ }
56
+ function setTab(tab) {
57
+ var _state_explorer;
58
+ const state = [
59
+ ...explorerStates
60
+ ];
61
+ var _state_explorer_queries;
62
+ state[explorer] = {
63
+ tab,
64
+ queries: (_state_explorer_queries = (_state_explorer = state[explorer]) === null || _state_explorer === void 0 ? void 0 : _state_explorer.queries) !== null && _state_explorer_queries !== void 0 ? _state_explorer_queries : []
65
+ };
66
+ setExplorerStates(state);
67
+ if (initialState === null || initialState === void 0 ? void 0 : initialState.setTab) {
68
+ initialState.setTab(tab);
69
+ }
70
+ }
71
+ function setQueries(queries) {
72
+ var _state_explorer;
73
+ const state = [
74
+ ...explorerStates
75
+ ];
76
+ var _state_explorer_tab;
77
+ state[explorer] = {
78
+ tab: (_state_explorer_tab = (_state_explorer = state[explorer]) === null || _state_explorer === void 0 ? void 0 : _state_explorer.tab) !== null && _state_explorer_tab !== void 0 ? _state_explorer_tab : 0,
79
+ queries: queries
80
+ };
81
+ setExplorerStates(state);
82
+ if (initialState === null || initialState === void 0 ? void 0 : initialState.setQueries) {
83
+ initialState === null || initialState === void 0 ? void 0 : initialState.setQueries(queries);
84
+ }
85
+ }
86
+ return /*#__PURE__*/ _jsx(ExplorerManagerContext.Provider, {
87
+ value: {
88
+ explorer,
89
+ tab,
90
+ queries,
91
+ setExplorer,
92
+ setTab,
93
+ setQueries
94
+ },
95
+ children: children
96
+ });
97
+ }
98
+ export function useExplorerManagerContext() {
99
+ const ctx = useContext(ExplorerManagerContext);
100
+ if (ctx === undefined) {
101
+ throw new Error('No ExplorerManagerContext found. Did you forget a Provider?');
102
+ }
103
+ return ctx;
104
+ }
105
+
106
+ //# sourceMappingURL=ExplorerManagerProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, ReactNode, useContext, useMemo, useState } from 'react';\nimport { QueryDefinition } from '@perses-dev/core';\n\ninterface ExplorerState {\n tab: number;\n queries: QueryDefinition[];\n}\n\ninterface ExplorerManagerContextType {\n explorer: number;\n tab: number;\n queries: QueryDefinition[];\n setExplorer: (explorer: number) => void;\n setTab: (tab: number) => void;\n setQueries: (queries: QueryDefinition[]) => void;\n}\n\ninterface ExplorerManagerInitialState {\n explorer?: number;\n tab?: number;\n queries?: QueryDefinition[];\n setExplorer: (explorer: number | undefined) => void;\n setTab: (tab: number | undefined) => void;\n setQueries: (queries: QueryDefinition[] | undefined) => void;\n}\n\nconst ExplorerManagerContext = createContext<ExplorerManagerContextType | undefined>(undefined);\n\ninterface ExplorerManagerProviderProps {\n children: ReactNode;\n initialState?: ExplorerManagerInitialState;\n}\n\nfunction initExplorerStates(initialState?: ExplorerManagerInitialState): ExplorerState[] {\n const result: ExplorerState[] = [];\n if (initialState?.explorer !== undefined) {\n result[initialState.explorer] = {\n tab: initialState.tab ?? 0,\n queries: initialState.queries ?? [],\n };\n }\n return result;\n}\n\nexport function ExplorerManagerProvider({ children, initialState }: ExplorerManagerProviderProps) {\n const [explorerStates, setExplorerStates] = useState<ExplorerState[]>(initExplorerStates(initialState));\n const [explorer, setInternalExplorer] = useState<number>(initialState?.explorer ?? 0);\n const tab: number = useMemo(() => explorerStates[explorer]?.tab ?? 0, [explorer, explorerStates]);\n const queries: QueryDefinition[] = useMemo(() => explorerStates[explorer]?.queries ?? [], [explorer, explorerStates]);\n\n function setExplorer(explorer: number) {\n setInternalExplorer(explorer);\n if (initialState?.setExplorer) {\n initialState.setExplorer(explorer);\n initialState.setTab(explorerStates[explorer]?.tab);\n initialState.setQueries(explorerStates[explorer]?.queries);\n }\n }\n\n function setTab(tab: number) {\n const state = [...explorerStates];\n state[explorer] = { tab, queries: state[explorer]?.queries ?? [] };\n setExplorerStates(state);\n if (initialState?.setTab) {\n initialState.setTab(tab);\n }\n }\n\n function setQueries(queries: QueryDefinition[]) {\n const state = [...explorerStates];\n state[explorer] = { tab: state[explorer]?.tab ?? 0, queries: queries };\n setExplorerStates(state);\n if (initialState?.setQueries) {\n initialState?.setQueries(queries);\n }\n }\n\n return (\n <ExplorerManagerContext.Provider value={{ explorer, tab, queries, setExplorer, setTab, setQueries }}>\n {children}\n </ExplorerManagerContext.Provider>\n );\n}\n\nexport function useExplorerManagerContext(): ExplorerManagerContextType {\n const ctx = useContext(ExplorerManagerContext);\n if (ctx === undefined) {\n throw new Error('No ExplorerManagerContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n"],"names":["React","createContext","useContext","useMemo","useState","ExplorerManagerContext","undefined","initExplorerStates","initialState","result","explorer","tab","queries","ExplorerManagerProvider","children","explorerStates","setExplorerStates","setInternalExplorer","setExplorer","setTab","setQueries","state","Provider","value","useExplorerManagerContext","ctx","Error"],"mappings":"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"}
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ interface ExplorerManagerProviderWithQueryParamsProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare function ExplorerManagerProviderWithQueryParams({ children }: ExplorerManagerProviderWithQueryParamsProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=ExplorerManagerProviderWithQueryParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExplorerManagerProviderWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYzC,UAAU,2CAA2C;IACnD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sCAAsC,CAAC,EAAE,QAAQ,EAAE,EAAE,2CAA2C,2CAe/G"}
@@ -0,0 +1,51 @@
1
+ // Copyright 2024 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 } from "react/jsx-runtime";
14
+ import React from 'react';
15
+ import { JsonParam, NumberParam, useQueryParams } from 'use-query-params';
16
+ import { ExplorerManagerProvider } from './ExplorerManagerProvider';
17
+ const exploreQueryConfig = {
18
+ explorer: NumberParam,
19
+ tab: NumberParam,
20
+ queries: JsonParam
21
+ };
22
+ export function ExplorerManagerProviderWithQueryParams({ children }) {
23
+ const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig, {
24
+ updateType: 'replaceIn'
25
+ });
26
+ var _queryParams_explorer, _queryParams_tab;
27
+ const initialState = {
28
+ explorer: (_queryParams_explorer = queryParams.explorer) !== null && _queryParams_explorer !== void 0 ? _queryParams_explorer : undefined,
29
+ tab: (_queryParams_tab = queryParams.tab) !== null && _queryParams_tab !== void 0 ? _queryParams_tab : undefined,
30
+ queries: queryParams.queries ? queryParams.queries : undefined,
31
+ setExplorer: (explorer)=>{
32
+ setQueryParams({
33
+ explorer,
34
+ queries: undefined,
35
+ tab: undefined
36
+ });
37
+ },
38
+ setTab: (tab)=>setQueryParams({
39
+ tab
40
+ }),
41
+ setQueries: (queries)=>setQueryParams({
42
+ queries
43
+ })
44
+ };
45
+ return /*#__PURE__*/ _jsx(ExplorerManagerProvider, {
46
+ initialState: initialState,
47
+ children: children
48
+ });
49
+ }
50
+
51
+ //# sourceMappingURL=ExplorerManagerProviderWithQueryParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { ReactNode } from 'react';\n\nimport { JsonParam, NumberParam, useQueryParams } from 'use-query-params';\nimport { QueryDefinition } from '@perses-dev/core';\nimport { ExplorerManagerProvider } from './ExplorerManagerProvider';\n\nconst exploreQueryConfig = {\n explorer: NumberParam,\n tab: NumberParam,\n queries: JsonParam,\n};\n\ninterface ExplorerManagerProviderWithQueryParamsProps {\n children: ReactNode;\n}\n\nexport function ExplorerManagerProviderWithQueryParams({ children }: ExplorerManagerProviderWithQueryParamsProps) {\n const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig, { updateType: 'replaceIn' });\n\n const initialState = {\n explorer: queryParams.explorer ?? undefined, // can be null, forcing to undefined\n tab: queryParams.tab ?? undefined, // can be null, forcing to undefined\n queries: queryParams.queries ? (queryParams.queries as QueryDefinition[]) : undefined,\n setExplorer: (explorer: number | undefined) => {\n setQueryParams({ explorer, queries: undefined, tab: undefined });\n },\n setTab: (tab: number | undefined) => setQueryParams({ tab }),\n setQueries: (queries: QueryDefinition[] | undefined) => setQueryParams({ queries }),\n };\n\n return <ExplorerManagerProvider initialState={initialState}>{children}</ExplorerManagerProvider>;\n}\n"],"names":["React","JsonParam","NumberParam","useQueryParams","ExplorerManagerProvider","exploreQueryConfig","explorer","tab","queries","ExplorerManagerProviderWithQueryParams","children","queryParams","setQueryParams","updateType","initialState","undefined","setExplorer","setTab","setQueries"],"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,OAAOA,WAA0B,QAAQ;AAEzC,SAASC,SAAS,EAAEC,WAAW,EAAEC,cAAc,QAAQ,mBAAmB;AAE1E,SAASC,uBAAuB,QAAQ,4BAA4B;AAEpE,MAAMC,qBAAqB;IACzBC,UAAUJ;IACVK,KAAKL;IACLM,SAASP;AACX;AAMA,OAAO,SAASQ,uCAAuC,EAAEC,QAAQ,EAA+C;IAC9G,MAAM,CAACC,aAAaC,eAAe,GAAGT,eAAeE,oBAAoB;QAAEQ,YAAY;IAAY;QAGvFF,uBACLA;IAFP,MAAMG,eAAe;QACnBR,UAAUK,CAAAA,wBAAAA,YAAYL,QAAQ,cAApBK,mCAAAA,wBAAwBI;QAClCR,KAAKI,CAAAA,mBAAAA,YAAYJ,GAAG,cAAfI,8BAAAA,mBAAmBI;QACxBP,SAASG,YAAYH,OAAO,GAAIG,YAAYH,OAAO,GAAyBO;QAC5EC,aAAa,CAACV;YACZM,eAAe;gBAAEN;gBAAUE,SAASO;gBAAWR,KAAKQ;YAAU;QAChE;QACAE,QAAQ,CAACV,MAA4BK,eAAe;gBAAEL;YAAI;QAC1DW,YAAY,CAACV,UAA2CI,eAAe;gBAAEJ;YAAQ;IACnF;IAEA,qBAAO,KAACJ;QAAwBU,cAAcA;kBAAeJ;;AAC/D"}
@@ -0,0 +1,2 @@
1
+ export declare function MetricsExplorer(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=MetricsExplorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetricsExplorer.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/MetricsExplorer.tsx"],"names":[],"mappings":"AAkFA,wBAAgB,eAAe,4CAsB9B"}
@@ -0,0 +1,145 @@
1
+ // Copyright 2024 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, Stack, Tab, Tabs } from '@mui/material';
15
+ import { DataQueriesProvider, MultiQueryEditor, useSuggestedStepMs } from '@perses-dev/plugin-system';
16
+ import useResizeObserver from 'use-resize-observer';
17
+ import { Panel } from '@perses-dev/dashboards';
18
+ import { PANEL_PREVIEW_HEIGHT } from './constants';
19
+ import { useExplorerManagerContext } from './ExplorerManagerProvider';
20
+ function TimeSeriesPanel({ queries }) {
21
+ const { width, ref: boxRef } = useResizeObserver();
22
+ const height = PANEL_PREVIEW_HEIGHT;
23
+ const suggestedStepMs = useSuggestedStepMs(width);
24
+ // map TimeSeriesQueryDefinition to Definition<UnknownSpec>
25
+ const definitions = queries.length ? queries.map((query)=>{
26
+ return {
27
+ kind: query.spec.plugin.kind,
28
+ spec: query.spec.plugin.spec
29
+ };
30
+ }) : [];
31
+ return /*#__PURE__*/ _jsx(Box, {
32
+ ref: boxRef,
33
+ height: height,
34
+ children: /*#__PURE__*/ _jsx(DataQueriesProvider, {
35
+ definitions: definitions,
36
+ options: {
37
+ suggestedStepMs,
38
+ mode: 'range'
39
+ },
40
+ children: /*#__PURE__*/ _jsx(Panel, {
41
+ panelOptions: {
42
+ hideHeader: true
43
+ },
44
+ definition: {
45
+ kind: 'Panel',
46
+ spec: {
47
+ queries: queries,
48
+ display: {
49
+ name: ''
50
+ },
51
+ plugin: {
52
+ kind: 'TimeSeriesChart',
53
+ spec: {}
54
+ }
55
+ }
56
+ }
57
+ })
58
+ })
59
+ });
60
+ }
61
+ function MetricDataTable({ queries }) {
62
+ const height = PANEL_PREVIEW_HEIGHT;
63
+ // map TimeSeriesQueryDefinition to Definition<UnknownSpec>
64
+ const definitions = (queries !== null && queries !== void 0 ? queries : []).map((query)=>{
65
+ return {
66
+ kind: query.spec.plugin.kind,
67
+ spec: query.spec.plugin.spec
68
+ };
69
+ });
70
+ return /*#__PURE__*/ _jsx(Box, {
71
+ height: height,
72
+ children: /*#__PURE__*/ _jsx(DataQueriesProvider, {
73
+ definitions: definitions,
74
+ options: {
75
+ mode: 'instant'
76
+ },
77
+ children: /*#__PURE__*/ _jsx(Panel, {
78
+ panelOptions: {
79
+ hideHeader: true
80
+ },
81
+ definition: {
82
+ kind: 'Panel',
83
+ spec: {
84
+ queries: queries,
85
+ display: {
86
+ name: ''
87
+ },
88
+ plugin: {
89
+ kind: 'TimeSeriesTable',
90
+ spec: {}
91
+ }
92
+ }
93
+ }
94
+ })
95
+ })
96
+ });
97
+ }
98
+ export function MetricsExplorer() {
99
+ const { tab, queries, setTab, setQueries } = useExplorerManagerContext();
100
+ return /*#__PURE__*/ _jsxs(Stack, {
101
+ gap: 2,
102
+ sx: {
103
+ width: '100%'
104
+ },
105
+ children: [
106
+ /*#__PURE__*/ _jsx(MultiQueryEditor, {
107
+ queryTypes: [
108
+ 'TimeSeriesQuery'
109
+ ],
110
+ onChange: setQueries,
111
+ queries: queries
112
+ }),
113
+ /*#__PURE__*/ _jsxs(Tabs, {
114
+ value: tab,
115
+ onChange: (_, state)=>setTab(state),
116
+ variant: "scrollable",
117
+ sx: {
118
+ borderBottom: 1,
119
+ borderColor: 'divider'
120
+ },
121
+ children: [
122
+ /*#__PURE__*/ _jsx(Tab, {
123
+ label: "Table"
124
+ }),
125
+ /*#__PURE__*/ _jsx(Tab, {
126
+ label: "Graph"
127
+ })
128
+ ]
129
+ }),
130
+ /*#__PURE__*/ _jsxs(Stack, {
131
+ gap: 1,
132
+ children: [
133
+ tab === 0 && /*#__PURE__*/ _jsx(MetricDataTable, {
134
+ queries: queries
135
+ }),
136
+ tab === 1 && /*#__PURE__*/ _jsx(TimeSeriesPanel, {
137
+ queries: queries
138
+ })
139
+ ]
140
+ })
141
+ ]
142
+ });
143
+ }
144
+
145
+ //# sourceMappingURL=MetricsExplorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/MetricsExplorer.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition } from '@perses-dev/core';\nimport { Box, Stack, Tab, Tabs } from '@mui/material';\nimport { DataQueriesProvider, MultiQueryEditor, useSuggestedStepMs } from '@perses-dev/plugin-system';\nimport useResizeObserver from 'use-resize-observer';\nimport { Panel } from '@perses-dev/dashboards';\nimport { PANEL_PREVIEW_HEIGHT } from './constants';\nimport { useExplorerManagerContext } from './ExplorerManagerProvider';\n\nfunction TimeSeriesPanel({ queries }: { queries: QueryDefinition[] }) {\n const { width, ref: boxRef } = useResizeObserver();\n const height = PANEL_PREVIEW_HEIGHT;\n\n const suggestedStepMs = useSuggestedStepMs(width);\n\n // map TimeSeriesQueryDefinition to Definition<UnknownSpec>\n const definitions = queries.length\n ? queries.map((query) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n })\n : [];\n\n return (\n <Box ref={boxRef} height={height}>\n <DataQueriesProvider definitions={definitions} options={{ suggestedStepMs, mode: 'range' }}>\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: { queries: queries, display: { name: '' }, plugin: { kind: 'TimeSeriesChart', spec: {} } },\n }}\n />\n </DataQueriesProvider>\n </Box>\n );\n}\n\nfunction MetricDataTable({ queries }: { queries: QueryDefinition[] }) {\n const height = PANEL_PREVIEW_HEIGHT;\n\n // map TimeSeriesQueryDefinition to Definition<UnknownSpec>\n const definitions = (queries ?? []).map((query) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n });\n\n return (\n <Box height={height}>\n <DataQueriesProvider definitions={definitions} options={{ mode: 'instant' }}>\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: { queries: queries, display: { name: '' }, plugin: { kind: 'TimeSeriesTable', spec: {} } },\n }}\n />\n </DataQueriesProvider>\n </Box>\n );\n}\n\nexport function MetricsExplorer() {\n const { tab, queries, setTab, setQueries } = useExplorerManagerContext();\n\n return (\n <Stack gap={2} sx={{ width: '100%' }}>\n <MultiQueryEditor queryTypes={['TimeSeriesQuery']} onChange={setQueries} queries={queries} />\n\n <Tabs\n value={tab}\n onChange={(_, state) => setTab(state)}\n variant=\"scrollable\"\n sx={{ borderBottom: 1, borderColor: 'divider' }}\n >\n <Tab label=\"Table\" />\n <Tab label=\"Graph\" />\n </Tabs>\n <Stack gap={1}>\n {tab === 0 && <MetricDataTable queries={queries} />}\n {tab === 1 && <TimeSeriesPanel queries={queries} />}\n </Stack>\n </Stack>\n );\n}\n"],"names":["Box","Stack","Tab","Tabs","DataQueriesProvider","MultiQueryEditor","useSuggestedStepMs","useResizeObserver","Panel","PANEL_PREVIEW_HEIGHT","useExplorerManagerContext","TimeSeriesPanel","queries","width","ref","boxRef","height","suggestedStepMs","definitions","length","map","query","kind","spec","plugin","options","mode","panelOptions","hideHeader","definition","display","name","MetricDataTable","MetricsExplorer","tab","setTab","setQueries","gap","sx","queryTypes","onChange","value","_","state","variant","borderBottom","borderColor","label"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export declare function TracesExplorer(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=TracesExplorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TracesExplorer.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/TracesExplorer.tsx"],"names":[],"mappings":"AAiDA,wBAAgB,cAAc,4CAoB7B"}
@@ -0,0 +1,90 @@
1
+ // Copyright 2024 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 { DataQueriesProvider, MultiQueryEditor, useSuggestedStepMs } from '@perses-dev/plugin-system';
15
+ import { Box, Stack, Tab, Tabs } from '@mui/material';
16
+ import { ScatterChart } from '@perses-dev/panels-plugin';
17
+ import { ErrorAlert, ErrorBoundary } from '@perses-dev/components';
18
+ import useResizeObserver from 'use-resize-observer';
19
+ import { PANEL_PREVIEW_DEFAULT_WIDTH, PANEL_PREVIEW_HEIGHT } from './constants';
20
+ import { useExplorerManagerContext } from './ExplorerManagerProvider';
21
+ function TracePanel({ queries }) {
22
+ const { width, ref: boxRef } = useResizeObserver();
23
+ const height = PANEL_PREVIEW_HEIGHT;
24
+ const suggestedStepMs = useSuggestedStepMs(width);
25
+ // map TraceQueryDefinition to Definition<UnknownSpec>
26
+ const definitions = queries.length ? queries.map((query)=>{
27
+ return {
28
+ kind: query.spec.plugin.kind,
29
+ spec: query.spec.plugin.spec
30
+ };
31
+ }) : [];
32
+ return /*#__PURE__*/ _jsx(Box, {
33
+ ref: boxRef,
34
+ height: height,
35
+ children: /*#__PURE__*/ _jsx(DataQueriesProvider, {
36
+ definitions: definitions,
37
+ options: {
38
+ suggestedStepMs
39
+ },
40
+ children: /*#__PURE__*/ _jsx(ScatterChart.PanelComponent, {
41
+ contentDimensions: {
42
+ width: width !== null && width !== void 0 ? width : PANEL_PREVIEW_DEFAULT_WIDTH,
43
+ height
44
+ },
45
+ spec: {}
46
+ })
47
+ })
48
+ });
49
+ }
50
+ export function TracesExplorer() {
51
+ const { tab, queries, setTab, setQueries } = useExplorerManagerContext();
52
+ return /*#__PURE__*/ _jsxs(Stack, {
53
+ gap: 2,
54
+ sx: {
55
+ width: '100%'
56
+ },
57
+ children: [
58
+ /*#__PURE__*/ _jsx(MultiQueryEditor, {
59
+ queryTypes: [
60
+ 'TraceQuery'
61
+ ],
62
+ onChange: setQueries,
63
+ queries: queries
64
+ }),
65
+ /*#__PURE__*/ _jsx(Tabs, {
66
+ value: tab,
67
+ onChange: (_, state)=>setTab(state),
68
+ variant: "scrollable",
69
+ sx: {
70
+ borderRight: 1,
71
+ borderColor: 'divider'
72
+ },
73
+ children: /*#__PURE__*/ _jsx(Tab, {
74
+ label: "Graph"
75
+ })
76
+ }),
77
+ /*#__PURE__*/ _jsx(Stack, {
78
+ gap: 1,
79
+ children: /*#__PURE__*/ _jsx(ErrorBoundary, {
80
+ FallbackComponent: ErrorAlert,
81
+ children: tab === 0 && /*#__PURE__*/ _jsx(TracePanel, {
82
+ queries: queries
83
+ })
84
+ })
85
+ })
86
+ ]
87
+ });
88
+ }
89
+
90
+ //# sourceMappingURL=TracesExplorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/TracesExplorer.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DataQueriesProvider, MultiQueryEditor, useSuggestedStepMs } from '@perses-dev/plugin-system';\nimport { Box, Stack, Tab, Tabs } from '@mui/material';\nimport { ScatterChart } from '@perses-dev/panels-plugin';\nimport { QueryDefinition } from '@perses-dev/core';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport useResizeObserver from 'use-resize-observer';\nimport { PANEL_PREVIEW_DEFAULT_WIDTH, PANEL_PREVIEW_HEIGHT } from './constants';\nimport { useExplorerManagerContext } from './ExplorerManagerProvider';\n\nfunction TracePanel({ queries }: { queries: QueryDefinition[] }) {\n const { width, ref: boxRef } = useResizeObserver();\n const height = PANEL_PREVIEW_HEIGHT;\n const suggestedStepMs = useSuggestedStepMs(width);\n\n // map TraceQueryDefinition to Definition<UnknownSpec>\n const definitions = queries.length\n ? queries.map((query) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n })\n : [];\n\n return (\n <Box ref={boxRef} height={height}>\n <DataQueriesProvider definitions={definitions} options={{ suggestedStepMs }}>\n <ScatterChart.PanelComponent\n contentDimensions={{ width: width ?? PANEL_PREVIEW_DEFAULT_WIDTH, height }}\n spec={{}}\n />\n </DataQueriesProvider>\n </Box>\n );\n}\n\nexport function TracesExplorer() {\n const { tab, queries, setTab, setQueries } = useExplorerManagerContext();\n\n return (\n <Stack gap={2} sx={{ width: '100%' }}>\n <MultiQueryEditor queryTypes={['TraceQuery']} onChange={setQueries} queries={queries} />\n\n <Tabs\n value={tab}\n onChange={(_, state) => setTab(state)}\n variant=\"scrollable\"\n sx={{ borderRight: 1, borderColor: 'divider' }}\n >\n <Tab label=\"Graph\" />\n </Tabs>\n <Stack gap={1}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>{tab === 0 && <TracePanel queries={queries} />}</ErrorBoundary>\n </Stack>\n </Stack>\n );\n}\n"],"names":["DataQueriesProvider","MultiQueryEditor","useSuggestedStepMs","Box","Stack","Tab","Tabs","ScatterChart","ErrorAlert","ErrorBoundary","useResizeObserver","PANEL_PREVIEW_DEFAULT_WIDTH","PANEL_PREVIEW_HEIGHT","useExplorerManagerContext","TracePanel","queries","width","ref","boxRef","height","suggestedStepMs","definitions","length","map","query","kind","spec","plugin","options","PanelComponent","contentDimensions","TracesExplorer","tab","setTab","setQueries","gap","sx","queryTypes","onChange","value","_","state","variant","borderRight","borderColor","label","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,SAASA,mBAAmB,EAAEC,gBAAgB,EAAEC,kBAAkB,QAAQ,4BAA4B;AACtG,SAASC,GAAG,EAAEC,KAAK,EAAEC,GAAG,EAAEC,IAAI,QAAQ,gBAAgB;AACtD,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AACnE,OAAOC,uBAAuB,sBAAsB;AACpD,SAASC,2BAA2B,EAAEC,oBAAoB,QAAQ,cAAc;AAChF,SAASC,yBAAyB,QAAQ,4BAA4B;AAEtE,SAASC,WAAW,EAAEC,OAAO,EAAkC;IAC7D,MAAM,EAAEC,KAAK,EAAEC,KAAKC,MAAM,EAAE,GAAGR;IAC/B,MAAMS,SAASP;IACf,MAAMQ,kBAAkBlB,mBAAmBc;IAE3C,sDAAsD;IACtD,MAAMK,cAAcN,QAAQO,MAAM,GAC9BP,QAAQQ,GAAG,CAAC,CAACC;QACX,OAAO;YACLC,MAAMD,MAAME,IAAI,CAACC,MAAM,CAACF,IAAI;YAC5BC,MAAMF,MAAME,IAAI,CAACC,MAAM,CAACD,IAAI;QAC9B;IACF,KACA,EAAE;IAEN,qBACE,KAACvB;QAAIc,KAAKC;QAAQC,QAAQA;kBACxB,cAAA,KAACnB;YAAoBqB,aAAaA;YAAaO,SAAS;gBAAER;YAAgB;sBACxE,cAAA,KAACb,aAAasB,cAAc;gBAC1BC,mBAAmB;oBAAEd,OAAOA,kBAAAA,mBAAAA,QAASL;oBAA6BQ;gBAAO;gBACzEO,MAAM,CAAC;;;;AAKjB;AAEA,OAAO,SAASK;IACd,MAAM,EAAEC,GAAG,EAAEjB,OAAO,EAAEkB,MAAM,EAAEC,UAAU,EAAE,GAAGrB;IAE7C,qBACE,MAACT;QAAM+B,KAAK;QAAGC,IAAI;YAAEpB,OAAO;QAAO;;0BACjC,KAACf;gBAAiBoC,YAAY;oBAAC;iBAAa;gBAAEC,UAAUJ;gBAAYnB,SAASA;;0BAE7E,KAACT;gBACCiC,OAAOP;gBACPM,UAAU,CAACE,GAAGC,QAAUR,OAAOQ;gBAC/BC,SAAQ;gBACRN,IAAI;oBAAEO,aAAa;oBAAGC,aAAa;gBAAU;0BAE7C,cAAA,KAACvC;oBAAIwC,OAAM;;;0BAEb,KAACzC;gBAAM+B,KAAK;0BACV,cAAA,KAAC1B;oBAAcqC,mBAAmBtC;8BAAawB,QAAQ,mBAAK,KAAClB;wBAAWC,SAASA;;;;;;AAIzF"}
@@ -0,0 +1,3 @@
1
+ export declare const PANEL_PREVIEW_HEIGHT = 300;
2
+ export declare const PANEL_PREVIEW_DEFAULT_WIDTH = 840;
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/constants.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,eAAO,MAAM,2BAA2B,MAAM,CAAC"}
@@ -0,0 +1,16 @@
1
+ // Copyright 2024 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 const PANEL_PREVIEW_HEIGHT = 300;
14
+ export const PANEL_PREVIEW_DEFAULT_WIDTH = 840;
15
+
16
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/constants.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport const PANEL_PREVIEW_HEIGHT = 300;\nexport const PANEL_PREVIEW_DEFAULT_WIDTH = 840;\n"],"names":["PANEL_PREVIEW_HEIGHT","PANEL_PREVIEW_DEFAULT_WIDTH"],"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,OAAO,MAAMA,uBAAuB,IAAI;AACxC,OAAO,MAAMC,8BAA8B,IAAI"}
@@ -0,0 +1,2 @@
1
+ export * from './ExploreManager';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}