@perses-dev/plugin-system 0.50.0-rc.0 → 0.50.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,6 +1,6 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { ProjectResource } from '@perses-dev/core';
|
|
3
|
+
import { ProjectResource, StatusError } from '@perses-dev/core';
|
|
4
4
|
export interface ProjectStore {
|
|
5
5
|
setProject: (project: ProjectResource) => void;
|
|
6
6
|
project: ProjectResource;
|
|
@@ -10,7 +10,7 @@ export interface ProjectStoreProviderProps {
|
|
|
10
10
|
enabledURLParams?: boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare const ProjectStoreContext: import("react").Context<ProjectStore | undefined>;
|
|
13
|
-
export declare function useProjectList(): UseQueryResult<ProjectResource[],
|
|
13
|
+
export declare function useProjectList(): UseQueryResult<ProjectResource[], StatusError>;
|
|
14
14
|
export declare function useProjectStore(): ProjectStore;
|
|
15
15
|
export declare function ProjectStoreProvider(props: ProjectStoreProviderProps): ReactElement;
|
|
16
16
|
//# sourceMappingURL=ProjectStoreProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,MAAM,kBAAkB,CAAC;
|
|
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 +1 @@
|
|
|
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 } 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[],
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/plugin-system",
|
|
3
|
-
"version": "0.50.0
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"description": "The plugin feature in Pereses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@perses-dev/components": "0.50.0
|
|
32
|
-
"@perses-dev/core": "0.50.0
|
|
31
|
+
"@perses-dev/components": "0.50.0",
|
|
32
|
+
"@perses-dev/core": "0.50.0",
|
|
33
33
|
"date-fns": "^2.30.0",
|
|
34
34
|
"immer": "^9.0.15",
|
|
35
35
|
"react-hook-form": "^7.46.1",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"zod": "^3.22.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@perses-dev/storybook": "0.50.0
|
|
41
|
+
"@perses-dev/storybook": "0.50.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@mui/material": "^6.1.10",
|