@perses-dev/explore 0.55.0-beta.9 → 0.55.0-rc.0

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.
@@ -1,4 +1,9 @@
1
+ import type { PluginMetadataWithModule } from '@perses-dev/plugin-system';
1
2
  import type { ReactElement, ReactNode } from 'react';
3
+ /** Identifier of an explorer plugin, as stored in the explorer manager state. */
4
+ export declare function getExplorerKey(plugin: PluginMetadataWithModule): string;
5
+ /** Explore plugins sorted by display name, matching the order of the explorer tabs. */
6
+ export declare function useSortedExplorerPlugins(): PluginMetadataWithModule[] | undefined;
2
7
  export interface ExploreManagerProps {
3
8
  exploreTitleComponent?: ReactNode;
4
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExploreManager.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExploreManager.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQrD,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,CAAC,EAAE,SAAS,CAAC;CACnC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAiGvE"}
1
+ {"version":3,"file":"ExploreManager.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExploreManager.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAI1E,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQrD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM,CAEvE;AAED,uFAAuF;AACvF,wBAAgB,wBAAwB,IAAI,wBAAwB,EAAE,GAAG,SAAS,CAMjF;AAED,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,CAAC,EAAE,SAAS,CAAC;CACnC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAsFvE"}
@@ -13,38 +13,32 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  // limitations under the License.
14
14
  import { Box, Button, Card, Stack, Tab, Tabs, useMediaQuery } from "@mui/material";
15
15
  import { useLocalStorage } from "@perses-dev/components";
16
- import { PluginLoaderComponent, useListPluginMetadata } from "@perses-dev/plugin-system";
16
+ import { PluginLoaderComponent, useListPluginMetadata, usePluginRegistry } from "@perses-dev/plugin-system";
17
17
  import ChevronLeft from "mdi-material-ui/ChevronLeft";
18
18
  import ChevronRight from "mdi-material-ui/ChevronRight";
19
- import { useEffect, useMemo } from "react";
19
+ import { useMemo } from "react";
20
20
  import { ExploreToolbar } from "../ExploreToolbar/index.js";
21
21
  import { useExplorerManagerContext } from "./ExplorerManagerProvider.js";
22
22
  const EXPLORE_TABS_COLLAPSED_KEY = 'PERSES_EXPLORE_TABS_COLLAPSED';
23
- export function ExploreManager(props) {
24
- const { exploreTitleComponent } = props;
25
- const { explorer, setExplorer } = useExplorerManagerContext();
23
+ /** Identifier of an explorer plugin, as stored in the explorer manager state. */ export function getExplorerKey(plugin) {
24
+ return `${plugin.module.name}-${plugin.spec.name}`;
25
+ }
26
+ /** Explore plugins sorted by display name, matching the order of the explorer tabs. */ export function useSortedExplorerPlugins() {
26
27
  const plugins = useListPluginMetadata([
27
28
  'Explore'
28
29
  ]);
29
- const isSmallScreen = useMediaQuery('(max-width: 768px)');
30
- const [isCollapsed, setIsCollapsed] = useLocalStorage(EXPLORE_TABS_COLLAPSED_KEY, false);
31
- const explorerPluginsMap = useMemo(()=>Object.fromEntries(plugins.data?.map((plugin)=>[
32
- `${plugin.module.name}-${plugin.spec.name}`,
33
- plugin
34
- ]) ?? []), [
30
+ return useMemo(()=>plugins.data?.toSorted((a, b)=>a.spec.display.name.localeCompare(b.spec.display.name)), [
35
31
  plugins.data
36
32
  ]);
37
- useEffect(()=>{
38
- const plugins = Object.keys(explorerPluginsMap);
39
- if (!explorer && plugins?.[0]) {
40
- setExplorer(plugins[0]);
41
- }
42
- }, [
43
- explorerPluginsMap,
44
- explorer,
45
- setExplorer
46
- ]);
47
- const currentPlugin = explorer ? explorerPluginsMap[explorer] : undefined;
33
+ }
34
+ export function ExploreManager(props) {
35
+ const { exploreTitleComponent } = props;
36
+ const { explorer, setExplorer } = useExplorerManagerContext();
37
+ const plugins = useSortedExplorerPlugins();
38
+ const { pluginsBaseURL } = usePluginRegistry();
39
+ const isSmallScreen = useMediaQuery('(max-width: 768px)');
40
+ const [isCollapsed, setIsCollapsed] = useLocalStorage(EXPLORE_TABS_COLLAPSED_KEY, false);
41
+ const currentPlugin = explorer ? plugins?.find((plugin)=>getExplorerKey(plugin) === explorer) : undefined;
48
42
  if (!explorer) {
49
43
  return /*#__PURE__*/ _jsx("div", {
50
44
  children: "No explorer plugin available"
@@ -108,13 +102,13 @@ export function ExploreManager(props) {
108
102
  sx: {
109
103
  display: isCollapsed ? 'none' : 'flex'
110
104
  },
111
- children: plugins.data?.toSorted((a, b)=>a.spec.display.name.localeCompare(b.spec.display.name)).map((plugin)=>/*#__PURE__*/ _jsx(Tab, {
112
- value: `${plugin.module.name}-${plugin.spec.name}`,
105
+ children: plugins?.map((plugin)=>/*#__PURE__*/ _jsx(Tab, {
106
+ value: getExplorerKey(plugin),
113
107
  label: plugin.spec.display.name,
114
108
  sx: {
115
109
  padding: 0.5
116
110
  }
117
- }, `${plugin.module.name}-${plugin.spec.name}`))
111
+ }, getExplorerKey(plugin)))
118
112
  })
119
113
  ]
120
114
  }),
@@ -126,9 +120,12 @@ export function ExploreManager(props) {
126
120
  children: currentPlugin && /*#__PURE__*/ _jsx(PluginLoaderComponent, {
127
121
  plugin: {
128
122
  name: currentPlugin.spec.name,
129
- moduleName: currentPlugin.module.name
123
+ moduleName: currentPlugin.module.name,
124
+ version: currentPlugin.module.version,
125
+ registry: currentPlugin.module.registry,
126
+ baseURL: pluginsBaseURL
130
127
  }
131
- }, `${currentPlugin.module.name}-${currentPlugin.spec.name}`)
128
+ }, getExplorerKey(currentPlugin))
132
129
  })
133
130
  ]
