@perses-dev/dashboards 0.50.3 → 0.51.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) 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/EditJsonDialog/EditJsonDialog.js +5 -7
  8. package/dist/cjs/components/EmptyDashboard/EmptyDashboard.js +1 -1
  9. package/dist/cjs/components/GridLayout/GridItemContent.js +4 -3
  10. package/dist/cjs/components/GridLayout/GridLayout.js +5 -6
  11. package/dist/cjs/components/GridLayout/GridTitle.js +3 -3
  12. package/dist/cjs/{stories/decorators/constants.js → components/Panel/HeaderIconButton.js} +8 -20
  13. package/dist/cjs/components/Panel/Panel.js +16 -10
  14. package/dist/cjs/components/Panel/PanelActions.js +365 -0
  15. package/dist/cjs/components/Panel/PanelContent.js +59 -13
  16. package/dist/cjs/components/Panel/PanelHeader.js +14 -141
  17. package/dist/cjs/components/Panel/PanelLinks.js +5 -6
  18. package/dist/cjs/components/Panel/PanelPluginLoader.js +56 -0
  19. package/dist/cjs/components/Panel/index.js +1 -0
  20. package/dist/cjs/components/PanelDrawer/PanelDrawer.js +9 -6
  21. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +17 -33
  22. package/dist/cjs/components/PanelDrawer/PanelPreview.js +4 -5
  23. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  24. package/dist/cjs/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
  25. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -4
  26. package/dist/cjs/components/Variables/BuiltinVariableAccordions.js +5 -12
  27. package/dist/cjs/components/Variables/Variable.js +20 -35
  28. package/dist/cjs/components/Variables/VariableEditor.js +14 -23
  29. package/dist/cjs/components/Variables/VariableList.js +4 -6
  30. package/dist/cjs/constants/styles.js +12 -0
  31. package/dist/cjs/constants/user-interface-text.js +1 -0
  32. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +5 -6
  33. package/dist/cjs/context/DashboardProvider/DashboardProviderWithQueryParams.js +1 -1
  34. package/dist/cjs/context/DashboardProvider/common.js +2 -2
  35. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +13 -3
  36. package/dist/cjs/context/DashboardProvider/delete-panel-slice.js +1 -2
  37. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +3 -6
  38. package/dist/cjs/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  39. package/dist/cjs/context/DashboardProvider/panel-group-slice.js +3 -4
  40. package/dist/cjs/context/DashboardProvider/view-panel-slice.js +1 -2
  41. package/dist/cjs/context/DatasourceStoreProvider.js +15 -22
  42. package/dist/cjs/context/VariableProvider/VariableProvider.js +12 -20
  43. package/dist/cjs/context/VariableProvider/hydrationUtils.js +3 -6
  44. package/dist/cjs/context/VariableProvider/utils.js +2 -2
  45. package/dist/cjs/test/datasource-provider.js +1 -1
  46. package/dist/cjs/test/plugin-registry.js +8 -3
  47. package/dist/cjs/test/render.js +13 -11
  48. package/dist/cjs/views/ViewDashboard/DashboardApp.js +4 -3
  49. package/dist/cjs/views/ViewDashboard/ViewDashboard.js +5 -5
  50. package/dist/components/Dashboard/Dashboard.js +1 -3
  51. package/dist/components/Dashboard/Dashboard.js.map +1 -1
  52. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -0
  53. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  54. package/dist/components/DashboardToolbar/DashboardToolbar.js +3 -3
  55. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  56. package/dist/components/Datasources/DatasourceEditor.js +2 -5
  57. package/dist/components/Datasources/DatasourceEditor.js.map +1 -1
  58. package/dist/components/Datasources/EditDatasourcesButton.js +2 -5
  59. package/dist/components/Datasources/EditDatasourcesButton.js.map +1 -1
  60. package/dist/components/DeletePanelDialog/DeletePanelDialog.js +3 -1
  61. package/dist/components/DeletePanelDialog/DeletePanelDialog.js.map +1 -1
  62. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  63. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -4
  64. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  65. package/dist/components/DownloadButton/DownloadButton.js.map +1 -1
  66. package/dist/components/EditJsonDialog/EditJsonDialog.js +5 -7
  67. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  68. package/dist/components/EmptyDashboard/EmptyDashboard.js +1 -1
  69. package/dist/components/EmptyDashboard/EmptyDashboard.js.map +1 -1
  70. package/dist/components/GridLayout/GridContainer.js.map +1 -1
  71. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  72. package/dist/components/GridLayout/GridItemContent.js +5 -4
  73. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  74. package/dist/components/GridLayout/GridLayout.js +6 -7
  75. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  76. package/dist/components/GridLayout/GridTitle.js +3 -3
  77. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  78. package/dist/components/Panel/HeaderIconButton.d.ts +5 -0
  79. package/dist/components/Panel/HeaderIconButton.d.ts.map +1 -0
  80. package/dist/{stories/decorators/index.js → components/Panel/HeaderIconButton.js} +7 -6
  81. package/dist/components/Panel/HeaderIconButton.js.map +1 -0
  82. package/dist/components/Panel/Panel.d.ts +7 -2
  83. package/dist/components/Panel/Panel.d.ts.map +1 -1
  84. package/dist/components/Panel/Panel.js +22 -11
  85. package/dist/components/Panel/Panel.js.map +1 -1
  86. package/dist/components/Panel/PanelActions.d.ts +22 -0
  87. package/dist/components/Panel/PanelActions.d.ts.map +1 -0
  88. package/dist/components/Panel/PanelActions.js +352 -0
  89. package/dist/components/Panel/PanelActions.js.map +1 -0
  90. package/dist/components/Panel/PanelContent.d.ts +5 -4
  91. package/dist/components/Panel/PanelContent.d.ts.map +1 -1
  92. package/dist/components/Panel/PanelContent.js +61 -15
  93. package/dist/components/Panel/PanelContent.js.map +1 -1
  94. package/dist/components/Panel/PanelHeader.d.ts +7 -11
  95. package/dist/components/Panel/PanelHeader.d.ts.map +1 -1
  96. package/dist/components/Panel/PanelHeader.js +18 -140
  97. package/dist/components/Panel/PanelHeader.js.map +1 -1
  98. package/dist/components/Panel/PanelLinks.js +5 -6
  99. package/dist/components/Panel/PanelLinks.js.map +1 -1
  100. package/dist/components/Panel/PanelPluginLoader.d.ts +13 -0
  101. package/dist/components/Panel/PanelPluginLoader.d.ts.map +1 -0
  102. package/dist/components/Panel/PanelPluginLoader.js +51 -0
  103. package/dist/components/Panel/PanelPluginLoader.js.map +1 -0
  104. package/dist/components/Panel/index.d.ts +1 -0
  105. package/dist/components/Panel/index.d.ts.map +1 -1
  106. package/dist/components/Panel/index.js +1 -0
  107. package/dist/components/Panel/index.js.map +1 -1
  108. package/dist/components/PanelDrawer/PanelDrawer.d.ts.map +1 -1
  109. package/dist/components/PanelDrawer/PanelDrawer.js +10 -7
  110. package/dist/components/PanelDrawer/PanelDrawer.js.map +1 -1
  111. package/dist/components/PanelDrawer/PanelEditorForm.js +17 -33
  112. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  113. package/dist/components/PanelDrawer/PanelPreview.js +4 -5
  114. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  115. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +1 -1
  116. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  117. package/dist/components/QuerySummaryTable/QuerySummaryTable.js +3 -5
  118. package/dist/components/QuerySummaryTable/QuerySummaryTable.js.map +1 -1
  119. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +2 -4
  120. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -1
  121. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -1
  122. package/dist/components/Variables/BuiltinVariableAccordions.js +5 -12
  123. package/dist/components/Variables/BuiltinVariableAccordions.js.map +1 -1
  124. package/dist/components/Variables/Variable.js +20 -35
  125. package/dist/components/Variables/Variable.js.map +1 -1
  126. package/dist/components/Variables/VariableEditor.js +14 -23
  127. package/dist/components/Variables/VariableEditor.js.map +1 -1
  128. package/dist/components/Variables/VariableList.js +4 -6
  129. package/dist/components/Variables/VariableList.js.map +1 -1
  130. package/dist/constants/styles.d.ts +3 -0
  131. package/dist/constants/styles.d.ts.map +1 -1
  132. package/dist/constants/styles.js +3 -0
  133. package/dist/constants/styles.js.map +1 -1
  134. package/dist/constants/user-interface-text.d.ts +1 -0
  135. package/dist/constants/user-interface-text.d.ts.map +1 -1
  136. package/dist/constants/user-interface-text.js +1 -0
  137. package/dist/constants/user-interface-text.js.map +1 -1
  138. package/dist/context/DashboardProvider/DashboardProvider.js +5 -6
  139. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  140. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js +1 -1
  141. package/dist/context/DashboardProvider/DashboardProviderWithQueryParams.js.map +1 -1
  142. package/dist/context/DashboardProvider/common.js +2 -2
  143. package/dist/context/DashboardProvider/common.js.map +1 -1
  144. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +11 -2
  145. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  146. package/dist/context/DashboardProvider/dashboard-provider-api.js +13 -4
  147. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  148. package/dist/context/DashboardProvider/delete-panel-slice.js +1 -2
  149. package/dist/context/DashboardProvider/delete-panel-slice.js.map +1 -1
  150. package/dist/context/DashboardProvider/duplicate-panel-slice.js.map +1 -1
  151. package/dist/context/DashboardProvider/panel-editor-slice.js +3 -6
  152. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  153. package/dist/context/DashboardProvider/panel-group-editor-slice.js +1 -2
  154. package/dist/context/DashboardProvider/panel-group-editor-slice.js.map +1 -1
  155. package/dist/context/DashboardProvider/panel-group-slice.d.ts +1 -1
  156. package/dist/context/DashboardProvider/panel-group-slice.d.ts.map +1 -1
  157. package/dist/context/DashboardProvider/panel-group-slice.js +3 -4
  158. package/dist/context/DashboardProvider/panel-group-slice.js.map +1 -1
  159. package/dist/context/DashboardProvider/view-panel-slice.js +1 -2
  160. package/dist/context/DashboardProvider/view-panel-slice.js.map +1 -1
  161. package/dist/context/DatasourceStoreProvider.js +15 -22
  162. package/dist/context/DatasourceStoreProvider.js.map +1 -1
  163. package/dist/context/VariableProvider/VariableProvider.js +9 -12
  164. package/dist/context/VariableProvider/VariableProvider.js.map +1 -1
  165. package/dist/context/VariableProvider/hydrationUtils.js +3 -6
  166. package/dist/context/VariableProvider/hydrationUtils.js.map +1 -1
  167. package/dist/context/VariableProvider/query-params.js.map +1 -1
  168. package/dist/context/VariableProvider/utils.js +2 -2
  169. package/dist/context/VariableProvider/utils.js.map +1 -1
  170. package/dist/context/useDashboard.js.map +1 -1
  171. package/dist/test/datasource-provider.d.ts +1 -1
  172. package/dist/test/datasource-provider.d.ts.map +1 -1
  173. package/dist/test/datasource-provider.js +1 -1
  174. package/dist/test/datasource-provider.js.map +1 -1
  175. package/dist/test/plugin-registry.d.ts.map +1 -1
  176. package/dist/test/plugin-registry.js +8 -3
  177. package/dist/test/plugin-registry.js.map +1 -1
  178. package/dist/test/render.d.ts.map +1 -1
  179. package/dist/test/render.js +9 -7
  180. package/dist/test/render.js.map +1 -1
  181. package/dist/utils/panelUtils.js.map +1 -1
  182. package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -0
  183. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  184. package/dist/views/ViewDashboard/DashboardApp.js +4 -3
  185. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  186. package/dist/views/ViewDashboard/ViewDashboard.d.ts.map +1 -1
  187. package/dist/views/ViewDashboard/ViewDashboard.js +5 -5
  188. package/dist/views/ViewDashboard/ViewDashboard.js.map +1 -1
  189. package/package.json +9 -10
  190. package/dist/cjs/stories/decorators/WithDashboard.js +0 -41
  191. package/dist/cjs/stories/decorators/WithDatasourceStore.js +0 -39
  192. package/dist/cjs/stories/decorators/WithVariables.js +0 -37
  193. package/dist/cjs/stories/decorators/index.js +0 -33
  194. package/dist/stories/decorators/WithDashboard.js +0 -33
  195. package/dist/stories/decorators/WithDashboard.js.map +0 -1
  196. package/dist/stories/decorators/WithDatasourceStore.js +0 -31
  197. package/dist/stories/decorators/WithDatasourceStore.js.map +0 -1
  198. package/dist/stories/decorators/WithVariables.js +0 -29
  199. package/dist/stories/decorators/WithVariables.js.map +0 -1
  200. package/dist/stories/decorators/constants.js +0 -31
  201. package/dist/stories/decorators/constants.js.map +0 -1
  202. package/dist/stories/decorators/index.js.map +0 -1
