@perses-dev/plugin-system 0.52.0 → 0.53.0-beta.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.
Files changed (85) hide show
  1. package/dist/cjs/components/{DatasourceSelect.js → DatasourceSelect/DatasourceSelect.js} +2 -2
  2. package/dist/cjs/components/DatasourceSelect/index.js +30 -0
  3. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +25 -34
  4. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +33 -19
  5. package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -0
  6. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +47 -0
  7. package/dist/cjs/components/Variables/variable-model.js +3 -3
  8. package/dist/cjs/components/index.js +0 -1
  9. package/dist/cjs/context/index.js +0 -1
  10. package/dist/cjs/remote/remotePluginLoader.js +19 -4
  11. package/dist/cjs/runtime/UsageMetricsProvider.js +4 -3
  12. package/dist/cjs/runtime/time-series-queries.js +4 -4
  13. package/dist/cjs/test/mock-data.js +158 -0
  14. package/dist/components/{DatasourceSelect.d.ts → DatasourceSelect/DatasourceSelect.d.ts} +1 -1
  15. package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -0
  16. package/dist/components/{DatasourceSelect.js → DatasourceSelect/DatasourceSelect.js} +2 -2
  17. package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -0
  18. package/dist/components/DatasourceSelect/index.d.ts +2 -0
  19. package/dist/components/DatasourceSelect/index.d.ts.map +1 -0
  20. package/dist/components/DatasourceSelect/index.js +15 -0
  21. package/dist/components/DatasourceSelect/index.js.map +1 -0
  22. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  23. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +25 -34
  24. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  25. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -0
  26. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  27. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +33 -19
  28. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  29. package/dist/components/Variables/VariableEditorForm/index.d.ts +1 -0
  30. package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -1
  31. package/dist/components/Variables/VariableEditorForm/index.js +1 -0
  32. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  33. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +6 -0
  34. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  35. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +44 -0
  36. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  37. package/dist/components/Variables/variable-model.js +3 -3
  38. package/dist/components/Variables/variable-model.js.map +1 -1
  39. package/dist/components/index.d.ts +0 -1
  40. package/dist/components/index.d.ts.map +1 -1
  41. package/dist/components/index.js +0 -1
  42. package/dist/components/index.js.map +1 -1
  43. package/dist/context/index.d.ts +0 -1
  44. package/dist/context/index.d.ts.map +1 -1
  45. package/dist/context/index.js +0 -1
  46. package/dist/context/index.js.map +1 -1
  47. package/dist/model/time-series-queries.d.ts +1 -1
  48. package/dist/model/time-series-queries.d.ts.map +1 -1
  49. package/dist/model/time-series-queries.js.map +1 -1
  50. package/dist/model/variables.d.ts +1 -1
  51. package/dist/model/variables.d.ts.map +1 -1
  52. package/dist/model/variables.js.map +1 -1
  53. package/dist/remote/remotePluginLoader.d.ts +18 -1
  54. package/dist/remote/remotePluginLoader.d.ts.map +1 -1
  55. package/dist/remote/remotePluginLoader.js +22 -4
  56. package/dist/remote/remotePluginLoader.js.map +1 -1
  57. package/dist/runtime/UsageMetricsProvider.d.ts +3 -1
  58. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
  59. package/dist/runtime/UsageMetricsProvider.js +4 -3
  60. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  61. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  62. package/dist/runtime/time-series-queries.js +4 -4
  63. package/dist/runtime/time-series-queries.js.map +1 -1
  64. package/dist/test/mock-data.d.ts +134 -0
  65. package/dist/test/mock-data.d.ts.map +1 -1
  66. package/dist/test/mock-data.js +135 -0
  67. package/dist/test/mock-data.js.map +1 -1
  68. package/package.json +3 -3
  69. package/dist/cjs/components/ProjectSelect.js +0 -96
  70. package/dist/cjs/context/ProjectStoreProvider.js +0 -81
  71. package/dist/cjs/context/query-params.js +0 -49
  72. package/dist/components/DatasourceSelect.d.ts.map +0 -1
  73. package/dist/components/DatasourceSelect.js.map +0 -1
  74. package/dist/components/ProjectSelect.d.ts +0 -15
  75. package/dist/components/ProjectSelect.d.ts.map +0 -1
  76. package/dist/components/ProjectSelect.js +0 -91
  77. package/dist/components/ProjectSelect.js.map +0 -1
  78. package/dist/context/ProjectStoreProvider.d.ts +0 -16
  79. package/dist/context/ProjectStoreProvider.d.ts.map +0 -1
  80. package/dist/context/ProjectStoreProvider.js +0 -59
  81. package/dist/context/ProjectStoreProvider.js.map +0 -1
  82. package/dist/context/query-params.d.ts +0 -5
  83. package/dist/context/query-params.d.ts.map +0 -1
  84. package/dist/context/query-params.js +0 -41
  85. package/dist/context/query-params.js.map +0 -1
