@perses-dev/plugin-system 0.52.0-beta.4 → 0.52.0-beta.5

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.
@@ -37,26 +37,39 @@ function PluginEditor(props) {
37
37
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
38
38
  const { value, withRunQueryButton = true, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;
39
39
  const { pendingSelection, isLoading, error, onSelectionChange, onSpecChange } = (0, _plugineditorapi.usePluginEditor)(props);
40
- const [watchedQuery, setWatchQuery] = (0, _react.useState)(value.spec['query']);
40
+ /*
41
+ We could technically merge the watchedQuery, watchedOtherSpecs into a single watched-object,
42
+ because at the end of the day, they are all specs.
43
+ However, let's have them separated to keep the code simple and readable.
44
+ Reason: Only Query string field is common between all of them. Other specs may be different
45
+ Example: Legend, and MinSteps
46
+ */ const [watchedQuery, setWatchQuery] = (0, _react.useState)(value.spec['query']);
47
+ const [watchedOtherSpecs, setWatchOtherSpecs] = (0, _react.useState)(value.spec);
41
48
  const runQueryHandler = (0, _react.useCallback)(()=>{
42
49
  onSpecChange({
43
50
  ...value.spec,
51
+ ...watchedOtherSpecs,
44
52
  query: watchedQuery
45
53
  });
46
54
  }, [
47
55
  value.spec,
48
56
  onSpecChange,
49
- watchedQuery
57
+ watchedQuery,
58
+ watchedOtherSpecs
50
59
  ]);
51
- let queryHandlerSettings = undefined;
52
- if (withRunQueryButton) {
53
- queryHandlerSettings = {
60
+ const queryHandlerSettings = (0, _react.useMemo)(()=>{
61
+ return withRunQueryButton ? {
54
62
  runWithOnBlur: false,
55
63
  watchQueryChanges: (query)=>{
56
64
  setWatchQuery(query);
65
+ },
66
+ setWatchOtherSpecs: (otherSpecs)=>{
67
+ setWatchOtherSpecs(otherSpecs);
57
68
  }
58
- };
59
- }
69
+ } : undefined;
70
+ }, [
71
+ withRunQueryButton
72
+ ]);
60
73
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
61
74
  ...others,
62
75
  children: [
@@ -1 +1 @@
1
- {"version":3,"file":"PluginEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAyB,MAAM,OAAO,CAAC;AAG5D,OAAO,EAAE,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA8DnE"}
1
+ {"version":3,"file":"PluginEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAkC,MAAM,OAAO,CAAC;AAIrE,OAAO,EAAE,iBAAiB,EAAmB,MAAM,qBAAqB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA0EnE"}
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { Box, Button } from '@mui/material';
15
15
  import Reload from 'mdi-material-ui/Reload';
16
16
  import { ErrorAlert, ErrorBoundary } from '@perses-dev/components';
17
- import { useCallback, useState } from 'react';
17
+ import { useCallback, useMemo, useState } from 'react';
18
18
  import { PluginKindSelect } from '../PluginKindSelect';
19
19
  import { PluginSpecEditor } from '../PluginSpecEditor';
20
20
  import { usePluginEditor } from './plugin-editor-api';
@@ -29,26 +29,39 @@ import { usePluginEditor } from './plugin-editor-api';
29
29
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
30
30
  const { value, withRunQueryButton = true, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;
31
31
  const { pendingSelection, isLoading, error, onSelectionChange, onSpecChange } = usePluginEditor(props);
32
- const [watchedQuery, setWatchQuery] = useState(value.spec['query']);
32
+ /*
33
+ We could technically merge the watchedQuery, watchedOtherSpecs into a single watched-object,
34
+ because at the end of the day, they are all specs.
35
+ However, let's have them separated to keep the code simple and readable.
36
+ Reason: Only Query string field is common between all of them. Other specs may be different
37
+ Example: Legend, and MinSteps
38
+ */ const [watchedQuery, setWatchQuery] = useState(value.spec['query']);
39
+ const [watchedOtherSpecs, setWatchOtherSpecs] = useState(value.spec);
33
40
  const runQueryHandler = useCallback(()=>{
34
41
  onSpecChange({
35
42
  ...value.spec,
43
+ ...watchedOtherSpecs,
36
44
  query: watchedQuery
37
45
  });
38
46
  }, [
39
47
  value.spec,
40
48
  onSpecChange,
41
- watchedQuery
49
+ watchedQuery,
50
+ watchedOtherSpecs
42
51
  ]);
43
- let queryHandlerSettings = undefined;
44
- if (withRunQueryButton) {
45
- queryHandlerSettings = {
52
+ const queryHandlerSettings = useMemo(()=>{
53
+ return withRunQueryButton ? {
46
54
  runWithOnBlur: false,
47
55
  watchQueryChanges: (query)=>{
48
56
  setWatchQuery(query);
57
+ },
58
+ setWatchOtherSpecs: (otherSpecs)=>{
59
+ setWatchOtherSpecs(otherSpecs);
49
60
  }
50
- };
51
- }
61
+ } : undefined;
62
+ }, [
63
+ withRunQueryButton
64
+ ]);
52
65
  return /*#__PURE__*/ _jsxs(Box, {
53
66
  ...others,
54
67
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PluginEditor/PluginEditor.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 { Box, Button } from '@mui/material';\nimport Reload from 'mdi-material-ui/Reload';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { ReactElement, useCallback, useState } from 'react';\nimport { PluginKindSelect } from '../PluginKindSelect';\nimport { PluginSpecEditor } from '../PluginSpecEditor';\nimport { PluginEditorProps, usePluginEditor } from './plugin-editor-api';\n\n/**\n * A combination `PluginKindSelect` and `PluginSpecEditor` component. This is meant for editing the `plugin` property\n * that's common in our JSON specs where a user selects a plugin `kind` and then edits the `spec` via that plugin's\n * editor component. It takes care of transitioning from one plugin kind to another \"all at once\" so that when the\n * plugin's kind changes, the spec is also changed at the same time so those options editor components don't see a\n * previous plugin's spec state. If you just want this behavior, but in a different UI layout from this, try the\n * `usePluginEditor` hook that powers this component.\n */\nexport function PluginEditor(props: PluginEditorProps): ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { value, withRunQueryButton = true, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;\n const { pendingSelection, isLoading, error, onSelectionChange, onSpecChange } = usePluginEditor(props);\n const [watchedQuery, setWatchQuery] = useState<string>(value.spec['query'] as string);\n\n const runQueryHandler = useCallback((): void => {\n onSpecChange({ ...value.spec, query: watchedQuery });\n }, [value.spec, onSpecChange, watchedQuery]);\n\n let queryHandlerSettings = undefined;\n\n if (withRunQueryButton) {\n queryHandlerSettings = {\n runWithOnBlur: false,\n watchQueryChanges: (query: string): void => {\n setWatchQuery(query);\n },\n };\n }\n\n return (\n <Box {...others}>\n <Box sx={{ display: 'flex', flexDirection: 'row' }}>\n <PluginKindSelect\n fullWidth={false}\n sx={{ mb: 2, minWidth: 120 }}\n margin=\"dense\"\n label={pluginKindLabel}\n pluginTypes={pluginTypes}\n disabled={isLoading}\n value={pendingSelection ? pendingSelection : value.selection}\n InputProps={{ readOnly: isReadonly }}\n error={!!error}\n helperText={error?.message}\n onChange={onSelectionChange}\n />\n\n {withRunQueryButton && !isLoading && (\n <Button\n data-testid=\"run_query_button\"\n variant=\"contained\"\n sx={{ marginTop: 1.5, marginBottom: 1.5, paddingTop: 0.5, marginLeft: 'auto' }}\n startIcon={<Reload />}\n onClick={runQueryHandler}\n >\n Run Query\n </Button>\n )}\n </Box>\n\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PluginSpecEditor\n pluginSelection={value.selection}\n value={value.spec}\n onChange={onSpecChange}\n isReadonly={isReadonly}\n queryHandlerSettings={queryHandlerSettings}\n />\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","Button","Reload","ErrorAlert","ErrorBoundary","useCallback","useState","PluginKindSelect","PluginSpecEditor","usePluginEditor","PluginEditor","props","value","withRunQueryButton","pluginTypes","pluginKindLabel","onChange","_","isReadonly","others","pendingSelection","isLoading","error","onSelectionChange","onSpecChange","watchedQuery","setWatchQuery","spec","runQueryHandler","query","queryHandlerSettings","undefined","runWithOnBlur","watchQueryChanges","sx","display","flexDirection","fullWidth","mb","minWidth","margin","label","disabled","selection","InputProps","readOnly","helperText","message","data-testid","variant","marginTop","marginBottom","paddingTop","marginLeft","startIcon","onClick","FallbackComponent","pluginSelection"],"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,GAAG,EAAEC,MAAM,QAAQ,gBAAgB;AAC5C,OAAOC,YAAY,yBAAyB;AAC5C,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AACnE,SAAuBC,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAC5D,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAA4BC,eAAe,QAAQ,sBAAsB;AAEzE;;;;;;;CAOC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,6DAA6D;IAC7D,MAAM,EAAEC,KAAK,EAAEC,qBAAqB,IAAI,EAAEC,WAAW,EAAEC,eAAe,EAAEC,UAAUC,CAAC,EAAEC,UAAU,EAAE,GAAGC,QAAQ,GAAGR;IAC/G,MAAM,EAAES,gBAAgB,EAAEC,SAAS,EAAEC,KAAK,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGf,gBAAgBE;IAChG,MAAM,CAACc,cAAcC,cAAc,GAAGpB,SAAiBM,MAAMe,IAAI,CAAC,QAAQ;IAE1E,MAAMC,kBAAkBvB,YAAY;QAClCmB,aAAa;YAAE,GAAGZ,MAAMe,IAAI;YAAEE,OAAOJ;QAAa;IACpD,GAAG;QAACb,MAAMe,IAAI;QAAEH;QAAcC;KAAa;IAE3C,IAAIK,uBAAuBC;IAE3B,IAAIlB,oBAAoB;QACtBiB,uBAAuB;YACrBE,eAAe;YACfC,mBAAmB,CAACJ;gBAClBH,cAAcG;YAChB;QACF;IACF;IAEA,qBACE,MAAC7B;QAAK,GAAGmB,MAAM;;0BACb,MAACnB;gBAAIkC,IAAI;oBAAEC,SAAS;oBAAQC,eAAe;gBAAM;;kCAC/C,KAAC7B;wBACC8B,WAAW;wBACXH,IAAI;4BAAEI,IAAI;4BAAGC,UAAU;wBAAI;wBAC3BC,QAAO;wBACPC,OAAO1B;wBACPD,aAAaA;wBACb4B,UAAUrB;wBACVT,OAAOQ,mBAAmBA,mBAAmBR,MAAM+B,SAAS;wBAC5DC,YAAY;4BAAEC,UAAU3B;wBAAW;wBACnCI,OAAO,CAAC,CAACA;wBACTwB,YAAYxB,OAAOyB;wBACnB/B,UAAUO;;oBAGXV,sBAAsB,CAACQ,2BACtB,KAACpB;wBACC+C,eAAY;wBACZC,SAAQ;wBACRf,IAAI;4BAAEgB,WAAW;4BAAKC,cAAc;4BAAKC,YAAY;4BAAKC,YAAY;wBAAO;wBAC7EC,yBAAW,KAACpD;wBACZqD,SAAS3B;kCACV;;;;0BAML,KAACxB;gBAAcoD,mBAAmBrD;0BAChC,cAAA,KAACK;oBACCiD,iBAAiB7C,MAAM+B,SAAS;oBAChC/B,OAAOA,MAAMe,IAAI;oBACjBX,UAAUQ;oBACVN,YAAYA;oBACZY,sBAAsBA;;;;;AAKhC"}
1
+ {"version":3,"sources":["../../../src/components/PluginEditor/PluginEditor.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 { Box, Button } from '@mui/material';\nimport Reload from 'mdi-material-ui/Reload';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { ReactElement, useCallback, useMemo, useState } from 'react';\nimport { UnknownSpec } from '@perses-dev/core';\nimport { PluginKindSelect } from '../PluginKindSelect';\nimport { PluginSpecEditor } from '../PluginSpecEditor';\nimport { PluginEditorProps, usePluginEditor } from './plugin-editor-api';\n\n/**\n * A combination `PluginKindSelect` and `PluginSpecEditor` component. This is meant for editing the `plugin` property\n * that's common in our JSON specs where a user selects a plugin `kind` and then edits the `spec` via that plugin's\n * editor component. It takes care of transitioning from one plugin kind to another \"all at once\" so that when the\n * plugin's kind changes, the spec is also changed at the same time so those options editor components don't see a\n * previous plugin's spec state. If you just want this behavior, but in a different UI layout from this, try the\n * `usePluginEditor` hook that powers this component.\n */\nexport function PluginEditor(props: PluginEditorProps): ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { value, withRunQueryButton = true, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;\n const { pendingSelection, isLoading, error, onSelectionChange, onSpecChange } = usePluginEditor(props);\n\n /* \n We could technically merge the watchedQuery, watchedOtherSpecs into a single watched-object,\n because at the end of the day, they are all specs.\n However, let's have them separated to keep the code simple and readable.\n Reason: Only Query string field is common between all of them. Other specs may be different\n Example: Legend, and MinSteps\n */\n const [watchedQuery, setWatchQuery] = useState<string>(value.spec['query'] as string);\n const [watchedOtherSpecs, setWatchOtherSpecs] = useState<UnknownSpec>(value.spec);\n\n const runQueryHandler = useCallback((): void => {\n onSpecChange({ ...value.spec, ...watchedOtherSpecs, query: watchedQuery });\n }, [value.spec, onSpecChange, watchedQuery, watchedOtherSpecs]);\n\n const queryHandlerSettings = useMemo(() => {\n return withRunQueryButton\n ? {\n runWithOnBlur: false,\n watchQueryChanges: (query: string): void => {\n setWatchQuery(query);\n },\n setWatchOtherSpecs: (otherSpecs: UnknownSpec): void => {\n setWatchOtherSpecs(otherSpecs);\n },\n }\n : undefined;\n }, [withRunQueryButton]);\n\n return (\n <Box {...others}>\n <Box sx={{ display: 'flex', flexDirection: 'row' }}>\n <PluginKindSelect\n fullWidth={false}\n sx={{ mb: 2, minWidth: 120 }}\n margin=\"dense\"\n label={pluginKindLabel}\n pluginTypes={pluginTypes}\n disabled={isLoading}\n value={pendingSelection ? pendingSelection : value.selection}\n InputProps={{ readOnly: isReadonly }}\n error={!!error}\n helperText={error?.message}\n onChange={onSelectionChange}\n />\n\n {withRunQueryButton && !isLoading && (\n <Button\n data-testid=\"run_query_button\"\n variant=\"contained\"\n sx={{ marginTop: 1.5, marginBottom: 1.5, paddingTop: 0.5, marginLeft: 'auto' }}\n startIcon={<Reload />}\n onClick={runQueryHandler}\n >\n Run Query\n </Button>\n )}\n </Box>\n\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PluginSpecEditor\n pluginSelection={value.selection}\n value={value.spec}\n onChange={onSpecChange}\n isReadonly={isReadonly}\n queryHandlerSettings={queryHandlerSettings}\n />\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","Button","Reload","ErrorAlert","ErrorBoundary","useCallback","useMemo","useState","PluginKindSelect","PluginSpecEditor","usePluginEditor","PluginEditor","props","value","withRunQueryButton","pluginTypes","pluginKindLabel","onChange","_","isReadonly","others","pendingSelection","isLoading","error","onSelectionChange","onSpecChange","watchedQuery","setWatchQuery","spec","watchedOtherSpecs","setWatchOtherSpecs","runQueryHandler","query","queryHandlerSettings","runWithOnBlur","watchQueryChanges","otherSpecs","undefined","sx","display","flexDirection","fullWidth","mb","minWidth","margin","label","disabled","selection","InputProps","readOnly","helperText","message","data-testid","variant","marginTop","marginBottom","paddingTop","marginLeft","startIcon","onClick","FallbackComponent","pluginSelection"],"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,GAAG,EAAEC,MAAM,QAAQ,gBAAgB;AAC5C,OAAOC,YAAY,yBAAyB;AAC5C,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AACnE,SAAuBC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAErE,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAA4BC,eAAe,QAAQ,sBAAsB;AAEzE;;;;;;;CAOC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,6DAA6D;IAC7D,MAAM,EAAEC,KAAK,EAAEC,qBAAqB,IAAI,EAAEC,WAAW,EAAEC,eAAe,EAAEC,UAAUC,CAAC,EAAEC,UAAU,EAAE,GAAGC,QAAQ,GAAGR;IAC/G,MAAM,EAAES,gBAAgB,EAAEC,SAAS,EAAEC,KAAK,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGf,gBAAgBE;IAEhG;;;;;;GAMC,GACD,MAAM,CAACc,cAAcC,cAAc,GAAGpB,SAAiBM,MAAMe,IAAI,CAAC,QAAQ;IAC1E,MAAM,CAACC,mBAAmBC,mBAAmB,GAAGvB,SAAsBM,MAAMe,IAAI;IAEhF,MAAMG,kBAAkB1B,YAAY;QAClCoB,aAAa;YAAE,GAAGZ,MAAMe,IAAI;YAAE,GAAGC,iBAAiB;YAAEG,OAAON;QAAa;IAC1E,GAAG;QAACb,MAAMe,IAAI;QAAEH;QAAcC;QAAcG;KAAkB;IAE9D,MAAMI,uBAAuB3B,QAAQ;QACnC,OAAOQ,qBACH;YACEoB,eAAe;YACfC,mBAAmB,CAACH;gBAClBL,cAAcK;YAChB;YACAF,oBAAoB,CAACM;gBACnBN,mBAAmBM;YACrB;QACF,IACAC;IACN,GAAG;QAACvB;KAAmB;IAEvB,qBACE,MAACd;QAAK,GAAGoB,MAAM;;0BACb,MAACpB;gBAAIsC,IAAI;oBAAEC,SAAS;oBAAQC,eAAe;gBAAM;;kCAC/C,KAAChC;wBACCiC,WAAW;wBACXH,IAAI;4BAAEI,IAAI;4BAAGC,UAAU;wBAAI;wBAC3BC,QAAO;wBACPC,OAAO7B;wBACPD,aAAaA;wBACb+B,UAAUxB;wBACVT,OAAOQ,mBAAmBA,mBAAmBR,MAAMkC,SAAS;wBAC5DC,YAAY;4BAAEC,UAAU9B;wBAAW;wBACnCI,OAAO,CAAC,CAACA;wBACT2B,YAAY3B,OAAO4B;wBACnBlC,UAAUO;;oBAGXV,sBAAsB,CAACQ,2BACtB,KAACrB;wBACCmD,eAAY;wBACZC,SAAQ;wBACRf,IAAI;4BAAEgB,WAAW;4BAAKC,cAAc;4BAAKC,YAAY;4BAAKC,YAAY;wBAAO;wBAC7EC,yBAAW,KAACxD;wBACZyD,SAAS5B;kCACV;;;;0BAML,KAAC3B;gBAAcwD,mBAAmBzD;0BAChC,cAAA,KAACM;oBACCoD,iBAAiBhD,MAAMkC,SAAS;oBAChClC,OAAOA,MAAMe,IAAI;oBACjBX,UAAUQ;oBACVN,YAAYA;oBACZc,sBAAsBA;;;;;AAKhC"}
@@ -1,4 +1,4 @@
1
- import { QueryDefinition } from '@perses-dev/core';
1
+ import { QueryDefinition, UnknownSpec } from '@perses-dev/core';
2
2
  import React from 'react';
3
3
  /**
4
4
  * Base type of all plugin implementations.
@@ -23,6 +23,7 @@ export interface OptionsEditorProps<Spec> {
23
23
  queryHandlerSettings?: {
24
24
  runWithOnBlur: boolean;
25
25
  watchQueryChanges: (query: string) => void;
26
+ setWatchOtherSpecs: (otherSpecs: UnknownSpec) => void;
26
27
  };
27
28
  }
28
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-base.d.ts","sourceRoot":"","sources":["../../src/model/plugin-base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,IAAI;IAC1B;;OAEG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvE;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,IAAI;IAGtC,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE;QACrB,aAAa,EAAE,OAAO,CAAC;QACvB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;KAC5C,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,CAAE,SAAQ,kBAAkB,CAAC,IAAI,CAAC;IACtE,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B"}
1
+ {"version":3,"file":"plugin-base.d.ts","sourceRoot":"","sources":["../../src/model/plugin-base.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,IAAI;IAC1B;;OAEG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvE;;OAEG;IACH,oBAAoB,EAAE,MAAM,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,IAAI;IAGtC,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE;QACrB,aAAa,EAAE,OAAO,CAAC;QACvB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAC3C,kBAAkB,EAAE,CAAC,UAAU,EAAE,WAAW,KAAK,IAAI,CAAC;KACvD,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,CAAE,SAAQ,kBAAkB,CAAC,IAAI,CAAC;IACtE,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/plugin-base.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\nimport { QueryDefinition } from '@perses-dev/core';\nimport React from 'react';\n\n/**\n * Base type of all plugin implementations.\n */\nexport interface Plugin<Spec> {\n /**\n * React component for editing the plugin's options in the UI.\n */\n OptionsEditorComponent?: React.ComponentType<OptionsEditorProps<Spec>>;\n\n /**\n * Callback for creating the initial options for the plugin.\n */\n createInitialOptions: () => Spec;\n}\n\n/**\n * Common props passed to options editor components.\n */\nexport interface OptionsEditorProps<Spec> {\n // TODO: These are temporary and may not actually make sense, so replace\n // with whatever makes sense as visual editing evolves\n value: Spec;\n onChange: (next: Spec) => void;\n isReadonly?: boolean;\n queryHandlerSettings?: {\n runWithOnBlur: boolean;\n watchQueryChanges: (query: string) => void;\n };\n}\n\n/**\n * Common props passed to query editor component\n */\nexport interface QueryEditorProps<Spec> extends OptionsEditorProps<Spec> {\n queries: QueryDefinition[];\n}\n"],"names":["React"],"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;AAGjC,OAAOA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["../../src/model/plugin-base.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\nimport { QueryDefinition, UnknownSpec } from '@perses-dev/core';\nimport React from 'react';\n\n/**\n * Base type of all plugin implementations.\n */\nexport interface Plugin<Spec> {\n /**\n * React component for editing the plugin's options in the UI.\n */\n OptionsEditorComponent?: React.ComponentType<OptionsEditorProps<Spec>>;\n\n /**\n * Callback for creating the initial options for the plugin.\n */\n createInitialOptions: () => Spec;\n}\n\n/**\n * Common props passed to options editor components.\n */\nexport interface OptionsEditorProps<Spec> {\n // TODO: These are temporary and may not actually make sense, so replace\n // with whatever makes sense as visual editing evolves\n value: Spec;\n onChange: (next: Spec) => void;\n isReadonly?: boolean;\n queryHandlerSettings?: {\n runWithOnBlur: boolean;\n watchQueryChanges: (query: string) => void;\n setWatchOtherSpecs: (otherSpecs: UnknownSpec) => void;\n };\n}\n\n/**\n * Common props passed to query editor component\n */\nexport interface QueryEditorProps<Spec> extends OptionsEditorProps<Spec> {\n queries: QueryDefinition[];\n}\n"],"names":["React"],"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;AAGjC,OAAOA,WAAW,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/plugin-system",
3
- "version": "0.52.0-beta.4",
3
+ "version": "0.52.0-beta.5",
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",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@module-federation/enhanced": "^0.18.0",
32
- "@perses-dev/components": "0.52.0-beta.4",
33
- "@perses-dev/core": "0.52.0-beta.4",
32
+ "@perses-dev/components": "0.52.0-beta.5",
33
+ "@perses-dev/core": "0.52.0-beta.5",
34
34
  "date-fns": "^4.1.0",
35
35
  "date-fns-tz": "^3.2.0",
36
36
  "immer": "^10.1.1",