@@ -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":"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"}
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,GAAGZ,GAAG,MAAM,CAAC;IACpC,MAAMa,uBAAuB,GAAGb,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,EAAE;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":"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"}
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":"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"}
@@ -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"}
@@ -12,7 +12,7 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useState } from 'react';
15
- import { Drawer } from '@perses-dev/components';
15
+ import { Drawer, ErrorAlert, ErrorBoundary } from '@perses-dev/components';
16
16
  import { usePanelEditor } from '../../context';
17
17
  import { PanelEditorForm } from './PanelEditorForm';
18
18
  /**
@@ -36,7 +36,7 @@ import { PanelEditorForm } from './PanelEditorForm';
36
36
  };
37
37
  // Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state
38
38
  const handleExited = ()=>{
39
- panelEditor === null || panelEditor === void 0 ? void 0 : panelEditor.close();
39
+ panelEditor?.close();
40
40
  setIsClosing(false);
41
41
  };
42
42
  // Disables closing on click out. This is a quick-win solution to avoid losing draft changes.
@@ -50,11 +50,14 @@ import { PanelEditorForm } from './PanelEditorForm';
50
50
  onExited: handleExited
51
51
  },
52
52
  "data-testid": "panel-editor",
53
- children: panelEditor && /*#__PURE__*/ _jsx(PanelEditorForm, {
54
- initialAction: panelEditor.mode,
55
- initialValues: panelEditor.initialValues,
56
- onSave: handleSave,
57
- onClose: handleClose
53
+ children: panelEditor && /*#__PURE__*/ _jsx(ErrorBoundary, {
54
+ FallbackComponent: ErrorAlert,
55
+ children: /*#__PURE__*/ _jsx(PanelEditorForm, {
56
+ initialAction: panelEditor.mode,
57
+ initialValues: panelEditor.initialValues,
58
+ onSave: handleSave,
59
+ onClose: handleClose
60
+ })
58
61
  })
59
62
  });
