@perses-dev/dashboards 0.0.0-snapshot-color-palette-gen-test-0ebddd6 → 0.0.0-snapshot-saving-defaults-refinements-1b25cec

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 (212) hide show
  1. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +79 -0
  2. package/dist/cjs/{stories/decorators/WithQueryParams.js → components/DashboardStickyToolbar/index.js} +11 -12
  3. package/dist/cjs/components/DashboardToolbar/DashboardToolbar.js +8 -24
  4. package/dist/cjs/components/EditJsonButton/EditJsonButton.js +1 -0
  5. package/dist/cjs/components/EditJsonDialog/EditJsonDialog.js +5 -0
  6. package/dist/cjs/components/GridLayout/GridItemContent.js +22 -4
  7. package/dist/cjs/components/GridLayout/GridLayout.js +31 -2
  8. package/dist/cjs/components/GridLayout/GridTitle.js +30 -9
  9. package/dist/cjs/components/Panel/Panel.js +2 -2
  10. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +41 -34
  11. package/dist/cjs/components/PanelDrawer/PanelPreview.js +32 -18
  12. package/dist/cjs/components/PanelDrawer/usePanelEditor.js +87 -0
  13. package/dist/cjs/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +92 -0
  14. package/dist/cjs/components/SaveChangesConfirmationDialog/index.js +28 -0
  15. package/dist/cjs/components/SaveDashboardButton/SaveDashboardButton.js +81 -0
  16. package/dist/cjs/components/SaveDashboardButton/index.js +28 -0
  17. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +5 -5
  18. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +124 -198
  19. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +178 -0
  20. package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -0
  21. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +7 -8
  22. package/dist/cjs/components/Variables/VariableList.js +16 -55
  23. package/dist/cjs/components/Variables/index.js +1 -0
  24. package/dist/cjs/components/index.js +3 -0
  25. package/dist/cjs/context/DashboardProvider/DashboardProvider.js +9 -8
  26. package/dist/cjs/context/DashboardProvider/common.js +26 -6
  27. package/dist/cjs/context/DashboardProvider/dashboard-provider-api.js +13 -4
  28. package/dist/cjs/context/DashboardProvider/index.js +1 -0
  29. package/dist/cjs/context/DashboardProvider/panel-editor-slice.js +8 -32
  30. package/dist/cjs/context/DashboardProvider/save-changes-dialog-slice.js +33 -0
  31. package/dist/cjs/context/TemplateVariableProvider/TemplateVariableProvider.js +56 -7
  32. package/dist/cjs/context/TemplateVariableProvider/hydrationUtils.js +2 -0
  33. package/dist/cjs/context/TemplateVariableProvider/utils.js +44 -0
  34. package/dist/cjs/context/useDashboard.js +4 -4
  35. package/dist/cjs/stories/decorators/WithDatasourceStore.js +2 -47
  36. package/dist/cjs/stories/decorators/index.js +0 -4
  37. package/dist/cjs/test/datasource-provider.js +70 -0
  38. package/dist/cjs/test/index.js +1 -0
  39. package/dist/cjs/test/plugin-registry.js +11 -5
  40. package/dist/cjs/test/render.js +35 -13
  41. package/dist/cjs/test/testDashboard.js +79 -79
  42. package/dist/cjs/utils/index.js +1 -0
  43. package/dist/cjs/{stories/decorators/WithQueryClient.js → utils/time.js} +9 -11
  44. package/dist/cjs/views/ViewDashboard/DashboardApp.js +2 -1
  45. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts +9 -0
  46. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -0
  47. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +68 -0
  48. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -0
  49. package/dist/components/DashboardStickyToolbar/index.d.ts +2 -0
  50. package/dist/components/DashboardStickyToolbar/index.d.ts.map +1 -0
  51. package/dist/{stories/decorators/WithQueryClient.js → components/DashboardStickyToolbar/index.js} +2 -10
  52. package/dist/components/DashboardStickyToolbar/index.js.map +1 -0
  53. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts +2 -2
  54. package/dist/components/DashboardToolbar/DashboardToolbar.d.ts.map +1 -1
  55. package/dist/components/DashboardToolbar/DashboardToolbar.js +10 -26
  56. package/dist/components/DashboardToolbar/DashboardToolbar.js.map +1 -1
  57. package/dist/components/EditJsonButton/EditJsonButton.js +1 -0
  58. package/dist/components/EditJsonButton/EditJsonButton.js.map +1 -1
  59. package/dist/components/EditJsonDialog/EditJsonDialog.d.ts.map +1 -1
  60. package/dist/components/EditJsonDialog/EditJsonDialog.js +5 -0
  61. package/dist/components/EditJsonDialog/EditJsonDialog.js.map +1 -1
  62. package/dist/components/GridLayout/GridItemContent.d.ts +1 -0
  63. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  64. package/dist/components/GridLayout/GridItemContent.js +22 -4
  65. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  66. package/dist/components/GridLayout/GridLayout.d.ts.map +1 -1
  67. package/dist/components/GridLayout/GridLayout.js +31 -2
  68. package/dist/components/GridLayout/GridLayout.js.map +1 -1
  69. package/dist/components/GridLayout/GridTitle.d.ts.map +1 -1
  70. package/dist/components/GridLayout/GridTitle.js +30 -9
  71. package/dist/components/GridLayout/GridTitle.js.map +1 -1
  72. package/dist/components/Panel/Panel.d.ts +1 -1
  73. package/dist/components/Panel/Panel.d.ts.map +1 -1
  74. package/dist/components/Panel/Panel.js +3 -3
  75. package/dist/components/Panel/Panel.js.map +1 -1
  76. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  77. package/dist/components/PanelDrawer/PanelEditorForm.js +42 -35
  78. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  79. package/dist/components/PanelDrawer/PanelPreview.d.ts +1 -1
  80. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  81. package/dist/components/PanelDrawer/PanelPreview.js +32 -18
  82. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  83. package/dist/components/PanelDrawer/usePanelEditor.d.ts +15 -0
  84. package/dist/components/PanelDrawer/usePanelEditor.d.ts.map +1 -0
  85. package/dist/components/PanelDrawer/usePanelEditor.js +84 -0
  86. package/dist/components/PanelDrawer/usePanelEditor.js.map +1 -0
  87. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts +3 -0
  88. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.d.ts.map +1 -0
  89. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js +86 -0
  90. package/dist/components/SaveChangesConfirmationDialog/SaveChangesConfirmationDialog.js.map +1 -0
  91. package/dist/components/SaveChangesConfirmationDialog/index.d.ts +2 -0
  92. package/dist/components/SaveChangesConfirmationDialog/index.d.ts.map +1 -0
  93. package/dist/{stories/decorators/WithQueryParams.js → components/SaveChangesConfirmationDialog/index.js} +2 -10
  94. package/dist/components/SaveChangesConfirmationDialog/index.js.map +1 -0
  95. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts +10 -0
  96. package/dist/components/SaveDashboardButton/SaveDashboardButton.d.ts.map +1 -0
  97. package/dist/components/SaveDashboardButton/SaveDashboardButton.js +75 -0
  98. package/dist/components/SaveDashboardButton/SaveDashboardButton.js.map +1 -0
  99. package/dist/components/SaveDashboardButton/index.d.ts +2 -0
  100. package/dist/components/SaveDashboardButton/index.d.ts.map +1 -0
  101. package/dist/components/SaveDashboardButton/index.js +15 -0
  102. package/dist/components/SaveDashboardButton/index.js.map +1 -0
  103. package/dist/components/TimeRangeControls/TimeRangeControls.js +6 -6
  104. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  105. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +4 -2
  106. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  107. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +127 -196
  108. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  109. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +16 -0
  110. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -0
  111. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +122 -0
  112. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -0
  113. package/dist/components/Variables/VariableEditorForm/index.d.ts +1 -0
  114. package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -1
  115. package/dist/components/Variables/VariableEditorForm/index.js +1 -0
  116. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  117. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  118. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +7 -8
  119. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  120. package/dist/components/Variables/VariableList.d.ts +1 -7
  121. package/dist/components/Variables/VariableList.d.ts.map +1 -1
  122. package/dist/components/Variables/VariableList.js +18 -52
  123. package/dist/components/Variables/VariableList.js.map +1 -1
  124. package/dist/components/Variables/index.d.ts +1 -0
  125. package/dist/components/Variables/index.d.ts.map +1 -1
  126. package/dist/components/Variables/index.js +1 -0
  127. package/dist/components/Variables/index.js.map +1 -1
  128. package/dist/components/index.d.ts +3 -0
  129. package/dist/components/index.d.ts.map +1 -1
  130. package/dist/components/index.js +3 -0
  131. package/dist/components/index.js.map +1 -1
  132. package/dist/context/DashboardProvider/DashboardProvider.d.ts +4 -3
  133. package/dist/context/DashboardProvider/DashboardProvider.d.ts.map +1 -1
  134. package/dist/context/DashboardProvider/DashboardProvider.js +9 -8
  135. package/dist/context/DashboardProvider/DashboardProvider.js.map +1 -1
  136. package/dist/context/DashboardProvider/common.d.ts +3 -0
  137. package/dist/context/DashboardProvider/common.d.ts.map +1 -1
  138. package/dist/context/DashboardProvider/common.js +17 -2
  139. package/dist/context/DashboardProvider/common.js.map +1 -1
  140. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts +6 -1
  141. package/dist/context/DashboardProvider/dashboard-provider-api.d.ts.map +1 -1
  142. package/dist/context/DashboardProvider/dashboard-provider-api.js +11 -3
  143. package/dist/context/DashboardProvider/dashboard-provider-api.js.map +1 -1
  144. package/dist/context/DashboardProvider/index.d.ts +1 -0
  145. package/dist/context/DashboardProvider/index.d.ts.map +1 -1
  146. package/dist/context/DashboardProvider/index.js +1 -0
  147. package/dist/context/DashboardProvider/index.js.map +1 -1
  148. package/dist/context/DashboardProvider/panel-editor-slice.d.ts +3 -6
  149. package/dist/context/DashboardProvider/panel-editor-slice.d.ts.map +1 -1
  150. package/dist/context/DashboardProvider/panel-editor-slice.js +9 -33
  151. package/dist/context/DashboardProvider/panel-editor-slice.js.map +1 -1
  152. package/dist/context/DashboardProvider/save-changes-dialog-slice.d.ts +15 -0
  153. package/dist/context/DashboardProvider/save-changes-dialog-slice.d.ts.map +1 -0
  154. package/dist/context/DashboardProvider/save-changes-dialog-slice.js +27 -0
  155. package/dist/context/DashboardProvider/save-changes-dialog-slice.js.map +1 -0
  156. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts +10 -0
  157. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.d.ts.map +1 -1
  158. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js +51 -7
  159. package/dist/context/TemplateVariableProvider/TemplateVariableProvider.js.map +1 -1
  160. package/dist/context/TemplateVariableProvider/hydrationUtils.d.ts.map +1 -1
  161. package/dist/context/TemplateVariableProvider/hydrationUtils.js +2 -0
  162. package/dist/context/TemplateVariableProvider/hydrationUtils.js.map +1 -1
  163. package/dist/context/TemplateVariableProvider/utils.d.ts +7 -0
  164. package/dist/context/TemplateVariableProvider/utils.d.ts.map +1 -0
  165. package/dist/context/TemplateVariableProvider/utils.js +40 -0
  166. package/dist/context/TemplateVariableProvider/utils.js.map +1 -0
  167. package/dist/context/useDashboard.d.ts.map +1 -1
  168. package/dist/context/useDashboard.js +4 -4
  169. package/dist/context/useDashboard.js.map +1 -1
  170. package/dist/stories/decorators/WithDashboard.js.map +1 -1
  171. package/dist/stories/decorators/WithDatasourceStore.js +1 -46
  172. package/dist/stories/decorators/WithDatasourceStore.js.map +1 -1
  173. package/dist/stories/decorators/WithTemplateVariables.js.map +1 -1
  174. package/dist/stories/decorators/index.js +0 -4
  175. package/dist/stories/decorators/index.js.map +1 -1
  176. package/dist/test/datasource-provider.d.ts +6 -0
  177. package/dist/test/datasource-provider.d.ts.map +1 -0
  178. package/dist/test/datasource-provider.js +60 -0
  179. package/dist/test/datasource-provider.js.map +1 -0
  180. package/dist/test/index.d.ts +1 -0
  181. package/dist/test/index.d.ts.map +1 -1
  182. package/dist/test/index.js +1 -0
  183. package/dist/test/index.js.map +1 -1
  184. package/dist/test/plugin-registry.d.ts.map +1 -1
  185. package/dist/test/plugin-registry.js +11 -5
  186. package/dist/test/plugin-registry.js.map +1 -1
  187. package/dist/test/render.d.ts.map +1 -1
  188. package/dist/test/render.js +35 -13
  189. package/dist/test/render.js.map +1 -1
  190. package/dist/test/testDashboard.js +79 -79
  191. package/dist/test/testDashboard.js.map +1 -1
  192. package/dist/utils/index.d.ts +1 -0
  193. package/dist/utils/index.d.ts.map +1 -1
  194. package/dist/utils/index.js +1 -0
  195. package/dist/utils/index.js.map +1 -1
  196. package/dist/utils/time.d.ts +5 -0
  197. package/dist/utils/time.d.ts.map +1 -0
  198. package/dist/utils/time.js +23 -0
  199. package/dist/utils/time.js.map +1 -0
  200. package/dist/views/ViewDashboard/DashboardApp.d.ts +2 -1
  201. package/dist/views/ViewDashboard/DashboardApp.d.ts.map +1 -1
  202. package/dist/views/ViewDashboard/DashboardApp.js +3 -2
  203. package/dist/views/ViewDashboard/DashboardApp.js.map +1 -1
  204. package/package.json +7 -6
  205. package/dist/cjs/stories/decorators/WithPluginRegistry.js +0 -91
  206. package/dist/cjs/stories/decorators/WithTimeRange.js +0 -38
  207. package/dist/stories/decorators/WithPluginRegistry.js +0 -46
  208. package/dist/stories/decorators/WithPluginRegistry.js.map +0 -1
  209. package/dist/stories/decorators/WithQueryClient.js.map +0 -1
  210. package/dist/stories/decorators/WithQueryParams.js.map +0 -1
  211. package/dist/stories/decorators/WithTimeRange.js +0 -32
  212. package/dist/stories/decorators/WithTimeRange.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/ViewDashboard/DashboardApp.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 { useState } from 'react';\nimport { Box } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { DashboardResource } from '@perses-dev/core';\nimport {\n PanelDrawer,\n Dashboard,\n PanelGroupDialog,\n DeletePanelGroupDialog,\n DiscardChangesConfirmationDialog,\n DashboardToolbar,\n DeletePanelDialog,\n EmptyDashboardProps,\n EditJsonDialog,\n} from '../../components';\nimport { useDashboard, useDiscardChangesConfirmationDialog, useEditMode } from '../../context';\n\nexport interface DashboardAppProps {\n emptyDashboardProps?: Partial<EmptyDashboardProps>;\n dashboardResource: DashboardResource;\n dashboardTitleComponent?: JSX.Element;\n\n onSave?: (entity: DashboardResource) => Promise<DashboardResource>;\n onDiscard?: (entity: DashboardResource) => void;\n initialVariableIsSticky?: boolean;\n isReadonly: boolean;\n}\n\nexport const DashboardApp = (props: DashboardAppProps) => {\n const {\n dashboardResource,\n dashboardTitleComponent,\n emptyDashboardProps,\n onSave,\n onDiscard,\n initialVariableIsSticky,\n isReadonly,\n } = props;\n const { setEditMode } = useEditMode();\n const { dashboard, setDashboard } = useDashboard();\n const [originalDashboard, setOriginalDashboard] = useState<DashboardResource | undefined>(undefined);\n\n const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } =\n useDiscardChangesConfirmationDialog();\n\n const handleDiscardChanges = () => {\n // Reset to the original spec and exit edit mode\n if (originalDashboard) {\n setDashboard(originalDashboard);\n }\n setEditMode(false);\n closeDiscardChangesConfirmationDialog();\n if (onDiscard) {\n onDiscard(dashboard);\n }\n };\n\n const onEditButtonClick = () => {\n setEditMode(true);\n setOriginalDashboard(dashboard);\n };\n\n const onCancelButtonClick = () => {\n // check if dashboard has been modified\n if (JSON.stringify(dashboard) === JSON.stringify(originalDashboard)) {\n setEditMode(false);\n } else {\n openDiscardChangesConfirmationDialog({\n onDiscardChanges: () => {\n handleDiscardChanges();\n },\n onCancel: () => {\n closeDiscardChangesConfirmationDialog();\n },\n });\n }\n };\n\n return (\n <Box\n sx={{\n flexGrow: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <DashboardToolbar\n dashboardName={dashboardResource.metadata.name}\n dashboardTitleComponent={dashboardTitleComponent}\n initialVariableIsSticky={initialVariableIsSticky}\n onSave={onSave}\n isReadonly={isReadonly}\n onEditButtonClick={onEditButtonClick}\n onCancelButtonClick={onCancelButtonClick}\n />\n <Box sx={{ padding: (theme) => theme.spacing(2), height: '100%' }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Dashboard\n emptyDashboardProps={{\n onEditButtonClick,\n ...emptyDashboardProps,\n }}\n />\n </ErrorBoundary>\n <PanelDrawer />\n <PanelGroupDialog />\n <DeletePanelGroupDialog />\n <DeletePanelDialog />\n <DiscardChangesConfirmationDialog />\n <EditJsonDialog />\n </Box>\n </Box>\n );\n};\n"],"names":["useState","Box","ErrorAlert","ErrorBoundary","PanelDrawer","Dashboard","PanelGroupDialog","DeletePanelGroupDialog","DiscardChangesConfirmationDialog","DashboardToolbar","DeletePanelDialog","EditJsonDialog","useDashboard","useDiscardChangesConfirmationDialog","useEditMode","DashboardApp","props","dashboardResource","dashboardTitleComponent","emptyDashboardProps","onSave","onDiscard","initialVariableIsSticky","isReadonly","setEditMode","dashboard","setDashboard","originalDashboard","setOriginalDashboard","undefined","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","handleDiscardChanges","onEditButtonClick","onCancelButtonClick","JSON","stringify","onDiscardChanges","onCancel","sx","flexGrow","overflowX","overflowY","display","flexDirection","dashboardName","metadata","name","padding","theme","spacing","height","FallbackComponent"],"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;AAAA,SAASA,QAAQ,QAAQ,OAAO,CAAC;AACjC,SAASC,GAAG,QAAQ,eAAe,CAAC;AACpC,SAASC,UAAU,EAAEC,aAAa,QAAQ,wBAAwB,CAAC;AAEnE,SACEC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,sBAAsB,EACtBC,gCAAgC,EAChCC,gBAAgB,EAChBC,iBAAiB,EAEjBC,cAAc,QACT,kBAAkB,CAAC;AAC1B,SAASC,YAAY,EAAEC,mCAAmC,EAAEC,WAAW,QAAQ,eAAe,CAAC;AAa/F,OAAO,MAAMC,YAAY,GAAG,CAACC,KAAwB,GAAK;IACxD,MAAM,EACJC,iBAAiB,CAAA,EACjBC,uBAAuB,CAAA,EACvBC,mBAAmB,CAAA,EACnBC,MAAM,CAAA,EACNC,SAAS,CAAA,EACTC,uBAAuB,CAAA,EACvBC,UAAU,CAAA,IACX,GAAGP,KAAK,AAAC;IACV,MAAM,EAAEQ,WAAW,CAAA,EAAE,GAAGV,WAAW,EAAE,AAAC;IACtC,MAAM,EAAEW,SAAS,CAAA,EAAEC,YAAY,CAAA,EAAE,GAAGd,YAAY,EAAE,AAAC;IACnD,MAAM,CAACe,iBAAiB,EAAEC,oBAAoB,CAAC,GAAG5B,QAAQ,CAAgC6B,SAAS,CAAC,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uBAAuB;gBAChDF,MAAM,EAAEA,MAAM;gBACdG,UAAU,EAAEA,UAAU;gBACtBU,iBAAiB,EAAEA,iBAAiB;gBACpCC,mBAAmB,EAAEA,mBAAmB;cACxC;0BACF,MAACjC,GAAG;gBAACsC,EAAE,EAAE;oBAAES,OAAO,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC;oBAAEC,MAAM,EAAE,MAAM;iBAAE;;kCAC/D,KAAChD,aAAa;wBAACiD,iBAAiB,EAAElD,UAAU;kCAC1C,cAAA,KAACG,SAAS;4BACRc,mBAAmB,EAAE;gCACnBc,iBAAiB;gCACjB,GAAGd,mBAAmB;6BACvB;0BACD;sBACY;kCAChB,KAACf,WAAW,KAAG;kCACf,KAACE,gBAAgB,KAAG;kCACpB,KAACC,sBAAsB,KAAG;kCAC1B,KAACG,iBAAiB,KAAG;kCACrB,KAACF,gCAAgC,KAAG;kCACpC,KAACG,cAAc,KAAG;;cACd;;MACF,CACN;AACJ,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../../src/views/ViewDashboard/DashboardApp.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 { useState } from 'react';\nimport { Box } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { DashboardResource } from '@perses-dev/core';\nimport {\n PanelDrawer,\n Dashboard,\n PanelGroupDialog,\n DeletePanelGroupDialog,\n DiscardChangesConfirmationDialog,\n DashboardToolbar,\n DeletePanelDialog,\n EmptyDashboardProps,\n EditJsonDialog,\n SaveChangesConfirmationDialog,\n} from '../../components';\nimport { OnSaveDashboard, useDashboard, useDiscardChangesConfirmationDialog, useEditMode } from '../../context';\n\nexport interface DashboardAppProps {\n emptyDashboardProps?: Partial<EmptyDashboardProps>;\n dashboardResource: DashboardResource;\n dashboardTitleComponent?: JSX.Element;\n onSave?: OnSaveDashboard;\n onDiscard?: (entity: DashboardResource) => void;\n initialVariableIsSticky?: boolean;\n isReadonly: boolean;\n}\n\nexport const DashboardApp = (props: DashboardAppProps) => {\n const {\n dashboardResource,\n dashboardTitleComponent,\n emptyDashboardProps,\n onSave,\n onDiscard,\n initialVariableIsSticky,\n isReadonly,\n } = props;\n const { setEditMode } = useEditMode();\n const { dashboard, setDashboard } = useDashboard();\n const [originalDashboard, setOriginalDashboard] = useState<DashboardResource | undefined>(undefined);\n\n const { openDiscardChangesConfirmationDialog, closeDiscardChangesConfirmationDialog } =\n useDiscardChangesConfirmationDialog();\n\n const handleDiscardChanges = () => {\n // Reset to the original spec and exit edit mode\n if (originalDashboard) {\n setDashboard(originalDashboard);\n }\n setEditMode(false);\n closeDiscardChangesConfirmationDialog();\n if (onDiscard) {\n onDiscard(dashboard);\n }\n };\n\n const onEditButtonClick = () => {\n setEditMode(true);\n setOriginalDashboard(dashboard);\n };\n\n const onCancelButtonClick = () => {\n // check if dashboard has been modified\n if (JSON.stringify(dashboard) === JSON.stringify(originalDashboard)) {\n setEditMode(false);\n } else {\n openDiscardChangesConfirmationDialog({\n onDiscardChanges: () => {\n handleDiscardChanges();\n },\n onCancel: () => {\n closeDiscardChangesConfirmationDialog();\n },\n });\n }\n };\n\n return (\n <Box\n sx={{\n flexGrow: 1,\n overflowX: 'hidden',\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n }}\n >\n <DashboardToolbar\n dashboardName={dashboardResource.metadata.name}\n dashboardTitleComponent={dashboardTitleComponent}\n initialVariableIsSticky={initialVariableIsSticky}\n onSave={onSave}\n isReadonly={isReadonly}\n onEditButtonClick={onEditButtonClick}\n onCancelButtonClick={onCancelButtonClick}\n />\n <Box sx={{ padding: (theme) => theme.spacing(2), height: '100%' }}>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Dashboard\n emptyDashboardProps={{\n onEditButtonClick,\n ...emptyDashboardProps,\n }}\n />\n </ErrorBoundary>\n <PanelDrawer />\n <PanelGroupDialog />\n <DeletePanelGroupDialog />\n <DeletePanelDialog />\n <DiscardChangesConfirmationDialog />\n <EditJsonDialog />\n <SaveChangesConfirmationDialog />\n </Box>\n </Box>\n );\n};\n"],"names":["useState","Box","ErrorAlert","ErrorBoundary","PanelDrawer","Dashboard","PanelGroupDialog","DeletePanelGroupDialog","DiscardChangesConfirmationDialog","DashboardToolbar","DeletePanelDialog","EditJsonDialog","SaveChangesConfirmationDialog","useDashboard","useDiscardChangesConfirmationDialog","useEditMode","DashboardApp","props","dashboardResource","dashboardTitleComponent","emptyDashboardProps","onSave","onDiscard","initialVariableIsSticky","isReadonly","setEditMode","dashboard","setDashboard","originalDashboard","setOriginalDashboard","undefined","openDiscardChangesConfirmationDialog","closeDiscardChangesConfirmationDialog","handleDiscardChanges","onEditButtonClick","onCancelButtonClick","JSON","stringify","onDiscardChanges","onCancel","sx","flexGrow","overflowX","overflowY","display","flexDirection","dashboardName","metadata","name","padding","theme","spacing","height","FallbackComponent"],"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;AAAA,SAASA,QAAQ,QAAQ,OAAO,CAAC;AACjC,SAASC,GAAG,QAAQ,eAAe,CAAC;AACpC,SAASC,UAAU,EAAEC,aAAa,QAAQ,wBAAwB,CAAC;AAEnE,SACEC,WAAW,EACXC,SAAS,EACTC,gBAAgB,EAChBC,sBAAsB,EACtBC,gCAAgC,EAChCC,gBAAgB,EAChBC,iBAAiB,EAEjB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AC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/dashboards",
3
- "version": "0.0.0-snapshot-color-palette-gen-test-0ebddd6",
3
+ "version": "0.0.0-snapshot-saving-defaults-refinements-1b25cec",
4
4
  "description": "The dashboards feature in Perses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -29,9 +29,9 @@
29
29
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
30
30
  },
