@perses-dev/plugin-system 0.50.0-rc.1 → 0.50.1

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.
@@ -0,0 +1,41 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "MetricLabelInput", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return MetricLabelInput;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _components = require("@perses-dev/components");
26
+ const MetricLabelInput = ({ value, onChange })=>{
27
+ const handleChange = (event)=>{
28
+ const newValue = event.target.value;
29
+ onChange(newValue || undefined);
30
+ };
31
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
32
+ label: "Metric label",
33
+ description: "Specify label to display",
34
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
35
+ fullWidth: true,
36
+ name: "Metric label",
37
+ value: value || '',
38
+ onChange: handleChange
39
+ })
40
+ });
41
+ };
@@ -0,0 +1,30 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _export_star(require("./MetricLabelInput"), exports);
18
+ function _export_star(from, to) {
19
+ Object.keys(from).forEach(function(k) {
20
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
+ Object.defineProperty(to, k, {
22
+ enumerable: true,
23
+ get: function() {
24
+ return from[k];
25
+ }
26
+ });
27
+ }
28
+ });
29
+ return from;
30
+ }
@@ -29,6 +29,7 @@ _export_star(require("./PluginSpecEditor"), exports);
29
29
  _export_star(require("./TimeRangeControls"), exports);
30
30
  _export_star(require("./Variables"), exports);
31
31
  _export_star(require("./ProjectSelect"), exports);
32
+ _export_star(require("./MetricLabelInput"), exports);
32
33
  function _export_star(from, to) {
33
34
  Object.keys(from).forEach(function(k) {
34
35
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ export interface MetricLabelInputProps {
3
+ value?: string;
4
+ onChange: (metricLabel?: string) => void;
5
+ }
6
+ export declare const MetricLabelInput: FC<MetricLabelInputProps>;
7
+ //# sourceMappingURL=MetricLabelInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MetricLabelInput.d.ts","sourceRoot":"","sources":["../../../src/components/MetricLabelInput/MetricLabelInput.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAatD,CAAC"}
@@ -0,0 +1,33 @@
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 { TextField } from '@mui/material';
15
+ import { OptionsEditorControl } from '@perses-dev/components';
16
+ export const MetricLabelInput = ({ value, onChange })=>{
17
+ const handleChange = (event)=>{
18
+ const newValue = event.target.value;
19
+ onChange(newValue || undefined);
20
+ };
21
+ return /*#__PURE__*/ _jsx(OptionsEditorControl, {
22
+ label: "Metric label",
23
+ description: "Specify label to display",
24
+ control: /*#__PURE__*/ _jsx(TextField, {
25
+ fullWidth: true,
26
+ name: "Metric label",
27
+ value: value || '',
28
+ onChange: handleChange
29
+ })
30
+ });
31
+ };
32
+
33
+ //# sourceMappingURL=MetricLabelInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/MetricLabelInput/MetricLabelInput.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 { TextField } from '@mui/material';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { FC } from 'react';\n\nexport interface MetricLabelInputProps {\n value?: string;\n onChange: (metricLabel?: string) => void;\n}\n\nexport const MetricLabelInput: FC<MetricLabelInputProps> = ({ value, onChange }) => {\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n const newValue = event.target.value;\n onChange(newValue || undefined);\n };\n\n return (\n <OptionsEditorControl\n label=\"Metric label\"\n description=\"Specify label to display\"\n control={<TextField fullWidth name=\"Metric label\" value={value || ''} onChange={handleChange} />}\n />\n );\n};\n"],"names":["TextField","OptionsEditorControl","MetricLabelInput","value","onChange","handleChange","event","newValue","target","undefined","label","description","control","fullWidth","name"],"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,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,oBAAoB,QAAQ,yBAAyB;AAQ9D,OAAO,MAAMC,mBAA8C,CAAC,EAAEC,KAAK,EAAEC,QAAQ,EAAE;IAC7E,MAAMC,eAAe,CAACC;QACpB,MAAMC,WAAWD,MAAME,MAAM,CAACL,KAAK;QACnCC,SAASG,YAAYE;IACvB;IAEA,qBACE,KAACR;QACCS,OAAM;QACNC,aAAY;QACZC,uBAAS,KAACZ;YAAUa,SAAS;YAACC,MAAK;YAAeX,OAAOA,SAAS;YAAIC,UAAUC;;;AAGtF,EAAE"}
@@ -0,0 +1,2 @@
1
+ export * from './MetricLabelInput';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MetricLabelInput/index.ts"],"names":[],"mappings":"AAaA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './MetricLabelInput';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/MetricLabelInput/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './MetricLabelInput';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
@@ -13,4 +13,5 @@ export * from './PluginSpecEditor';
13
13
  export * from './TimeRangeControls';
14
14
  export * from './Variables';
15
15
  export * from './ProjectSelect';
16
+ export * from './MetricLabelInput';
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
@@ -25,5 +25,6 @@ export * from './PluginSpecEditor';
25
25
  export * from './TimeRangeControls';
26
26
  export * from './Variables';
27
27
  export * from './ProjectSelect';
28
+ export * from './MetricLabelInput';
28
29
 
29
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\nexport * from './DatasourceEditorForm';\nexport * from './DatasourceSelect';\nexport * from './LegendOptionsEditor';\nexport * from './MultiQueryEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeRangeControls';\nexport * from './Variables';\nexport * from './ProjectSelect';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB;AACtC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,cAAc;AAC5B,cAAc,kBAAkB"}
1
+ {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\nexport * from './DatasourceEditorForm';\nexport * from './DatasourceSelect';\nexport * from './LegendOptionsEditor';\nexport * from './MultiQueryEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeRangeControls';\nexport * from './Variables';\nexport * from './ProjectSelect';\nexport * from './MetricLabelInput';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB;AACtC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,qBAAqB"}
@@ -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[], Error>;
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;AAG9D,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,KAAK,CAAC,CAOzE;AAED,wBAAgB,eAAe,IAAI,YAAY,CAM9C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,YAAY,CAoBnF"}
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[], Error> {\n return useQuery<ProjectResource[], Error>({\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,QAAyB,mBAAmB;AAC9D,SAASC,mBAAmB,QAAQ,iBAAiB;AAYrD,OAAO,MAAMC,oCAAsBL,cAAwCM,WAAW;AAEtF,OAAO,SAASC;IACd,OAAOR,SAAmC;QACxCS,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
+ {"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-rc.1",
3
+ "version": "0.50.1",
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-rc.1",
32
- "@perses-dev/core": "0.50.0-rc.1",
31
+ "@perses-dev/components": "0.50.1",
32
+ "@perses-dev/core": "0.50.1",
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-rc.1"
41
+ "@perses-dev/storybook": "0.50.1"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@mui/material": "^6.1.10",