60
63
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n// 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 { ReactElement, useState } from 'react';\nimport { Drawer } from '@perses-dev/components';\nimport { PanelEditorValues } from '@perses-dev/core';\nimport { usePanelEditor } from '../../context';\nimport { PanelEditorForm } from './PanelEditorForm';\n\n/**\n * The Add/Edit panel drawer for editing a panel's options.\n */\nexport const PanelDrawer = (): ReactElement => {\n const panelEditor = usePanelEditor();\n\n // When the user clicks close, start closing but don't call the store yet to keep values stable during animtation\n const [isClosing, setIsClosing] = useState(false);\n\n // Drawer is open if we have a model and we're not transitioning out\n const isOpen = panelEditor !== undefined && isClosing === false;\n\n function handleSave(values: PanelEditorValues): void {\n // This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy\n if (panelEditor === undefined || values === undefined) {\n throw new Error('Cannot apply changes');\n }\n panelEditor.applyChanges(values);\n setIsClosing(true);\n }\n\n const handleClose = (): void => {\n setIsClosing(true);\n };\n\n // Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state\n const handleExited = (): void => {\n panelEditor?.close();\n setIsClosing(false);\n };\n\n // Disables closing on click out. This is a quick-win solution to avoid losing draft changes.\n // -> TODO find a way to enable closing by clicking-out in edit view, with a discard confirmation modal popping up\n const handleClickOut = (): void => {\n /* do nothing */\n };\n\n return (\n <Drawer isOpen={isOpen} onClose={handleClickOut} SlideProps={{ onExited: handleExited }} data-testid=\"panel-editor\">\n {/* When the drawer is opened, we should have panel editor state (this also ensures the form state gets reset between opens) */}\n {panelEditor && (\n <PanelEditorForm\n initialAction={panelEditor.mode}\n initialValues={panelEditor.initialValues}\n onSave={handleSave}\n onClose={handleClose}\n />\n )}\n </Drawer>\n );\n};\n"],"names":["useState","Drawer","usePanelEditor","PanelEditorForm","PanelDrawer","panelEditor","isClosing","setIsClosing","isOpen","undefined","handleSave","values","Error","applyChanges","handleClose","handleExited","close","handleClickOut","onClose","SlideProps","onExited","data-testid","initialAction","mode","initialValues","onSave"],"mappings":"AAAA,uDAAuD,GACvD,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,eAAe,QAAQ,oBAAoB;AAEpD;;CAEC,GACD,OAAO,MAAMC,cAAc;IACzB,MAAMC,cAAcH;IAEpB,iHAAiH;IACjH,MAAM,CAACI,WAAWC,aAAa,GAAGP,SAAS;IAE3C,oEAAoE;IACpE,MAAMQ,SAASH,gBAAgBI,aAAaH,cAAc;IAE1D,SAASI,WAAWC,MAAyB;QAC3C,kHAAkH;QAClH,IAAIN,gBAAgBI,aAAaE,WAAWF,WAAW;YACrD,MAAM,IAAIG,MAAM;QAClB;QACAP,YAAYQ,YAAY,CAACF;QACzBJ,aAAa;IACf;IAEA,MAAMO,cAAc;QAClBP,aAAa;IACf;IAEA,6GAA6G;IAC7G,MAAMQ,eAAe;QACnBV,wBAAAA,kCAAAA,YAAaW,KAAK;QAClBT,aAAa;IACf;IAEA,6FAA6F;IAC7F,kHAAkH;IAClH,MAAMU,iBAAiB;IACrB,cAAc,GAChB;IAEA,qBACE,KAAChB;QAAOO,QAAQA;QAAQU,SAASD;QAAgBE,YAAY;YAAEC,UAAUL;QAAa;QAAGM,eAAY;kBAElGhB,6BACC,KAACF;YACCmB,eAAejB,YAAYkB,IAAI;YAC/BC,eAAenB,YAAYmB,aAAa;YACxCC,QAAQf;YACRQ,SAASJ;;;AAKnB,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/PanelDrawer/PanelDrawer.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n// 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 { ReactElement, useState } from 'react';\nimport { Drawer, ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { PanelEditorValues } from '@perses-dev/core';\nimport { usePanelEditor } from '../../context';\nimport { PanelEditorForm } from './PanelEditorForm';\n\n/**\n * The Add/Edit panel drawer for editing a panel's options.\n */\nexport const PanelDrawer = (): ReactElement => {\n const panelEditor = usePanelEditor();\n\n // When the user clicks close, start closing but don't call the store yet to keep values stable during animtation\n const [isClosing, setIsClosing] = useState(false);\n\n // Drawer is open if we have a model and we're not transitioning out\n const isOpen = panelEditor !== undefined && isClosing === false;\n\n function handleSave(values: PanelEditorValues): void {\n // This shouldn't happen since we don't render the submit button until we have a model, but check to make TS happy\n if (panelEditor === undefined || values === undefined) {\n throw new Error('Cannot apply changes');\n }\n panelEditor.applyChanges(values);\n setIsClosing(true);\n }\n\n const handleClose = (): void => {\n setIsClosing(true);\n };\n\n // Don't call closeDrawer on the store until the Drawer has completely transitioned out and reset close state\n const handleExited = (): void => {\n panelEditor?.close();\n setIsClosing(false);\n };\n\n // Disables closing on click out. This is a quick-win solution to avoid losing draft changes.\n // -> TODO find a way to enable closing by clicking-out in edit view, with a discard confirmation modal popping up\n const handleClickOut = (): void => {\n /* do nothing */\n };\n\n return (\n <Drawer isOpen={isOpen} onClose={handleClickOut} SlideProps={{ onExited: handleExited }} data-testid=\"panel-editor\">\n {/* When the drawer is opened, we should have panel editor state (this also ensures the form state gets reset between opens) */}\n {panelEditor && (\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PanelEditorForm\n initialAction={panelEditor.mode}\n initialValues={panelEditor.initialValues}\n onSave={handleSave}\n onClose={handleClose}\n />\n </ErrorBoundary>\n )}\n </Drawer>\n );\n};\n"],"names":["useState","Drawer","ErrorAlert","ErrorBoundary","usePanelEditor","PanelEditorForm","PanelDrawer","panelEditor","isClosing","setIsClosing","isOpen","undefined","handleSave","values","Error","applyChanges","handleClose","handleExited","close","handleClickOut","onClose","SlideProps","onExited","data-testid","FallbackComponent","initialAction","mode","initialValues","onSave"],"mappings":"AAAA,uDAAuD,GACvD,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SAASC,MAAM,EAAEC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAE3E,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,eAAe,QAAQ,oBAAoB;AAEpD;;CAEC,GACD,OAAO,MAAMC,cAAc;IACzB,MAAMC,cAAcH;IAEpB,iHAAiH;IACjH,MAAM,CAACI,WAAWC,aAAa,GAAGT,SAAS;IAE3C,oEAAoE;IACpE,MAAMU,SAASH,gBAAgBI,aAAaH,cAAc;IAE1D,SAASI,WAAWC,MAAyB;QAC3C,kHAAkH;QAClH,IAAIN,gBAAgBI,aAAaE,WAAWF,WAAW;YACrD,MAAM,IAAIG,MAAM;QAClB;QACAP,YAAYQ,YAAY,CAACF;QACzBJ,aAAa;IACf;IAEA,MAAMO,cAAc;QAClBP,aAAa;IACf;IAEA,6GAA6G;IAC7G,MAAMQ,eAAe;QACnBV,aAAaW;QACbT,aAAa;IACf;IAEA,6FAA6F;IAC7F,kHAAkH;IAClH,MAAMU,iBAAiB;IACrB,cAAc,GAChB;IAEA,qBACE,KAAClB;QAAOS,QAAQA;QAAQU,SAASD;QAAgBE,YAAY;YAAEC,UAAUL;QAAa;QAAGM,eAAY;kBAElGhB,6BACC,KAACJ;YAAcqB,mBAAmBtB;sBAChC,cAAA,KAACG;gBACCoB,eAAelB,YAAYmB,IAAI;gBAC/BC,eAAepB,YAAYoB,aAAa;gBACxCC,QAAQhB;gBACRQ,SAASJ;;;;AAMrB,EAAE"}
@@ -161,22 +161,19 @@ export function PanelEditorForm(props) {
161
161
  children: /*#__PURE__*/ _jsx(Controller, {
162
162
  control: form.control,
163
163
  name: "panelDefinition.spec.display.name",
164
- render: ({ field, fieldState })=>{
165
- var _fieldState_error;
166
- return /*#__PURE__*/ _jsx(TextField, {
164
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
167
165
  ...field,
168
166
  required: true,
169
167
  fullWidth: true,
170
168
  label: "Name",
171
169
  error: !!fieldState.error,
172
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
173
- value: watchedName !== null && watchedName !== void 0 ? watchedName : '',
170
+ helperText: fieldState.error?.message,
171
+ value: watchedName ?? '',
174
172
  onChange: (event)=>{
175
173
  field.onChange(event);
176
174
  setName(event.target.value);
177
175
  }
178
- });
179
- }
176
+ })
180
177
  })