@@ -1,91 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { Select, MenuItem, Stack, ListItemText } from '@mui/material';
15
- import { useProjectList } from '../context';
16
- /**
17
- * Displays a MUI input for selecting a Project of a particular kind. Note: The 'value' and `onChange` handler for
18
- * the input deal with a `ProjectSelector`.
19
- */ export function ProjectSelect(props) {
20
- const { onChange, value, ...others } = props;
21
- const { data, isLoading } = useProjectList();
22
- // While loading available values, just use an empty string so MUI select doesn't warn about values out of range
23
- const optionValue = isLoading ? '' : projectToOptionValue(value);
24
- // When the user makes a selection, convert the string option value back to a DatasourceSelector
25
- const handleChange = (e)=>{
26
- const next = optionValueToSelector(e.target.value);
27
- onChange(next);
28
- };
29
- // TODO:
30
- // - Does this need a loading indicator of some kind?
31
- // - The group's edit link is not clickable once selected.
32
- // - The group's edit link is disabled if datasource is overridden.
33
- // Ref: https://github.com/mui/material-ui/issues/36572
34
- return /*#__PURE__*/ _jsxs(Select, {
35
- ...others,
36
- value: optionValue,
37
- onChange: handleChange,
38
- children: [
39
- /*#__PURE__*/ _jsx(MenuItem, {
40
- value: "none",
41
- children: /*#__PURE__*/ _jsx(Stack, {
42
- direction: "row",
43
- alignItems: "center",
44
- justifyContent: "space-between",
45
- width: "100%",
46
- height: 32,
47
- children: /*#__PURE__*/ _jsx(ListItemText, {
48
- children: "None"
49
- })
50
- })
51
- }),
52
- data?.map((project)=>[
53
- /*#__PURE__*/ _jsx(MenuItem, {
54
- value: project.metadata.name,
55
- children: /*#__PURE__*/ _jsx(Stack, {
56
- direction: "row",
57
- alignItems: "center",
58
- justifyContent: "space-between",
59
- width: "100%",
60
- height: 32,
61
- children: /*#__PURE__*/ _jsx(ListItemText, {
62
- children: project.metadata.name
63
- })
64
- })
65
- }, project.metadata.name)
66
- ])
67
- ]
68
- });
69
- }
70
- /**
71
- * Given a ProjectSelectItemSelector,
72
- * returns a string value that can be used as a Select input value.
73
- * @param selector
74
- */ function projectToOptionValue(project) {
75
- return project.metadata.name ?? 'none';
76
- }
77
- /**
78
- * Given an option value name,
79
- * returns a ProjectResource to be used by the query data model.
80
- * @param optionValue
81
- */ function optionValueToSelector(optionValue) {
82
- return {
83
- kind: 'Project',
84
- metadata: {
85
- name: optionValue
86
- },
87
- spec: {}
88
- };
89
- }
90
-
91
- //# sourceMappingURL=ProjectSelect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/ProjectSelect.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Select, SelectProps, MenuItem, Stack, ListItemText } from '@mui/material';\nimport { ProjectResource } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { useProjectList } from '../context';\n\n// Props on MUI Select that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\n\nexport interface ProjectSelectProps extends Omit<SelectProps<string>, OmittedMuiProps> {\n onChange: (next: ProjectResource) => void;\n value: ProjectResource;\n}\n\n/**\n * Displays a MUI input for selecting a Project of a particular kind. Note: The 'value' and `onChange` handler for\n * the input deal with a `ProjectSelector`.\n */\nexport function ProjectSelect(props: ProjectSelectProps): ReactElement {\n const { onChange, value, ...others } = props;\n\n const { data, isLoading } = useProjectList();\n\n // While loading available values, just use an empty string so MUI select doesn't warn about values out of range\n const optionValue = isLoading ? '' : projectToOptionValue(value);\n\n // When the user makes a selection, convert the string option value back to a DatasourceSelector\n const handleChange: SelectProps<string>['onChange'] = (e) => {\n const next = optionValueToSelector(e.target.value);\n onChange(next);\n };\n\n // TODO:\n // - Does this need a loading indicator of some kind?\n // - The group's edit link is not clickable once selected.\n // - The group's edit link is disabled if datasource is overridden.\n // Ref: https://github.com/mui/material-ui/issues/36572\n return (\n <Select {...others} value={optionValue} onChange={handleChange}>\n <MenuItem value=\"none\">\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" width=\"100%\" height={32}>\n <ListItemText>None</ListItemText>\n </Stack>\n </MenuItem>\n {data?.map((project: ProjectResource) => [\n <MenuItem key={project.metadata.name} value={project.metadata.name}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" width=\"100%\" height={32}>\n <ListItemText>{project.metadata.name}</ListItemText>\n </Stack>\n </MenuItem>,\n ])}\n </Select>\n );\n}\n\n/**\n * Given a ProjectSelectItemSelector,\n * returns a string value that can be used as a Select input value.\n * @param selector\n */\nfunction projectToOptionValue(project: ProjectResource): string {\n return project.metadata.name ?? 'none';\n}\n\n/**\n * Given an option value name,\n * returns a ProjectResource to be used by the query data model.\n * @param optionValue\n */\nfunction optionValueToSelector(optionValue: string): ProjectResource {\n return {\n kind: 'Project',\n metadata: {\n name: optionValue,\n },\n spec: {},\n };\n}\n"],"names":["Select","MenuItem","Stack","ListItemText","useProjectList","ProjectSelect","props","onChange","value","others","data","isLoading","optionValue","projectToOptionValue","handleChange","e","next","optionValueToSelector","target","direction","alignItems","justifyContent","width","height","map","project","metadata","name","kind","spec"],"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,MAAM,EAAeC,QAAQ,EAAEC,KAAK,EAAEC,YAAY,QAAQ,gBAAgB;AAGnF,SAASC,cAAc,QAAQ,aAAa;AAW5C;;;CAGC,GACD,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGC,QAAQ,GAAGH;IAEvC,MAAM,EAAEI,IAAI,EAAEC,SAAS,EAAE,GAAGP;IAE5B,gHAAgH;IAChH,MAAMQ,cAAcD,YAAY,KAAKE,qBAAqBL;IAE1D,gGAAgG;IAChG,MAAMM,eAAgD,CAACC;QACrD,MAAMC,OAAOC,sBAAsBF,EAAEG,MAAM,CAACV,KAAK;QACjDD,SAASS;IACX;IAEA,QAAQ;IACR,sDAAsD;IACtD,2DAA2D;IAC3D,oEAAoE;IACpE,0DAA0D;IAC1D,qBACE,MAAChB;QAAQ,GAAGS,MAAM;QAAED,OAAOI;QAAaL,UAAUO;;0BAChD,KAACb;gBAASO,OAAM;0BACd,cAAA,KAACN;oBAAMiB,WAAU;oBAAMC,YAAW;oBAASC,gBAAe;oBAAgBC,OAAM;oBAAOC,QAAQ;8BAC7F,cAAA,KAACpB;kCAAa;;;;YAGjBO,MAAMc,IAAI,CAACC,UAA6B;kCACvC,KAACxB;wBAAqCO,OAAOiB,QAAQC,QAAQ,CAACC,IAAI;kCAChE,cAAA,KAACzB;4BAAMiB,WAAU;4BAAMC,YAAW;4BAASC,gBAAe;4BAAgBC,OAAM;4BAAOC,QAAQ;sCAC7F,cAAA,KAACpB;0CAAcsB,QAAQC,QAAQ,CAACC,IAAI;;;uBAFzBF,QAAQC,QAAQ,CAACC,IAAI;iBAKrC;;;AAGP;AAEA;;;;CAIC,GACD,SAASd,qBAAqBY,OAAwB;IACpD,OAAOA,QAAQC,QAAQ,CAACC,IAAI,IAAI;AAClC;AAEA;;;;CAIC,GACD,SAASV,sBAAsBL,WAAmB;IAChD,OAAO;QACLgB,MAAM;QACNF,UAAU;YACRC,MAAMf;QACR;QACAiB,MAAM,CAAC;IACT;AACF"}
@@ -1,16 +0,0 @@
1
- import { UseQueryResult } from '@tanstack/react-query';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { ProjectResource, StatusError } from '@perses-dev/core';
4
- export interface ProjectStore {
5
- setProject: (project: ProjectResource) => void;
6
- project: ProjectResource;
7
- }
8
- export interface ProjectStoreProviderProps {
9
- children?: ReactNode;
10
- enabledURLParams?: boolean;
11
- }
12
- export declare const ProjectStoreContext: import("react").Context<ProjectStore | undefined>;
13
- export declare function useProjectList(): UseQueryResult<ProjectResource[], StatusError>;
14
- export declare function useProjectStore(): ProjectStore;
15
- export declare function ProjectStoreProvider(props: ProjectStoreProviderProps): ReactElement;
16
- //# sourceMappingURL=ProjectStoreProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProjectStoreProvider.d.ts","sourceRoot":"","sources":["../../src/context/ProjectStoreProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAsC,YAAY,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,EAAa,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG3E,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,mBAAmB,mDAAqD,CAAC;AAEtF,wBAAgB,cAAc,IAAI,cAAc,CAAC,eAAe,EAAE,EAAE,WAAW,CAAC,CAO/E;AAED,wBAAgB,eAAe,IAAI,YAAY,CAM9C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,YAAY,CAoBnF"}
@@ -1,59 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { useQuery } from '@tanstack/react-query';
15
- import { createContext, useContext, useMemo } from 'react';
16
- import { fetchJson } from '@perses-dev/core';
17
- import { useSetProjectParams } from './query-params';
18
- export const ProjectStoreContext = /*#__PURE__*/ createContext(undefined);
19
- export function useProjectList() {
20
- return useQuery({
21
- queryKey: [
22
- 'projects'
23
- ],
24
- queryFn: ()=>{
25
- return fetchJson('/api/v1/projects');
26
- }
27
- });
28
- }
29
- export function useProjectStore() {
30
- const ctx = useContext(ProjectStoreContext);
31
- if (ctx === undefined) {
32
- throw new Error('No ProjectStoreContext found. Did you forget a Provider?');
33
- }
34
- return ctx;
35
- }
36
- export function ProjectStoreProvider(props) {
37
- const { children, enabledURLParams } = props;
38
- const { project, setProject } = useSetProjectParams(enabledURLParams);
39
- const contextValue = useMemo(()=>({
40
- project: {
41
- kind: 'Project',
42
- metadata: {
43
- name: project
44
- }
45
- },
46
- setProject: (project)=>{
47
- setProject(project.metadata.name);
48
- }
49
- }), [
50
- project,
51
- setProject
52
- ]);
53
- return /*#__PURE__*/ _jsx(ProjectStoreContext.Provider, {
54
- value: contextValue,
55
- children: children
56
- });
57
- }
58
-
59
- //# sourceMappingURL=ProjectStoreProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/ProjectStoreProvider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { ReactNode, createContext, useContext, useMemo, ReactElement } from 'react';\nimport { fetchJson, ProjectResource, StatusError } from '@perses-dev/core';\nimport { useSetProjectParams } from './query-params';\n\nexport interface ProjectStore {\n setProject: (project: ProjectResource) => void;\n project: ProjectResource;\n}\n\nexport interface ProjectStoreProviderProps {\n children?: ReactNode;\n enabledURLParams?: boolean;\n}\n\nexport const ProjectStoreContext = createContext<ProjectStore | undefined>(undefined);\n\nexport function useProjectList(): UseQueryResult<ProjectResource[], StatusError> {\n return useQuery<ProjectResource[], StatusError>({\n queryKey: ['projects'],\n queryFn: () => {\n return fetchJson<ProjectResource[]>('/api/v1/projects');\n },\n });\n}\n\nexport function useProjectStore(): ProjectStore {\n const ctx = useContext(ProjectStoreContext);\n if (ctx === undefined) {\n throw new Error('No ProjectStoreContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function ProjectStoreProvider(props: ProjectStoreProviderProps): ReactElement {\n const { children, enabledURLParams } = props;\n const { project, setProject } = useSetProjectParams(enabledURLParams);\n\n const contextValue = useMemo(\n () => ({\n project: {\n kind: 'Project',\n metadata: {\n name: project,\n },\n } as ProjectResource,\n setProject: (project: ProjectResource): void => {\n setProject(project.metadata.name);\n },\n }),\n [project, setProject]\n );\n\n return <ProjectStoreContext.Provider value={contextValue}>{children}</ProjectStoreContext.Provider>;\n}\n"],"names":["useQuery","createContext","useContext","useMemo","fetchJson","useSetProjectParams","ProjectStoreContext","undefined","useProjectList","queryKey","queryFn","useProjectStore","ctx","Error","ProjectStoreProvider","props","children","enabledURLParams","project","setProject","contextValue","kind","metadata","name","Provider","value"],"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,QAAQ,QAAwB,wBAAwB;AACjE,SAAoBC,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAsB,QAAQ;AACpF,SAASC,SAAS,QAAsC,mBAAmB;AAC3E,SAASC,mBAAmB,QAAQ,iBAAiB;AAYrD,OAAO,MAAMC,oCAAsBL,cAAwCM,WAAW;AAEtF,OAAO,SAASC;IACd,OAAOR,SAAyC;QAC9CS,UAAU;YAAC;SAAW;QACtBC,SAAS;YACP,OAAON,UAA6B;QACtC;IACF;AACF;AAEA,OAAO,SAASO;IACd,MAAMC,MAAMV,WAAWI;IACvB,IAAIM,QAAQL,WAAW;QACrB,MAAM,IAAIM,MAAM;IAClB;IACA,OAAOD;AACT;AAEA,OAAO,SAASE,qBAAqBC,KAAgC;IACnE,MAAM,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGF;IACvC,MAAM,EAAEG,OAAO,EAAEC,UAAU,EAAE,GAAGd,oBAAoBY;IAEpD,MAAMG,eAAejB,QACnB,IAAO,CAAA;YACLe,SAAS;gBACPG,MAAM;gBACNC,UAAU;oBACRC,MAAML;gBACR;YACF;YACAC,YAAY,CAACD;gBACXC,WAAWD,QAAQI,QAAQ,CAACC,IAAI;YAClC;QACF,CAAA,GACA;QAACL;QAASC;KAAW;IAGvB,qBAAO,KAACb,oBAAoBkB,QAAQ;QAACC,OAAOL;kBAAeJ;;AAC7D"}
@@ -1,5 +0,0 @@
1
- export declare function useSetProjectParams(enabledURLParams?: boolean): {
2
- project: string;
3
- setProject: (project: string) => void;
4
- };
5
- //# sourceMappingURL=query-params.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query-params.d.ts","sourceRoot":"","sources":["../../src/context/query-params.ts"],"names":[],"mappings":"AAgBA,wBAAgB,mBAAmB,CAAC,gBAAgB,UAAO,GAAG;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAuBA"}
@@ -1,41 +0,0 @@
1
- // Copyright 2025 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { useCallback, useState } from 'react';
14
- import { useQueryParams } from 'use-query-params';
15
- export function useSetProjectParams(enabledURLParams = true) {
16
- const [query, setQuery] = useQueryParams({
17
- project: ''
18
- }, {
19
- updateType: 'replaceIn'
20
- });
21
- const [projectState, setProjectState] = useState('none');
22
- const setProject = useCallback((project)=>{
23
- return setQuery({
24
- project
25
- });
26
- }, [
27
- setQuery
28
- ]);
29
- if (enabledURLParams) {
30
- return {
31
- project: query.project || 'none',
32
- setProject
33
- };
34
- }
35
- return {
36
- project: projectState,
37
- setProject: setProjectState
38
- };
39
- }
40
-
41
- //# sourceMappingURL=query-params.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/query-params.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useCallback, useState } from 'react';\nimport { useQueryParams } from 'use-query-params';\n\nexport function useSetProjectParams(enabledURLParams = true): {\n project: string;\n setProject: (project: string) => void;\n} {\n const [query, setQuery] = useQueryParams({ project: '' }, { updateType: 'replaceIn' });\n\n const [projectState, setProjectState] = useState<string>('none');\n\n const setProject = useCallback(\n (project: string) => {\n return setQuery({ project });\n },\n [setQuery]\n );\n\n if (enabledURLParams) {\n return {\n project: query.project || 'none',\n setProject,\n };\n }\n\n return {\n project: projectState,\n setProject: setProjectState,\n };\n}\n"],"names":["useCallback","useState","useQueryParams","useSetProjectParams","enabledURLParams","query","setQuery","project","updateType","projectState","setProjectState","setProject"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAC9C,SAASC,cAAc,QAAQ,mBAAmB;AAElD,OAAO,SAASC,oBAAoBC,mBAAmB,IAAI;IAIzD,MAAM,CAACC,OAAOC,SAAS,GAAGJ,eAAe;QAAEK,SAAS;IAAG,GAAG;QAAEC,YAAY;IAAY;IAEpF,MAAM,CAACC,cAAcC,gBAAgB,GAAGT,SAAiB;IAEzD,MAAMU,aAAaX,YACjB,CAACO;QACC,OAAOD,SAAS;YAAEC;QAAQ;IAC5B,GACA;QAACD;KAAS;IAGZ,IAAIF,kBAAkB;QACpB,OAAO;YACLG,SAASF,MAAME,OAAO,IAAI;YAC1BI;QACF;IACF;IAEA,OAAO;QACLJ,SAASE;QACTE,YAAYD;IACd;AACF"}