@perses-dev/plugin-system 0.55.0-beta.8 → 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.
- package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.js +0 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
- package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.d.ts.map +1 -1
- package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.js +2 -7
- package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPProxyOAuthPassthroughEditor.d.ts +11 -0
- package/dist/components/HTTPSettingsEditor/HTTPProxyOAuthPassthroughEditor.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPProxyOAuthPassthroughEditor.js +62 -0
- package/dist/components/HTTPSettingsEditor/HTTPProxyOAuthPassthroughEditor.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPProxyTimeoutEditor.d.ts +11 -0
- package/dist/components/HTTPSettingsEditor/HTTPProxyTimeoutEditor.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPProxyTimeoutEditor.js +58 -0
- package/dist/components/HTTPSettingsEditor/HTTPProxyTimeoutEditor.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +44 -15
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts.map +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +7 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
- package/dist/components/LinksEditor/LinksEditor.js +5 -0
- package/dist/components/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +16 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +4 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +7 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +54 -41
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +14 -0
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +187 -23
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +72 -7
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +1 -0
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +6 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +6 -2
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +0 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +7 -2
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/model/datasource.d.ts +3 -0
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/plugin-loading.d.ts +1 -0
- package/dist/model/plugin-loading.d.ts.map +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.d.ts +11 -0
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/remote/PluginLoaderComponent.d.ts.map +1 -1
- package/dist/remote/PluginLoaderComponent.js +28 -15
- package/dist/remote/PluginLoaderComponent.js.map +1 -1
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.js +32 -24
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/dist/remote/remotePluginLoader.d.ts.map +1 -1
- package/dist/remote/remotePluginLoader.js +1 -0
- package/dist/remote/remotePluginLoader.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +21 -15
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +23 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts +3 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js +2 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +7 -9
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
- package/dist/runtime/UsageMetricsProvider.js +24 -20
- package/dist/runtime/UsageMetricsProvider.js.map +1 -1
- package/dist/runtime/alerts-queries.d.ts.map +1 -1
- package/dist/runtime/alerts-queries.js +6 -2
- package/dist/runtime/alerts-queries.js.map +1 -1
- package/dist/runtime/annotations.d.ts +8 -0
- package/dist/runtime/annotations.d.ts.map +1 -1
- package/dist/runtime/annotations.js +47 -83
- package/dist/runtime/annotations.js.map +1 -1
- package/dist/runtime/datasources.d.ts +4 -0
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +4 -3
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/log-queries.d.ts.map +1 -1
- package/dist/runtime/log-queries.js +3 -1
- package/dist/runtime/log-queries.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +23 -8
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +52 -16
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/profile-queries.d.ts.map +1 -1
- package/dist/runtime/profile-queries.js +3 -1
- package/dist/runtime/profile-queries.js.map +1 -1
- package/dist/runtime/silences-queries.d.ts.map +1 -1
- package/dist/runtime/silences-queries.js +6 -2
- package/dist/runtime/silences-queries.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +10 -3
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +6 -2
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/variables.d.ts +6 -0
- package/dist/runtime/variables.d.ts.map +1 -1
- package/dist/runtime/variables.js +17 -1
- package/dist/runtime/variables.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/plugin-versions.d.ts +18 -0
- package/dist/utils/plugin-versions.d.ts.map +1 -0
- package/dist/utils/plugin-versions.js +52 -0
- package/dist/utils/plugin-versions.js.map +1 -0
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiQueryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAC7D;AA4CD;;;;;;;GAOG;AAEH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"MultiQueryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAC7D;AA4CD;;;;;;;GAOG;AAEH,eAAO,MAAM,gBAAgB,mHAkG3B,CAAC"}
|
|
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
14
14
|
import { Button, Stack } from "@mui/material";
|
|
15
15
|
import { produce } from "immer";
|
|
16
16
|
import AddIcon from "mdi-material-ui/Plus";
|
|
17
|
-
import { forwardRef, useState } from "react";
|
|
17
|
+
import { forwardRef, useEffect, useState } from "react";
|
|
18
18
|
import { useListPluginMetadata, usePlugin, usePluginRegistry } from "../../runtime/index.js";
|
|
19
19
|
import { QueryEditorContainer } from "./QueryEditorContainer.js";
|
|
20
20
|
function useDefaultQueryDefinition(queryTypes, filteredQueryPlugins) {
|
|
@@ -62,6 +62,21 @@ function useDefaultQueryDefinition(queryTypes, filteredQueryPlugins) {
|
|
|
62
62
|
const { defaultInitialQueryDefinition, isLoading } = useDefaultQueryDefinition(queryTypes, filteredQueryPlugins);
|
|
63
63
|
// State for which queries are collapsed
|
|
64
64
|
const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(()=>false));
|
|
65
|
+
// When a panel has no queries, MultiQueryEditor displays a default query (see queryDefinitions below), but that
|
|
66
|
+
// default is only visual until the user interacts with it. Persist it so panels whose default query needs no user
|
|
67
|
+
// input (e.g. alerts/silences) still have a query saved, and therefore run in view mode.
|
|
68
|
+
useEffect(()=>{
|
|
69
|
+
if (queries.length === 0 && !isLoading && defaultInitialQueryDefinition.spec.plugin.kind !== '') {
|
|
70
|
+
onChange([
|
|
71
|
+
defaultInitialQueryDefinition
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
}, [
|
|
75
|
+
queries.length,
|
|
76
|
+
isLoading,
|
|
77
|
+
defaultInitialQueryDefinition,
|
|
78
|
+
onChange
|
|
79
|
+
]);
|
|
65
80
|
// Query handlers
|
|
66
81
|
const handleQueryChange = (index, queryDef)=>{
|
|
67
82
|
onChange(produce(queries, (draft)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.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 { Button, Stack } from '@mui/material';\nimport type { QueryDefinition, QueryPluginType } from '@perses-dev/spec';\nimport { produce } from 'immer';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport type { ReactElement } from 'react';\nimport { forwardRef, useState } from 'react';\n\nimport type { QueryData } from '../../runtime';\nimport { useListPluginMetadata, usePlugin, usePluginRegistry } from '../../runtime';\nimport type { PluginEditorRef } from '../PluginEditor';\nimport { QueryEditorContainer } from './QueryEditorContainer';\n\nexport interface MultiQueryEditorProps {\n queryTypes: QueryPluginType[];\n filteredQueryPlugins?: string[];\n queries?: QueryDefinition[];\n queryResults?: QueryData[];\n onChange: (queries: QueryDefinition[]) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n}\n\nfunction useDefaultQueryDefinition(\n queryTypes: QueryPluginType[],\n filteredQueryPlugins?: string[],\n): {\n defaultInitialQueryDefinition: QueryDefinition;\n isLoading: boolean;\n} {\n // Build the default query plugin\n // This will be used only if the queries are empty, to open a starting query\n\n // Firs the default query type\n const defaultQueryType = queryTypes[0]!;\n // Then the default plugin kind\n // Use as default the plugin kind explicitly set as default or the first in the list\n const { data: queryPlugins, isLoading } = useListPluginMetadata(queryTypes);\n const { defaultPluginKinds } = usePluginRegistry();\n\n let defaultQueryKind: string = '';\n\n if (filteredQueryPlugins?.length) {\n defaultQueryKind = queryPlugins?.find((i) => filteredQueryPlugins.includes(i.spec.name))!.spec.name ?? '';\n } else {\n defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';\n }\n\n const { data: defaultQueryPlugin, isLoading: isPluginLoading } = usePlugin(defaultQueryType, defaultQueryKind, {\n useErrorBoundary: true,\n enabled: true,\n });\n\n // This default query definition is used if no query is provided initially or when we add a new query\n return {\n defaultInitialQueryDefinition: {\n kind: defaultQueryType,\n spec: {\n plugin: { kind: defaultQueryKind, spec: defaultQueryPlugin?.createInitialOptions() || {} },\n },\n },\n isLoading: isLoading || isPluginLoading,\n };\n}\n\n/**\n * A component render a list of {@link QueryEditorContainer} for the given query definitions.\n * It allows adding, removing and editing queries.\n * @param queryTypes The list of query types that the underlying editor will propose\n * @param queries The list of query definitions to render\n * @param onChange The callback to call when the queries are modified\n * @constructor\n */\n\nexport const MultiQueryEditor = forwardRef<PluginEditorRef, MultiQueryEditorProps>((props, ref): ReactElement => {\n const { queryTypes, queries = [], queryResults, filteredQueryPlugins, onChange, onQueryRun } = props;\n const { defaultInitialQueryDefinition, isLoading } = useDefaultQueryDefinition(queryTypes, filteredQueryPlugins);\n // State for which queries are collapsed\n const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(() => false));\n\n // Query handlers\n const handleQueryChange = (index: number, queryDef: QueryDefinition): void => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft[index] = queryDef;\n } else {\n draft = [queryDef];\n }\n }),\n );\n };\n\n const handleQueryRun = (index: number, queryDef: QueryDefinition): void => {\n onQueryRun(index, queryDef);\n };\n\n const handleQueryAdd = (): void => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft.push(defaultInitialQueryDefinition);\n } else {\n draft = [...queries, defaultInitialQueryDefinition];\n }\n }),\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.push(false);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryDelete = (index: number): void => {\n onChange(\n produce(queries, (draft) => {\n draft.splice(index, 1);\n }),\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.splice(index, 1);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryCollapseExpand = (index: number): void => {\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed[index] = !queriesCollapsed[index];\n return [...queriesCollapsed];\n });\n };\n\n // show one query input if queries is empty\n let queryDefinitions: QueryDefinition[] = queries;\n if (queries.length === 0 && !isLoading) {\n queryDefinitions = [defaultInitialQueryDefinition];\n }\n\n return (\n <>\n <Stack spacing={1}>\n {queryDefinitions.map((query: QueryDefinition, i: number) => (\n <QueryEditorContainer\n ref={ref}\n queryTypes={queryTypes}\n key={i}\n index={i}\n query={query}\n queryResult={queryResults?.[i]}\n filteredQueryPlugins={filteredQueryPlugins}\n isCollapsed={!!queriesCollapsed[i]}\n onChange={handleQueryChange}\n onQueryRun={handleQueryRun}\n onDelete={queries.length > 1 ? handleQueryDelete : undefined}\n onCollapseExpand={handleQueryCollapseExpand}\n />\n ))}\n </Stack>\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleQueryAdd}>\n Add Query\n </Button>\n </>\n );\n});\n\nMultiQueryEditor.displayName = 'MultiQueryEditor';\n"],"names":["Button","Stack","produce","AddIcon","forwardRef","useState","useListPluginMetadata","usePlugin","usePluginRegistry","QueryEditorContainer","useDefaultQueryDefinition","queryTypes","filteredQueryPlugins","defaultQueryType","data","queryPlugins","isLoading","defaultPluginKinds","defaultQueryKind","length","find","i","includes","spec","name","defaultQueryPlugin","isPluginLoading","useErrorBoundary","enabled","defaultInitialQueryDefinition","kind","plugin","createInitialOptions","MultiQueryEditor","props","ref","queries","queryResults","onChange","onQueryRun","queriesCollapsed","setQueriesCollapsed","map","handleQueryChange","index","queryDef","draft","handleQueryRun","handleQueryAdd","push","handleQueryDelete","splice","handleQueryCollapseExpand","queryDefinitions","spacing","query","queryResult","isCollapsed","onDelete","undefined","onCollapseExpand","variant","startIcon","sx","marginTop","onClick","displayName"],"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,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAE9C,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,aAAa,uBAAuB;AAE3C,SAASC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAG7C,SAASC,qBAAqB,EAAEC,SAAS,EAAEC,iBAAiB,QAAQ,yBAAgB;AAEpF,SAASC,oBAAoB,QAAQ,4BAAyB;AAW9D,SAASC,0BACPC,UAA6B,EAC7BC,oBAA+B;IAK/B,iCAAiC;IACjC,4EAA4E;IAE5E,8BAA8B;IAC9B,MAAMC,mBAAmBF,UAAU,CAAC,EAAE;IACtC,+BAA+B;IAC/B,oFAAoF;IACpF,MAAM,EAAEG,MAAMC,YAAY,EAAEC,SAAS,EAAE,GAAGV,sBAAsBK;IAChE,MAAM,EAAEM,kBAAkB,EAAE,GAAGT;IAE/B,IAAIU,mBAA2B;IAE/B,IAAIN,sBAAsBO,QAAQ;QAChCD,mBAAmBH,cAAcK,KAAK,CAACC,IAAMT,qBAAqBU,QAAQ,CAACD,EAAEE,IAAI,CAACC,IAAI,GAAID,KAAKC,QAAQ;IACzG,OAAO;QACLN,mBAAmBD,oBAAoB,CAACJ,iBAAiB,IAAIE,cAAc,CAAC,EAAE,EAA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oBAAoB,CAACN;QACzBN,SACEpC,QAAQkC,SAAS,CAACU;YAChBA,MAAMK,MAAM,CAACP,OAAO;QACtB;QAEFH,oBAAoB,CAACD;YACnBA,iBAAiBW,MAAM,CAACP,OAAO;YAC/B,OAAO;mBAAIJ;aAAiB;QAC9B;IACF;IAEA,MAAMY,4BAA4B,CAACR;QACjCH,oBAAoB,CAACD;YACnBA,gBAAgB,CAACI,MAAM,GAAG,CAACJ,gBAAgB,CAACI,MAAM;YAClD,OAAO;mBAAIJ;aAAiB;QAC9B;IACF;IAEA,2CAA2C;IAC3C,IAAIa,mBAAsCjB;IAC1C,IAAIA,QAAQjB,MAAM,KAAK,KAAK,CAACH,WAAW;QACtCqC,mBAAmB;YAACxB;SAA8B;IACpD;IAEA,qBACE;;0BACE,KAAC5B;gBAAMqD,SAAS;0BACbD,iBAAiBX,GAAG,CAAC,CAACa,OAAwBlC,kBAC7C,KAACZ;wBACC0B,KAAKA;wBACLxB,YAAYA;wBAEZiC,OAAOvB;wBACPkC,OAAOA;wBACPC,aAAanB,cAAc,CAAChB,EAAE;wBAC9BT,sBAAsBA;wBACtB6C,aAAa,CAAC,CAACjB,gBAAgB,CAACnB,EAAE;wBAClCiB,UAAUK;wBACVJ,YAAYQ;wBACZW,UAAUtB,QAAQjB,MAAM,GAAG,IAAI+B,oBAAoBS;wBACnDC,kBAAkBR;uBATb/B;;0BAaX,KAACrB;gBAAO6D,SAAQ;gBAAYC,yBAAW,KAAC3D;gBAAY4D,IAAI;oBAAEC,WAAW;gBAAE;gBAAGC,SAASjB;0BAAgB;;;;AAKzG,GAAG;AAEHf,iBAAiBiC,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.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 { Button, Stack } from '@mui/material';\nimport type { QueryDefinition, QueryPluginType } from '@perses-dev/spec';\nimport { produce } from 'immer';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport type { ReactElement } from 'react';\nimport { forwardRef, useEffect, useState } from 'react';\n\nimport type { QueryData } from '../../runtime';\nimport { useListPluginMetadata, usePlugin, usePluginRegistry } from '../../runtime';\nimport type { PluginEditorRef } from '../PluginEditor';\nimport { QueryEditorContainer } from './QueryEditorContainer';\n\nexport interface MultiQueryEditorProps {\n queryTypes: QueryPluginType[];\n filteredQueryPlugins?: string[];\n queries?: QueryDefinition[];\n queryResults?: QueryData[];\n onChange: (queries: QueryDefinition[]) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n}\n\nfunction useDefaultQueryDefinition(\n queryTypes: QueryPluginType[],\n filteredQueryPlugins?: string[],\n): {\n defaultInitialQueryDefinition: QueryDefinition;\n isLoading: boolean;\n} {\n // Build the default query plugin\n // This will be used only if the queries are empty, to open a starting query\n\n // Firs the default query type\n const defaultQueryType = queryTypes[0]!;\n // Then the default plugin kind\n // Use as default the plugin kind explicitly set as default or the first in the list\n const { data: queryPlugins, isLoading } = useListPluginMetadata(queryTypes);\n const { defaultPluginKinds } = usePluginRegistry();\n\n let defaultQueryKind: string = '';\n\n if (filteredQueryPlugins?.length) {\n defaultQueryKind = queryPlugins?.find((i) => filteredQueryPlugins.includes(i.spec.name))!.spec.name ?? '';\n } else {\n defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';\n }\n\n const { data: defaultQueryPlugin, isLoading: isPluginLoading } = usePlugin(defaultQueryType, defaultQueryKind, {\n useErrorBoundary: true,\n enabled: true,\n });\n\n // This default query definition is used if no query is provided initially or when we add a new query\n return {\n defaultInitialQueryDefinition: {\n kind: defaultQueryType,\n spec: {\n plugin: { kind: defaultQueryKind, spec: defaultQueryPlugin?.createInitialOptions() || {} },\n },\n },\n isLoading: isLoading || isPluginLoading,\n };\n}\n\n/**\n * A component render a list of {@link QueryEditorContainer} for the given query definitions.\n * It allows adding, removing and editing queries.\n * @param queryTypes The list of query types that the underlying editor will propose\n * @param queries The list of query definitions to render\n * @param onChange The callback to call when the queries are modified\n * @constructor\n */\n\nexport const MultiQueryEditor = forwardRef<PluginEditorRef, MultiQueryEditorProps>((props, ref): ReactElement => {\n const { queryTypes, queries = [], queryResults, filteredQueryPlugins, onChange, onQueryRun } = props;\n const { defaultInitialQueryDefinition, isLoading } = useDefaultQueryDefinition(queryTypes, filteredQueryPlugins);\n // State for which queries are collapsed\n const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(() => false));\n\n // When a panel has no queries, MultiQueryEditor displays a default query (see queryDefinitions below), but that\n // default is only visual until the user interacts with it. Persist it so panels whose default query needs no user\n // input (e.g. alerts/silences) still have a query saved, and therefore run in view mode.\n useEffect(() => {\n if (queries.length === 0 && !isLoading && defaultInitialQueryDefinition.spec.plugin.kind !== '') {\n onChange([defaultInitialQueryDefinition]);\n }\n }, [queries.length, isLoading, defaultInitialQueryDefinition, onChange]);\n\n // Query handlers\n const handleQueryChange = (index: number, queryDef: QueryDefinition): void => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft[index] = queryDef;\n } else {\n draft = [queryDef];\n }\n }),\n );\n };\n\n const handleQueryRun = (index: number, queryDef: QueryDefinition): void => {\n onQueryRun(index, queryDef);\n };\n\n const handleQueryAdd = (): void => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft.push(defaultInitialQueryDefinition);\n } else {\n draft = [...queries, defaultInitialQueryDefinition];\n }\n }),\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.push(false);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryDelete = (index: number): void => {\n onChange(\n produce(queries, (draft) => {\n draft.splice(index, 1);\n }),\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.splice(index, 1);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryCollapseExpand = (index: number): void => {\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed[index] = !queriesCollapsed[index];\n return [...queriesCollapsed];\n });\n };\n\n // show one query input if queries is empty\n let queryDefinitions: QueryDefinition[] = queries;\n if (queries.length === 0 && !isLoading) {\n queryDefinitions = [defaultInitialQueryDefinition];\n }\n\n return (\n <>\n <Stack spacing={1}>\n {queryDefinitions.map((query: QueryDefinition, i: number) => (\n <QueryEditorContainer\n ref={ref}\n queryTypes={queryTypes}\n key={i}\n index={i}\n query={query}\n queryResult={queryResults?.[i]}\n filteredQueryPlugins={filteredQueryPlugins}\n isCollapsed={!!queriesCollapsed[i]}\n onChange={handleQueryChange}\n onQueryRun={handleQueryRun}\n onDelete={queries.length > 1 ? handleQueryDelete : undefined}\n onCollapseExpand={handleQueryCollapseExpand}\n />\n ))}\n </Stack>\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleQueryAdd}>\n Add Query\n </Button>\n </>\n );\n});\n\nMultiQueryEditor.displayName = 'MultiQueryEditor';\n"],"names":["Button","Stack","produce","AddIcon","forwardRef","useEffect","useState","useListPluginMetadata","usePlugin","usePluginRegistry","QueryEditorContainer","useDefaultQueryDefinition","queryTypes","filteredQueryPlugins","defaultQueryType","data","queryPlugins","isLoading","defaultPluginKinds","defaultQueryKind","length","find","i","includes","spec","name","defaultQueryPlugin","isPluginLoading","useErrorBoundary","enabled","defaultInitialQueryDefinition","kind","plugin","createInitialOptions","MultiQueryEditor","props","ref","queries","queryResults","onChange","onQueryRun","queriesCollapsed","setQueriesCollapsed","map","handleQueryChange","index","queryDef","draft","handleQueryRun","handleQueryAdd","push","handleQueryDelete","splice","handleQueryCollapseExpand","queryDefinitions","spacing","query","queryResult","isCollapsed","onDelete","undef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;mBAAIT;aAAiB;QAC9B;IACF;IAEA,MAAMU,oBAAoB,CAACN;QACzBN,SACErC,QAAQmC,SAAS,CAACU;YAChBA,MAAMK,MAAM,CAACP,OAAO;QACtB;QAEFH,oBAAoB,CAACD;YACnBA,iBAAiBW,MAAM,CAACP,OAAO;YAC/B,OAAO;mBAAIJ;aAAiB;QAC9B;IACF;IAEA,MAAMY,4BAA4B,CAACR;QACjCH,oBAAoB,CAACD;YACnBA,gBAAgB,CAACI,MAAM,GAAG,CAACJ,gBAAgB,CAACI,MAAM;YAClD,OAAO;mBAAIJ;aAAiB;QAC9B;IACF;IAEA,2CAA2C;IAC3C,IAAIa,mBAAsCjB;IAC1C,IAAIA,QAAQjB,MAAM,KAAK,KAAK,CAACH,WAAW;QACtCqC,mBAAmB;YAACxB;SAA8B;IACpD;IAEA,qBACE;;0BACE,KAAC7B;gBAAMsD,SAAS;0BACbD,iBAAiBX,GAAG,CAAC,CAACa,OAAwBlC,kBAC7C,KAACZ;wBACC0B,KAAKA;wBACLxB,YAAYA;wBAEZiC,OAAOvB;wBACPkC,OAAOA;wBACPC,aAAanB,cAAc,CAAChB,EAAE;wBAC9BT,sBAAsBA;wBACtB6C,aAAa,CAAC,CAACjB,gBAAgB,CAACnB,EAAE;wBAClCiB,UAAUK;wBACVJ,YAAYQ;wBACZW,UAAUtB,QAAQjB,MAAM,GAAG,IAAI+B,oBAAoBS;wBACnDC,kBAAkBR;uBATb/B;;0BAaX,KAACtB;gBAAO8D,SAAQ;gBAAYC,yBAAW,KAAC5D;gBAAY6D,IAAI;oBAAEC,WAAW;gBAAE;gBAAGC,SAASjB;0BAAgB;;;;AAKzG,GAAG;AAEHf,iBAAiBiC,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelSpecEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PanelSpecEditor/PanelSpecEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,eA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AE,MAAM,iBAAiB,CAAC;AAM3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpC,eAAe,EAAE,eAAe,CAAC;IACjC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IACpD,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,eAAe,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACtD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5D,kBAAkB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAChD,mBAAmB,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAC7D,YAAY,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,eAAe,kHAmJ1B,CAAC"}
|
|
@@ -23,7 +23,10 @@ import { PanelAnnotationsEditor } from "./PanelAnnotationsEditor.js";
|
|
|
23
23
|
export const PanelSpecEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
24
24
|
const { control, panelDefinition, variableDefinitionGroups, panelGroups, onQueriesChange, onQueryRun, onPluginSpecChange, onAnnotationsChange, onJSONChange } = props;
|
|
25
25
|
const { kind } = panelDefinition.spec.plugin;
|
|
26
|
-
const { data: plugin, isLoading, error } = usePlugin('Panel', kind
|
|
26
|
+
const { data: plugin, isLoading, error } = usePlugin('Panel', kind, {
|
|
27
|
+
version: panelDefinition.spec.plugin.metadata?.version,
|
|
28
|
+
registry: panelDefinition.spec.plugin.metadata?.registry
|
|
29
|
+
});
|
|
27
30
|
const { queryResults } = useDataQueriesContext();
|
|
28
31
|
if (error) {
|
|
29
32
|
return /*#__PURE__*/ _jsx(ErrorAlert, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PanelSpecEditor/PanelSpecEditor.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 { ErrorAlert, JSONEditor } from '@perses-dev/components';\nimport type { AnnotationSpec, PanelDefinition, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport type { ReactElement } from 'react';\nimport { forwardRef } from 'react';\nimport type { Control } from 'react-hook-form';\nimport { Controller } from 'react-hook-form';\n\nimport type { PanelEditorValues, PanelPlugin } from '../../model';\nimport { useDataQueriesContext, usePlugin } from '../../runtime';\nimport type { PanelGroup, VariableDefinitionGroup } from '../LayoutEditor';\nimport { LayoutEditor } from '../LayoutEditor';\nimport { LinksEditor } from '../LinksEditor';\nimport { MultiQueryEditor } from '../MultiQueryEditor';\nimport type { OptionsEditorTabsProps } from '../OptionsEditorTabs';\nimport { OptionsEditorTabs } from '../OptionsEditorTabs';\nimport type { PluginEditorRef } from '../PluginEditor';\nimport { PanelAnnotationsEditor } from './PanelAnnotationsEditor';\n\nexport interface PanelSpecEditorProps {\n control: Control<PanelEditorValues>;\n panelDefinition: PanelDefinition;\n variableDefinitionGroups: VariableDefinitionGroup[];\n panelGroups?: PanelGroup[];\n onQueriesChange: (queries: QueryDefinition[]) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n onPluginSpecChange: (spec: UnknownSpec) => void;\n onAnnotationsChange: (annotations: AnnotationSpec[]) => void;\n onJSONChange: (panelDefinitionStr: string) => void;\n}\n\nexport const PanelSpecEditor = forwardRef<PluginEditorRef, PanelSpecEditorProps>((props, ref): ReactElement | null => {\n const {\n control,\n panelDefinition,\n variableDefinitionGroups,\n panelGroups,\n onQueriesChange,\n onQueryRun,\n onPluginSpecChange,\n onAnnotationsChange,\n onJSONChange,\n } = props;\n const { kind } = panelDefinition.spec.plugin;\n const { data: plugin, isLoading, error } = usePlugin('Panel', kind);\n\n const { queryResults } = useDataQueriesContext();\n\n if (error) {\n return <ErrorAlert error={error} />;\n }\n\n if (isLoading) {\n return null;\n }\n\n if (!plugin) {\n throw new Error(`Missing implementation for panel plugin with kind '${kind}'`);\n }\n\n const { panelOptionsEditorComponents, hideQueryEditor, supportsAnnotations } = plugin as PanelPlugin;\n let tabs: OptionsEditorTabsProps['tabs'] = [];\n\n if (!hideQueryEditor) {\n tabs.push({\n label: 'Query',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.queries\"\n render={({ field }) => (\n <MultiQueryEditor\n ref={ref}\n queryTypes={plugin.supportedQueryTypes ?? []}\n queries={panelDefinition.spec.queries ?? []}\n queryResults={queryResults}\n onChange={(queries) => {\n field.onChange(queries);\n onQueriesChange(queries);\n }}\n onQueryRun={(index, query) => {\n onQueryRun(index, query);\n // If spec has not changed, refetch to update the data\n if (JSON.stringify(panelDefinition.spec.queries?.[index]) === JSON.stringify(query)) {\n queryResults[index]?.refetch?.();\n }\n }}\n />\n )}\n />\n ),\n });\n }\n\n if (panelOptionsEditorComponents) {\n tabs = tabs.concat(\n panelOptionsEditorComponents.map(({ label, content: OptionsEditorComponent }) => ({\n label,\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.plugin.spec\"\n render={({ field }) => (\n <OptionsEditorComponent\n value={panelDefinition.spec.plugin.spec}\n onChange={(spec) => {\n field.onChange(spec);\n onPluginSpecChange(spec);\n }}\n />\n )}\n />\n ),\n })),\n );\n }\n\n // annotations are common to all panel plugins, but only shown for plugins that render them\n if (supportsAnnotations) {\n tabs.push({\n label: 'Annotations',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.annotations\"\n render={({ field }) => (\n <PanelAnnotationsEditor\n value={panelDefinition.spec.annotations ?? []}\n onChange={(annotations) => {\n field.onChange(annotations);\n onAnnotationsChange(annotations);\n }}\n />\n )}\n />\n ),\n });\n }\n\n // Always show the JSON editor, Links editor, and Layout editor by default.\n tabs.push({\n label: 'Links',\n content: <LinksEditor control={control} />,\n });\n tabs.push({\n label: 'JSON',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition\"\n render={({ field }) => (\n <JSONEditor\n maxHeight=\"80vh\"\n value={panelDefinition}\n onChange={(json) => {\n field.onChange(JSON.parse(json));\n onJSONChange(json);\n }}\n />\n )}\n />\n ),\n });\n tabs.push({\n label: 'Layout',\n content: (\n <LayoutEditor control={control} variableDefinitionGroups={variableDefinitionGroups} panelGroups={panelGroups} />\n ),\n });\n\n return <OptionsEditorTabs key={tabs.length} tabs={tabs} />;\n});\n\nPanelSpecEditor.displayName = 'PanelSpecEditor';\n"],"names":["ErrorAlert","JSONEditor","forwardRef","Controller","useDataQueriesContext","usePlugin","LayoutEditor","LinksEditor","MultiQueryEditor","OptionsEditorTabs","PanelAnnotationsEditor","PanelSpecEditor","props","ref","control","panelDefinition","variableDefinitionGroups","panelGroups","onQueriesChange","onQueryRun","onPluginSpecChange","onAnnotationsChange","onJSONChange","kind","spec","plugin","data","isLoading","error","queryResults","Error","panelOptionsEditorComponents","hideQueryEditor","supportsAnnotations","tabs","push","label","content","name","render","field","queryTypes","supportedQueryTypes","queries","onChange","index","query","JSON","stringify","refetch","concat","map","OptionsEditorComponent","value","annotations","maxHeight","json","parse","length","displayName"],"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,UAAU,EAAEC,UAAU,QAAQ,yBAAyB;AAGhE,SAASC,UAAU,QAAQ,QAA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;YACCW,SAASA;YACTwB,MAAK;YACLC,QAAQ,CAAC,EAAEC,KAAK,EAAE,iBAChB,KAACvC;oBACCsD,WAAU;oBACVF,OAAOtC;oBACP6B,UAAU,CAACY;wBACThB,MAAMI,QAAQ,CAACG,KAAKU,KAAK,CAACD;wBAC1BlC,aAAakC;oBACf;;;IAKV;IACAtB,KAAKC,IAAI,CAAC;QACRC,OAAO;QACPC,uBACE,KAAC/B;YAAaQ,SAASA;YAASE,0BAA0BA;YAA0BC,aAAaA;;IAErG;IAEA,qBAAO,KAACR;QAAoCyB,MAAMA;OAAnBA,KAAKwB,MAAM;AAC5C,GAAG;AAEH/C,gBAAgBgD,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelSpecEditor/PanelSpecEditor.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 { ErrorAlert, JSONEditor } from '@perses-dev/components';\nimport type { AnnotationSpec, PanelDefinition, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport type { ReactElement } from 'react';\nimport { forwardRef } from 'react';\nimport type { Control } from 'react-hook-form';\nimport { Controller } from 'react-hook-form';\n\nimport type { PanelEditorValues, PanelPlugin } from '../../model';\nimport { useDataQueriesContext, usePlugin } from '../../runtime';\nimport type { PanelGroup, VariableDefinitionGroup } from '../LayoutEditor';\nimport { LayoutEditor } from '../LayoutEditor';\nimport { LinksEditor } from '../LinksEditor';\nimport { MultiQueryEditor } from '../MultiQueryEditor';\nimport type { OptionsEditorTabsProps } from '../OptionsEditorTabs';\nimport { OptionsEditorTabs } from '../OptionsEditorTabs';\nimport type { PluginEditorRef } from '../PluginEditor';\nimport { PanelAnnotationsEditor } from './PanelAnnotationsEditor';\n\nexport interface PanelSpecEditorProps {\n control: Control<PanelEditorValues>;\n panelDefinition: PanelDefinition;\n variableDefinitionGroups: VariableDefinitionGroup[];\n panelGroups?: PanelGroup[];\n onQueriesChange: (queries: QueryDefinition[]) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n onPluginSpecChange: (spec: UnknownSpec) => void;\n onAnnotationsChange: (annotations: AnnotationSpec[]) => void;\n onJSONChange: (panelDefinitionStr: string) => void;\n}\n\nexport const PanelSpecEditor = forwardRef<PluginEditorRef, PanelSpecEditorProps>((props, ref): ReactElement | null => {\n const {\n control,\n panelDefinition,\n variableDefinitionGroups,\n panelGroups,\n onQueriesChange,\n onQueryRun,\n onPluginSpecChange,\n onAnnotationsChange,\n onJSONChange,\n } = props;\n const { kind } = panelDefinition.spec.plugin;\n const {\n data: plugin,\n isLoading,\n error,\n } = usePlugin('Panel', kind, {\n version: panelDefinition.spec.plugin.metadata?.version,\n registry: panelDefinition.spec.plugin.metadata?.registry,\n });\n\n const { queryResults } = useDataQueriesContext();\n\n if (error) {\n return <ErrorAlert error={error} />;\n }\n\n if (isLoading) {\n return null;\n }\n\n if (!plugin) {\n throw new Error(`Missing implementation for panel plugin with kind '${kind}'`);\n }\n\n const { panelOptionsEditorComponents, hideQueryEditor, supportsAnnotations } = plugin as PanelPlugin;\n let tabs: OptionsEditorTabsProps['tabs'] = [];\n\n if (!hideQueryEditor) {\n tabs.push({\n label: 'Query',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.queries\"\n render={({ field }) => (\n <MultiQueryEditor\n ref={ref}\n queryTypes={plugin.supportedQueryTypes ?? []}\n queries={panelDefinition.spec.queries ?? []}\n queryResults={queryResults}\n onChange={(queries) => {\n field.onChange(queries);\n onQueriesChange(queries);\n }}\n onQueryRun={(index, query) => {\n onQueryRun(index, query);\n // If spec has not changed, refetch to update the data\n if (JSON.stringify(panelDefinition.spec.queries?.[index]) === JSON.stringify(query)) {\n queryResults[index]?.refetch?.();\n }\n }}\n />\n )}\n />\n ),\n });\n }\n\n if (panelOptionsEditorComponents) {\n tabs = tabs.concat(\n panelOptionsEditorComponents.map(({ label, content: OptionsEditorComponent }) => ({\n label,\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.plugin.spec\"\n render={({ field }) => (\n <OptionsEditorComponent\n value={panelDefinition.spec.plugin.spec}\n onChange={(spec) => {\n field.onChange(spec);\n onPluginSpecChange(spec);\n }}\n />\n )}\n />\n ),\n })),\n );\n }\n\n // annotations are common to all panel plugins, but only shown for plugins that render them\n if (supportsAnnotations) {\n tabs.push({\n label: 'Annotations',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.annotations\"\n render={({ field }) => (\n <PanelAnnotationsEditor\n value={panelDefinition.spec.annotations ?? []}\n onChange={(annotations) => {\n field.onChange(annotations);\n onAnnotationsChange(annotations);\n }}\n />\n )}\n />\n ),\n });\n }\n\n // Always show the JSON editor, Links editor, and Layout editor by default.\n tabs.push({\n label: 'Links',\n content: <LinksEditor control={control} />,\n });\n tabs.push({\n label: 'JSON',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition\"\n render={({ field }) => (\n <JSONEditor\n maxHeight=\"80vh\"\n value={panelDefinition}\n onChange={(json) => {\n field.onChange(JSON.parse(json));\n onJSONChange(json);\n }}\n />\n )}\n />\n ),\n });\n tabs.push({\n label: 'Layout',\n content: (\n <LayoutEditor control={control} variableDefinitionGroups={variableDefinitionGroups} panelGroups={panelGroups} />\n ),\n });\n\n return <OptionsEditorTabs key={tabs.length} tabs={tabs} />;\n});\n\nPanelSpecEditor.displayName = 'PanelSpecEditor';\n"],"names":["ErrorAlert","JSONEditor","forwardRef","Controller","useDataQueriesContext","usePlugin","LayoutEditor","LinksEditor","MultiQueryEditor","OptionsEditorTabs","PanelAnnotationsEditor","PanelSpecEditor","props","ref","control","panelDefinition","variableDefinitionGroups","panelGroups","onQueriesChange","onQueryRun","onPluginSpecChange","onAnnotationsChange","onJSONChange","kind","spec","plugin","data","isLoading","error","version","metadata","registry","queryResults","Error","panelOptionsEditorComponents","hideQueryEditor","supportsAnnotations","tabs","push","label","content","name","render","field","queryTypes","supportedQueryTypes","queries","onChange","index","query","JSON","stringify","refetch","concat","map","OptionsEditorComponent","value","annotations","maxHeight","json","parse","length","displayName"],"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,UAAU,EAAEC,UAAU,QAAQ,yBAAyB;AAGhE,SAASC,UAAU,QAAQ,QAAQ;AAEnC,SAASC,UAAU,QAAQ,kBAAkB;AAG7C,SAASC,qBAAqB,EAAEC,SAAS,QAAQ,yBAAgB;AAEjE,SAASC,YAAY,QAAQ,2BAAkB;AAC/C,SAASC,WAAW,QAAQ,0BAAiB;AAC7C,SAASC,gBAAgB,QAAQ,+BAAsB;AAEvD,SAASC,iBAAiB,QAAQ,gCAAuB;AAEzD,SAASC,sBAAsB,QAAQ,8BAA2B;AAclE,OAAO,MAAMC,gCAAkBT,WAAkD,CAACU,OAAOC;IACvF,MAAM,EACJC,OAAO,EACPC,eAAe,EACfC,wBAAwB,EACxBC,WAAW,EACXC,eAAe,EACfC,UAAU,EACVC,kBAAkB,EAClBC,mBAAmB,EACnBC,YAAY,EACb,GAAGV;IACJ,MAAM,EAAEW,IAAI,EAAE,GAAGR,gBAAgBS,IAAI,CAACC,MAAM;IAC5C,MAAM,EACJC,MAAMD,MAAM,EACZE,SAAS,EACTC,KAAK,EACN,GAAGvB,UAAU,SAASkB,MAAM;QAC3BM,SAASd,gBAAgBS,IAAI,CAACC,MAAM,CAACK,QAAQ,EAAED;QAC/CE,UAAUhB,gBAAgBS,IAAI,CAACC,MAAM,CAACK,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4BACCC,OAAOzC,gBAAgBS,IAAI,CAACC,MAAM,CAACD,IAAI;4BACvCuB,UAAU,CAACvB;gCACTmB,MAAMI,QAAQ,CAACvB;gCACfJ,mBAAmBI;4BACrB;;;YAKV,CAAA;IAEJ;IAEA,2FAA2F;IAC3F,IAAIY,qBAAqB;QACvBC,KAAKC,IAAI,CAAC;YACRC,OAAO;YACPC,uBACE,KAACrC;gBACCW,SAASA;gBACT2B,MAAK;gBACLC,QAAQ,CAAC,EAAEC,KAAK,EAAE,iBAChB,KAACjC;wBACC8C,OAAOzC,gBAAgBS,IAAI,CAACiC,WAAW,IAAI,EAAE;wBAC7CV,UAAU,CAACU;4BACTd,MAAMI,QAAQ,CAACU;4BACfpC,oBAAoBoC;wBACtB;;;QAKV;IACF;IAEA,2EAA2E;IAC3EpB,KAAKC,IAAI,CAAC;QACRC,OAAO;QACPC,uBAAS,KAACjC;YAAYO,SAASA;;IACjC;IACAuB,KAAKC,IAAI,CAAC;QACRC,OAAO;QACPC,uBACE,KAACrC;YACCW,SAASA;YACT2B,MAAK;YACLC,QAAQ,CAAC,EAAEC,KAAK,EAAE,iBAChB,KAAC1C;oBACCyD,WAAU;oBACVF,OAAOzC;oBACPgC,UAAU,CAACY;wBACThB,MAAMI,QAAQ,CAACG,KAAKU,KAAK,CAACD;wBAC1BrC,aAAaqC;oBACf;;;IAKV;IACAtB,KAAKC,IAAI,CAAC;QACRC,OAAO;QACPC,uBACE,KAAClC;YAAaQ,SAASA;YAASE,0BAA0BA;YAA0BC,aAAaA;;IAErG;IAEA,qBAAO,KAACR;QAAoC4B,MAAMA;OAAnBA,KAAKwB,MAAM;AAC5C,GAAG;AAEHlD,gBAAgBmD,WAAW,GAAG"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { BoxProps } from '@mui/material';
|
|
2
|
-
import type { DatasourceSpec, UnknownSpec } from '@perses-dev/spec';
|
|
2
|
+
import type { DatasourceSpec, PluginDefinitionMetadata, UnknownSpec } from '@perses-dev/spec';
|
|
3
3
|
import type { PluginType } from '../../model';
|
|
4
4
|
export interface PluginEditorSelection {
|
|
5
5
|
type: PluginType;
|
|
6
6
|
kind: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional plugin definition metadata (version and/or registry), matching the `metadata` field of a spec
|
|
9
|
+
* `Definition`. Only set when the user explicitly picks a specific version/registry of a plugin that has several of
|
|
10
|
+
* them available. When omitted, the latest available version is used.
|
|
11
|
+
*/
|
|
12
|
+
metadata?: PluginDefinitionMetadata;
|
|
7
13
|
}
|
|
8
14
|
export interface PluginEditorValue {
|
|
9
15
|
selection: PluginEditorSelection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-editor-api.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/plugin-editor-api.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-editor-api.d.ts","sourceRoot":"","sources":["../../../src/components/PluginEditor/plugin-editor-api.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK9F,OAAO,KAAK,EAAe,UAAU,EAAwB,MAAM,aAAa,CAAC;AAMjF,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,qBAAqB,CAAC;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;AAID,KAAK,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAA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
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
13
14
|
import { produce } from "immer";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
15
|
+
import { useRef, useEffect } from "react";
|
|
16
|
+
import { usePluginRegistry } from "../../runtime/index.js";
|
|
16
17
|
import { useEvent } from "../../utils/index.js";
|
|
17
18
|
/**
|
|
18
19
|
* Returns the state/handlers that power the `PluginEditor` component. Useful for custom components that want to provide
|
|
@@ -20,7 +21,6 @@ import { useEvent } from "../../utils/index.js";
|
|
|
20
21
|
* remembers previous `spec` values that it's seen, allowing and restores those values if a user switches the plugin
|
|
21
22
|
* kind back.
|
|
22
23
|
*/ export function usePluginEditor(props) {
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
24
24
|
const { pluginTypes, value, onHideQueryEditorChange = ()=>{} } = props; // setting onHideQueryEditorChange to empty function here because useEvent requires a function
|
|
25
25
|
// Keep a stable reference, so we don't run the effect below when we don't need to
|
|
26
26
|
const onChange = useEvent(props.onChange);
|
|
@@ -43,56 +43,63 @@ import { useEvent } from "../../utils/index.js";
|
|
|
43
43
|
const hideQueryState = useRef({
|
|
44
44
|
[value.selection.kind]: false
|
|
45
45
|
});
|
|
46
|
-
const { defaultPluginKinds } = usePluginRegistry();
|
|
46
|
+
const { defaultPluginKinds, getPlugin } = usePluginRegistry();
|
|
47
|
+
const queryClient = useQueryClient();
|
|
48
|
+
const currentRequest = useRef(undefined);
|
|
49
|
+
const selectionLoad = useMutation({
|
|
50
|
+
mutationFn: (selection)=>queryClient.fetchQuery({
|
|
51
|
+
queryKey: [
|
|
52
|
+
'getPlugin',
|
|
53
|
+
selection.type,
|
|
54
|
+
selection.kind,
|
|
55
|
+
selection.metadata?.version ?? '',
|
|
56
|
+
selection.metadata?.registry ?? ''
|
|
57
|
+
],
|
|
58
|
+
queryFn: ()=>getPlugin({
|
|
59
|
+
kind: selection.type,
|
|
60
|
+
name: selection.kind,
|
|
61
|
+
version: selection.metadata?.version,
|
|
62
|
+
registry: selection.metadata?.registry
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
const pendingSelection = selectionLoad.isSuccess ? undefined : selectionLoad.variables;
|
|
47
67
|
const defaultPluginType = pluginTypes[0];
|
|
48
68
|
const defaultPluginKind = defaultPluginType ? defaultPluginKinds?.[defaultPluginType] : undefined;
|
|
49
|
-
|
|
50
|
-
type: defaultPluginType,
|
|
51
|
-
kind: defaultPluginKind
|
|
52
|
-
} : undefined;
|
|
53
|
-
const initPendingSelection = !value.selection && defaultPluginSelection ? defaultPluginSelection : undefined;
|
|
54
|
-
// When kind changes and we haven't loaded that plugin before, we will need to enter a "pending" state so that we
|
|
55
|
-
// can generate proper initial spec values that match the new plugin kind
|
|
56
|
-
const [pendingSelection, setPendingSelection] = useState(initPendingSelection);
|
|
57
|
-
// Take a default kind in case user write explicitly an empty kind in the initial value
|
|
69
|
+
// Notify the owner instead of mutating the selection passed by the caller.
|
|
58
70
|
useEffect(()=>{
|
|
59
|
-
if (value.selection.kind === '') {
|
|
60
|
-
|
|
71
|
+
if (value.selection.kind === '' && defaultPluginKind) {
|
|
72
|
+
onChange({
|
|
73
|
+
...value,
|
|
74
|
+
selection: {
|
|
75
|
+
...value.selection,
|
|
76
|
+
kind: defaultPluginKind
|
|
77
|
+
}
|
|
78
|
+
});
|
|
61
79
|
}
|
|
62
80
|
}, [
|
|
63
|
-
value
|
|
64
|
-
defaultPluginKind
|
|
81
|
+
value,
|
|
82
|
+
defaultPluginKind,
|
|
83
|
+
onChange
|
|
65
84
|
]);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
if (!
|
|
70
|
-
|
|
71
|
-
if (plugin === undefined || isFetching) return;
|
|
72
|
-
// Fire an onChange to change to the pending kind with initial values from the plugin
|
|
85
|
+
// Apply each completed load once, independently of how the owner stores the selection metadata.
|
|
86
|
+
const applyLoadedSelection = useEvent((plugin, selection)=>{
|
|
87
|
+
// v4 `reset()` still observes the in-flight load, which then reports the current (empty or newer) result.
|
|
88
|
+
if (!plugin || selection !== currentRequest.current) return;
|
|
89
|
+
currentRequest.current = undefined;
|
|
73
90
|
rememberCurrentSpecState();
|
|
74
91
|
onChange({
|
|
75
|
-
selection
|
|
92
|
+
selection,
|
|
76
93
|
spec: plugin.createInitialOptions ? plugin.createInitialOptions() : {}
|
|
77
94
|
});
|
|
78
|
-
if (
|
|
95
|
+
if (selection.type === 'Panel') {
|
|
79
96
|
const panelPlugin = plugin;
|
|
80
|
-
hideQueryState.current[
|
|
97
|
+
hideQueryState.current[selection.kind] = !!panelPlugin.hideQueryEditor;
|
|
81
98
|
if (!!panelPlugin.hideQueryEditor !== hideQueryState.current[value.selection.kind]) {
|
|
82
99
|
onHideQuery(!!panelPlugin.hideQueryEditor);
|
|
83
100
|
}
|
|
84
101
|
}
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
pendingSelection,
|
|
88
|
-
plugin,
|
|
89
|
-
isFetching,
|
|
90
|
-
rememberCurrentSpecState,
|
|
91
|
-
onChange,
|
|
92
|
-
onHideQuery,
|
|
93
|
-
hideQueryState,
|
|
94
|
-
value.selection
|
|
95
|
-
]);
|
|
102
|
+
});
|
|
96
103
|
/**
|
|
97
104
|
* When the user tries to change the plugin kind, make sure we have the correct spec for that plugin kind before we
|
|
98
105
|
* make the switch.
|
|
@@ -100,6 +107,8 @@ import { useEvent } from "../../utils/index.js";
|
|
|
100
107
|
// If we already have state for this plugin type/kind from a previous selection, just use it
|
|
101
108
|
const previousState = prevSpecState.current[nextSelection.type]?.[nextSelection.kind];
|
|
102
109
|
if (previousState !== undefined) {
|
|
110
|
+
currentRequest.current = undefined;
|
|
111
|
+
selectionLoad.reset();
|
|
103
112
|
rememberCurrentSpecState();
|
|
104
113
|
onChange({
|
|
105
114
|
selection: nextSelection,
|
|
@@ -107,7 +116,11 @@ import { useEvent } from "../../utils/index.js";
|
|
|
107
116
|
});
|
|
108
117
|
} else {
|
|
109
118
|
// Otherwise, kick off the async loading process
|
|
110
|
-
|
|
119
|
+
// Per-call callbacks run only for the latest mutation while the editor is mounted.
|
|
120
|
+
currentRequest.current = nextSelection;
|
|
121
|
+
selectionLoad.mutate(nextSelection, {
|
|
122
|
+
onSuccess: applyLoadedSelection
|
|
123
|
+
});
|
|
111
124
|
}
|
|
112
125
|
if (nextSelection.type === 'Panel' && hideQueryState.current[nextSelection.kind] !== undefined && hideQueryState.current[value.selection.kind] !== hideQueryState.current[nextSelection.kind]) {
|
|
113
126
|
onHideQuery(!!hideQueryState.current[nextSelection.kind]);
|
|
@@ -122,8 +135,8 @@ import { useEvent } from "../../utils/index.js";
|
|
|
122
135
|
};
|
|
123
136
|
return {
|
|
124
137
|
pendingSelection,
|
|
125
|
-
isLoading:
|
|
126
|
-
error,
|
|
138
|
+
isLoading: selectionLoad.isLoading,
|
|
139
|
+
error: selectionLoad.error,
|
|
127
140
|
onSelectionChange,
|
|
128
141
|
onSpecChange,
|
|
129
142
|
rememberCurrentSpecState
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PluginEditor/plugin-editor-api.ts"],"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 { BoxProps } from '@mui/material';\nimport type { DatasourceSpec, UnknownSpec } from '@perses-dev/spec';\nimport { produce } from 'immer';\nimport { useState, useRef, useEffect } from 'react';\n\nimport type { PanelPlugin, PluginType } from '../../model';\nimport { usePlugin, usePluginRegistry } from '../../runtime';\nimport { useEvent } from '../../utils';\nimport type { PluginKindSelectProps } from '../PluginKindSelect';\nimport type { PluginSpecEditorProps } from '../PluginSpecEditor';\n\nexport interface PluginEditorSelection {\n type: PluginType;\n kind: string;\n}\n\nexport interface PluginEditorValue {\n selection: PluginEditorSelection;\n spec: UnknownSpec;\n}\n\n// Props on MUI Box 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 PluginEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n pluginTypes: PluginType[];\n pluginKindLabel: string;\n value: PluginEditorValue;\n isReadonly?: boolean;\n withRunQueryButton?: boolean;\n filteredQueryPlugins?: string[];\n onChange: (next: PluginEditorValue) => void;\n onRunQuery?: () => void;\n testConnection?: (spec: DatasourceSpec, healthCheckPath: string) => Promise<void>;\n}\n\nexport interface PluginEditorRef {\n flushChanges?: () => void;\n}\n\ntype PreviousSpecState = Record<string, Record<string, UnknownSpec>>;\ntype HideQueryEditorState = Record<string, boolean>;\n\n/**\n * Props needed by the usePluginEditor hook.\n */\nexport type UsePluginEditorProps = Pick<PluginEditorProps, 'pluginTypes' | 'value' | 'onChange'> & {\n onHideQueryEditorChange?: (isHidden: boolean) => void;\n};\n\n/**\n * Returns the state/handlers that power the `PluginEditor` component. Useful for custom components that want to provide\n * a different UI, but want the same behavior of changing `kind` and `spec` together on plugin kind changes. Also\n * remembers previous `spec` values that it's seen, allowing and restores those values if a user switches the plugin\n * kind back.\n */\nexport function usePluginEditor(props: UsePluginEditorProps): {\n pendingSelection?: PluginEditorSelection;\n isLoading: boolean;\n error: Error | null;\n onSelectionChange: (s: PluginEditorSelection) => void;\n onSpecChange: (next: UnknownSpec) => void;\n rememberCurrentSpecState: () => void;\n} {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const { pluginTypes, value, onHideQueryEditorChange = (): void => {} } = props; // setting onHideQueryEditorChange to empty function here because useEvent requires a function\n\n // Keep a stable reference, so we don't run the effect below when we don't need to\n const onChange = useEvent(props.onChange);\n const onHideQuery = useEvent(onHideQueryEditorChange);\n\n // The previous spec state for PluginType and kind and a helper function for remembering current values\n const prevSpecState = useRef<PreviousSpecState>({\n [value.selection.type]: { [value.selection.kind]: value.spec },\n });\n const rememberCurrentSpecState = useEvent(() => {\n let byPluginType = prevSpecState.current[value.selection.type];\n if (byPluginType === undefined) {\n byPluginType = {};\n prevSpecState.current[value.selection.type] = byPluginType;\n }\n byPluginType[value.selection.kind] = value.spec;\n });\n\n // The previous hide query state for each panel kind\n const hideQueryState = useRef<HideQueryEditorState>({\n [value.selection.kind]: false,\n });\n\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultPluginType = pluginTypes[0];\n const defaultPluginKind = defaultPluginType ? defaultPluginKinds?.[defaultPluginType] : undefined;\n const defaultPluginSelection =\n defaultPluginType && defaultPluginKind\n ? {\n type: defaultPluginType,\n kind: defaultPluginKind,\n }\n : undefined;\n const initPendingSelection = !value.selection && defaultPluginSelection ? defaultPluginSelection : undefined;\n\n // When kind changes and we haven't loaded that plugin before, we will need to enter a \"pending\" state so that we\n // can generate proper initial spec values that match the new plugin kind\n const [pendingSelection, setPendingSelection] = useState<PluginEditorSelection | undefined>(initPendingSelection);\n\n // Take a default kind in case user write explicitly an empty kind in the initial value\n useEffect(() => {\n if (value.selection.kind === '') {\n value.selection.kind = defaultPluginKind || '';\n }\n }, [value.selection, defaultPluginKind]);\n\n const { data: plugin, isFetching, error } = usePlugin(pendingSelection?.type, pendingSelection?.kind || '');\n\n useEffect(() => {\n // Nothing to do if no new plugin kind is pending\n if (!pendingSelection) return;\n\n // Can't get spec value until we have a plugin\n if (plugin === undefined || isFetching) return;\n\n // Fire an onChange to change to the pending kind with initial values from the plugin\n rememberCurrentSpecState();\n onChange({\n selection: pendingSelection,\n spec: plugin.createInitialOptions ? plugin.createInitialOptions() : {},\n });\n\n if (pendingSelection.type === 'Panel') {\n const panelPlugin = plugin as PanelPlugin;\n hideQueryState.current[pendingSelection.kind] = !!panelPlugin.hideQueryEditor;\n if (!!panelPlugin.hideQueryEditor !== hideQueryState.current[value.selection.kind]) {\n onHideQuery(!!panelPlugin.hideQueryEditor);\n }\n }\n setPendingSelection(undefined);\n }, [\n pendingSelection,\n plugin,\n isFetching,\n rememberCurrentSpecState,\n onChange,\n onHideQuery,\n hideQueryState,\n value.selection,\n ]);\n\n /**\n * When the user tries to change the plugin kind, make sure we have the correct spec for that plugin kind before we\n * make the switch.\n */\n const onSelectionChange: PluginKindSelectProps['onChange'] = (nextSelection) => {\n // If we already have state for this plugin type/kind from a previous selection, just use it\n const previousState = prevSpecState.current[nextSelection.type]?.[nextSelection.kind];\n if (previousState !== undefined) {\n rememberCurrentSpecState();\n onChange({\n selection: nextSelection,\n spec: previousState,\n });\n } else {\n // Otherwise, kick off the async loading process\n setPendingSelection(nextSelection);\n }\n\n if (\n nextSelection.type === 'Panel' &&\n hideQueryState.current[nextSelection.kind] !== undefined &&\n hideQueryState.current[value.selection.kind] !== hideQueryState.current[nextSelection.kind]\n ) {\n onHideQuery(!!hideQueryState.current[nextSelection.kind]);\n }\n };\n\n /**\n * Spec changes are independent and always just set the spec state.\n */\n const onSpecChange: PluginSpecEditorProps['onChange'] = (next) => {\n onChange(\n produce(value, (draft) => {\n draft.spec = next;\n }),\n );\n };\n\n return {\n pendingSelection,\n isLoading: isFetching,\n error,\n onSelectionChange,\n onSpecChange,\n rememberCurrentSpecState,\n };\n}\n"],"names":["produce","useState","useRef","useEffect","usePlugin","usePluginRegistry","useEvent","usePluginEditor","props","pluginTypes","value","onHideQueryEditorChange","onChange","onHideQuery","prevSpecState","selection","type","kind","spec","rememberCurrentSpecState","byPluginType","current","undefined","hideQueryState","defaultPluginKinds","defaultPluginType","defaultPluginKind","defaultPluginSelection","initPendingSelection","pendingSelection","setPendingSelection","data","plugin","isFetching","error","createInitialOptions","panelPlugin","hideQueryEditor","onSelectionChange","nextSelection","previousState","onSpecChange","next","draft","isLoading"],"mappings":"AAAA,+BAA+B;AAC/B,kEAA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AAMuB,oBAAuD,CAACC;QAC5D,4FAA4F;QAC5F,MAAMC,gBAAgB1B,cAAcO,OAAO,CAACkB,cAAcvB,IAAI,CAAC,EAAE,CAACuB,cAActB,IAAI,CAAC;QACrF,IAAIuB,kBAAkBlB,WAAW;YAC/BH;YACAP,SAAS;gBACPG,WAAWwB;gBACXrB,MAAMsB;YACR;QACF,OAAO;YACL,gDAAgD;YAChDV,oBAAoBS;QACtB;QAEA,IACEA,cAAcvB,IAAI,KAAK,WACvBO,eAAeF,OAAO,CAACkB,cAActB,IAAI,CAAC,KAAKK,aAC/CC,eAAeF,OAAO,CAACX,MAAMK,SAAS,CAACE,IAAI,CAAC,KAAKM,eAAeF,OAAO,CAACkB,cAActB,IAAI,CAAC,EAC3F;YACAJ,YAAY,CAAC,CAACU,eAAeF,OAAO,CAACkB,cAActB,IAAI,CAAC;QAC1D;IACF;IAEA;;GAEC,GACD,MAAMwB,eAAkD,CAACC;QACvD9B,SACEZ,QAAQU,OAAO,CAACiC;YACdA,MAAMzB,IAAI,GAAGwB;QACf;IAEJ;IAEA,OAAO;QACLb;QACAe,WAAWX;QACXC;QACAI;QACAG;QACAtB;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginEditor/plugin-editor-api.ts"],"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 { BoxProps } from '@mui/material';\nimport type { DatasourceSpec, PluginDefinitionMetadata, UnknownSpec } from '@perses-dev/spec';\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\nimport { produce } from 'immer';\nimport { useRef, useEffect } from 'react';\n\nimport type { PanelPlugin, PluginType, PluginImplementation } from '../../model';\nimport { usePluginRegistry } from '../../runtime';\nimport { useEvent } from '../../utils';\nimport type { PluginKindSelectProps } from '../PluginKindSelect';\nimport type { PluginSpecEditorProps } from '../PluginSpecEditor';\n\nexport interface PluginEditorSelection {\n type: PluginType;\n kind: string;\n /**\n * Optional plugin definition metadata (version and/or registry), matching the `metadata` field of a spec\n * `Definition`. Only set when the user explicitly picks a specific version/registry of a plugin that has several of\n * them available. When omitted, the latest available version is used.\n */\n metadata?: PluginDefinitionMetadata;\n}\n\nexport interface PluginEditorValue {\n selection: PluginEditorSelection;\n spec: UnknownSpec;\n}\n\n// Props on MUI Box 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 PluginEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n pluginTypes: PluginType[];\n pluginKindLabel: string;\n value: PluginEditorValue;\n isReadonly?: boolean;\n withRunQueryButton?: boolean;\n filteredQueryPlugins?: string[];\n onChange: (next: PluginEditorValue) => void;\n onRunQuery?: () => void;\n testConnection?: (spec: DatasourceSpec, healthCheckPath: string) => Promise<void>;\n}\n\nexport interface PluginEditorRef {\n flushChanges?: () => void;\n}\n\ntype PreviousSpecState = Record<string, Record<string, UnknownSpec>>;\ntype HideQueryEditorState = Record<string, boolean>;\n\n/**\n * Props needed by the usePluginEditor hook.\n */\nexport type UsePluginEditorProps = Pick<PluginEditorProps, 'pluginTypes' | 'value' | 'onChange'> & {\n onHideQueryEditorChange?: (isHidden: boolean) => void;\n};\n\n/**\n * Returns the state/handlers that power the `PluginEditor` component. Useful for custom components that want to provide\n * a different UI, but want the same behavior of changing `kind` and `spec` together on plugin kind changes. Also\n * remembers previous `spec` values that it's seen, allowing and restores those values if a user switches the plugin\n * kind back.\n */\nexport function usePluginEditor(props: UsePluginEditorProps): {\n pendingSelection?: PluginEditorSelection;\n isLoading: boolean;\n error: Error | null;\n onSelectionChange: (s: PluginEditorSelection) => void;\n onSpecChange: (next: UnknownSpec) => void;\n rememberCurrentSpecState: () => void;\n} {\n const { pluginTypes, value, onHideQueryEditorChange = (): void => {} } = props; // setting onHideQueryEditorChange to empty function here because useEvent requires a function\n\n // Keep a stable reference, so we don't run the effect below when we don't need to\n const onChange = useEvent(props.onChange);\n const onHideQuery = useEvent(onHideQueryEditorChange);\n\n // The previous spec state for PluginType and kind and a helper function for remembering current values\n const prevSpecState = useRef<PreviousSpecState>({\n [value.selection.type]: { [value.selection.kind]: value.spec },\n });\n const rememberCurrentSpecState = useEvent(() => {\n let byPluginType = prevSpecState.current[value.selection.type];\n if (byPluginType === undefined) {\n byPluginType = {};\n prevSpecState.current[value.selection.type] = byPluginType;\n }\n byPluginType[value.selection.kind] = value.spec;\n });\n\n // The previous hide query state for each panel kind\n const hideQueryState = useRef<HideQueryEditorState>({\n [value.selection.kind]: false,\n });\n\n const { defaultPluginKinds, getPlugin } = usePluginRegistry();\n const queryClient = useQueryClient();\n const currentRequest = useRef<PluginEditorSelection | undefined>(undefined);\n const selectionLoad = useMutation<PluginImplementation<PluginType>, Error, PluginEditorSelection>({\n mutationFn: (selection) =>\n queryClient.fetchQuery({\n queryKey: [\n 'getPlugin',\n selection.type,\n selection.kind,\n selection.metadata?.version ?? '',\n selection.metadata?.registry ?? '',\n ],\n queryFn: () =>\n getPlugin({\n kind: selection.type,\n name: selection.kind,\n version: selection.metadata?.version,\n registry: selection.metadata?.registry,\n }),\n }),\n });\n const pendingSelection = selectionLoad.isSuccess ? undefined : selectionLoad.variables;\n const defaultPluginType = pluginTypes[0];\n const defaultPluginKind = defaultPluginType ? defaultPluginKinds?.[defaultPluginType] : undefined;\n\n // Notify the owner instead of mutating the selection passed by the caller.\n useEffect(() => {\n if (value.selection.kind === '' && defaultPluginKind) {\n onChange({ ...value, selection: { ...value.selection, kind: defaultPluginKind } });\n }\n }, [value, defaultPluginKind, onChange]);\n\n // Apply each completed load once, independently of how the owner stores the selection metadata.\n const applyLoadedSelection = useEvent(\n (plugin: PluginImplementation<PluginType> | undefined, selection: PluginEditorSelection) => {\n // v4 `reset()` still observes the in-flight load, which then reports the current (empty or newer) result.\n if (!plugin || selection !== currentRequest.current) return;\n currentRequest.current = undefined;\n rememberCurrentSpecState();\n onChange({\n selection,\n spec: plugin.createInitialOptions ? plugin.createInitialOptions() : {},\n });\n\n if (selection.type === 'Panel') {\n const panelPlugin = plugin as PanelPlugin;\n hideQueryState.current[selection.kind] = !!panelPlugin.hideQueryEditor;\n if (!!panelPlugin.hideQueryEditor !== hideQueryState.current[value.selection.kind]) {\n onHideQuery(!!panelPlugin.hideQueryEditor);\n }\n }\n },\n );\n\n /**\n * When the user tries to change the plugin kind, make sure we have the correct spec for that plugin kind before we\n * make the switch.\n */\n const onSelectionChange: PluginKindSelectProps['onChange'] = (nextSelection) => {\n // If we already have state for this plugin type/kind from a previous selection, just use it\n const previousState = prevSpecState.current[nextSelection.type]?.[nextSelection.kind];\n if (previousState !== undefined) {\n currentRequest.current = undefined;\n selectionLoad.reset();\n rememberCurrentSpecState();\n onChange({\n selection: nextSelection,\n spec: previousState,\n });\n } else {\n // Otherwise, kick off the async loading process\n // Per-call callbacks run only for the latest mutation while the editor is mounted.\n currentRequest.current = nextSelection;\n selectionLoad.mutate(nextSelection, { onSuccess: applyLoadedSelection });\n }\n\n if (\n nextSelection.type === 'Panel' &&\n hideQueryState.current[nextSelection.kind] !== undefined &&\n hideQueryState.current[value.selection.kind] !== hideQueryState.current[nextSelection.kind]\n ) {\n onHideQuery(!!hideQueryState.current[nextSelection.kind]);\n }\n };\n\n /**\n * Spec changes are independent and always just set the spec state.\n */\n const onSpecChange: PluginSpecEditorProps['onChange'] = (next) => {\n onChange(\n produce(value, (draft) => {\n draft.spec = next;\n }),\n );\n };\n\n return {\n pendingSelection,\n isLoading: selectionLoad.isLoading,\n error: selectionLoad.error,\n onSelectionChange,\n onSpecChange,\n rememberCurrentSpecState,\n };\n}\n"],"names":["useMutation","useQueryClient","produce","useRef","useEffect","usePluginRegistry","useEvent","usePluginEditor","props","pluginTypes","value","onHideQueryEditorChange","onChange","onHideQuery","prevSpecState","selection","type","kind","spec","rememberCurrentSpecState","byPluginType","current","undefined","hideQueryState","defaultPluginKinds","getPlugin","queryClient","currentRequest","selectionLoad","mutationFn","fetchQuery","queryKey","metadata","version","registry","queryFn","name","pendingSelection","isSuccess","variables","defaultPluginType","defaultPluginKind","applyLoadedSelection","plugin","createInitialOptions","panelPlugin","hideQueryEditor","onSelectionChange","nextSelection","previousState","reset","mutate","onSuccess","onSpecChange","next","draft","isLoading","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;AAIjC,SAASA,WAAW,EAAEC,cAAc,QAAQ,wBAAwB;AACpE,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,MAAM,EAAEC,SAAS,QAAQ,QAAQ;AAG1C,SAASC,iBAAiB,QAAQ,yBAAgB;AAClD,SAASC,QAAQ,QAAQ,uBAAc;AAkDvC;;;;;CAKC,GACD,OAAO,SAASC,gBAAgBC,KAA2B;IAQzD,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,0BAA0B,KAAa,CAAC,EAAE,GAAGH,OAAO,8FAA8F;IAE9K,kFAAkF;IAClF,MAAMI,WAAWN,SAASE,MAAMI,QAAQ;IACxC,MAAMC,cAAcP,SAASK;IAE7B,uGAAuG;IACvG,MAAMG,gBAAgBX,OAA0B;QAC9C,CAACO,MAAMK,SAAS,CAACC,IAAI,CAAC,EAAE;YAAE,CAACN,MAAMK,SAAS,CAACE,IAAI,CAAC,EAAEP,MAAMQ,IAAI;QAAC;IAC/D;IACA,MAAMC,2BAA2Bb,SAAS;QACxC,IAAIc,eAAeN,cAAcO,OAAO,CAACX,MAAMK,SAAS,CAACC,IAAI,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ACU,eAAeF,OAAO,CAAC2B,cAAc/B,IAAI,CAAC;QAC1D;IACF;IAEA;;GAEC,GACD,MAAMoC,eAAkD,CAACC;QACvD1C,SACEV,QAAQQ,OAAO,CAAC6C;YACdA,MAAMrC,IAAI,GAAGoC;QACf;IAEJ;IAEA,OAAO;QACLjB;QACAmB,WAAW5B,cAAc4B,SAAS;QAClCC,OAAO7B,cAAc6B,KAAK;QAC1BV;QACAM;QACAlC;IACF;AACF"}
|
|
@@ -6,6 +6,20 @@ export interface PluginKindSelectProps extends Omit<TextFieldProps, 'value' | 'o
|
|
|
6
6
|
pluginTypes: PluginType[];
|
|
7
7
|
value?: PluginEditorSelection;
|
|
8
8
|
onChange?: (s: PluginEditorSelection) => void;
|
|
9
|
+
/**
|
|
10
|
+
* When true, a plugin that has more than one version available is listed with a `<display name> - Latest` option and
|
|
11
|
+
* once per version, labeled `<display name> - <version>`. Selecting a specific version sets `metadata.version` on the
|
|
12
|
+
* selection so it can be persisted on the definition, while selecting Latest leaves the version unpinned. A plugin
|
|
13
|
+
* with a single available version is listed without a version, so it keeps resolving to the latest one. Defaults to
|
|
14
|
+
* false.
|
|
15
|
+
*/
|
|
16
|
+
enableVersionSelection?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* When true, a plugin that is available in more than one registry is listed once per registry, labeled
|
|
19
|
+
* `<display name> (<registry>)`. Selecting such an option sets `metadata.registry` on the selection. A plugin
|
|
20
|
+
* available in a single registry is listed without it. Defaults to false.
|
|
21
|
+
*/
|
|
22
|
+
enableRegistrySelection?: boolean;
|
|
9
23
|
}
|
|
10
24
|
/**
|
|
11
25
|
* Displays a MUI Select input for selecting a plugin's kind from a list of all the available plugins of some specific
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginKindSelect.d.ts","sourceRoot":"","sources":["../../../src/components/PluginKindSelect/PluginKindSelect.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginKindSelect.d.ts","sourceRoot":"","sources":["../../../src/components/PluginKindSelect/PluginKindSelect.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAMpD,OAAO,KAAK,EAA4B,UAAU,EAAE,MAAM,aAAa,CAAC;AAGxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;IACpG,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC9C;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAsFD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,wHAkH3B,CAAC"}
|