181
178
  }),
182
179
  /*#__PURE__*/ _jsx(Grid, {
@@ -185,28 +182,22 @@ export function PanelEditorForm(props) {
185
182
  children: /*#__PURE__*/ _jsx(Controller, {
186
183
  control: form.control,
187
184
  name: "groupId",
188
- render: ({ field, fieldState })=>{
189
- var _fieldState_error;
190
- return /*#__PURE__*/ _jsx(TextField, {
185
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
191
186
  select: true,
192
187
  ...field,
193
188
  required: true,
194
189
  fullWidth: true,
195
190
  label: "Group",
196
191
  error: !!fieldState.error,
197
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
192
+ helperText: fieldState.error?.message,
198
193
  onChange: (event)=>{
199
194
  field.onChange(event);
200
195
  },
201
- children: panelGroups.map((panelGroup, index)=>{
202
- var _panelGroup_title;
203
- return /*#__PURE__*/ _jsx(MenuItem, {
196
+ children: panelGroups.map((panelGroup, index)=>/*#__PURE__*/ _jsx(MenuItem, {
204
197
  value: panelGroup.id,
205
- children: (_panelGroup_title = panelGroup.title) !== null && _panelGroup_title !== void 0 ? _panelGroup_title : `Group ${index + 1}`
206
- }, panelGroup.id);
207
- })
208
- });
209
- }
198
+ children: panelGroup.title ?? `Group ${index + 1}`
199
+ }, panelGroup.id))
200
+ })
210
201
  })
211
202
  }),