31
31
  "dependencies": {
32
- "@perses-dev/components": "0.0.0-snapshot-color-palette-gen-test-0ebddd6",
33
- "@perses-dev/core": "0.0.0-snapshot-color-palette-gen-test-0ebddd6",
34
- "@perses-dev/plugin-system": "0.0.0-snapshot-color-palette-gen-test-0ebddd6",
32
+ "@perses-dev/components": "0.0.0-snapshot-saving-defaults-refinements-1b25cec",
33
+ "@perses-dev/core": "0.0.0-snapshot-saving-defaults-refinements-1b25cec",
34
+ "@perses-dev/plugin-system": "0.0.0-snapshot-saving-defaults-refinements-1b25cec",
35
35
  "@types/react-grid-layout": "^1.3.2",
36
36
  "date-fns": "^2.28.0",
37
37
  "immer": "^9.0.15",
@@ -44,8 +44,9 @@
44
44
  "zustand": "^4.3.3"
45
45
  },
46
46
  "devDependencies": {
47
- "@perses-dev/internal-utils": "0.0.0-snapshot-color-palette-gen-test-0ebddd6",
48
- "@perses-dev/storybook": "0.0.0-snapshot-color-palette-gen-test-0ebddd6",
47
+ "@perses-dev/internal-utils": "0.0.0-snapshot-saving-defaults-refinements-1b25cec",
48
+ "@perses-dev/storybook": "0.0.0-snapshot-saving-defaults-refinements-1b25cec",
49
+ "history": "^5.3.0",
49
50
  "intersection-observer": "^0.12.2"
50
51
  },