134
131
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExploreManager/ExploreManager.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Button, Card, Stack, Tab, Tabs, useMediaQuery } from '@mui/material';\nimport { useLocalStorage } from '@perses-dev/components';\nimport { PluginLoaderComponent, useListPluginMetadata } from '@perses-dev/plugin-system';\nimport ChevronLeft from 'mdi-material-ui/ChevronLeft';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport type { ReactElement, ReactNode } from 'react';\nimport { useEffect, useMemo } from 'react';\n\nimport { ExploreToolbar } from '../ExploreToolbar';\nimport { useExplorerManagerContext } from './ExplorerManagerProvider';\n\nconst EXPLORE_TABS_COLLAPSED_KEY = 'PERSES_EXPLORE_TABS_COLLAPSED';\n\nexport interface ExploreManagerProps {\n exploreTitleComponent?: ReactNode;\n}\n\nexport function ExploreManager(props: ExploreManagerProps): ReactElement {\n const { exploreTitleComponent } = props;\n const { explorer, setExplorer } = useExplorerManagerContext();\n\n const plugins = useListPluginMetadata(['Explore']);\n\n const isSmallScreen = useMediaQuery('(max-width: 768px)');\n const [isCollapsed, setIsCollapsed] = useLocalStorage<boolean>(EXPLORE_TABS_COLLAPSED_KEY, false);\n\n const explorerPluginsMap = useMemo(\n () =>\n Object.fromEntries(plugins.data?.map((plugin) => [`${plugin.module.name}-${plugin.spec.name}`, plugin]) ?? []),\n [plugins.data],\n );\n\n useEffect(() => {\n const plugins = Object.keys(explorerPluginsMap);\n if (!explorer && plugins?.[0]) {\n setExplorer(plugins[0]);\n }\n }, [explorerPluginsMap, explorer, setExplorer]);\n\n const currentPlugin = explorer ? explorerPluginsMap[explorer] : undefined;\n\n if (!explorer) {\n return <div>No explorer plugin available</div>;\n }\n\n return (\n <Stack sx={{ width: '100%' }} px={2} pb={2} pt={1.5} gap={1}>\n <ExploreToolbar exploreTitleComponent={exploreTitleComponent} />\n\n <Stack direction={isSmallScreen ? 'column' : 'row'} gap={2} sx={{ width: '100%' }}>\n <Stack\n sx={{\n borderRight: isSmallScreen ? 0 : 1,\n borderBottom: isSmallScreen ? 1 : 0,\n borderColor: 'divider',\n minWidth: isCollapsed ? 15 : 100,\n }}\n >\n <Box sx={{ position: 'relative', height: 30, display: isSmallScreen ? 'none' : undefined }} test-id=\"qdqwd\">\n <Button\n title={isCollapsed ? 'Expand explorer tabs' : 'Collapse explorer tabs'}\n aria-label={isCollapsed ? 'Expand explorer tabs' : 'Collapse explorer tabs'}\n variant=\"text\"\n sx={{\n position: 'absolute',\n right: -15,\n zIndex: 1,\n padding: 0.5,\n minWidth: 'auto',\n backgroundColor: (theme) => theme.palette.background.default,\n }}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n {isCollapsed ? <ChevronRight /> : <ChevronLeft />}\n </Button>\n </Box>\n\n <Tabs\n orientation={isSmallScreen ? 'horizontal' : 'vertical'}\n value={explorer}\n onChange={(_, state) => setExplorer(state)}\n variant={isSmallScreen ? 'fullWidth' : 'scrollable'}\n sx={{\n display: isCollapsed ? 'none' : 'flex',\n }}\n >\n {plugins.data\n ?.toSorted((a, b) => a.spec.display.name.localeCompare(b.spec.display.name))\n .map((plugin) => (\n <Tab\n key={`${plugin.module.name}-${plugin.spec.name}`}\n value={`${plugin.module.name}-${plugin.spec.name}`}\n label={plugin.spec.display.name}\n sx={{\n padding: 0.5,\n }}\n />\n ))}\n </Tabs>\n </Stack>\n <Card sx={{ padding: '10px', width: '100%' }}>\n {currentPlugin && (\n <PluginLoaderComponent\n key={`${currentPlugin.module.name}-${currentPlugin.spec.name}`}\n plugin={{\n name: currentPlugin.spec.name,\n moduleName: currentPlugin.module.name,\n }}\n />\n )}\n </Card>\n </Stack>\n </Stack>\n );\n}\n"],"names":["Box","Button","Card","Stack","Tab","Tabs","useMediaQuery","useLocalStorage","PluginLoaderComponent","useListPluginMetadata","ChevronLeft","ChevronRight","useEffect","useMemo","ExploreToolbar","useExplorerManagerContext","EXPLORE_TABS_COLLAPSED_KEY","ExploreManager","props","exploreTitleComponent","explorer","setExplorer","plugins","isSmallScreen","isCollapsed","setIsCollapsed","explorerPluginsMap","Object","fromEntries","data","map","plugin","module","name","spec","keys","currentPlugin","undefined","div","sx","width","px","pb","pt","gap","direction","borderRight","borderBottom","borderColor","minWidth","position","height","display","test-id","title","aria-label","variant","right","zIndex","padding","backgroundColor","theme","palette","background","default","onClick","orientation","value","onChange","_","state","toSorted","a","b","localeCompare","label","moduleName"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,aAAa,QAAQ,gBAAgB;AACnF,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,qBAAqB,EAAEC,qBAAqB,QAAQ,4BAA4B;AACzF,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,kBAAkB,+BAA+B;AAExD,SAASC,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAE3C,SAASC,cAAc,QAAQ,6BAAoB;AACnD,SAASC,yBAAyB,QAAQ,+BAA4B;AAEtE,MAAMC,6BAA6B;AAMnC,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAE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vC;2BAJK,GAAGG,cAAcJ,MAAM,CAACC,IAAI,CAAC,CAAC,EAAEG,cAAcF,IAAI,CAACD,IAAI,EAAE;;;;;;AAW5E"}
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/ExploreManager.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Button, Card, Stack, Tab, Tabs, useMediaQuery } from '@mui/material';\nimport { useLocalStorage } from '@perses-dev/components';\nimport type { PluginMetadataWithModule } from '@perses-dev/plugin-system';\nimport { PluginLoaderComponent, useListPluginMetadata, usePluginRegistry } from '@perses-dev/plugin-system';\nimport ChevronLeft from 'mdi-material-ui/ChevronLeft';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport type { ReactElement, ReactNode } from 'react';\nimport { useMemo } from 'react';\n\nimport { ExploreToolbar } from '../ExploreToolbar';\nimport { useExplorerManagerContext } from './ExplorerManagerProvider';\n\nconst EXPLORE_TABS_COLLAPSED_KEY = 'PERSES_EXPLORE_TABS_COLLAPSED';\n\n/** Identifier of an explorer plugin, as stored in the explorer manager state. */\nexport function getExplorerKey(plugin: PluginMetadataWithModule): string {\n return `${plugin.module.name}-${plugin.spec.name}`;\n}\n\n/** Explore plugins sorted by display name, matching the order of the explorer tabs. */\nexport function useSortedExplorerPlugins(): PluginMetadataWithModule[] | undefined {\n const plugins = useListPluginMetadata(['Explore']);\n return useMemo(\n () => plugins.data?.toSorted((a, b) => a.spec.display.name.localeCompare(b.spec.display.name)),\n [plugins.data],\n );\n}\n\nexport interface ExploreManagerProps {\n exploreTitleComponent?: ReactNode;\n}\n\nexport function ExploreManager(props: ExploreManagerProps): ReactElement {\n const { exploreTitleComponent } = props;\n const { explorer, setExplorer } = useExplorerManagerContext();\n\n const plugins = useSortedExplorerPlugins();\n const { pluginsBaseURL } = usePluginRegistry();\n\n const isSmallScreen = useMediaQuery('(max-width: 768px)');\n const [isCollapsed, setIsCollapsed] = useLocalStorage<boolean>(EXPLORE_TABS_COLLAPSED_KEY, false);\n\n const currentPlugin = explorer ? plugins?.find((plugin) => getExplorerKey(plugin) === explorer) : undefined;\n\n if (!explorer) {\n return <div>No explorer plugin available</div>;\n }\n\n return (\n <Stack sx={{ width: '100%' }} px={2} pb={2} pt={1.5} gap={1}>\n <ExploreToolbar exploreTitleComponent={exploreTitleComponent} />\n\n <Stack direction={isSmallScreen ? 'column' : 'row'} gap={2} sx={{ width: '100%' }}>\n <Stack\n sx={{\n borderRight: isSmallScreen ? 0 : 1,\n borderBottom: isSmallScreen ? 1 : 0,\n borderColor: 'divider',\n minWidth: isCollapsed ? 15 : 100,\n }}\n >\n <Box sx={{ position: 'relative', height: 30, display: isSmallScreen ? 'none' : undefined }} test-id=\"qdqwd\">\n <Button\n title={isCollapsed ? 'Expand explorer tabs' : 'Collapse explorer tabs'}\n aria-label={isCollapsed ? 'Expand explorer tabs' : 'Collapse explorer tabs'}\n variant=\"text\"\n sx={{\n position: 'absolute',\n right: -15,\n zIndex: 1,\n padding: 0.5,\n minWidth: 'auto',\n backgroundColor: (theme) => theme.palette.background.default,\n }}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n {isCollapsed ? <ChevronRight /> : <ChevronLeft />}\n </Button>\n </Box>\n\n <Tabs\n orientation={isSmallScreen ? 'horizontal' : 'vertical'}\n value={explorer}\n onChange={(_, state) => setExplorer(state)}\n variant={isSmallScreen ? 'fullWidth' : 'scrollable'}\n sx={{\n display: isCollapsed ? 'none' : 'flex',\n }}\n >\n {plugins?.map((plugin) => (\n <Tab\n key={getExplorerKey(plugin)}\n value={getExplorerKey(plugin)}\n label={plugin.spec.display.name}\n sx={{\n padding: 0.5,\n }}\n />\n ))}\n </Tabs>\n </Stack>\n <Card sx={{ padding: '10px', width: '100%' }}>\n {currentPlugin && (\n <PluginLoaderComponent\n key={getExplorerKey(currentPlugin)}\n plugin={{\n name: currentPlugin.spec.name,\n moduleName: currentPlugin.module.name,\n version: currentPlugin.module.version,\n registry: currentPlugin.module.registry,\n baseURL: pluginsBaseURL,\n }}\n />\n )}\n </Card>\n </Stack>\n </Stack>\n );\n}\n"],"names":["Box","Button","Card","Stack","Tab","Tabs","useMediaQuery","useLocalStorage","PluginLoaderComponent","useListPluginMetadata","usePluginRegistry","ChevronLeft","ChevronRight","useMemo","ExploreToolbar","useExplorerManagerContext","EXPLORE_TABS_COLLAPSED_KEY","getExplorerKey","plugin","module","name","spec","useSortedExplorerPlugins","plugins","data","toSorted","a","b","display","localeCompare","ExploreManager","props","exploreTitleComponent","explorer","setExplorer","pluginsBaseURL","isSmallScreen","isCollapsed","setIsCollapsed","currentPlugin","find","undefined","div","sx","width","px","pb","pt","gap","direction","borderRight","borderBottom","borderColor","minWidth","position","height","test-id","title","aria-label","variant","right","zIndex","padding","backgroundColor","theme","palette","background","default","onClick","orientation","value","onChange","_","state","map","label","moduleName","version","registry","baseURL"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,aAAa,QAAQ,gBAAgB;AACnF,SAASC,eAAe,QAAQ,yBAAyB;AAEzD,SAASC,qBAAqB,EAAEC,qBAAqB,EAAEC,iBAAiB,QAAQ,4BAA4B;AAC5G,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,kBAAkB,+BAA+B;AAEx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5C;4BACX;2BAPKlB,eAAesB;;;;;;AAclC"}
@@ -13,8 +13,10 @@ interface ExplorerManagerContextType<T> {
13
13
  interface ExplorerManagerProviderProps {
14
14
  children: ReactNode;
15
15
  store?: [ExplorerState<unknown>, (state: ExplorerState<unknown>) => void];
16
+ /** Explorer used while the store has none selected; committed to the store on the first state change. */
17
+ defaultExplorer?: string;
16
18
  }
17
- export declare function ExplorerManagerProvider({ children, store: externalStore, }: ExplorerManagerProviderProps): ReactElement;
19
+ export declare function ExplorerManagerProvider({ children, store: externalStore, defaultExplorer, }: ExplorerManagerProviderProps): ReactElement;
18
20
  export declare function useExplorerManagerContext<T>(): ExplorerManagerContextType<T>;
19
21
  export {};
20
22
  //# sourceMappingURL=ExplorerManagerProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExplorerManagerProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,UAAU,aAAa,CAAC,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;CACT;AAED,UAAU,0BAA0B,CAAC,CAAC;IACpC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CAC5B;AAID,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;CAC3E;AAED,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,KAAK,EAAE,aAAa,GACrB,EAAE,4BAA4B,GAAG,YAAY,CAgC7C;AAED,wBAAgB,yBAAyB,CAAC,CAAC,KAAK,0BAA0B,CAAC,CAAC,CAAC,CAM5E"}
1
+ {"version":3,"file":"ExplorerManagerProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,UAAU,aAAa,CAAC,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;CACT;AAED,UAAU,0BAA0B,CAAC,CAAC;IACpC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;IACR,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CAC5B;AAID,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;IAC1E,yGAAyG;IACzG,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,KAAK,EAAE,aAAa,EACpB,eAAe,GAChB,EAAE,4BAA4B,GAAG,YAAY,CAkC7C;AAED,wBAAgB,yBAAyB,CAAC,CAAC,KAAK,0BAA0B,CAAC,CAAC,CAAC,CAM5E"}
@@ -13,7 +13,7 @@
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { createContext, useContext, useState } from "react";
15
15
  const ExplorerManagerContext = /*#__PURE__*/ createContext(undefined);
16
- export function ExplorerManagerProvider({ children, store: externalStore }) {
16
+ export function ExplorerManagerProvider({ children, store: externalStore, defaultExplorer }) {
17
17
  // cache the state of currently not rendered explore UIs
18
18
  const [explorerStateCache, setExplorerStateCache] = useState({});
19
19
  // local store in case external store is not provided by prop
@@ -23,14 +23,18 @@ export function ExplorerManagerProvider({ children, store: externalStore }) {
23
23
  });
24
24
  // use store provided by 'store' prop if available, otherwise use local store
25
25
  const [explorerState, setExplorerState] = externalStore ? externalStore : localStore;
26
- const { explorer, data } = explorerState;
26
+ const { data } = explorerState;
27
+ const explorer = explorerState.explorer ?? defaultExplorer;
27
28
  function setExplorer(newExplorer) {
29
+ if (newExplorer === explorer) return;
28
30
  if (explorer) {
29
31
  // store current explorer state
30
- explorerStateCache[explorer] = {
31
- data
32
- };
33
- setExplorerStateCache(explorerStateCache);
32
+ setExplorerStateCache((cache)=>({
33
+ ...cache,
34
+ [explorer]: {
35
+ data
36
+ }
37
+ }));
34
38
  }
35
39
  // restore previous explorer state (if any)
36
40
  const state = explorerStateCache[newExplorer] ?? {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { createContext, useContext, useState } from 'react';\n\ninterface ExplorerState<T> {\n explorer?: string;\n data: T;\n}\n\ninterface ExplorerManagerContextType<T> {\n /** observability signal, for example metrics or traces */\n explorer?: string;\n data: T;\n setExplorer: (explorer: string) => void;\n setData: (data: T) => void;\n}\n\nconst ExplorerManagerContext = createContext<ExplorerManagerContextType<unknown> | undefined>(undefined);\n\ninterface ExplorerManagerProviderProps {\n children: ReactNode;\n store?: [ExplorerState<unknown>, (state: ExplorerState<unknown>) => void];\n}\n\nexport function ExplorerManagerProvider({\n children,\n store: externalStore,\n}: ExplorerManagerProviderProps): ReactElement {\n // cache the state of currently not rendered explore UIs\n const [explorerStateCache, setExplorerStateCache] = useState<\n Record<string, Omit<ExplorerState<unknown>, 'explorer'>>\n >({});\n // local store in case external store is not provided by prop\n const localStore = useState<ExplorerState<unknown>>({ explorer: undefined, data: {} });\n // use store provided by 'store' prop if available, otherwise use local store\n const [explorerState, setExplorerState] = externalStore ? externalStore : localStore;\n const { explorer, data } = explorerState;\n\n function setExplorer(newExplorer: string): void {\n if (explorer) {\n // store current explorer state\n explorerStateCache[explorer] = { data };\n setExplorerStateCache(explorerStateCache);\n }\n\n // restore previous explorer state (if any)\n const state = explorerStateCache[newExplorer] ?? { data: {} };\n setExplorerState({ explorer: newExplorer, data: state.data });\n }\n\n function setData(newData: unknown): void {\n setExplorerState({ explorer, data: newData });\n }\n\n return (\n <ExplorerManagerContext.Provider value={{ explorer, data, setExplorer, setData }}>\n {children}\n </ExplorerManagerContext.Provider>\n );\n}\n\nexport function useExplorerManagerContext<T>(): ExplorerManagerContextType<T> {\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 as ExplorerManagerContextType<T>;\n}\n"],"names":["createContext","useContext","useState","ExplorerManagerContext","undefined","ExplorerManagerProvider","children","store","externalStore","explorerStateCache","setExplorerStateCache","localStore","explorer","data","explorerState","setExplorerState","setExplorer","newExplorer","state","setData","newData","Provider","value","useExplorerManagerContext","ctx","Error"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,aAAa,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAe5D,MAAMC,uCAAyBH,cAA+DI;AAO9F,OAAO,SAASC,wBAAwB,EACtCC,QAAQ,EACRC,OAAOC,aAAa,EACS;IAC7B,wDAAwD;IACxD,MAAM,CAACC,oBAAoBC,sBAAsB,GAAGR,SAElD,CAAC;IACH,6DAA6D;IAC7D,MAAMS,aAAaT,SAAiC;QAAEU,UAAUR;QAAWS,MAAM,CAAC;IAAE;IACpF,6EAA6E;IAC7E,MAAM,CAACC,eAAeC,iBAAiB,GAAGP,gBAAgBA,gBAAgBG;IAC1E,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC;IAE3B,SAASE,YAAYC,WAAmB;QACtC,IAAIL,UAAU;YACZ,+BAA+B;YAC/BH,kBAAkB,CAACG,SAAS,GAAG;gBAAEC;YAAK;YACtCH,sBAAsBD;QACxB;QAEA,2CAA2C;QAC3C,MAAMS,QAAQT,kBAAkB,CAACQ,YAAY,IAAI;YAAEJ,MAAM,CAAC;QAAE;QAC5DE,iBAAiB;YAAEH,UAAUK;YAAaJ,MAAMK,MAAML,IAAI;QAAC;IAC7D;IAEA,SAASM,QAAQC,OAAgB;QAC/BL,iBAAiB;YAAEH;YAAUC,MAAMO;QAAQ;IAC7C;IAEA,qBACE,KAACjB,uBAAuBkB,QAAQ;QAACC,OAAO;YAAEV;YAAUC;YAAMG;YAAaG;QAAQ;kBAC5Eb;;AAGP;AAEA,OAAO,SAASiB;IACd,MAAMC,MAAMvB,WAAWE;IACvB,IAAIqB,QAAQpB,WAAW;QACrB,MAAM,IAAIqB,MAAM;IAClB;IACA,OAAOD;AACT"}
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { createContext, useContext, useState } from 'react';\n\ninterface ExplorerState<T> {\n explorer?: string;\n data: T;\n}\n\ninterface ExplorerManagerContextType<T> {\n /** observability signal, for example metrics or traces */\n explorer?: string;\n data: T;\n setExplorer: (explorer: string) => void;\n setData: (data: T) => void;\n}\n\nconst ExplorerManagerContext = createContext<ExplorerManagerContextType<unknown> | undefined>(undefined);\n\ninterface ExplorerManagerProviderProps {\n children: ReactNode;\n store?: [ExplorerState<unknown>, (state: ExplorerState<unknown>) => void];\n /** Explorer used while the store has none selected; committed to the store on the first state change. */\n defaultExplorer?: string;\n}\n\nexport function ExplorerManagerProvider({\n children,\n store: externalStore,\n defaultExplorer,\n}: ExplorerManagerProviderProps): ReactElement {\n // cache the state of currently not rendered explore UIs\n const [explorerStateCache, setExplorerStateCache] = useState<\n Record<string, Omit<ExplorerState<unknown>, 'explorer'>>\n >({});\n // local store in case external store is not provided by prop\n const localStore = useState<ExplorerState<unknown>>({ explorer: undefined, data: {} });\n // use store provided by 'store' prop if available, otherwise use local store\n const [explorerState, setExplorerState] = externalStore ? externalStore : localStore;\n const { data } = explorerState;\n const explorer = explorerState.explorer ?? defaultExplorer;\n\n function setExplorer(newExplorer: string): void {\n if (newExplorer === explorer) return;\n\n if (explorer) {\n // store current explorer state\n setExplorerStateCache((cache) => ({ ...cache, [explorer]: { data } }));\n }\n\n // restore previous explorer state (if any)\n const state = explorerStateCache[newExplorer] ?? { data: {} };\n setExplorerState({ explorer: newExplorer, data: state.data });\n }\n\n function setData(newData: unknown): void {\n setExplorerState({ explorer, data: newData });\n }\n\n return (\n <ExplorerManagerContext.Provider value={{ explorer, data, setExplorer, setData }}>\n {children}\n </ExplorerManagerContext.Provider>\n );\n}\n\nexport function useExplorerManagerContext<T>(): ExplorerManagerContextType<T> {\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 as ExplorerManagerContextType<T>;\n}\n"],"names":["createContext","useContext","useState","ExplorerManagerContext","undefined","ExplorerManagerProvider","children","store","externalStore","defaultExplorer","explorerStateCache","setExplorerStateCache","localStore","explorer","data","explorerState","setExplorerState","setExplorer","newExplorer","cache","state","setData","newData","Provider","value","useExplorerManagerContext","ctx","Error"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,aAAa,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAe5D,MAAMC,uCAAyBH,cAA+DI;AAS9F,OAAO,SAASC,wBAAwB,EACtCC,QAAQ,EACRC,OAAOC,aAAa,EACpBC,eAAe,EACc;IAC7B,wDAAwD;IACxD,MAAM,CAACC,oBAAoBC,sBAAsB,GAAGT,SAElD,CAAC;IACH,6DAA6D;IAC7D,MAAMU,aAAaV,SAAiC;QAAEW,UAAUT;QAAWU,MAAM,CAAC;IAAE;IACpF,6EAA6E;IAC7E,MAAM,CAACC,eAAeC,iBAAiB,GAAGR,gBAAgBA,gBAAgBI;IAC1E,MAAM,EAAEE,IAAI,EAAE,GAAGC;IACjB,MAAMF,WAAWE,cAAcF,QAAQ,IAAIJ;IAE3C,SAASQ,YAAYC,WAAmB;QACtC,IAAIA,gBAAgBL,UAAU;QAE9B,IAAIA,UAAU;YACZ,+BAA+B;YAC/BF,sBAAsB,CAACQ,QAAW,CAAA;oBAAE,GAAGA,KAAK;oBAAE,CAACN,SAAS,EAAE;wBAAEC;oBAAK;gBAAE,CAAA;QACrE;QAEA,2CAA2C;QAC3C,MAAMM,QAAQV,kBAAkB,CAACQ,YAAY,IAAI;YAAEJ,MAAM,CAAC;QAAE;QAC5DE,iBAAiB;YAAEH,UAAUK;YAAaJ,MAAMM,MAAMN,IAAI;QAAC;IAC7D;IAEA,SAASO,QAAQC,OAAgB;QAC/BN,iBAAiB;YAAEH;YAAUC,MAAMQ;QAAQ;IAC7C;IAEA,qBACE,KAACnB,uBAAuBoB,QAAQ;QAACC,OAAO;YAAEX;YAAUC;YAAMG;YAAaI;QAAQ;kBAC5Ef;;AAGP;AAEA,OAAO,SAASmB;IACd,MAAMC,MAAMzB,WAAWE;IACvB,IAAIuB,QAAQtB,WAAW;QACrB,MAAM,IAAIuB,MAAM;IAClB;IACA,OAAOD;AACT"}
@@ -1,7 +1,8 @@
1
1
  import type { ReactElement, ReactNode } from 'react';
2
2
  interface ExplorerManagerProviderWithQueryParamsProps {
3
3
  children: ReactNode;
4
+ defaultExplorer?: string;
4
5
  }
5
- export declare function ExplorerManagerProviderWithQueryParams({ children, }: ExplorerManagerProviderWithQueryParamsProps): ReactElement;
6
+ export declare function ExplorerManagerProviderWithQueryParams({ children, defaultExplorer, }: ExplorerManagerProviderWithQueryParamsProps): ReactElement;
6
7
  export {};
7
8
  //# sourceMappingURL=ExplorerManagerProviderWithQueryParams.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExplorerManagerProviderWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUrD,UAAU,2CAA2C;IACnD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sCAAsC,CAAC,EACrD,QAAQ,GACT,EAAE,2CAA2C,GAAG,YAAY,CAI5D"}
1
+ {"version":3,"file":"ExplorerManagerProviderWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUrD,UAAU,2CAA2C;IACnD,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,sCAAsC,CAAC,EACrD,QAAQ,EACR,eAAe,GAChB,EAAE,2CAA2C,GAAG,YAAY,CAQ5D"}
@@ -17,13 +17,14 @@ const exploreQueryConfig = {
17
17
  explorer: withDefault(StringParam, undefined),
18
18
  data: withDefault(JsonParam, {})
19
19
  };
20
- export function ExplorerManagerProviderWithQueryParams({ children }) {
20
+ export function ExplorerManagerProviderWithQueryParams({ children, defaultExplorer }) {
21
21
  const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig);
22
22
  return /*#__PURE__*/ _jsx(ExplorerManagerProvider, {
23
23
  store: [
24
24
  queryParams,
25
25
  setQueryParams
26
26
  ],
27
+ defaultExplorer: defaultExplorer,
27
28
  children: children
28
29
  });
29
30
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { JsonParam, StringParam, useQueryParams, withDefault } from 'use-query-params';\n\nimport { ExplorerManagerProvider } from './ExplorerManagerProvider';\n\nconst exploreQueryConfig = {\n explorer: withDefault(StringParam, undefined),\n data: withDefault(JsonParam, {}),\n};\n\ninterface ExplorerManagerProviderWithQueryParamsProps {\n children: ReactNode;\n}\n\nexport function ExplorerManagerProviderWithQueryParams({\n children,\n}: ExplorerManagerProviderWithQueryParamsProps): ReactElement {\n const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig);\n\n return <ExplorerManagerProvider store={[queryParams, setQueryParams]}>{children}</ExplorerManagerProvider>;\n}\n"],"names":["JsonParam","StringParam","useQueryParams","withDefault","ExplorerManagerProvider","exploreQueryConfig","explorer","undefined","data","ExplorerManagerProviderWithQueryParams","children","queryParams","setQueryParams","store"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,SAAS,EAAEC,WAAW,EAAEC,cAAc,EAAEC,WAAW,QAAQ,mBAAmB;AAEvF,SAASC,uBAAuB,QAAQ,+BAA4B;AAEpE,MAAMC,qBAAqB;IACzBC,UAAUH,YAAYF,aAAaM;IACnCC,MAAML,YAAYH,WAAW,CAAC;AAChC;AAMA,OAAO,SAASS,uCAAuC,EACrDC,QAAQ,EACoC;IAC5C,MAAM,CAACC,aAAaC,eAAe,GAAGV,eAAeG;IAErD,qBAAO,KAACD;QAAwBS,OAAO;YAACF;YAAaC;SAAe;kBAAGF;;AACzE"}
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ReactElement, ReactNode } from 'react';\nimport { JsonParam, StringParam, useQueryParams, withDefault } from 'use-query-params';\n\nimport { ExplorerManagerProvider } from './ExplorerManagerProvider';\n\nconst exploreQueryConfig = {\n explorer: withDefault(StringParam, undefined),\n data: withDefault(JsonParam, {}),\n};\n\ninterface ExplorerManagerProviderWithQueryParamsProps {\n children: ReactNode;\n defaultExplorer?: string;\n}\n\nexport function ExplorerManagerProviderWithQueryParams({\n children,\n defaultExplorer,\n}: ExplorerManagerProviderWithQueryParamsProps): ReactElement {\n const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig);\n\n return (\n <ExplorerManagerProvider store={[queryParams, setQueryParams]} defaultExplorer={defaultExplorer}>\n {children}\n </ExplorerManagerProvider>\n );\n}\n"],"names":["JsonParam","StringParam","useQueryParams","withDefault","ExplorerManagerProvider","exploreQueryConfig","explorer","undefined","data","ExplorerManagerProviderWithQueryParams","children","defaultExplorer","queryParams","setQueryParams","store"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,SAAS,EAAEC,WAAW,EAAEC,cAAc,EAAEC,WAAW,QAAQ,mBAAmB;AAEvF,SAASC,uBAAuB,QAAQ,+BAA4B;AAEpE,MAAMC,qBAAqB;IACzBC,UAAUH,YAAYF,aAAaM;IACnCC,MAAML,YAAYH,WAAW,CAAC;AAChC;AAOA,OAAO,SAASS,uCAAuC,EACrDC,QAAQ,EACRC,eAAe,EAC6B;IAC5C,MAAM,CAACC,aAAaC,eAAe,GAAGX,eAAeG;IAErD,qBACE,KAACD;QAAwBU,OAAO;YAACF;YAAaC;SAAe;QAAEF,iBAAiBA;kBAC7ED;;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"file":"ViewExploreApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewExplore/ViewExploreApp.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,MAAM,WAAW,YAAY;IAC3B,qBAAqB,CAAC,EAAE,SAAS,CAAC;CACnC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAsBhE"}
1
+ {"version":3,"file":"ViewExploreApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewExplore/ViewExploreApp.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASrD,MAAM,WAAW,YAAY;IAC3B,qBAAqB,CAAC,EAAE,SAAS,CAAC;CACnC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAwBhE"}
@@ -13,10 +13,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  // limitations under the License.
14
14
  import { Box } from "@mui/material";
15
15
  import { ChartsProvider, useChartsTheme } from "@perses-dev/components";
16
- import { ExploreManager, ExplorerManagerProviderWithQueryParams } from "../../components/index.js";
16
+ import { ExploreManager, ExplorerManagerProviderWithQueryParams, getExplorerKey, useSortedExplorerPlugins } from "../../components/index.js";
17
17
  export function ViewExploreApp(props) {
18
18
  const { exploreTitleComponent } = props;
19
19
  const chartsTheme = useChartsTheme();
20
+ const explorerPlugins = useSortedExplorerPlugins();
21
+ const defaultExplorer = explorerPlugins?.[0] ? getExplorerKey(explorerPlugins[0]) : undefined;
20
22
  return /*#__PURE__*/ _jsx(Box, {
21
23
  sx: {
22
24
  flexGrow: 1,
@@ -29,6 +31,7 @@ export function ViewExploreApp(props) {
29
31
  chartsTheme: chartsTheme,
30
32
  enablePinning: false,
31
33
  children: /*#__PURE__*/ _jsx(ExplorerManagerProviderWithQueryParams, {
34
+ defaultExplorer: defaultExplorer,
32
35
  children: /*#__PURE__*/ _jsx(ExploreManager, {
33
36
  exploreTitleComponent: exploreTitleComponent
34
37
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/ViewExplore/ViewExploreApp.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { ChartsProvider, useChartsTheme } from '@perses-dev/components';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { ExploreManager, ExplorerManagerProviderWithQueryParams } from '../../components';\n\nexport interface ViewAppProps {\n exploreTitleComponent?: ReactNode;\n}\n\nexport function ViewExploreApp(props: ViewAppProps): ReactElement {\n const { exploreTitleComponent } = props;\n\n const chartsTheme = useChartsTheme();\n\n return (\n <Box\n sx={{\n flexGrow: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <ChartsProvider chartsTheme={chartsTheme} enablePinning={false}>\n <ExplorerManagerProviderWithQueryParams>\n <ExploreManager exploreTitleComponent={exploreTitleComponent} />\n </ExplorerManagerProviderWithQueryParams>\n </ChartsProvider>\n </Box>\n );\n}\n"],"names":["Box","ChartsProvider","useChartsTheme","ExploreManager","ExplorerManagerProviderWithQueryParams","ViewExploreApp","props","exploreTitleComponent","chartsTheme","sx","flexGrow","overflowX","overflowY","display","flexDirection","enablePinning"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,EAAEC,cAAc,QAAQ,yBAAyB;AAGxE,SAASC,cAAc,EAAEC,sCAAsC,QAAQ,4BAAmB;AAM1F,OAAO,SAASC,eAAeC,KAAmB;IAChD,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAElC,MAAME,cAAcN;IAEpB,qBACE,KAACF;QACCS,IAAI;YACFC,UAAU;YACVC,WAAW;YACXC,WAAW;YACXC,SAAS;YACTC,eAAe;QACjB;kBAEA,cAAA,KAACb;YAAeO,aAAaA;YAAaO,eAAe;sBACvD,cAAA,KAACX;0BACC,cAAA,KAACD;oBAAeI,uBAAuBA;;;;;AAKjD"}
1
+ {"version":3,"sources":["../../../src/views/ViewExplore/ViewExploreApp.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { ChartsProvider, useChartsTheme } from '@perses-dev/components';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport {\n ExploreManager,\n ExplorerManagerProviderWithQueryParams,\n getExplorerKey,\n useSortedExplorerPlugins,\n} from '../../components';\n\nexport interface ViewAppProps {\n exploreTitleComponent?: ReactNode;\n}\n\nexport function ViewExploreApp(props: ViewAppProps): ReactElement {\n const { exploreTitleComponent } = props;\n\n const chartsTheme = useChartsTheme();\n const explorerPlugins = useSortedExplorerPlugins();\n const defaultExplorer = explorerPlugins?.[0] ? getExplorerKey(explorerPlugins[0]) : undefined;\n\n return (\n <Box\n sx={{\n flexGrow: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <ChartsProvider chartsTheme={chartsTheme} enablePinning={false}>\n <ExplorerManagerProviderWithQueryParams defaultExplorer={defaultExplorer}>\n <ExploreManager exploreTitleComponent={exploreTitleComponent} />\n </ExplorerManagerProviderWithQueryParams>\n </ChartsProvider>\n </Box>\n );\n}\n"],"names":["Box","ChartsProvider","useChartsTheme","ExploreManager","ExplorerManagerProviderWithQueryParams","getExplorerKey","useSortedExplorerPlugins","ViewExploreApp","props","exploreTitleComponent","chartsTheme","explorerPlugins","defaultExplorer","undefined","sx","flexGrow","overflowX","overflowY","display","flexDirection","enablePinning"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,EAAEC,cAAc,QAAQ,yBAAyB;AAGxE,SACEC,cAAc,EACdC,sCAAsC,EACtCC,cAAc,EACdC,wBAAwB,QACnB,4BAAmB;AAM1B,OAAO,SAASC,eAAeC,KAAmB;IAChD,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAElC,MAAME,cAAcR;IACpB,MAAMS,kBAAkBL;IACxB,MAAMM,kBAAkBD,iBAAiB,CAAC,EAAE,GAAGN,eAAeM,eAAe,CAAC,EAAE,IAAIE;IAEpF,qBACE,KAACb;QACCc,IAAI;YACFC,UAAU;YACVC,WAAW;YACXC,WAAW;YACXC,SAAS;YACTC,eAAe;QACjB;kBAEA,cAAA,KAAClB;YAAeS,aAAaA;YAAaU,eAAe;sBACvD,cAAA,KAAChB;gBAAuCQ,iBAAiBA;0BACvD,cAAA,KAACT;oBAAeM,uBAAuBA;;;;;AAKjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/explore",
3
- "version": "0.55.0-beta.9",
3
+ "version": "0.55.0-rc.0",
4
4
  "description": "The explore feature in Perses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -30,11 +30,11 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@nexucis/fuzzy": "^0.5.1",
33
- "@perses-dev/components": "0.55.0-beta.9",
34
- "@perses-dev/dashboards": "0.55.0-beta.9",
35
- "@perses-dev/plugin-system": "0.55.0-beta.9",
33
+ "@perses-dev/components": "0.55.0-rc.0",
34
+ "@perses-dev/dashboards": "0.55.0-rc.0",
35
+ "@perses-dev/plugin-system": "0.55.0-rc.0",
36
36
  "mdi-material-ui": "^7.9.2",
37
- "qs": "^6.14.0",
37
+ "qs": "6.16.0",
38
38
  "react-virtuoso": "^4.12.2",
39
39
  "use-query-params": "^2.2.1",
40
40
  "use-resize-observer": "^9.0.0"