@perses-dev/dashboards 0.50.0 → 0.51.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/cjs/components/Dashboard/Dashboard.js +1 -3
  2. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +3 -3
  3. package/dist/cjs/components/Datasources/DatasourceEditor.js +2 -5
  4. package/dist/cjs/components/Datasources/EditDatasourcesButton.js +2 -5
  5. package/dist/cjs/components/DeletePanelDialog/DeletePanelDialog.js +2 -0
  6. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +4 -3
  7. package/dist/cjs/components/DownloadButton/DownloadButton.js +135 -29
  8. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +5 -7
  9. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +1 -1
  10. package/dist/cjs/components/GridLayout/GridItemContent.js +4 -3
  11. package/dist/cjs/components/GridLayout/GridLayout.js +5 -6
  12. package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
  13. package/dist/cjs/components/Panel/HeaderIconButton.js +27 -0
  14. package/dist/cjs/components/Panel/Panel.js +16 -10
  15. package/dist/cjs/components/Panel/PanelActions.js +365 -0
  16. package/dist/cjs/components/Panel/PanelContent.js +59 -13
  17. package/dist/cjs/components/Panel/PanelHeader.js +14 -141
  18. package/dist/cjs/components/Panel/PanelLinks.js +5 -6
  19. package/dist/cjs/components/Panel/PanelPluginLoader.js +56 -0
  20. package/dist/cjs/components/Panel/index.js +1 -0
  21. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
  22. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +17 -35
  23. package/dist/cjs/components/PanelDrawer/PanelPreview.js +4 -5
  24. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  25. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
  26. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -4
  27. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +5 -12
  28. package/dist/cjs/components/Variables/Variable.js +36 -41
  29. package/dist/cjs/components/Variables/VariableEditor.js +14 -23
  30. package/dist/cjs/components/Variables/VariableList.js +4 -6
  31. package/dist/cjs/constants/styles.js +12 -0
  32. package/dist/cjs/constants/user-interface-text.js +1 -1
  33. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +5 -6
  34. package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +1 -1
  35. package/dist/cjs/context/DashboardProvider/common.js +2 -2
  36. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +13 -3
  37. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
  38. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +3 -6
  39. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  40. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +3 -4
  41. package/dist/cjs/context/DashboardProvider/view-panel-slice.js +1 -2
  42. package/dist/cjs/context/DatasourceStoreProvider.js +15 -22
  43. package/dist/cjs/context/VariableProvider/VariableProvider.js +8 -11
  44. package/dist/cjs/context/VariableProvider/hydrationUtils.js +3 -6
  45. package/dist/cjs/context/VariableProvider/utils.js +2 -2
  46. package/dist/cjs/stories/decorators/WithDashboard.js +1 -1
  47. package/dist/cjs/stories/decorators/WithDatasourceStore.js +1 -1
  48. package/dist/cjs/stories/decorators/WithVariables.js +1 -1
  49. package/dist/cjs/test/plugin-registry.js +8 -3
  50. package/dist/cjs/test/render.js +13 -11
  51. package/dist/cjs/views/ViewDashboard/DashboardApp.js +4 -3
  52. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -5
  53. package/dist/components/Dashboard/Dashboard.js +1 -3
  54. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  55. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -0
  56. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  57. package/dist/components/DashboardToolbar/DashboardToolbar.js +3 -3
  58. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  59. package/dist/components/Datasources/DatasourceEditor.js +2 -5
  60. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  61. package/dist/components/Datasources/EditDatasourcesButton.js +2 -5
  62. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  63. package/dist/components/DeletePanelDialog/DeletePanelDialog.js +3 -1
  64. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  65. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  66. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -4
  67. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  68. package/dist/components/DownloadButton/DownloadButton.d.ts +1 -5
  69. package/dist/components/DownloadButton/DownloadButton.d.ts.map +1 -1
  70. package/dist/components/DownloadButton/DownloadButton.js +94 -29
  71. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  72. package/dist/components/EditJsonDialog/EditJsonDialog.js +5 -7
  73. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  74. package/dist/components/EmptyDashboard/EmptyDashboard.js +1 -1
  75. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  76. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  77. package/dist/components/GridLayout/GridItemContent.js +5 -4
  78. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  79. package/dist/components/GridLayout/GridLayout.js +6 -7
  80. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  81. package/dist/components/GridLayout/GridTitle.js +3 -3
  82. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  83. package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
  84. package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
  85. package/dist/components/Panel/HeaderIconButton.js +19 -0
  86. package/dist/components/Panel/HeaderIconButton.js.map +1 -0
  87. package/dist/components/Panel/Panel.d.ts +7 -2
  88. package/dist/components/Panel/Panel.d.ts.map +1 -1
  89. package/dist/components/Panel/Panel.js +22 -11
  90. package/dist/components/Panel/Panel.js.map +1 -1
  91. package/dist/components/Panel/PanelActions.d.ts +22 -0
  92. package/dist/components/Panel/PanelActions.d.ts.map +1 -0
  93. package/dist/components/Panel/PanelActions.js +352 -0
  94. package/dist/components/Panel/PanelActions.js.map +1 -0
  95. package/dist/components/Panel/PanelContent.d.ts +5 -4
  96. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  97. package/dist/components/Panel/PanelContent.js +61 -15
  98. package/dist/components/Panel/PanelContent.js.map +1 -1
  99. package/dist/components/Panel/PanelHeader.d.ts +7 -11
  100. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  101. package/dist/components/Panel/PanelHeader.js +18 -140
  102. package/dist/components/Panel/PanelHeader.js.map +1 -1
  103. package/dist/components/Panel/PanelLinks.js +5 -6
  104. package/dist/components/Panel/PanelLinks.js.map +1 -1
  105. package/dist/components/Panel/PanelPluginLoader.d.ts +13 -0
  106. package/dist/components/Panel/PanelPluginLoader.d.ts.map +1 -0
  107. package/dist/components/Panel/PanelPluginLoader.js +51 -0
  108. package/dist/components/Panel/PanelPluginLoader.js.map +1 -0
  109. package/dist/components/Panel/index.d.ts +1 -0
  110. package/dist/components/Panel/index.d.ts.map +1 -1
  111. package/dist/components/Panel/index.js +1 -0
  112. package/dist/components/Panel/index.js.map +1 -1
  113. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  114. package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
  115. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  116. package/dist/components/PanelDrawer/PanelEditorForm.js +17 -35
  117. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  118. package/dist/components/PanelDrawer/PanelPreview.js +4 -5
  119. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  120. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  121. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  122. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
  123. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  124. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -4
  125. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  126. package/dist/components/Variables/BuiltinVariableAccordions.js +5 -12
  127. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  128. package/dist/components/Variables/Variable.d.ts +2 -2
  129. package/dist/components/Variables/Variable.d.ts.map +1 -1
  130. package/dist/components/Variables/Variable.js +36 -41
  131. package/dist/components/Variables/Variable.js.map +1 -1
  132. package/dist/components/Variables/VariableEditor.js +14 -23
  133. package/dist/components/Variables/VariableEditor.js.map +1 -1
  134. package/dist/components/Variables/VariableList.js +4 -6
  135. package/dist/components/Variables/VariableList.js.map +1 -1
  136. package/dist/constants/styles.d.ts +3 -0
  137. package/dist/constants/styles.d.ts.map +1 -1
  138. package/dist/constants/styles.js +3 -0
  139. package/dist/constants/styles.js.map +1 -1
  140. package/dist/constants/user-interface-text.d.ts +1 -1
  141. package/dist/constants/user-interface-text.d.ts.map +1 -1
  142. package/dist/constants/user-interface-text.js +1 -1
  143. package/dist/constants/user-interface-text.js.map +1 -1
  144. package/dist/context/DashboardProvider/DashboardProvider.js +5 -6
  145. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  146. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +1 -1
  147. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -1
  148. package/dist/context/DashboardProvider/common.js +2 -2
  149. package/dist/context/DashboardProvider/common.js.map +1 -1
  150. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +11 -2
  151. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  152. package/dist/context/DashboardProvider/dashboard-provider-api.js +13 -4
  153. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  154. package/dist/context/DashboardProvider/delete-panel-slice.js +1 -2
  155. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  156. package/dist/context/DashboardProvider/panel-editor-slice.js +3 -6
  157. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  158. package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  159. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  160. package/dist/context/DashboardProvider/panel-group-slice.js +3 -4
  161. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  162. package/dist/context/DashboardProvider/view-panel-slice.js +1 -2
  163. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
  164. package/dist/context/DatasourceStoreProvider.js +15 -22
  165. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  166. package/dist/context/VariableProvider/VariableProvider.js +8 -11
  167. package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
  168. package/dist/context/VariableProvider/hydrationUtils.js +3 -6
  169. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
  170. package/dist/context/VariableProvider/utils.js +2 -2
  171. package/dist/context/VariableProvider/utils.js.map +1 -1
  172. package/dist/stories/decorators/WithDashboard.js +1 -1
  173. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  174. package/dist/stories/decorators/WithDatasourceStore.js +1 -1
  175. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  176. package/dist/stories/decorators/WithVariables.js +1 -1
  177. package/dist/stories/decorators/WithVariables.js.map +1 -1
  178. package/dist/test/plugin-registry.d.ts.map +1 -1
  179. package/dist/test/plugin-registry.js +8 -3
  180. package/dist/test/plugin-registry.js.map +1 -1
  181. package/dist/test/render.d.ts.map +1 -1
  182. package/dist/test/render.js +9 -7
  183. package/dist/test/render.js.map +1 -1
  184. package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -0
  185. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  186. package/dist/views/ViewDashboard/DashboardApp.js +4 -3
  187. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  188. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  189. package/dist/views/ViewDashboard/ViewDashboard.js +5 -5
  190. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  191. package/package.json +8 -7