51
52
  "peerDependencies": {
@@ -1,91 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "WithPluginRegistry", {
18
- enumerable: true,
19
- get: ()=>WithPluginRegistry
20
- });
21
- const _jsxRuntime = require("react/jsx-runtime");
22
- const _pluginSystem = require("@perses-dev/plugin-system");
23
- function _getRequireWildcardCache(nodeInterop) {
24
- if (typeof WeakMap !== "function") return null;
25
- var cacheBabelInterop = new WeakMap();
26
- var cacheNodeInterop = new WeakMap();
27
- return (_getRequireWildcardCache = function(nodeInterop) {
28
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
29
- })(nodeInterop);
30
- }
31
- function _interopRequireWildcard(obj, nodeInterop) {
32
- if (!nodeInterop && obj && obj.__esModule) {
33
- return obj;
34
- }
35
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
36
- return {
37
- default: obj
38
- };
39
- }
40
- var cache = _getRequireWildcardCache(nodeInterop);
41
- if (cache && cache.has(obj)) {
42
- return cache.get(obj);
43
- }
44
- var newObj = {};
45
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
46
- for(var key in obj){
47
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
48
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
49
- if (desc && (desc.get || desc.set)) {
50
- Object.defineProperty(newObj, key, desc);
51
- } else {
52
- newObj[key] = obj[key];
53
- }
54
- }
55
- }
56
- newObj.default = obj;
57
- if (cache) {
58
- cache.set(obj, newObj);
59
- }
60
- return newObj;
61
- }
62
- // NOTE: the aliases we use for components break these top level imports, so we
63
- // import relatively.
64
- // eslint-disable-next-line @typescript-eslint/no-var-requires
65
- const prometheusResource = require('../../../../prometheus-plugin/plugin.json');
66
- // eslint-disable-next-line @typescript-eslint/no-var-requires
67
- const panelsResource = require('../../../../panels-plugin/plugin.json');
68
- const bundledPluginLoader = (0, _pluginSystem.dynamicImportPluginLoader)([
69
- {
70
- resource: prometheusResource,
71
- // This throws an error in CI (but not locally for some reason), likely because
72
- // this package isn't a dependency for dashboards. We probably do not want to
73
- // make it one solely for type-checking in storybook.
74
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
75
- // @ts-ignore
76
- importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("@perses-dev/prometheus-plugin")))
77
- },
78
- {
79
- resource: panelsResource,
80
- // Same comment as above.
81
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
82
- // @ts-ignore
83
- importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("@perses-dev/panels-plugin")))
84
- }
85
- ]);
86
- const WithPluginRegistry = (Story)=>{
87
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.PluginRegistry, {
88
- pluginLoader: bundledPluginLoader,
89
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(Story, {})
90
- });
91
- };
@@ -1,38 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "WithTimeRange", {
18
- enumerable: true,
19
- get: ()=>WithTimeRange
20
- });
21
- const _jsxRuntime = require("react/jsx-runtime");
22
- const _pluginSystem = require("@perses-dev/plugin-system");
23
- // Type guard because storybook types parameters as `any`
24
- function isWithTimeRangeParameter(parameter) {
25
- return !!parameter && typeof parameter === 'object' && 'props' in parameter;
26
- }
27
- const WithTimeRange = (Story, context)=>{
28
- const initParameter = context.parameters.withTimeRange;
29
- const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;
30
- const props = parameter === null || parameter === void 0 ? void 0 : parameter.props;
31
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.TimeRangeProvider, {
32
- initialTimeRange: {
33
- pastDuration: '1h'
34
- },
35
- ...props,
36
- children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(Story, {})
37
- });
38
- };
@@ -1,46 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { PluginRegistry, dynamicImportPluginLoader } from '@perses-dev/plugin-system';
15
- // NOTE: the aliases we use for components break these top level imports, so we
16
- // import relatively.
17
- // eslint-disable-next-line @typescript-eslint/no-var-requires
18
- const prometheusResource = require('../../../../prometheus-plugin/plugin.json');
19
- // eslint-disable-next-line @typescript-eslint/no-var-requires
20
- const panelsResource = require('../../../../panels-plugin/plugin.json');
21
- const bundledPluginLoader = dynamicImportPluginLoader([
22
- {
23
- resource: prometheusResource,
24
- // This throws an error in CI (but not locally for some reason), likely because
25
- // this package isn't a dependency for dashboards. We probably do not want to
26
- // make it one solely for type-checking in storybook.
27
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
28
- // @ts-ignore
29
- importPlugin: ()=>import('@perses-dev/prometheus-plugin')
30
- },
31
- {
32
- resource: panelsResource,
33
- // Same comment as above.
34
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
35
- // @ts-ignore
36
- importPlugin: ()=>import('@perses-dev/panels-plugin')
37
- }
38
- ]);
39
- export const WithPluginRegistry = (Story)=>{
40
- return /*#__PURE__*/ _jsx(PluginRegistry, {
41
- pluginLoader: bundledPluginLoader,
42
- children: /*#__PURE__*/ _jsx(Story, {})
43
- });
44
- };
45
-
46
- //# sourceMappingURL=WithPluginRegistry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/stories/decorators/WithPluginRegistry.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 { StoryFn } from '@storybook/react';\nimport {\n PluginRegistry,\n PluginLoader,\n PluginModuleResource,\n dynamicImportPluginLoader,\n} from '@perses-dev/plugin-system';\n\n// NOTE: the aliases we use for components break these top level imports, so we\n// import relatively.\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst prometheusResource = require('../../../../prometheus-plugin/plugin.json');\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst panelsResource = require('../../../../panels-plugin/plugin.json');\n\nconst bundledPluginLoader: PluginLoader = dynamicImportPluginLoader([\n {\n resource: prometheusResource as PluginModuleResource,\n // This throws an error in CI (but not locally for some reason), likely because\n // this package isn't a dependency for dashboards. We probably do not want to\n // make it one solely for type-checking in storybook.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n importPlugin: () => import('@perses-dev/prometheus-plugin'),\n },\n {\n resource: panelsResource as PluginModuleResource,\n // Same comment as above.\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n importPlugin: () => import('@perses-dev/panels-plugin'),\n },\n]);\n\nexport const WithPluginRegistry = (Story: StoryFn) => {\n return (\n <PluginRegistry pluginLoader={bundledPluginLoader}>\n <Story />\n </PluginRegistry>\n );\n};\n"],"names":["PluginRegistry","dynamicImportPluginLoader","prometheusResource","require","panelsResource","bundledPluginLoader","resource","importPlugin","WithPluginRegistry","Story","pluginLoader"],"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;AACA,SACEA,cAAc,EAGdC,yBAAyB,QACpB,2BAA2B,CAAC;AAEnC,+EAA+E;AAC/E,qBAAqB;AACrB,8DAA8D;AAC9D,MAAMC,kBAAkB,GAAGC,OAAO,CAAC,2CAA2C,CAAC,AAAC;AAChF,8DAA8D;AAC9D,MAAMC,cAAc,GAAGD,OAAO,CAAC,uCAAuC,CAAC,AAAC;AAExE,MAAME,mBAAmB,GAAiBJ,yBAAyB,CAAC;IAClE;QACEK,QAAQ,EAAEJ,kBAAkB;QAC5B,+EAA+E;QAC/E,6EAA6E;QAC7E,qDAAqD;QACrD,6DAA6D;QAC7D,aAAa;QACbK,YAAY,EAAE,IAAM,MAAM,CAAC,+BAA+B,CAAC;KAC5D;IACD;QACED,QAAQ,EAAEF,cAAc;QACxB,yBAAyB;QACzB,6DAA6D;QAC7D,aAAa;QACbG,YAAY,EAAE,IAAM,MAAM,CAAC,2BAA2B,CAAC;KACxD;CACF,CAAC,AAAC;AAEH,OAAO,MAAMC,kBAAkB,GAAG,CAACC,KAAc,GAAK;IACpD,qBACE,KAACT,cAAc;QAACU,YAAY,EAAEL,mBAAmB;kBAC/C,cAAA,KAACI,KAAK,KAAG;MACM,CACjB;AACJ,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/stories/decorators/WithQueryClient.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 { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { StoryFn } from '@storybook/react';\n\nexport const WithQueryClient = (Story: StoryFn) => {\n const queryClient = new QueryClient({});\n\n return (\n <QueryClientProvider client={queryClient}>\n <Story />\n </QueryClientProvider>\n );\n};\n"],"names":["QueryClient","QueryClientProvider","WithQueryClient","Story","queryClient","client"],"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;AAAA,SAASA,WAAW,EAAEC,mBAAmB,QAAQ,uBAAuB,CAAC;AAGzE,OAAO,MAAMC,eAAe,GAAG,CAACC,KAAc,GAAK;IACjD,MAAMC,WAAW,GAAG,IAAIJ,WAAW,CAAC,EAAE,CAAC,AAAC;IAExC,qBACE,KAACC,mBAAmB;QAACI,MAAM,EAAED,WAAW;kBACtC,cAAA,KAACD,KAAK,KAAG;MACW,CACtB;AACJ,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/stories/decorators/WithQueryParams.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 { WindowHistoryAdapter } from 'use-query-params/adapters/window';\nimport { QueryParamProvider } from 'use-query-params';\nimport { StoryFn } from '@storybook/react';\n\nexport const WithQueryParams = (Story: StoryFn) => {\n return (\n <QueryParamProvider adapter={WindowHistoryAdapter}>\n <Story />\n </QueryParamProvider>\n );\n};\n"],"names":["WindowHistoryAdapter","QueryParamProvider","WithQueryParams","Story","adapter"],"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;AAAA,SAASA,oBAAoB,QAAQ,kCAAkC,CAAC;AACxE,SAASC,kBAAkB,QAAQ,kBAAkB,CAAC;AAGtD,OAAO,MAAMC,eAAe,GAAG,CAACC,KAAc,GAAK;IACjD,qBACE,KAACF,kBAAkB;QAACG,OAAO,EAAEJ,oBAAoB;kBAC/C,cAAA,KAACG,KAAK,KAAG;MACU,CACrB;AACJ,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- // Copyright 2023 The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- import { TimeRangeProvider } from '@perses-dev/plugin-system';
15
- // Type guard because storybook types parameters as `any`
16
- function isWithTimeRangeParameter(parameter) {
17
- return !!parameter && typeof parameter === 'object' && 'props' in parameter;
18
- }
19
- export const WithTimeRange = (Story, context)=>{
20
- const initParameter = context.parameters.withTimeRange;
21
- const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;
22
- const props = parameter === null || parameter === void 0 ? void 0 : parameter.props;
23
- return /*#__PURE__*/ _jsx(TimeRangeProvider, {
24
- initialTimeRange: {
25
- pastDuration: '1h'
26
- },
27
- ...props,
28
- children: /*#__PURE__*/ _jsx(Story, {})
29
- });
30
- };
31
-
32
- //# sourceMappingURL=WithTimeRange.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/stories/decorators/WithTimeRange.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 { StoryFn, StoryContext } from '@storybook/react';\nimport { TimeRangeProvider, TimeRangeProviderProps } from '@perses-dev/plugin-system';\n\nexport type WithTimeRangeParameter = {\n props: Partial<TimeRangeProviderProps>;\n};\n\n// Type guard because storybook types parameters as `any`\nfunction isWithTimeRangeParameter(parameter: unknown | WithTimeRangeParameter): parameter is WithTimeRangeParameter {\n return !!parameter && typeof parameter === 'object' && 'props' in parameter;\n}\n\nexport const WithTimeRange = (Story: StoryFn, context: StoryContext<unknown>) => {\n const initParameter = context.parameters.withTimeRange;\n const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;\n const props = parameter?.props;\n\n return (\n <TimeRangeProvider initialTimeRange={{ pastDuration: '1h' }} {...props}>\n <Story />\n </TimeRangeProvider>\n );\n};\n"],"names":["TimeRangeProvider","isWithTimeRangeParameter","parameter","WithTimeRange","Story","context","initParameter","parameters","withTimeRange","undefined","props","initialTimeRange","pastDuration"],"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;AACA,SAASA,iBAAiB,QAAgC,2BAA2B,CAAC;AAMtF,yDAAyD;AACzD,SAASC,wBAAwB,CAACC,SAA2C,EAAuC;IAClH,OAAO,CAAC,CAACA,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,OAAO,IAAIA,SAAS,CAAC;AAC9E,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG,CAACC,KAAc,EAAEC,OAA8B,GAAK;IAC/E,MAAMC,aAAa,GAAGD,OAAO,CAACE,UAAU,CAACC,aAAa,AAAC;IACvD,MAAMN,SAAS,GAAGD,wBAAwB,CAACK,aAAa,CAAC,GAAGA,aAAa,GAAGG,SAAS,AAAC;IACtF,MAAMC,KAAK,GAAGR,SAAS,aAATA,SAAS,WAAO,GAAhBA,KAAAA,CAAgB,GAAhBA,SAAS,CAAEQ,KAAK,AAAC;IAE/B,qBACE,KAACV,iBAAiB;QAACW,gBAAgB,EAAE;YAAEC,YAAY,EAAE,IAAI;SAAE;QAAG,GAAGF,KAAK;kBACpE,cAAA,KAACN,KAAK,KAAG;MACS,CACpB;AACJ,CAAC,CAAC"}