212
203
  /*#__PURE__*/ _jsx(Grid, {
@@ -215,21 +206,18 @@ export function PanelEditorForm(props) {
215
206
  children: /*#__PURE__*/ _jsx(Controller, {
216
207
  control: form.control,
217
208
  name: "panelDefinition.spec.display.description",
218
- render: ({ field, fieldState })=>{
219
- var _fieldState_error;
220
- return /*#__PURE__*/ _jsx(TextField, {
209
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(TextField, {
221
210
  ...field,
222
211
  fullWidth: true,
223
212
  label: "Description",
224
213
  error: !!fieldState.error,
225
- helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
226
- value: watchedDescription !== null && watchedDescription !== void 0 ? watchedDescription : '',
214
+ helperText: fieldState.error?.message,
215
+ value: watchedDescription ?? '',
227
216
  onChange: (event)=>{
228
217
  field.onChange(event);
229
218
  setDescription(event.target.value);
230
219
  }
231
- });
232
- }
220
+ })
233
221
  })
234
222
  }),
235
223
  /*#__PURE__*/ _jsx(Grid, {
@@ -238,10 +226,7 @@ export function PanelEditorForm(props) {
238
226
  children: /*#__PURE__*/ _jsx(Controller, {
239
227
  control: form.control,
240
228
  name: "panelDefinition.spec.plugin.kind",
241
- render: ({ field, fieldState })=>{
242
- var _pluginEditor_error, _fieldState_error;
243
- var _pluginEditor_error_message;
244
- return /*#__PURE__*/ _jsx(PluginKindSelect, {
229
+ render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(PluginKindSelect, {
245
230
  ...field,
246
231
  pluginTypes: [
247
232
  'Panel'
@@ -251,7 +236,7 @@ export function PanelEditorForm(props) {
251
236
  label: "Type",
252
237
  disabled: pluginEditor.isLoading,
253
238
  error: !!pluginEditor.error || !!fieldState.error,
254
- helperText: (_pluginEditor_error_message = (_pluginEditor_error = pluginEditor.error) === null || _pluginEditor_error === void 0 ? void 0 : _pluginEditor_error.message) !== null && _pluginEditor_error_message !== void 0 ? _pluginEditor_error_message : (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
239
+ helperText: pluginEditor.error?.message ?? fieldState.error?.message,
255
240
  value: {
256
241
  type: 'Panel',
257
242
  kind: watchedPluginKind
@@ -260,8 +245,7 @@ export function PanelEditorForm(props) {
260
245
  field.onChange(event.kind);
261
246
  pluginEditor.onSelectionChange(event);
262
247
  }
263
- });
264
- }
248
+ })
265
249
  })
266
250
  }),
267
251
  /*#__PURE__*/ _jsxs(Grid, {