@@ -12,32 +12,78 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { usePlugin } from '@perses-dev/plugin-system';
15
+ import { LoadingOverlay } from '@perses-dev/components';
15
16
  import { Skeleton } from '@mui/material';
17
+ import { PanelPluginLoader } from './PanelPluginLoader';
16
18
  /**
17
- * A small wrapper component that renders the appropriate PanelComponent from a Panel plugin based on the panel
18
- * definition's kind. Used so that an ErrorBoundary can be wrapped around this.
19
+ * Based on the status of the queries (loading, error or data available), this component renders a
20
+ * loading overlay, throws an error, or renders the panel content.
19
21
  */ export function PanelContent(props) {
20
- const { panelPluginKind, contentDimensions, definition, ...others } = props;
21
- const { data: plugin, isLoading } = usePlugin('Panel', panelPluginKind, {
22
- useErrorBoundary: true
22
+ const { panelPluginKind, definition, queryResults, spec, contentDimensions } = props;
23
+ const { data: plugin, isLoading: isPanelLoading } = usePlugin('Panel', panelPluginKind, {
24
+ throwOnError: true
23
25
  });
24
- const PanelComponent = plugin === null || plugin === void 0 ? void 0 : plugin.PanelComponent;
25
- if (isLoading) {
26
+ // Show fullsize skeleton if the panel plugin is loading.
27
+ if (isPanelLoading) {
26
28
  return /*#__PURE__*/ _jsx(Skeleton, {
27
29
  variant: "rectangular",
28
- width: contentDimensions === null || contentDimensions === void 0 ? void 0 : contentDimensions.width,
29
- height: contentDimensions === null || contentDimensions === void 0 ? void 0 : contentDimensions.height,
30
+ width: contentDimensions?.width,
31
+ height: contentDimensions?.height,
30
32
  "aria-label": "Loading..."
31
33
  });
32
34
  }
33
- if (PanelComponent === undefined) {
34
- throw new Error(`Missing PanelComponent from panel plugin for kind '${panelPluginKind}'`);
35
+ // Render the panel if any query has data, or the panel doesn't have a query attached (for example MarkdownPanel).
36
+ // Loading indicator or errors of other queries are shown in the panel header.
37
+ const queryResultsWithData = queryResults.flatMap((q)=>q.data ? [
38
+ {
39
+ data: q.data,
40
+ definition: q.definition
41
+ }
42
+ ] : []);
43
+ if (queryResultsWithData.length > 0 || queryResults.length === 0) {
44
+ return /*#__PURE__*/ _jsx(PanelPluginLoader, {
45
+ kind: panelPluginKind,
46
+ spec: spec,
47
+ contentDimensions: contentDimensions,
48
+ definition: definition,
49
+ queryResults: queryResultsWithData
50
+ });
51
+ }
52
+ // No query has data, show loading overlay if any query is fetching data.
53
+ if (queryResults.some((q)=>q.isFetching)) {
54
+ return /*#__PURE__*/ _jsx(PanelLoading, {
55
+ plugin: plugin,
56
+ spec: spec,
57
+ definition: definition,
58
+ contentDimensions: contentDimensions
59
+ });
60
+ }
61
+ // No query has data or is loading, show the error if any query has an error.
62
+ // The error will be catched in <ErrorBoundary> of <Panel>.
63
+ const queryError = queryResults.find((q)=>q.error);
64
+ if (queryError) {
65
+ throw queryError.error;
35
66
  }
36
- return /*#__PURE__*/ _jsx(PanelComponent, {
37
- ...others,
38
- contentDimensions: contentDimensions,
39
- definition: definition
67
+ // At this point, one or more queries are defined, but no query has data, is loading, or has an error.
68
+ // This can happen if all queries are disabled (e.g. dependent dashboard variables are loading, or they are not in the viewport of the browser).
69
+ // Most likely, some query will be enabled later. Render the panel loading skeleton.
70
+ return /*#__PURE__*/ _jsx(PanelLoading, {
71
+ plugin: plugin,
72
+ spec: spec,
73
+ definition: definition,
74
+ contentDimensions: contentDimensions
40
75
  });
41
76
  }
77
+ function PanelLoading({ plugin, spec, definition, contentDimensions }) {
78
+ if (plugin?.LoadingComponent) {
79
+ return /*#__PURE__*/ _jsx(plugin.LoadingComponent, {
80
+ spec: spec,
81
+ contentDimensions: contentDimensions,
82
+ definition: definition,
83
+ queryResults: []
84
+ });
85
+ }
86
+ return /*#__PURE__*/ _jsx(LoadingOverlay, {});
87
+ }
42
88
 
43
89
  //# sourceMappingURL=PanelContent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Panel/PanelContent.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 { usePlugin, PanelProps } from '@perses-dev/plugin-system';\nimport { Skeleton } from '@mui/material';\nimport { UnknownSpec, PanelDefinition } from '@perses-dev/core';\nimport { ReactElement } from 'react';\n\nexport interface PanelContentProps extends PanelProps<UnknownSpec> {\n panelPluginKind: string;\n definition?: PanelDefinition<UnknownSpec>;\n}\n\n/**\n * A small wrapper component that renders the appropriate PanelComponent from a Panel plugin based on the panel\n * definition's kind. Used so that an ErrorBoundary can be wrapped around this.\n */\nexport function PanelContent(props: PanelContentProps): ReactElement {\n const { panelPluginKind, contentDimensions, definition, ...others } = props;\n const { data: plugin, isLoading } = usePlugin('Panel', panelPluginKind, { useErrorBoundary: true });\n const PanelComponent = plugin?.PanelComponent;\n\n if (isLoading) {\n return (\n <Skeleton\n variant=\"rectangular\"\n width={contentDimensions?.width}\n height={contentDimensions?.height}\n aria-label=\"Loading...\"\n />\n );\n }\n\n if (PanelComponent === undefined) {\n throw new Error(`Missing PanelComponent from panel plugin for kind '${panelPluginKind}'`);\n }\n\n return <PanelComponent {...others} contentDimensions={contentDimensions} definition={definition} />;\n}\n"],"names":["usePlugin","Skeleton","PanelContent","props","panelPluginKind","contentDimensions","definition","others","data","plugin","isLoading","useErrorBoundary","PanelComponent","variant","width","height","aria-label","undefined","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,SAAS,QAAoB,4BAA4B;AAClE,SAASC,QAAQ,QAAQ,gBAAgB;AASzC;;;CAGC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EAAEC,eAAe,EAAEC,iBAAiB,EAAEC,UAAU,EAAE,GAAGC,QAAQ,GAAGJ;IACtE,MAAM,EAAEK,MAAMC,MAAM,EAAEC,SAAS,EAAE,GAAGV,UAAU,SAASI,iBAAiB;QAAEO,kBAAkB;IAAK;IACjG,MAAMC,iBAAiBH,mBAAAA,6BAAAA,OAAQG,cAAc;IAE7C,IAAIF,WAAW;QACb,qBACE,KAACT;YACCY,SAAQ;YACRC,KAAK,EAAET,8BAAAA,wCAAAA,kBAAmBS,KAAK;YAC/BC,MAAM,EAAEV,8BAAAA,wCAAAA,kBAAmBU,MAAM;YACjCC,cAAW;;IAGjB;IAEA,IAAIJ,mBAAmBK,WAAW;QAChC,MAAM,IAAIC,MAAM,CAAC,mDAAmD,EAAEd,gBAAgB,CAAC,CAAC;IAC1F;IAEA,qBAAO,KAACQ;QAAgB,GAAGL,MAAM;QAAEF,mBAAmBA;QAAmBC,YAAYA;;AACvF"}
1
+ {"version":3,"sources":["../../../src/components/Panel/PanelContent.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 { usePlugin, PanelProps, QueryData, PanelPlugin } from '@perses-dev/plugin-system';\nimport { UnknownSpec, PanelDefinition, QueryDataType } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { LoadingOverlay } from '@perses-dev/components';\nimport { Skeleton } from '@mui/material';\nimport { PanelPluginLoader } from './PanelPluginLoader';\n\nexport interface PanelContentProps extends Omit<PanelProps<UnknownSpec>, 'queryResults'> {\n panelPluginKind: string;\n definition?: PanelDefinition<UnknownSpec>;\n queryResults: QueryData[];\n}\n\n/**\n * Based on the status of the queries (loading, error or data available), this component renders a\n * loading overlay, throws an error, or renders the panel content.\n */\nexport function PanelContent(props: PanelContentProps): ReactElement {\n const { panelPluginKind, definition, queryResults, spec, contentDimensions } = props;\n const { data: plugin, isLoading: isPanelLoading } = usePlugin('Panel', panelPluginKind, { throwOnError: true });\n\n // Show fullsize skeleton if the panel plugin is loading.\n if (isPanelLoading) {\n return (\n <Skeleton\n variant=\"rectangular\"\n width={contentDimensions?.width}\n height={contentDimensions?.height}\n aria-label=\"Loading...\"\n />\n );\n }\n\n // Render the panel if any query has data, or the panel doesn't have a query attached (for example MarkdownPanel).\n // Loading indicator or errors of other queries are shown in the panel header.\n const queryResultsWithData = queryResults.flatMap((q) =>\n q.data ? [{ data: q.data, definition: q.definition }] : []\n );\n if (queryResultsWithData.length > 0 || queryResults.length === 0) {\n return (\n <PanelPluginLoader\n kind={panelPluginKind}\n spec={spec}\n contentDimensions={contentDimensions}\n definition={definition}\n queryResults={queryResultsWithData}\n />\n );\n }\n\n // No query has data, show loading overlay if any query is fetching data.\n if (queryResults.some((q) => q.isFetching)) {\n return <PanelLoading plugin={plugin} spec={spec} definition={definition} contentDimensions={contentDimensions} />;\n }\n\n // No query has data or is loading, show the error if any query has an error.\n // The error will be catched in <ErrorBoundary> of <Panel>.\n const queryError = queryResults.find((q) => q.error);\n if (queryError) {\n throw queryError.error;\n }\n\n // At this point, one or more queries are defined, but no query has data, is loading, or has an error.\n // This can happen if all queries are disabled (e.g. dependent dashboard variables are loading, or they are not in the viewport of the browser).\n // Most likely, some query will be enabled later. Render the panel loading skeleton.\n return <PanelLoading plugin={plugin} spec={spec} definition={definition} contentDimensions={contentDimensions} />;\n}\n\ninterface PanelLoadingProps extends Pick<PanelContentProps, 'spec' | 'definition' | 'contentDimensions'> {\n plugin?: PanelPlugin<UnknownSpec, PanelProps<UnknownSpec, QueryDataType>>;\n}\n\nfunction PanelLoading({ plugin, spec, definition, contentDimensions }: PanelLoadingProps): ReactElement {\n if (plugin?.LoadingComponent) {\n return (\n <plugin.LoadingComponent\n spec={spec}\n contentDimensions={contentDimensions}\n definition={definition}\n queryResults={[]}\n />\n );\n }\n return <LoadingOverlay />;\n}\n"],"names":["usePlugin","LoadingOverlay","Skeleton","PanelPluginLoader","PanelContent","props","panelPluginKind","definition","queryResults","spec","contentDimensions","data","plugin","isLoading","isPanelLoading","throwOnError","variant","width","height","aria-label","queryResultsWithData","flatMap","q","length","kind","some","isFetching","PanelLoading","queryError","find","error","LoadingComponent"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,SAAS,QAA4C,4BAA4B;AAG1F,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,iBAAiB,QAAQ,sBAAsB;AAQxD;;;CAGC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EAAEC,eAAe,EAAEC,UAAU,EAAEC,YAAY,EAAEC,IAAI,EAAEC,iBAAiB,EAAE,GAAGL;IAC/E,MAAM,EAAEM,MAAMC,MAAM,EAAEC,WAAWC,cAAc,EAAE,GAAGd,UAAU,SAASM,iBAAiB;QA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1,8 @@
1
1
  import { CardHeaderProps } from '@mui/material';
2
- import { ReactElement, ReactNode } from 'react';
3
2
  import { Link } from '@perses-dev/core';
3
+ import { QueryData } from '@perses-dev/plugin-system';
4
+ import { ReactElement, ReactNode } from 'react';
5
+ import { PanelActionsProps } from './PanelActions';
4
6
  type OmittedProps = 'children' | 'action' | 'title' | 'disableTypography';
5
7
  export interface PanelHeaderProps extends Omit<CardHeaderProps, OmittedProps> {
6
8
  id: string;
@@ -8,16 +10,10 @@ export interface PanelHeaderProps extends Omit<CardHeaderProps, OmittedProps> {
8
10
  description?: string;
9
11
  links?: Link[];
10
12
  extra?: ReactNode;
11
- readHandlers?: {
12
- isPanelViewed?: boolean;
13
- onViewPanelClick: () => void;
14
- };
15
- editHandlers?: {
16
- onEditPanelClick: () => void;
17
- onDuplicatePanelClick: () => void;
18
- onDeletePanelClick: () => void;
19
- };
13
+ queryResults: QueryData[];
14
+ readHandlers?: PanelActionsProps['readHandlers'];
15
+ editHandlers?: PanelActionsProps['editHandlers'];
20
16
  }
21
- export declare function PanelHeader({ id, title: rawTitle, description: rawDescription, links, readHandlers, editHandlers, sx, extra, ...rest }: PanelHeaderProps): ReactElement;
17
+ export declare function PanelHeader({ id, title: rawTitle, description: rawDescription, links, queryResults, readHandlers, editHandlers, sx, extra, ...rest }: PanelHeaderProps): ReactElement;
22
18
  export {};
23
19
  //# sourceMappingURL=PanelHeader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelHeader.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiC,eAAe,EAAsB,MAAM,eAAe,CAAC;AAUnG,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,KAAK,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAE1E,MAAM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AC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,SAAS,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;CAClD;AAED,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,cAAc,EAC3B,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,EAAE,EACF,KAAK,EACL,GAAG,IAAI,EACR,EAAE,gBAAgB,GAAG,YAAY,CA0DjC"}
@@ -1,4 +1,4 @@
1
- // Copyright 2023 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -10,100 +10,17 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
- import { CardHeader, Typography, Stack, styled, IconButton } from '@mui/material';
15
- import { InfoTooltip, combineSx } from '@perses-dev/components';
16
- import InformationOutlineIcon from 'mdi-material-ui/InformationOutline';
17
- import PencilIcon from 'mdi-material-ui/PencilOutline';
18
- import DeleteIcon from 'mdi-material-ui/DeleteOutline';
19
- import DragIcon from 'mdi-material-ui/DragVertical';
20
- import ArrowExpandIcon from 'mdi-material-ui/ArrowExpand';
21
- import ArrowCollapseIcon from 'mdi-material-ui/ArrowCollapse';
22
- import ContentCopyIcon from 'mdi-material-ui/ContentCopy';
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { CardHeader, Stack, Typography } from '@mui/material';
15
+ import { combineSx } from '@perses-dev/components';
23
16
  import { useReplaceVariablesInString } from '@perses-dev/plugin-system';
24
- import { ARIA_LABEL_TEXT, TOOLTIP_TEXT } from '../../constants';
25
- import { PanelLinks } from './PanelLinks';
26
- export function PanelHeader({ id, title: rawTitle, description: rawDescription, links, readHandlers, editHandlers, sx, extra, ...rest }) {
17
+ import { HEADER_ACTIONS_CONTAINER_NAME } from '../../constants';
18
+ import { PanelActions } from './PanelActions';
19
+ export function PanelHeader({ id, title: rawTitle, description: rawDescription, links, queryResults, readHandlers, editHandlers, sx, extra, ...rest }) {
27
20
  const titleElementId = `${id}-title`;
28
21
  const descriptionTooltipId = `${id}-description`;
29
22
  const title = useReplaceVariablesInString(rawTitle);
30
23
  const description = useReplaceVariablesInString(rawDescription);
31
- let readActions = undefined;
32
- if (readHandlers !== undefined) {
33
- readActions = /*#__PURE__*/ _jsx(InfoTooltip, {
34
- description: TOOLTIP_TEXT.viewPanel,
35
- children: /*#__PURE__*/ _jsx(HeaderIconButton, {
36
- "aria-label": ARIA_LABEL_TEXT.viewPanel(title),
37
- size: "small",
38
- onClick: readHandlers.onViewPanelClick,
39
- children: readHandlers.isPanelViewed ? /*#__PURE__*/ _jsx(ArrowCollapseIcon, {
40
- fontSize: "inherit"
41
- }) : /*#__PURE__*/ _jsx(ArrowExpandIcon, {
42
- fontSize: "inherit"
43
- })
44
- })
45
- });
46
- }
47
- let editActions = undefined;
48
- if (editHandlers !== undefined) {
49
- // If there are edit handlers, always just show the edit buttons
50
- editActions = /*#__PURE__*/ _jsxs(_Fragment, {
51
- children: [
52
- /*#__PURE__*/ _jsx(InfoTooltip, {
53
- description: TOOLTIP_TEXT.editPanel,
54
- children: /*#__PURE__*/ _jsx(HeaderIconButton, {
55
- "aria-label": ARIA_LABEL_TEXT.editPanel(title),
56
- size: "small",
57
- onClick: editHandlers.onEditPanelClick,
58
- children: /*#__PURE__*/ _jsx(PencilIcon, {
59
- fontSize: "inherit"
60
- })
61
- })
62
- }),
63
- /*#__PURE__*/ _jsx(InfoTooltip, {
64
- description: TOOLTIP_TEXT.duplicatePanel,
65
- children: /*#__PURE__*/ _jsx(HeaderIconButton, {
66
- "aria-label": ARIA_LABEL_TEXT.duplicatePanel(title),
67
- size: "small",
68
- onClick: editHandlers.onDuplicatePanelClick,
69
- children: /*#__PURE__*/ _jsx(ContentCopyIcon, {
70
- fontSize: "inherit",
71
- sx: {
72
- // Shrink this icon a little bit to look more consistent
73
- // with the other icons in the header.
74
- transform: 'scale(0.925)'
75
- }
76
- })
77
- })
78
- }),
79
- /*#__PURE__*/ _jsx(InfoTooltip, {
80
- description: TOOLTIP_TEXT.deletePanel,
81
- children: /*#__PURE__*/ _jsx(HeaderIconButton, {
82
- "aria-label": ARIA_LABEL_TEXT.deletePanel(title),
83
- size: "small",
84
- onClick: editHandlers.onDeletePanelClick,
85
- children: /*#__PURE__*/ _jsx(DeleteIcon, {
86
- fontSize: "inherit"
87
- })
88
- })
89
- }),
90
- /*#__PURE__*/ _jsx(InfoTooltip, {
91
- description: TOOLTIP_TEXT.movePanel,
92
- children: /*#__PURE__*/ _jsx(HeaderIconButton, {
93
- "aria-label": ARIA_LABEL_TEXT.movePanel(title),
94
- size: "small",
95
- children: /*#__PURE__*/ _jsx(DragIcon, {
96
- className: "drag-handle",
97
- sx: {
98
- cursor: 'grab'
99
- },
100
- fontSize: "inherit"
101
- })
102
- })
103
- })
104
- ]
105
- });
106
- }
107
24
  return /*#__PURE__*/ _jsx(CardHeader, {
108
25
  id: id,
109
26
  component: "header",
@@ -120,75 +37,36 @@ export function PanelHeader({ id, title: rawTitle, description: rawDescription,
120
37
  // `minHeight` guarantees that the header has the correct height
121
38
  // when there is no title (i.e. in the preview)
122
39
  lineHeight: '24px',
123
- minHeight: '24px',
40
+ minHeight: '26px',
124
41
  whiteSpace: 'nowrap',
125
42
  overflow: 'hidden',
126
43
  textOverflow: 'ellipsis'
127
44
  },
128
45
  children: title
129
46
  }),
130
- description !== undefined && description.trim().length > 0 && /*#__PURE__*/ _jsx(InfoTooltip, {
131
- id: descriptionTooltipId,
47
+ /*#__PURE__*/ _jsx(PanelActions, {
48
+ title: title,
132
49
  description: description,
133
- enterDelay: 100,
134
- children: /*#__PURE__*/ _jsx(HeaderIconButton, {
135
- "aria-label": "panel description",
136
- size: "small",
137
- children: /*#__PURE__*/ _jsx(InformationOutlineIcon, {
138
- "aria-describedby": "info-tooltip",
139
- "aria-hidden": false,
140
- fontSize: "inherit",
141
- sx: {
142
- color: (theme)=>theme.palette.text.secondary
143
- }
144
- })
145
- })
146
- }),
147
- links !== undefined && links.length > 0 && /*#__PURE__*/ _jsx(PanelLinks, {
148
- links: links
50
+ descriptionTooltipId: descriptionTooltipId,
51
+ links: links,
52
+ queryResults: queryResults,
53
+ readHandlers: readHandlers,
54
+ editHandlers: editHandlers,
55
+ extra: extra
149
56
  })
150
57
  ]
151
58
  }),
152
- action: /*#__PURE__*/ _jsxs(HeaderActionWrapper, {
153
- direction: "row",
154
- spacing: 0.25,
155
- alignItems: "center",
156
- children: [
157
- editHandlers === undefined && extra,
158
- " ",
159
- readActions,
160
- " ",
161
- editActions
162
- ]
163
- }),
164
59
  sx: combineSx((theme)=>({
60
+ containerType: 'inline-size',
61
+ containerName: HEADER_ACTIONS_CONTAINER_NAME,
165
62
  padding: theme.spacing(1),
166
63
  borderBottom: `solid 1px ${theme.palette.divider}`,
167
64
  '.MuiCardHeader-content': {
168
65
  overflow: 'hidden'
169
- },
170
- '.MuiCardHeader-action': {
171
- // Overriding the negative margins from MUI's defaults, so we
172
- // can vertically center the icons. Moving these values to a wrapper
173
- // inside the action in `HeaderActionWrapper` below.
174
- // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58
175
- margin: 'auto'
176
66
  }
177
67
  }), sx),
178
68
  ...rest
179
69
  });
180
70
  }
181
- const HeaderIconButton = styled(IconButton)(({ theme })=>({
182
- borderRadius: theme.shape.borderRadius,
183
- padding: '4px'
184
- }));
185
- const HeaderActionWrapper = styled(Stack)(()=>({
186
- // Adding back the negative margins from MUI's defaults for actions, so we
187
- // avoid increasing the header size when actions are present while also being
188
- // able to vertically center the actions.
189
- // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58
190
- marginTop: -4,
191
- marginBottom: -4
192
- }));
193
71
 
194
72
  //# sourceMappingURL=PanelHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Panel/PanelHeader.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 { CardHeader, Typography, Stack, CardHeaderProps, styled, IconButton } from '@mui/material';\nimport { InfoTooltip, combineSx } from '@perses-dev/components';\nimport InformationOutlineIcon from 'mdi-material-ui/InformationOutline';\nimport PencilIcon from 'mdi-material-ui/PencilOutline';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport DragIcon from 'mdi-material-ui/DragVertical';\nimport ArrowExpandIcon from 'mdi-material-ui/ArrowExpand';\nimport ArrowCollapseIcon from 'mdi-material-ui/ArrowCollapse';\nimport ContentCopyIcon from 'mdi-material-ui/ContentCopy';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport { ReactElement, ReactNode } from 'react';\nimport { Link } from '@perses-dev/core';\nimport { ARIA_LABEL_TEXT, TOOLTIP_TEXT } from '../../constants';\nimport { PanelLinks } from './PanelLinks';\ntype OmittedProps = 'children' | 'action' | 'title' | 'disableTypography';\n\nexport interface PanelHeaderProps extends Omit<CardHeaderProps, OmittedProps> {\n id: string;\n title: string;\n description?: string;\n links?: Link[];\n extra?: ReactNode;\n readHandlers?: {\n isPanelViewed?: boolean;\n onViewPanelClick: () => void;\n };\n editHandlers?: {\n onEditPanelClick: () => void;\n onDuplicatePanelClick: () => void;\n onDeletePanelClick: () => void;\n };\n}\n\nexport function PanelHeader({\n id,\n title: rawTitle,\n description: rawDescription,\n links,\n readHandlers,\n editHandlers,\n sx,\n extra,\n ...rest\n}: PanelHeaderProps): ReactElement {\n const titleElementId = `${id}-title`;\n const descriptionTooltipId = `${id}-description`;\n\n const title = useReplaceVariablesInString(rawTitle) as string;\n const description = useReplaceVariablesInString(rawDescription);\n\n let readActions: CardHeaderProps['action'] = undefined;\n if (readHandlers !== undefined) {\n readActions = (\n <InfoTooltip description={TOOLTIP_TEXT.viewPanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.viewPanel(title)}\n size=\"small\"\n onClick={readHandlers.onViewPanelClick}\n >\n {readHandlers.isPanelViewed ? (\n <ArrowCollapseIcon fontSize=\"inherit\" />\n ) : (\n <ArrowExpandIcon fontSize=\"inherit\" />\n )}\n </HeaderIconButton>\n </InfoTooltip>\n );\n }\n let editActions: CardHeaderProps['action'] = undefined;\n if (editHandlers !== undefined) {\n // If there are edit handlers, always just show the edit buttons\n editActions = (\n <>\n <InfoTooltip description={TOOLTIP_TEXT.editPanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.editPanel(title)}\n size=\"small\"\n onClick={editHandlers.onEditPanelClick}\n >\n <PencilIcon fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.duplicatePanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.duplicatePanel(title)}\n size=\"small\"\n onClick={editHandlers.onDuplicatePanelClick}\n >\n <ContentCopyIcon\n fontSize=\"inherit\"\n sx={{\n // Shrink this icon a little bit to look more consistent\n // with the other icons in the header.\n transform: 'scale(0.925)',\n }}\n />\n </HeaderIconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.deletePanel}>\n <HeaderIconButton\n aria-label={ARIA_LABEL_TEXT.deletePanel(title)}\n size=\"small\"\n onClick={editHandlers.onDeletePanelClick}\n >\n <DeleteIcon fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.movePanel}>\n <HeaderIconButton aria-label={ARIA_LABEL_TEXT.movePanel(title)} size=\"small\">\n <DragIcon className=\"drag-handle\" sx={{ cursor: 'grab' }} fontSize=\"inherit\" />\n </HeaderIconButton>\n </InfoTooltip>\n </>\n );\n }\n\n return (\n <CardHeader\n id={id}\n component=\"header\"\n aria-labelledby={titleElementId}\n aria-describedby={descriptionTooltipId}\n disableTypography\n title={\n <Stack direction=\"row\">\n <Typography\n id={titleElementId}\n variant=\"subtitle1\"\n sx={{\n // `minHeight` guarantees that the header has the correct height\n // when there is no title (i.e. in the preview)\n lineHeight: '24px',\n minHeight: '24px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {title}\n </Typography>\n {/* Show the info tooltip when description is defined and is not all whitespace */}\n {description !== undefined && description.trim().length > 0 && (\n <InfoTooltip id={descriptionTooltipId} description={description} enterDelay={100}>\n <HeaderIconButton aria-label=\"panel description\" size=\"small\">\n <InformationOutlineIcon\n aria-describedby=\"info-tooltip\"\n aria-hidden={false}\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.text.secondary }}\n />\n </HeaderIconButton>\n </InfoTooltip>\n )}\n {links !== undefined && links.length > 0 && <PanelLinks links={links} />}\n </Stack>\n }\n action={\n <HeaderActionWrapper direction=\"row\" spacing={0.25} alignItems=\"center\">\n {editHandlers === undefined && extra} {readActions} {editActions}\n </HeaderActionWrapper>\n }\n sx={combineSx(\n (theme) => ({\n padding: theme.spacing(1),\n borderBottom: `solid 1px ${theme.palette.divider}`,\n '.MuiCardHeader-content': {\n overflow: 'hidden',\n },\n '.MuiCardHeader-action': {\n // Overriding the negative margins from MUI's defaults, so we\n // can vertically center the icons. Moving these values to a wrapper\n // inside the action in `HeaderActionWrapper` below.\n // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58\n margin: 'auto',\n },\n }),\n sx\n )}\n {...rest}\n />\n );\n}\n\nconst HeaderIconButton = styled(IconButton)(({ theme }) => ({\n borderRadius: theme.shape.borderRadius,\n padding: '4px',\n}));\n\nconst HeaderActionWrapper = styled(Stack)(() => ({\n // Adding back the negative margins from MUI's defaults for actions, so we\n // avoid increasing the header size when actions are present while also being\n // able to vertically center the actions.\n // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/CardHeader/CardHeader.js#L56-L58\n marginTop: -4,\n marginBottom: -4,\n}));\n"],"names":["CardHeader","Typography","Stack","styled","IconButton","InfoTooltip","combineSx","InformationOutlineIcon","PencilIcon","DeleteIcon","DragIcon","ArrowExpandIcon","ArrowCollapseIcon","ContentCopyIcon","useReplaceVariablesInString","ARIA_LABEL_TEXT","TOOLTIP_TEXT","PanelLinks","PanelHeader","id","title","rawTitle","description","rawDescription","links","readHandlers","editHandlers","sx","extra","rest","titleElementId","descriptionTooltipId","readActions","undefined","viewPanel","HeaderIconButton","aria-label","size","onClick","onViewPanelClick","isPanelViewed","fontSize","editActions","editPanel","onEditPanelClick","duplicatePanel","onDuplicatePanelClick","transform","deletePanel","onDeletePanelClick","movePanel","className","cursor","component","aria-labelledby","aria-describedby","disableTypography","direction","variant","lineHeight","minHeight","whiteSpace","overflow","textOverflow","trim","length","enterDelay","aria-hidden","color","theme","palette","text","secondary","action","HeaderActionWrapper","spacing","alignItems","padding","borderBottom","divider","margin","borderRadius","shape","marginTop","marginBottom"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACp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ACxD,KAAC5D;oBAAYc,IAAIY;oBAAsBT,aAAaA;oBAAa4C,YAAY;8BAC3E,cAAA,KAAC/B;wBAAiBC,cAAW;wBAAoBC,MAAK;kCACpD,cAAA,KAAC9B;4BACCgD,oBAAiB;4BACjBY,eAAa;4BACb1B,UAAS;4BACTd,IAAI;gCAAEyC,OAAO,CAACC,QAAUA,MAAMC,OAAO,CAACC,IAAI,CAACC,SAAS;4BAAC;;;;gBAK5DhD,UAAUS,aAAaT,MAAMyC,MAAM,GAAG,mBAAK,KAAChD;oBAAWO,OAAOA;;;;QAGnEiD,sBACE,MAACC;YAAoBjB,WAAU;YAAMkB,SAAS;YAAMC,YAAW;;gBAC5DlD,iBAAiBO,aAAaL;gBAAM;gBAAEI;gBAAY;gBAAEU;;;QAGzDf,IAAIrB,UACF,CAAC+D,QAAW,CAAA;gBACVQ,SAASR,MAAMM,OAAO,CAAC;gBACvBG,cAAc,CAAC,UAAU,EAAET,MAAMC,OAAO,CAACS,OAAO,CAAC,CAAC;gBAClD,0BAA0B;oBACxBjB,UAAU;gBACZ;gBACA,yBAAyB;oBACvB,6DAA6D;oBAC7D,oEAAoE;oBACpE,oDAAoD;oBACpD,4GAA4G;oBAC5GkB,QAAQ;gBACV;YACF,CAAA,GACArD;QAED,GAAGE,IAAI;;AAGd;AAEA,MAAMM,mBAAmBhC,OAAOC,YAAY,CAAC,EAAEiE,KAAK,EAAE,GAAM,CAAA;QAC1DY,cAAcZ,MAAMa,KAAK,CAACD,YAAY;QACtCJ,SAAS;IACX,CAAA;AAEA,MAAMH,sBAAsBvE,OAAOD,OAAO,IAAO,CAAA;QAC/C,0EAA0E;QAC1E,6EAA6E;QAC7E,yCAAyC;QACzC,4GAA4G;QAC5GiF,WAAW,CAAC;QACZC,cAAc,CAAC;IACjB,CAAA"}
1
+ {"version":3,"sources":["../../../src/components/Panel/PanelHeader.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { CardHeader, CardHeaderProps, Stack, Typography } from '@mui/material';\nimport { combineSx } from '@perses-dev/components';\nimport { Link } from '@perses-dev/core';\nimport { QueryData, useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport { ReactElement, ReactNode } from 'react';\nimport { HEADER_ACTIONS_CONTAINER_NAME } from '../../constants';\nimport { PanelActions, PanelActionsProps } from './PanelActions';\n\ntype OmittedProps = 'children' | 'action' | 'title' | 'disableTypography';\n\nexport interface PanelHeaderProps extends Omit<CardHeaderProps, OmittedProps> {\n id: string;\n title: string;\n description?: string;\n links?: Link[];\n extra?: ReactNode;\n queryResults: QueryData[];\n readHandlers?: PanelActionsProps['readHandlers'];\n editHandlers?: PanelActionsProps['editHandlers'];\n}\n\nexport function PanelHeader({\n id,\n title: rawTitle,\n description: rawDescription,\n links,\n queryResults,\n readHandlers,\n editHandlers,\n sx,\n extra,\n ...rest\n}: PanelHeaderProps): ReactElement {\n const titleElementId = `${id}-title`;\n const descriptionTooltipId = `${id}-description`;\n\n const title = useReplaceVariablesInString(rawTitle) as string;\n const description = useReplaceVariablesInString(rawDescription);\n\n return (\n <CardHeader\n id={id}\n component=\"header\"\n aria-labelledby={titleElementId}\n aria-describedby={descriptionTooltipId}\n disableTypography\n title={\n <Stack direction=\"row\">\n <Typography\n id={titleElementId}\n variant=\"subtitle1\"\n sx={{\n // `minHeight` guarantees that the header has the correct height\n // when there is no title (i.e. in the preview)\n lineHeight: '24px',\n minHeight: '26px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {title}\n </Typography>\n <PanelActions\n title={title}\n description={description}\n descriptionTooltipId={descriptionTooltipId}\n links={links}\n queryResults={queryResults}\n readHandlers={readHandlers}\n editHandlers={editHandlers}\n extra={extra}\n />\n </Stack>\n }\n sx={combineSx(\n (theme) => ({\n containerType: 'inline-size',\n containerName: HEADER_ACTIONS_CONTAINER_NAME,\n padding: theme.spacing(1),\n borderBottom: `solid 1px ${theme.palette.divider}`,\n '.MuiCardHeader-content': {\n overflow: 'hidden',\n },\n }),\n sx\n )}\n {...rest}\n />\n );\n}\n"],"names":["CardHeader","Stack","Typography","combineSx","useReplaceVariablesInString","HEADER_ACTIONS_CONTAINER_NAME","PanelActions","PanelHeader","id","title","rawTitle","description","rawDescription","links","queryResults","readHandlers","editHandlers","sx","extra","rest","titleElementId","descriptionTooltipId","component","aria-labelledby","aria-describedby","disableTypography","direction","variant","lineHeight","minHeight","whiteSpace","overflow","textOverflow","theme","containerType","containerName","padding","spacing","borderBottom","palette","divider"],"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,UAAU,EAAmBC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAC/E,SAASC,SAAS,QAAQ,yBAAyB;AAEnD,SAAoBC,2BAA2B,QAAQ,4BAA4B;AAEnF,SAASC,6BAA6B,QAAQ,kBAAkB;AAChE,SAASC,YAAY,QAA2B,iBAAiB;AAejE,OAAO,SAASC,YAAY,EAC1BC,EAAE,EACFC,OAAOC,QAAQ,EACfC,aAAaC,cAAc,EAC3BC,KAAK,EACLC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,EAAE,EACFC,KAAK,EACL,GAAGC,MACc;IACjB,MAAMC,iBAAiB,CAAC,EAAEZ,GAAG,MAAM,CAAC;IACpC,MAAMa,uBAAuB,CAAC,EAAEb,GAAG,YAAY,CAAC;IAEhD,MAAMC,QAAQL,4BAA4BM;IAC1C,MAAMC,cAAcP,4BAA4BQ;IAEhD,qBACE,KAACZ;QACCQ,IAAIA;QACJc,WAAU;QACVC,mBAAiBH;QACjBI,oBAAkBH;QAClBI,iBAAiB;QACjBhB,qBACE,MAACR;YAAMyB,WAAU;;8BACf,KAACxB;oBACCM,IAAIY;oBACJO,SAAQ;oBACRV,IAAI;wBACF,gEAAgE;wBAChE,+CAA+C;wBAC/CW,YAAY;wBACZC,WAAW;wBACXC,YAAY;wBACZC,UAAU;wBACVC,cAAc;oBAChB;8BAECvB;;8BAEH,KAACH;oBACCG,OAAOA;oBACPE,aAAaA;oBACbU,sBAAsBA;oBACtBR,OAAOA;oBACPC,cAAcA;oBACdC,cAAcA;oBACdC,cAAcA;oBACdE,OAAOA;;;;QAIbD,IAAId,UACF,CAAC8B,QAAW,CAAA;gBACVC,eAAe;gBACfC,eAAe9B;gBACf+B,SAASH,MAAMI,OAAO,CAAC;gBACvBC,cAAc,CAAC,UAAU,EAAEL,MAAMM,OAAO,CAACC,OAAO,CAAC,CAAC;gBAClD,0BAA0B;oBACxBT,UAAU;gBACZ;YACF,CAAA,GACAd;QAED,GAAGE,IAAI;;AAGd"}
@@ -72,10 +72,10 @@ export function PanelLinks({ links }) {
72
72
  function LinkButton({ link }) {
73
73
  const { url, name, tooltip, targetBlank } = useLink(link);
74
74
  return /*#__PURE__*/ _jsx(InfoTooltip, {
75
- description: tooltip !== null && tooltip !== void 0 ? tooltip : url,
75
+ description: tooltip ?? url,
76
76
  enterDelay: 100,
77
77
  children: /*#__PURE__*/ _jsx(IconButton, {
78
- "aria-label": name !== null && name !== void 0 ? name : url,
78
+ "aria-label": name ?? url,
79
79
  size: "small",
80
80
  href: url,
81
81
  target: targetBlank ? '_blank' : '_self',
@@ -95,19 +95,18 @@ function LinkButton({ link }) {
95
95
  function LinkMenuItem({ link }) {
96
96
  const { url, name, tooltip, targetBlank } = useLink(link);
97
97
  return /*#__PURE__*/ _jsx(InfoTooltip, {
98
- description: tooltip !== null && tooltip !== void 0 ? tooltip : url,
98
+ description: tooltip ?? url,
99
99
  enterDelay: 100,
100
100
  children: /*#__PURE__*/ _jsx(MenuItem, {
101
101
  component: LinkComponent,
102
102
  href: url,
103
103
  target: targetBlank ? '_blank' : '_self',
104
- children: name !== null && name !== void 0 ? name : url
104
+ children: name ?? url
105
105
  })
106
106
  });
107
107
  }
108
108
  function useLink(link) {
109
- var _useReplaceVariablesInString;
110
- const url = (_useReplaceVariablesInString = useReplaceVariablesInString(link.url)) !== null && _useReplaceVariablesInString !== void 0 ? _useReplaceVariablesInString : link.url;
109
+ const url = useReplaceVariablesInString(link.url) ?? link.url;
111
110
  const name = useReplaceVariablesInString(link.name);
112
111
  const tooltip = useReplaceVariablesInString(link.tooltip);
113
112
  if (link.renderVariables === false) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Panel/PanelLinks.tsx"],"sourcesContent":["// Copyright 2024 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 { IconButton, Link as LinkComponent, Menu, MenuItem, Theme } from '@mui/material';\nimport LaunchIcon from 'mdi-material-ui/Launch';\nimport { Link } from '@perses-dev/core';\nimport { MouseEvent, ReactElement, useState } from 'react';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\n\nexport function PanelLinks({ links }: { links: Link[] }): ReactElement {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const isMenuOpened = Boolean(anchorEl);\n const handleOpenMenu = (event: MouseEvent<HTMLButtonElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n const handleClose = (): void => {\n setAnchorEl(null);\n };\n\n // If there is only one link, show it directly\n if (links.length === 1 && links[0]) {\n const link = links[0];\n return <LinkButton link={link} />;\n }\n\n // Else we show a menu with a list of all links\n return (\n <>\n <InfoTooltip description={`${links.length} links`} enterDelay={100}>\n <IconButton\n aria-label=\"Panel links\"\n size=\"small\"\n onClick={handleOpenMenu}\n sx={(theme) => ({ borderRadius: theme.shape.borderRadius, padding: '4px' })}\n >\n <LaunchIcon\n aria-describedby=\"links-icon\"\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.text.secondary }}\n />\n </IconButton>\n </InfoTooltip>\n\n <Menu\n anchorEl={anchorEl}\n open={isMenuOpened}\n onClose={handleClose}\n MenuListProps={{\n 'aria-labelledby': 'panel-links',\n }}\n >\n {links.map((link: Link) => (\n <LinkMenuItem key={link.url} link={link} />\n ))}\n </Menu>\n </>\n );\n}\n\nfunction LinkButton({ link }: { link: Link }): ReactElement {\n const { url, name, tooltip, targetBlank } = useLink(link);\n\n return (\n <InfoTooltip description={tooltip ?? url} enterDelay={100}>\n <IconButton\n aria-label={name ?? url}\n size=\"small\"\n href={url}\n target={targetBlank ? '_blank' : '_self'}\n sx={(theme) => ({ borderRadius: theme.shape.borderRadius, padding: '4px' })}\n >\n <LaunchIcon fontSize=\"inherit\" sx={{ color: (theme: Theme) => theme.palette.text.secondary }} />\n </IconButton>\n </InfoTooltip>\n );\n}\n\nfunction LinkMenuItem({ link }: { link: Link }): ReactElement {\n const { url, name, tooltip, targetBlank } = useLink(link);\n\n return (\n <InfoTooltip description={tooltip ?? url} enterDelay={100}>\n <MenuItem component={LinkComponent} href={url} target={targetBlank ? '_blank' : '_self'}>\n {name ?? url}\n </MenuItem>\n </InfoTooltip>\n );\n}\n\nfunction useLink(link: Link): Link {\n const url = useReplaceVariablesInString(link.url) ?? link.url;\n const name = useReplaceVariablesInString(link.name);\n const tooltip = useReplaceVariablesInString(link.tooltip);\n\n if (link.renderVariables === false) {\n return link;\n }\n\n return { ...link, url, name, tooltip };\n}\n"],"names":["IconButton","Link","LinkComponent","Menu","MenuItem","LaunchIcon","useState","InfoTooltip","useReplaceVariablesInString","PanelLinks","links","anchorEl","setAnchorEl","isMenuOpened","Boolean","handleOpenMenu","event","currentTarget","handleClose","length","link","LinkButton","description","enterDelay","aria-label","size","onClick","sx","theme","borderRadius","shape","padding","aria-describedby","fontSize","color","palette","text","secondary","open","onClose","MenuListProps","map","LinkMenuItem","url","name","tooltip","targetBlank","useLink","href","target","component","renderVariables"],"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,UAAU,EAAEC,QAAQC,aAAa,EAAEC,IAAI,EAAEC,QAAQ,QAAe,gBAAgB;AACzF,OAAOC,gBAAgB,yBAAyB;AAEhD,SAAmCC,QAAQ,QAAQ,QAAQ;AAC3D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,2BAA2B,QAAQ,4BAA4B;AAExE,OAAO,SAASC,WAAW,EAAEC,KAAK,EAAqB;IACrD,MAAM,CAACC,UAAUC,YAAY,GAAGN,SAA6B;IAC7D,MAAMO,eAAeC,QAAQH;IAC7B,MAAMI,iBAAiB,CAACC;QACtBJ,YAAYI,MAAMC,aAAa;IACjC;IACA,MAAMC,cAAc;QAClBN,YAAY;IACd;IAEA,8CAA8C;IAC9C,IAAIF,MAAMS,MAAM,KAAK,KAAKT,KAAK,CAAC,EAAE,EAAE;QAClC,MAAMU,OAAOV,KAAK,CAAC,EAAE;QACrB,qBAAO,KAACW;YAAWD,MAAMA;;IAC3B;IAEA,+CAA+C;IAC/C,qBACE;;0BACE,KAACb;gBAAYe,aAAa,CAAC,EAAEZ,MAAMS,MAAM,CAAC,MAAM,CAAC;gBAAEI,YAAY;0BAC7D,cA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F;QAAKpB,YAAY;kBACpD,cAAA,KAACnB;YAAS8C,WAAWhD;YAAe8C,MAAML;YAAKM,QAAQH,cAAc,WAAW;sBAC7EF,iBAAAA,kBAAAA,OAAQD;;;AAIjB;AAEA,SAASI,QAAQ3B,IAAU;QACbZ;IAAZ,MAAMmC,MAAMnC,CAAAA,+BAAAA,4BAA4BY,KAAKuB,GAAG,eAApCnC,0CAAAA,+BAAyCY,KAAKuB,GAAG;IAC7D,MAAMC,OAAOpC,4BAA4BY,KAAKwB,IAAI;IAClD,MAAMC,UAAUrC,4BAA4BY,KAAKyB,OAAO;IAExD,IAAIzB,KAAK+B,eAAe,KAAK,OAAO;QAClC,OAAO/B;IACT;IAEA,OAAO;QAAE,GAAGA,IAAI;QAAEuB;QAAKC;QAAMC;IAAQ;AACvC"}
1
+ {"version":3,"sources":["../../../src/components/Panel/PanelLinks.tsx"],"sourcesContent":["// Copyright 2024 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 { IconButton, Link as LinkComponent, Menu, MenuItem, Theme } from '@mui/material';\nimport LaunchIcon from 'mdi-material-ui/Launch';\nimport { Link } from '@perses-dev/core';\nimport { MouseEvent, ReactElement, useState } from 'react';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\n\nexport function PanelLinks({ links }: { links: Link[] }): ReactElement {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const isMenuOpened = Boolean(anchorEl);\n const handleOpenMenu = (event: MouseEvent<HTMLButtonElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n const handleClose = (): void => {\n setAnchorEl(null);\n };\n\n // If there is only one link, show it directly\n if (links.length === 1 && links[0]) {\n const link = links[0];\n return <LinkButton link={link} />;\n }\n\n // Else we show a menu with a list of all links\n return (\n <>\n <InfoTooltip description={`${links.length} links`} enterDelay={100}>\n <IconButton\n aria-label=\"Panel links\"\n size=\"small\"\n onClick={handleOpenMenu}\n sx={(theme) => ({ borderRadius: theme.shape.borderRadius, padding: '4px' })}\n >\n <LaunchIcon\n aria-describedby=\"links-icon\"\n fontSize=\"inherit\"\n sx={{ color: (theme) => theme.palette.text.secondary }}\n />\n </IconButton>\n </InfoTooltip>\n\n <Menu\n anchorEl={anchorEl}\n open={isMenuOpened}\n onClose={handleClose}\n MenuListProps={{\n 'aria-labelledby': 'panel-links',\n }}\n >\n {links.map((link: Link) => (\n <LinkMenuItem key={link.url} link={link} />\n ))}\n </Menu>\n </>\n );\n}\n\nfunction LinkButton({ link }: { link: Link }): ReactElement {\n const { url, name, tooltip, targetBlank } = useLink(link);\n\n return (\n <InfoTooltip description={tooltip ?? url} enterDelay={100}>\n <IconButton\n aria-label={name ?? url}\n size=\"small\"\n href={url}\n target={targetBlank ? '_blank' : '_self'}\n sx={(theme) => ({ borderRadius: theme.shape.borderRadius, padding: '4px' })}\n >\n <LaunchIcon fontSize=\"inherit\" sx={{ color: (theme: Theme) => theme.palette.text.secondary }} />\n </IconButton>\n </InfoTooltip>\n );\n}\n\nfunction LinkMenuItem({ link }: { link: Link }): ReactElement {\n const { url, name, tooltip, targetBlank } = useLink(link);\n\n return (\n <InfoTooltip description={tooltip ?? url} enterDelay={100}>\n <MenuItem component={LinkComponent} href={url} target={targetBlank ? '_blank' : '_self'}>\n {name ?? url}\n </MenuItem>\n </InfoTooltip>\n );\n}\n\nfunction useLink(link: Link): Link {\n const url = useReplaceVariablesInString(link.url) ?? link.url;\n const name = useReplaceVariablesInString(link.name);\n const tooltip = useReplaceVariablesInString(link.tooltip);\n\n if (link.renderVariables === false) {\n return link;\n }\n\n return { ...link, url, name, tooltip };\n}\n"],"names":["IconButton","Link","LinkComponent","Menu","MenuItem","LaunchIcon","useState","InfoTooltip","useReplaceVariablesInString","PanelLinks","links","anchorEl","setAnchorEl","isMenuOpened","Boolean","handleOpenMenu","event","currentTarget","handleClose","length","link","LinkButton","description","enterDelay","aria-label","size","onClick","sx","theme","borderRadius","shape","padding","aria-describedby","fontSize","color","palette","text","secondary","open","onClose","MenuListProps","map","LinkMenuItem","url","name","tooltip","targetBlank","useLink","href","target","component","renderVariables"],"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,UAAU,EAAEC,QAAQC,aAAa,EAAEC,IAAI,EAAEC,QAAQ,QAAe,gBAAgB;AACzF,OAAOC,gBAAgB,yBAAyB;AAEhD,SAAmCC,QAAQ,QAAQ,QAAQ;AAC3D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,2BAA2B,QAAQ,4BAA4B;AAExE,OAAO,SAASC,WAAW,EAAEC,KAAK,EAAqB;IACrD,MAAM,CAACC,UAAUC,YAAY,GAAGN,SAA6B;IAC7D,MAAMO,eAAeC,QAAQH;IAC7B,MAAMI,iBAAiB,CAACC;QACtBJ,YAAYI,MAAMC,aAAa;IACjC;IACA,MAAMC,cAAc;QAClBN,YAAY;IACd;IAEA,8CAA8C;IAC9C,IAAIF,MAAMS,MAAM,KAAK,KAAKT,KAAK,CAAC,EAAE,EAAE;QAClC,MAAMU,OAAOV,KAAK,CAAC,EAAE;QACrB,qBAAO,KAACW;YAAWD,MAAMA;;IAC3B;IAEA,+CAA+C;IAC/C,qBACE;;0BACE,KAACb;gBAAYe,aAAa,CAAC,EAAEZ,MAAMS,MAAM,CAAC,MAAM,CAAC;gBAAEI,YAAY;0BAC7D,cAAA,KAACvB;oBACCwB,cAAW;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QAAQH,cAAc,WAAW;sBAC7EF,QAAQD;;;AAIjB;AAEA,SAASI,QAAQ3B,IAAU;IACzB,MAAMuB,MAAMnC,4BAA4BY,KAAKuB,GAAG,KAAKvB,KAAKuB,GAAG;IAC7D,MAAMC,OAAOpC,4BAA4BY,KAAKwB,IAAI;IAClD,MAAMC,UAAUrC,4BAA4BY,KAAKyB,OAAO;IAExD,IAAIzB,KAAK+B,eAAe,KAAK,OAAO;QAClC,OAAO/B;IACT;IAEA,OAAO;QAAE,GAAGA,IAAI;QAAEuB;QAAKC;QAAMC;IAAQ;AACvC"}
@@ -0,0 +1,13 @@
1
+ import { PanelProps } from '@perses-dev/plugin-system';
2
+ import { UnknownSpec, QueryDataType } from '@perses-dev/core';
3
+ import { ReactElement } from 'react';
4
+ interface PanelPluginProps extends PanelProps<UnknownSpec, QueryDataType> {
5
+ kind: string;
6
+ }
7
+ /**
8
+ * PanelPluginLoader loads the panel plugin specified by the 'kind' prop from the plugin registry and
9
+ * renders its PanelComponent.
10
+ */
11
+ export declare function PanelPluginLoader(props: PanelPluginProps): ReactElement;
12
+ export {};
13
+ //# sourceMappingURL=PanelPluginLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PanelPluginLoader.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/PanelPluginLoader.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAa,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,UAAU,gBAAiB,SAAQ,UAAU,CAAC,WAAW,EAAE,aAAa,CAAC;IACvE,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAsCvE"}
@@ -0,0 +1,51 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { usePlugin } from '@perses-dev/plugin-system';
15
+ import { Skeleton } from '@mui/material';
16
+ /**
17
+ * PanelPluginLoader loads the panel plugin specified by the 'kind' prop from the plugin registry and
18
+ * renders its PanelComponent.
19
+ */ export function PanelPluginLoader(props) {
20
+ const { kind, spec, contentDimensions, definition, queryResults } = props;
21
+ const { data: plugin, isLoading: isPanelLoading } = usePlugin('Panel', kind, {
22
+ throwOnError: true
23
+ });
24
+ const PanelComponent = plugin?.PanelComponent;
25
+ const supportedQueryTypes = plugin?.supportedQueryTypes || [];
26
+ // Show fullsize skeleton if the panel plugin is loading.
27
+ if (isPanelLoading) {
28
+ return /*#__PURE__*/ _jsx(Skeleton, {
29
+ variant: "rectangular",
30
+ width: contentDimensions?.width,
31
+ height: contentDimensions?.height,
32
+ "aria-label": "Loading..."
33
+ });
34
+ }
35
+ if (PanelComponent === undefined) {
36
+ throw new Error(`Missing PanelComponent from panel plugin for kind '${kind}'`);
37
+ }
38
+ for (const queryResult of queryResults){
39
+ if (!supportedQueryTypes.includes(queryResult.definition.kind)) {
40
+ throw new Error(`This panel does not support queries of type '${queryResult.definition.kind}'. Supported query types: ${supportedQueryTypes.join(', ')}.`);
41
+ }
42
+ }
43
+ return /*#__PURE__*/ _jsx(PanelComponent, {
44
+ spec: spec,
45
+ contentDimensions: contentDimensions,
46
+ definition: definition,
47
+ queryResults: queryResults
48
+ });
49
+ }
50
+
51
+ //# sourceMappingURL=PanelPluginLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Panel/PanelPluginLoader.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { usePlugin, PanelProps } from '@perses-dev/plugin-system';\nimport { UnknownSpec, QueryDataType } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { Skeleton } from '@mui/material';\n\ninterface PanelPluginProps extends PanelProps<UnknownSpec, QueryDataType> {\n kind: string;\n}\n\n/**\n * PanelPluginLoader loads the panel plugin specified by the 'kind' prop from the plugin registry and\n * renders its PanelComponent.\n */\nexport function PanelPluginLoader(props: PanelPluginProps): ReactElement {\n const { kind, spec, contentDimensions, definition, queryResults } = props;\n const { data: plugin, isLoading: isPanelLoading } = usePlugin('Panel', kind, { throwOnError: true });\n const PanelComponent = plugin?.PanelComponent;\n const supportedQueryTypes = plugin?.supportedQueryTypes || [];\n\n // Show fullsize skeleton if the panel plugin is loading.\n if (isPanelLoading) {\n return (\n <Skeleton\n variant=\"rectangular\"\n width={contentDimensions?.width}\n height={contentDimensions?.height}\n aria-label=\"Loading...\"\n />\n );\n }\n\n if (PanelComponent === undefined) {\n throw new Error(`Missing PanelComponent from panel plugin for kind '${kind}'`);\n }\n\n for (const queryResult of queryResults) {\n if (!supportedQueryTypes.includes(queryResult.definition.kind)) {\n throw new Error(\n `This panel does not support queries of type '${queryResult.definition.kind}'. Supported query types: ${supportedQueryTypes.join(', ')}.`\n );\n }\n }\n\n return (\n <PanelComponent\n spec={spec}\n contentDimensions={contentDimensions}\n definition={definition}\n queryResults={queryResults}\n />\n );\n}\n"],"names":["usePlugin","Skeleton","PanelPluginLoader","props","kind","spec","contentDimensions","definition","queryResults","data","plugin","isLoading","isPanelLoading","throwOnError","PanelComponent","supportedQueryTypes","variant","width","height","aria-label","undefined","Error","queryResult","includes","join"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,SAAS,QAAoB,4BAA4B;AAGlE,SAASC,QAAQ,QAAQ,gBAAgB;AAMzC;;;CAGC,GACD,OAAO,SAASC,kBAAkBC,KAAuB;IACvD,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,iBAAiB,EAAEC,UAAU,EAAEC,YAAY,EAAE,GAAGL;IACpE,MAAM,EAAEM,MAAMC,MAAM,EAAEC,WAAWC,cAAc,EAAE,GAAGZ,UAAU,SAASI,MAAM;QAAES,cAAc;IAAK;IAClG,MAAMC,iBAAiBJ,QAAQI;IAC/B,MAAMC,sBAAsBL,QAAQK,uBAAuB,EAAE;IAE7D,yDAAyD;IACzD,IAAIH,gBAAgB;QAClB,qBACE,KAACX;YACCe,SAAQ;YACRC,OAAOX,mBAAmBW;YAC1BC,QAAQZ,mBAAmBY;YAC3BC,cAAW;;IAGjB;IAEA,IAAIL,mBAAmBM,WAAW;QAChC,MAAM,IAAIC,MAAM,CAAC,mDAAmD,EAAEjB,KAAK,CAAC,CAAC;IAC/E;IAEA,KAAK,MAAMkB,eAAed,aAAc;QACtC,IAAI,CAACO,oBAAoBQ,QAAQ,CAACD,YAAYf,UAAU,CAACH,IAAI,GAAG;YAC9D,MAAM,IAAIiB,MACR,CAAC,6CAA6C,EAAEC,YAAYf,UAAU,CAACH,IAAI,CAAC,0BAA0B,EAAEW,oBAAoBS,IAAI,CAAC,MAAM,CAAC,CAAC;QAE7I;IACF;IAEA,qBACE,KAACV;QACCT,MAAMA;QACNC,mBAAmBA;QACnBC,YAAYA;QACZC,cAAcA;;AAGpB"}
@@ -1,2 +1,3 @@
1
1
  export * from './Panel';
2
+ export * from './PanelPluginLoader';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC"}
@@ -11,5 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export * from './Panel';
14
+ export * from './PanelPluginLoader';
14
15
 
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Panel/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './Panel';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU"}
1
+ {"version":3,"sources":["../../../src/components/Panel/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './Panel';\nexport * from './PanelPluginLoader';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU;AACxB,cAAc,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"PanelDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAM/C;;GAEG;AACH,eAAO,MAAM,WAAW,QAAO,YA+C9B,CAAC"}
1
+ {"version":3,"file":"PanelDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAM/C;;GAEG;AACH,eAAO,MAAM,WAAW,QAAO,YAiD9B,CAAC"}