@perses-dev/explore 0.44.0 → 0.45.0-rc0

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 (51) hide show
  1. package/dist/cjs/components/ExploreToolbar/ExploreToolbar.js +8 -2
  2. package/dist/cjs/components/TimeSeriesExplorer/TimeSeriesExplorer.js +169 -0
  3. package/dist/cjs/views/ViewExplore/ViewExplore.js +25 -26
  4. package/dist/cjs/views/ViewExplore/ViewExploreApp.js +8 -20
  5. package/dist/components/ExploreToolbar/ExploreToolbar.d.ts +2 -2
  6. package/dist/components/ExploreToolbar/ExploreToolbar.d.ts.map +1 -1
  7. package/dist/components/ExploreToolbar/ExploreToolbar.js +2 -1
  8. package/dist/components/ExploreToolbar/ExploreToolbar.js.map +1 -1
  9. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.d.ts +11 -0
  10. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.d.ts.map +1 -0
  11. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.js +112 -0
  12. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.js.map +1 -0
  13. package/dist/views/ViewExplore/ViewExplore.d.ts +2 -4
  14. package/dist/views/ViewExplore/ViewExplore.d.ts.map +1 -1
  15. package/dist/views/ViewExplore/ViewExplore.js +21 -27
  16. package/dist/views/ViewExplore/ViewExplore.js.map +1 -1
  17. package/dist/views/ViewExplore/ViewExploreApp.d.ts +2 -2
  18. package/dist/views/ViewExplore/ViewExploreApp.d.ts.map +1 -1
  19. package/dist/views/ViewExplore/ViewExploreApp.js +3 -20
  20. package/dist/views/ViewExplore/ViewExploreApp.js.map +1 -1
  21. package/package.json +8 -9
  22. package/dist/cjs/components/PanelEditor/PanelEditorForm.js +0 -138
  23. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +0 -51
  24. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +0 -96
  25. package/dist/cjs/components/TimeSeriesQueryEditor/index.js +0 -30
  26. package/dist/cjs/context/usePanelEditor.js +0 -89
  27. package/dist/cjs/context/useTimeSeriesQueryEditorActions.js +0 -132
  28. package/dist/components/PanelEditor/PanelEditorForm.d.ts +0 -15
  29. package/dist/components/PanelEditor/PanelEditorForm.d.ts.map +0 -1
  30. package/dist/components/PanelEditor/PanelEditorForm.js +0 -125
  31. package/dist/components/PanelEditor/PanelEditorForm.js.map +0 -1
  32. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -11
  33. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +0 -1
  34. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +0 -43
  35. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +0 -1
  36. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +0 -11
  37. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
  38. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +0 -83
  39. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +0 -1
  40. package/dist/components/TimeSeriesQueryEditor/index.d.ts +0 -2
  41. package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +0 -1
  42. package/dist/components/TimeSeriesQueryEditor/index.js +0 -15
  43. package/dist/components/TimeSeriesQueryEditor/index.js.map +0 -1
  44. package/dist/context/usePanelEditor.d.ts +0 -15
  45. package/dist/context/usePanelEditor.d.ts.map +0 -1
  46. package/dist/context/usePanelEditor.js +0 -84
  47. package/dist/context/usePanelEditor.js.map +0 -1
  48. package/dist/context/useTimeSeriesQueryEditorActions.d.ts +0 -14
  49. package/dist/context/useTimeSeriesQueryEditorActions.d.ts.map +0 -1
  50. package/dist/context/useTimeSeriesQueryEditorActions.js +0 -119
  51. package/dist/context/useTimeSeriesQueryEditorActions.js.map +0 -1
@@ -22,7 +22,13 @@ Object.defineProperty(exports, "ExploreToolbar", {
22
22
  });
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
24
  const _material = require("@mui/material");
25
- const _dashboards = require("@perses-dev/dashboards");
25
+ const _pluginsystem = require("@perses-dev/plugin-system");
26
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
27
+ function _interop_require_default(obj) {
28
+ return obj && obj.__esModule ? obj : {
29
+ default: obj
30
+ };
31
+ }
26
32
  const ExploreToolbar = (props)=>{
27
33
  const { exploreTitleComponent } = props;
28
34
  const isBiggerThanLg = (0, _material.useMediaQuery)((0, _material.useTheme)().breakpoints.up('lg'));
@@ -42,7 +48,7 @@ const ExploreToolbar = (props)=>{
42
48
  ml: "auto",
43
49
  flexWrap: isBiggerThanLg ? 'nowrap' : 'wrap-reverse',
44
50
  justifyContent: "end",
45
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.TimeRangeControls, {})
51
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeControls, {})
46
52
  })
47
53
  ]
48
54
  })
@@ -0,0 +1,169 @@
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
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ TimeSeriesExplorer: function() {
25
+ return TimeSeriesExplorer;
26
+ },
27
+ TimeSeriesPanel: function() {
28
+ return TimeSeriesPanel;
29
+ }
30
+ });
31
+ const _jsxruntime = require("react/jsx-runtime");
32
+ const _pluginsystem = require("@perses-dev/plugin-system");
33
+ const _material = require("@mui/material");
34
+ const _components = require("@perses-dev/components");
35
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
36
+ const _panelsplugin = require("@perses-dev/panels-plugin");
37
+ const _ExploreToolbar = require("../ExploreToolbar");
38
+ function _getRequireWildcardCache(nodeInterop) {
39
+ if (typeof WeakMap !== "function") return null;
40
+ var cacheBabelInterop = new WeakMap();
41
+ var cacheNodeInterop = new WeakMap();
42
+ return (_getRequireWildcardCache = function(nodeInterop) {
43
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
44
+ })(nodeInterop);
45
+ }
46
+ function _interop_require_wildcard(obj, nodeInterop) {
47
+ if (!nodeInterop && obj && obj.__esModule) {
48
+ return obj;
49
+ }
50
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
51
+ return {
52
+ default: obj
53
+ };
54
+ }
55
+ var cache = _getRequireWildcardCache(nodeInterop);
56
+ if (cache && cache.has(obj)) {
57
+ return cache.get(obj);
58
+ }
59
+ var newObj = {
60
+ __proto__: null
61
+ };
62
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
63
+ for(var key in obj){
64
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
65
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
66
+ if (desc && (desc.get || desc.set)) {
67
+ Object.defineProperty(newObj, key, desc);
68
+ } else {
69
+ newObj[key] = obj[key];
70
+ }
71
+ }
72
+ }
73
+ newObj.default = obj;
74
+ if (cache) {
75
+ cache.set(obj, newObj);
76
+ }
77
+ return newObj;
78
+ }
79
+ const PANEL_PREVIEW_HEIGHT = 300;
80
+ const PANEL_PREVIEW_DEFAULT_WIDTH = 840;
81
+ function TimeSeriesPanel({ queries }) {
82
+ const boxRef = (0, _react.useRef)(null);
83
+ let width = PANEL_PREVIEW_DEFAULT_WIDTH;
84
+ if (boxRef.current !== null) {
85
+ width = boxRef.current.getBoundingClientRect().width;
86
+ }
87
+ const suggestedStepMs = (0, _pluginsystem.useSuggestedStepMs)(width);
88
+ // map TimeSeriesQueryDefinition to Definition<UnknownSpec>
89
+ const definitions = queries.length ? queries.map((query)=>{
90
+ return {
91
+ kind: query.spec.plugin.kind,
92
+ spec: query.spec.plugin.spec
93
+ };
94
+ }) : [];
95
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
96
+ ref: boxRef,
97
+ height: PANEL_PREVIEW_HEIGHT,
98
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DataQueriesProvider, {
99
+ definitions: definitions,
100
+ options: {
101
+ suggestedStepMs
102
+ },
103
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_panelsplugin.TimeSeriesChart.PanelComponent, {
104
+ contentDimensions: {
105
+ width,
106
+ height: PANEL_PREVIEW_HEIGHT
107
+ },
108
+ spec: {}
109
+ })
110
+ })
111
+ });
112
+ }
113
+ function TimeSeriesExplorer(props) {
114
+ const { exploreTitleComponent } = props;
115
+ const [queries, setQueries] = (0, _react.useState)();
116
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
117
+ sx: {
118
+ width: '100%'
119
+ },
120
+ px: 2,
121
+ pb: 2,
122
+ pt: 1.5,
123
+ gap: 2,
124
+ children: [
125
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_ExploreToolbar.ExploreToolbar, {
126
+ exploreTitleComponent: exploreTitleComponent
127
+ }),
128
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid, {
129
+ container: true,
130
+ spacing: 2,
131
+ children: [
132
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
133
+ item: true,
134
+ xs: 12,
135
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
136
+ gap: 1,
137
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.MultiQueryEditor, {
138
+ queryTypes: [
139
+ 'TimeSeriesQuery'
140
+ ],
141
+ onChange: setQueries,
142
+ queries: queries
143
+ })
144
+ })
145
+ }),
146
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid, {
147
+ item: true,
148
+ xs: 12,
149
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
150
+ gap: 1,
151
+ children: [
152
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
153
+ variant: "h4",
154
+ children: "Preview"
155
+ }),
156
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
157
+ FallbackComponent: _components.ErrorAlert,
158
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(TimeSeriesPanel, {
159
+ queries: queries !== null && queries !== void 0 ? queries : []
160
+ })
161
+ })
162
+ ]
163
+ })
164
+ })
165
+ ]
166
+ })
167
+ ]
168
+ });
169
+ }
@@ -26,38 +26,37 @@ const _pluginsystem = require("@perses-dev/plugin-system");
26
26
  const _core = require("@perses-dev/core");
27
27
  const _components = require("@perses-dev/components");
28
28
  const _dashboards = require("@perses-dev/dashboards");
29
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
29
30
  const _ViewExploreApp = require("./ViewExploreApp");
31
+ function _interop_require_default(obj) {
32
+ return obj && obj.__esModule ? obj : {
33
+ default: obj
34
+ };
35
+ }
30
36
  function ViewExplore(props) {
31
- const { dashboardResource, datasourceApi, externalVariableDefinitions, sx, exploreTitleComponent, ...others } = props;
37
+ const { datasourceApi, externalVariableDefinitions, sx, exploreTitleComponent, ...others } = props;
32
38
  const initialTimeRange = (0, _pluginsystem.useInitialTimeRange)(_core.DEFAULT_DASHBOARD_DURATION);
33
39
  const initialRefreshInterval = (0, _pluginsystem.useInitialRefreshInterval)(_core.DEFAULT_REFRESH_INTERVAL);
34
40
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.DatasourceStoreProvider, {
35
- dashboardResource: dashboardResource,
36
41
  datasourceApi: datasourceApi,
37
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.DashboardProvider, {
38
- initialState: {
39
- dashboardResource,
40
- isEditMode: true
41
- },
42
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProviderWithQueryParams, {
43
- initialTimeRange: initialTimeRange,
44
- initialRefreshInterval: initialRefreshInterval,
45
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.TemplateVariableProvider, {
46
- externalVariableDefinitions: externalVariableDefinitions,
47
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
48
- sx: (0, _components.combineSx)({
49
- display: 'flex',
50
- width: '100%',
51
- height: '100%',
52
- position: 'relative',
53
- overflow: 'hidden'
54
- }, sx),
55
- ...others,
56
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
57
- FallbackComponent: _components.ErrorAlert,
58
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ViewExploreApp.ViewExploreApp, {
59
- exploreTitleComponent: exploreTitleComponent
60
- })
42
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProviderWithQueryParams, {
43
+ initialTimeRange: initialTimeRange,
44
+ initialRefreshInterval: initialRefreshInterval,
45
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.TemplateVariableProvider, {
46
+ externalVariableDefinitions: externalVariableDefinitions,
47
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
48
+ sx: (0, _components.combineSx)({
49
+ display: 'flex',
50
+ width: '100%',
51
+ height: '100%',
52
+ position: 'relative',
53
+ overflow: 'hidden'
54
+ }, sx),
55
+ ...others,
56
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
57
+ FallbackComponent: _components.ErrorAlert,
58
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ViewExploreApp.ViewExploreApp, {
59
+ exploreTitleComponent: exploreTitleComponent
61
60
  })
62
61
  })
63
62
  })
@@ -23,26 +23,16 @@ Object.defineProperty(exports, "ViewExploreApp", {
23
23
  const _jsxruntime = require("react/jsx-runtime");
24
24
  const _material = require("@mui/material");
25
25
  const _components = require("@perses-dev/components");
26
- const _PanelEditorForm = require("../../components/PanelEditor/PanelEditorForm");
26
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
27
+ const _TimeSeriesExplorer = require("../../components/TimeSeriesExplorer/TimeSeriesExplorer");
28
+ function _interop_require_default(obj) {
29
+ return obj && obj.__esModule ? obj : {
30
+ default: obj
31
+ };
32
+ }
27
33
  function ViewExploreApp(props) {
28
34
  const { exploreTitleComponent } = props;
29
35
  const chartsTheme = (0, _components.useChartsTheme)();
30
- const data = {
31
- groupId: 0,
32
- panelDefinition: {
33
- kind: 'Panel',
34
- spec: {
35
- display: {
36
- name: ''
37
- },
38
- plugin: {
39
- kind: 'TimeSeriesChart',
40
- spec: {}
41
- },
42
- queries: []
43
- }
44
- }
45
- };
46
36
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
47
37
  sx: {
48
38
  flexGrow: 1,
@@ -54,9 +44,7 @@ function ViewExploreApp(props) {
54
44
  children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ChartsProvider, {
55
45
  chartsTheme: chartsTheme,
56
46
  enablePinning: false,
57
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelEditorForm.PanelEditorForm, {
58
- initialAction: "update",
59
- initialValues: data,
47
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeSeriesExplorer.TimeSeriesExplorer, {
60
48
  exploreTitleComponent: exploreTitleComponent
61
49
  })
62
50
  })
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export interface ExploreToolbarProps {
3
- exploreTitleComponent?: JSX.Element;
3
+ exploreTitleComponent?: React.ReactNode;
4
4
  }
5
5
  export declare const ExploreToolbar: (props: ExploreToolbarProps) => import("react/jsx-runtime").JSX.Element;
6
6
  //# sourceMappingURL=ExploreToolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExploreToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreToolbar/ExploreToolbar.tsx"],"names":[],"mappings":";AAgBA,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,4CAuBxD,CAAC"}
1
+ {"version":3,"file":"ExploreToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreToolbar/ExploreToolbar.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzC;AAED,eAAO,MAAM,cAAc,UAAW,mBAAmB,4CAuBxD,CAAC"}
@@ -12,7 +12,8 @@
12
12
  // limitations under the License.
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { Stack, Box, useTheme, useMediaQuery } from '@mui/material';
15
- import { TimeRangeControls } from '@perses-dev/dashboards';
15
+ import { TimeRangeControls } from '@perses-dev/plugin-system';
16
+ import React from 'react';
16
17
  export const ExploreToolbar = (props)=>{
17
18
  const { exploreTitleComponent } = props;
18
19
  const isBiggerThanLg = useMediaQuery(useTheme().breakpoints.up('lg'));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ExploreToolbar/ExploreToolbar.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 { Stack, Box, useTheme, useMediaQuery } from '@mui/material';\nimport { TimeRangeControls } from '@perses-dev/dashboards';\n\nexport interface ExploreToolbarProps {\n exploreTitleComponent?: JSX.Element;\n}\n\nexport const ExploreToolbar = (props: ExploreToolbarProps) => {\n const { exploreTitleComponent } = props;\n\n const isBiggerThanLg = useMediaQuery(useTheme().breakpoints.up('lg'));\n\n const testId = 'explore-toolbar';\n\n return (\n <Stack data-testid={testId}>\n <Box sx={{ display: 'flex', width: '100%' }}>\n {exploreTitleComponent}\n <Stack\n direction=\"row\"\n spacing={1}\n ml=\"auto\"\n flexWrap={isBiggerThanLg ? 'nowrap' : 'wrap-reverse'}\n justifyContent=\"end\"\n >\n <TimeRangeControls />\n </Stack>\n </Box>\n </Stack>\n );\n};\n"],"names":["Stack","Box","useTheme","useMediaQuery","TimeRangeControls","ExploreToolbar","props","exploreTitleComponent","isBiggerThanLg","breakpoints","up","testId","data-testid","sx","display","width","direction","spacing","ml","flexWrap","justifyContent"],"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,KAAK,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,gBAAgB;AACpE,SAASC,iBAAiB,QAAQ,yBAAyB;AAM3D,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAElC,MAAME,iBAAiBL,cAAcD,WAAWO,WAAW,CAACC,EAAE,CAAC;IAE/D,MAAMC,SAAS;IAEf,qBACE,KAACX;QAAMY,eAAaD;kBAClB,cAAA,MAACV;YAAIY,IAAI;gBAAEC,SAAS;gBAAQC,OAAO;YAAO;;gBACvCR;8BACD,KAACP;oBACCgB,WAAU;oBACVC,SAAS;oBACTC,IAAG;oBACHC,UAAUX,iBAAiB,WAAW;oBACtCY,gBAAe;8BAEf,cAAA,KAAChB;;;;;AAKX,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/ExploreToolbar/ExploreToolbar.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 { Stack, Box, useTheme, useMediaQuery } from '@mui/material';\nimport { TimeRangeControls } from '@perses-dev/plugin-system';\nimport React from 'react';\n\nexport interface ExploreToolbarProps {\n exploreTitleComponent?: React.ReactNode;\n}\n\nexport const ExploreToolbar = (props: ExploreToolbarProps) => {\n const { exploreTitleComponent } = props;\n\n const isBiggerThanLg = useMediaQuery(useTheme().breakpoints.up('lg'));\n\n const testId = 'explore-toolbar';\n\n return (\n <Stack data-testid={testId}>\n <Box sx={{ display: 'flex', width: '100%' }}>\n {exploreTitleComponent}\n <Stack\n direction=\"row\"\n spacing={1}\n ml=\"auto\"\n flexWrap={isBiggerThanLg ? 'nowrap' : 'wrap-reverse'}\n justifyContent=\"end\"\n >\n <TimeRangeControls />\n </Stack>\n </Box>\n </Stack>\n );\n};\n"],"names":["Stack","Box","useTheme","useMediaQuery","TimeRangeControls","React","ExploreToolbar","props","exploreTitleComponent","isBiggerThanLg","breakpoints","up","testId","data-testid","sx","display","width","direction","spacing","ml","flexWrap","justifyContent"],"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,KAAK,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,gBAAgB;AACpE,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,OAAOC,WAAW,QAAQ;AAM1B,OAAO,MAAMC,iBAAiB,CAACC;IAC7B,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAElC,MAAME,iBAAiBN,cAAcD,WAAWQ,WAAW,CAACC,EAAE,CAAC;IAE/D,MAAMC,SAAS;IAEf,qBACE,KAACZ;QAAMa,eAAaD;kBAClB,cAAA,MAACX;YAAIa,IAAI;gBAAEC,SAAS;gBAAQC,OAAO;YAAO;;gBACvCR;8BACD,KAACR;oBACCiB,WAAU;oBACVC,SAAS;oBACTC,IAAG;oBACHC,UAAUX,iBAAiB,WAAW;oBACtCY,gBAAe;8BAEf,cAAA,KAACjB;;;;;AAKX,EAAE"}
@@ -0,0 +1,11 @@
1
+ import { QueryDefinition } from '@perses-dev/core';
2
+ import React from 'react';
3
+ export interface TimeseriesExplorerProps {
4
+ exploreTitleComponent?: React.ReactNode;
5
+ }
6
+ export interface PanelPreviewValues {
7
+ queries: QueryDefinition[];
8
+ }
9
+ export declare function TimeSeriesPanel({ queries }: PanelPreviewValues): import("react/jsx-runtime").JSX.Element;
10
+ export declare function TimeSeriesExplorer(props: TimeseriesExplorerProps): import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=TimeSeriesExplorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeSeriesExplorer.d.ts","sourceRoot":"","sources":["../../../src/components/TimeSeriesExplorer/TimeSeriesExplorer.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAA2B,MAAM,OAAO,CAAC;AAIhD,MAAM,WAAW,uBAAuB;IACtC,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzC;AAKD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB,2CA+B9D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAyBhE"}
@@ -0,0 +1,112 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { DataQueriesProvider, MultiQueryEditor, useSuggestedStepMs } from '@perses-dev/plugin-system';
15
+ import { Box, Grid, Stack, Typography } from '@mui/material';
16
+ import { ErrorAlert, ErrorBoundary } from '@perses-dev/components';
17
+ import React, { useRef, useState } from 'react';
18
+ import { TimeSeriesChart } from '@perses-dev/panels-plugin';
19
+ import { ExploreToolbar } from '../ExploreToolbar';
20
+ const PANEL_PREVIEW_HEIGHT = 300;
21
+ const PANEL_PREVIEW_DEFAULT_WIDTH = 840;
22
+ export function TimeSeriesPanel({ queries }) {
23
+ const boxRef = useRef(null);
24
+ let width = PANEL_PREVIEW_DEFAULT_WIDTH;
25
+ if (boxRef.current !== null) {
26
+ width = boxRef.current.getBoundingClientRect().width;
27
+ }
28
+ const suggestedStepMs = useSuggestedStepMs(width);
29
+ // map TimeSeriesQueryDefinition to Definition<UnknownSpec>
30
+ const definitions = queries.length ? queries.map((query)=>{
31
+ return {
32
+ kind: query.spec.plugin.kind,
33
+ spec: query.spec.plugin.spec
34
+ };
35
+ }) : [];
36
+ return /*#__PURE__*/ _jsx(Box, {
37
+ ref: boxRef,
38
+ height: PANEL_PREVIEW_HEIGHT,
39
+ children: /*#__PURE__*/ _jsx(DataQueriesProvider, {
40
+ definitions: definitions,
41
+ options: {
42
+ suggestedStepMs
43
+ },
44
+ children: /*#__PURE__*/ _jsx(TimeSeriesChart.PanelComponent, {
45
+ contentDimensions: {
46
+ width,
47
+ height: PANEL_PREVIEW_HEIGHT
48
+ },
49
+ spec: {}
50
+ })
51
+ })
52
+ });
53
+ }
54
+ export function TimeSeriesExplorer(props) {
55
+ const { exploreTitleComponent } = props;
56
+ const [queries, setQueries] = useState();
57
+ return /*#__PURE__*/ _jsxs(Stack, {
58
+ sx: {
59
+ width: '100%'
60
+ },
61
+ px: 2,
62
+ pb: 2,
63
+ pt: 1.5,
64
+ gap: 2,
65
+ children: [
66
+ /*#__PURE__*/ _jsx(ExploreToolbar, {
67
+ exploreTitleComponent: exploreTitleComponent
68
+ }),
69
+ /*#__PURE__*/ _jsxs(Grid, {
70
+ container: true,
71
+ spacing: 2,
72
+ children: [
73
+ /*#__PURE__*/ _jsx(Grid, {
74
+ item: true,
75
+ xs: 12,
76
+ children: /*#__PURE__*/ _jsx(Stack, {
77
+ gap: 1,
78
+ children: /*#__PURE__*/ _jsx(MultiQueryEditor, {
79
+ queryTypes: [
80
+ 'TimeSeriesQuery'
81
+ ],
82
+ onChange: setQueries,
83
+ queries: queries
84
+ })
85
+ })
86
+ }),
87
+ /*#__PURE__*/ _jsx(Grid, {
88
+ item: true,
89
+ xs: 12,
90
+ children: /*#__PURE__*/ _jsxs(Stack, {
91
+ gap: 1,
92
+ children: [
93
+ /*#__PURE__*/ _jsx(Typography, {
94
+ variant: "h4",
95
+ children: "Preview"
96
+ }),
97
+ /*#__PURE__*/ _jsx(ErrorBoundary, {
98
+ FallbackComponent: ErrorAlert,
99
+ children: /*#__PURE__*/ _jsx(TimeSeriesPanel, {
100
+ queries: queries !== null && queries !== void 0 ? queries : []
101
+ })
102
+ })
103
+ ]
104
+ })
105
+ })
106
+ ]
107
+ })
108
+ ]
109
+ });
110
+ }
111
+
112
+ //# sourceMappingURL=TimeSeriesExplorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/TimeSeriesExplorer/TimeSeriesExplorer.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 { DataQueriesProvider, MultiQueryEditor, useSuggestedStepMs } from '@perses-dev/plugin-system';\nimport { Box, Grid, Stack, Typography } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { QueryDefinition } from '@perses-dev/core';\nimport React, { useRef, useState } from 'react';\nimport { TimeSeriesChart } from '@perses-dev/panels-plugin';\nimport { ExploreToolbar } from '../ExploreToolbar';\n\nexport interface TimeseriesExplorerProps {\n exploreTitleComponent?: React.ReactNode;\n}\n\nconst PANEL_PREVIEW_HEIGHT = 300;\nconst PANEL_PREVIEW_DEFAULT_WIDTH = 840;\n\nexport interface PanelPreviewValues {\n queries: QueryDefinition[];\n}\n\nexport function TimeSeriesPanel({ queries }: PanelPreviewValues) {\n const boxRef = useRef<HTMLDivElement>(null);\n let width = PANEL_PREVIEW_DEFAULT_WIDTH;\n if (boxRef.current !== null) {\n width = boxRef.current.getBoundingClientRect().width;\n }\n const suggestedStepMs = useSuggestedStepMs(width);\n\n // map TimeSeriesQueryDefinition to Definition<UnknownSpec>\n const definitions = queries.length\n ? queries.map((query) => {\n return {\n kind: query.spec.plugin.kind,\n spec: query.spec.plugin.spec,\n };\n })\n : [];\n\n return (\n <Box ref={boxRef} height={PANEL_PREVIEW_HEIGHT}>\n <DataQueriesProvider definitions={definitions} options={{ suggestedStepMs }}>\n <TimeSeriesChart.PanelComponent\n contentDimensions={{\n width,\n height: PANEL_PREVIEW_HEIGHT,\n }}\n spec={{}}\n />\n </DataQueriesProvider>\n </Box>\n );\n}\n\nexport function TimeSeriesExplorer(props: TimeseriesExplorerProps) {\n const { exploreTitleComponent } = props;\n\n const [queries, setQueries] = useState<QueryDefinition[]>();\n\n return (\n <Stack sx={{ width: '100%' }} px={2} pb={2} pt={1.5} gap={2}>\n <ExploreToolbar exploreTitleComponent={exploreTitleComponent} />\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Stack gap={1}>\n <MultiQueryEditor queryTypes={['TimeSeriesQuery']} onChange={setQueries} queries={queries} />\n </Stack>\n </Grid>\n <Grid item xs={12}>\n <Stack gap={1}>\n <Typography variant=\"h4\">Preview</Typography>\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TimeSeriesPanel queries={queries ?? []} />\n </ErrorBoundary>\n </Stack>\n </Grid>\n </Grid>\n </Stack>\n );\n}\n"],"names":["DataQueriesProvider","MultiQueryEditor","useSuggestedStepMs","Box","Grid","Stack","Typography","ErrorAlert","ErrorBoundary","React","useRef","useState","TimeSeriesChart","ExploreToolbar","PANEL_PREVIEW_HEIGHT","PANEL_PREVIEW_DEFAULT_WIDTH","TimeSeriesPanel","queries","boxRef","width","current","getBoundingClientRect","suggestedStepMs","definitions","length","map","query","kind","spec","plugin","ref","height","options","PanelComponent","contentDimensions","TimeSeriesExplorer","props","exploreTitleComponent","setQueries","sx","px","pb","pt","gap","container","spacing","item","xs","queryTypes","onChange","variant","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,SAASA,mBAAmB,EAAEC,gBAAgB,EAAEC,kBAAkB,QAAQ,4BAA4B;AACtG,SAASC,GAAG,EAAEC,IAAI,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAC7D,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAEnE,OAAOC,SAASC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAChD,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,cAAc,QAAQ,oBAAoB;AAMnD,MAAMC,uBAAuB;AAC7B,MAAMC,8BAA8B;AAMpC,OAAO,SAASC,gBAAgB,EAAEC,OAAO,EAAsB;IAC7D,MAAMC,SAASR,OAAuB;IACtC,IAAIS,QAAQJ;IACZ,IAAIG,OAAOE,OAAO,KAAK,MAAM;QAC3BD,QAAQD,OAAOE,OAAO,CAACC,qBAAqB,GAAGF,KAAK;IACtD;IACA,MAAMG,kBAAkBpB,mBAAmBiB;IAE3C,2DAA2D;IAC3D,MAAMI,cAAcN,QAAQO,MAAM,GAC9BP,QAAQQ,GAAG,CAAC,CAACC;QACX,OAAO;YACLC,MAAMD,MAAME,IAAI,CAACC,MAAM,CAACF,IAAI;YAC5BC,MAAMF,MAAME,IAAI,CAACC,MAAM,CAACD,IAAI;QAC9B;IACF,KACA,EAAE;IAEN,qBACE,KAACzB;QAAI2B,KAAKZ;QAAQa,QAAQjB;kBACxB,cAAA,KAACd;YAAoBuB,aAAaA;YAAaS,SAAS;gBAAEV;YAAgB;sBACxE,cAAA,KAACV,gBAAgBqB,cAAc;gBAC7BC,mBAAmB;oBACjBf;oBACAY,QAAQjB;gBACV;gBACAc,MAAM,CAAC;;;;AAKjB;AAEA,OAAO,SAASO,mBAAmBC,KAA8B;IAC/D,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAElC,MAAM,CAACnB,SAASqB,WAAW,GAAG3B;IAE9B,qBACE,MAACN;QAAMkC,IAAI;YAAEpB,OAAO;QAAO;QAAGqB,IAAI;QAAGC,IAAI;QAAGC,IAAI;QAAKC,KAAK;;0BACxD,KAAC9B;gBAAewB,uBAAuBA;;0BACvC,MAACjC;gBAAKwC,SAAS;gBAACC,SAAS;;kCACvB,KAACzC;wBAAK0C,IAAI;wBAACC,IAAI;kCACb,cAAA,KAAC1C;4BAAMsC,KAAK;sCACV,cAAA,KAAC1C;gCAAiB+C,YAAY;oCAAC;iCAAkB;gCAAEC,UAAUX;gCAAYrB,SAASA;;;;kCAGtF,KAACb;wBAAK0C,IAAI;wBAACC,IAAI;kCACb,cAAA,MAAC1C;4BAAMsC,KAAK;;8CACV,KAACrC;oCAAW4C,SAAQ;8CAAK;;8CACzB,KAAC1C;oCAAc2C,mBAAmB5C;8CAChC,cAAA,KAACS;wCAAgBC,SAASA,oBAAAA,qBAAAA,UAAW,EAAE;;;;;;;;;;AAOrD"}
@@ -1,12 +1,10 @@
1
- /// <reference types="react" />
2
1
  import { BoxProps } from '@mui/material';
3
- import { DashboardResource } from '@perses-dev/core';
4
2
  import { DatasourceStoreProviderProps, TemplateVariableProviderProps } from '@perses-dev/dashboards';
3
+ import React from 'react';
5
4
  export interface ViewExploreProps extends Omit<BoxProps, 'children'> {
6
- dashboardResource: DashboardResource;
7
5
  datasourceApi: DatasourceStoreProviderProps['datasourceApi'];
8
6
  externalVariableDefinitions?: TemplateVariableProviderProps['externalVariableDefinitions'];
9
- exploreTitleComponent?: JSX.Element;
7
+ exploreTitleComponent?: React.ReactNode;
10
8
  }
11
9
  export declare function ViewExplore(props: ViewExploreProps): import("react/jsx-runtime").JSX.Element;
12
10
  //# sourceMappingURL=ViewExplore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ViewExplore.d.ts","sourceRoot":"","sources":["../../../src/views/ViewExplore/ViewExplore.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAM9C,OAAO,EAAwD,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE3G,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAI9B,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IAClE,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,aAAa,EAAE,4BAA4B,CAAC,eAAe,CAAC,CAAC;IAC7D,2BAA2B,CAAC,EAAE,6BAA6B,CAAC,6BAA6B,CAAC,CAAC;IAC3F,qBAAqB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACrC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAoClD"}
1
+ {"version":3,"file":"ViewExplore.d.ts","sourceRoot":"","sources":["../../../src/views/ViewExplore/ViewExplore.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQ9C,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAG9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IAClE,aAAa,EAAE,4BAA4B,CAAC,eAAe,CAAC,CAAC;IAC7D,2BAA2B,CAAC,EAAE,6BAA6B,CAAC,6BAA6B,CAAC,CAAC;IAC3F,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAkClD"}
@@ -15,39 +15,33 @@ import { Box } from '@mui/material';
15
15
  import { TimeRangeProviderWithQueryParams, useInitialRefreshInterval, useInitialTimeRange } from '@perses-dev/plugin-system';
16
16
  import { DEFAULT_DASHBOARD_DURATION, DEFAULT_REFRESH_INTERVAL } from '@perses-dev/core';
17
17
  import { ErrorAlert, ErrorBoundary, combineSx } from '@perses-dev/components';
18
- import { DatasourceStoreProvider, DashboardProvider, TemplateVariableProvider } from '@perses-dev/dashboards';
18
+ import { DatasourceStoreProvider, TemplateVariableProvider } from '@perses-dev/dashboards';
19
+ import React from 'react';
19
20
  import { ViewExploreApp } from './ViewExploreApp';
20
21
  export function ViewExplore(props) {
21
- const { dashboardResource, datasourceApi, externalVariableDefinitions, sx, exploreTitleComponent, ...others } = props;
22
+ const { datasourceApi, externalVariableDefinitions, sx, exploreTitleComponent, ...others } = props;
22
23
  const initialTimeRange = useInitialTimeRange(DEFAULT_DASHBOARD_DURATION);
23
24
  const initialRefreshInterval = useInitialRefreshInterval(DEFAULT_REFRESH_INTERVAL);
24
25
  return /*#__PURE__*/ _jsx(DatasourceStoreProvider, {
25
- dashboardResource: dashboardResource,
26
26
  datasourceApi: datasourceApi,
27
- children: /*#__PURE__*/ _jsx(DashboardProvider, {
28
- initialState: {
29
- dashboardResource,
30
- isEditMode: true
31
- },
32
- children: /*#__PURE__*/ _jsx(TimeRangeProviderWithQueryParams, {
33
- initialTimeRange: initialTimeRange,
34
- initialRefreshInterval: initialRefreshInterval,
35
- children: /*#__PURE__*/ _jsx(TemplateVariableProvider, {
36
- externalVariableDefinitions: externalVariableDefinitions,
37
- children: /*#__PURE__*/ _jsx(Box, {
38
- sx: combineSx({
39
- display: 'flex',
40
- width: '100%',
41
- height: '100%',
42
- position: 'relative',
43
- overflow: 'hidden'
44
- }, sx),
45
- ...others,
46
- children: /*#__PURE__*/ _jsx(ErrorBoundary, {
47
- FallbackComponent: ErrorAlert,
48
- children: /*#__PURE__*/ _jsx(ViewExploreApp, {
49
- exploreTitleComponent: exploreTitleComponent
50
- })
27
+ children: /*#__PURE__*/ _jsx(TimeRangeProviderWithQueryParams, {
28
+ initialTimeRange: initialTimeRange,
29
+ initialRefreshInterval: initialRefreshInterval,
30
+ children: /*#__PURE__*/ _jsx(TemplateVariableProvider, {
31
+ externalVariableDefinitions: externalVariableDefinitions,
32
+ children: /*#__PURE__*/ _jsx(Box, {
33
+ sx: combineSx({
34
+ display: 'flex',
35
+ width: '100%',
36
+ height: '100%',
37
+ position: 'relative',
38
+ overflow: 'hidden'
39
+ }, sx),
40
+ ...others,
41
+ children: /*#__PURE__*/ _jsx(ErrorBoundary, {
42
+ FallbackComponent: ErrorAlert,
43
+ children: /*#__PURE__*/ _jsx(ViewExploreApp, {
44
+ exploreTitleComponent: exploreTitleComponent
51
45
  })
52
46
  })
53
47
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/ViewExplore/ViewExplore.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport {\n TimeRangeProviderWithQueryParams,\n useInitialRefreshInterval,\n useInitialTimeRange,\n} from '@perses-dev/plugin-system';\nimport { DEFAULT_DASHBOARD_DURATION, DEFAULT_REFRESH_INTERVAL, DashboardResource } from '@perses-dev/core';\nimport { ErrorAlert, ErrorBoundary, combineSx } from '@perses-dev/components';\nimport {\n DatasourceStoreProviderProps,\n TemplateVariableProviderProps,\n DatasourceStoreProvider,\n DashboardProvider,\n TemplateVariableProvider,\n} from '@perses-dev/dashboards';\nimport { ViewExploreApp } from './ViewExploreApp';\n\nexport interface ViewExploreProps extends Omit<BoxProps, 'children'> {\n dashboardResource: DashboardResource;\n datasourceApi: DatasourceStoreProviderProps['datasourceApi'];\n externalVariableDefinitions?: TemplateVariableProviderProps['externalVariableDefinitions'];\n exploreTitleComponent?: JSX.Element;\n}\n\nexport function ViewExplore(props: ViewExploreProps) {\n const { dashboardResource, datasourceApi, externalVariableDefinitions, sx, exploreTitleComponent, ...others } = props;\n\n const initialTimeRange = useInitialTimeRange(DEFAULT_DASHBOARD_DURATION);\n const initialRefreshInterval = useInitialRefreshInterval(DEFAULT_REFRESH_INTERVAL);\n\n return (\n <DatasourceStoreProvider dashboardResource={dashboardResource} datasourceApi={datasourceApi}>\n <DashboardProvider initialState={{ dashboardResource, isEditMode: true }}>\n <TimeRangeProviderWithQueryParams\n initialTimeRange={initialTimeRange}\n initialRefreshInterval={initialRefreshInterval}\n >\n <TemplateVariableProvider externalVariableDefinitions={externalVariableDefinitions}>\n <Box\n sx={combineSx(\n {\n display: 'flex',\n width: '100%',\n height: '100%',\n position: 'relative',\n overflow: 'hidden',\n },\n sx\n )}\n {...others}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <ViewExploreApp exploreTitleComponent={exploreTitleComponent} />\n </ErrorBoundary>\n </Box>\n </TemplateVariableProvider>\n </TimeRangeProviderWithQueryParams>\n </DashboardProvider>\n </DatasourceStoreProvider>\n );\n}\n"],"names":["Box","TimeRangeProviderWithQueryParams","useInitialRefreshInterval","useInitialTimeRange","DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL","ErrorAlert","ErrorBoundary","combineSx","DatasourceStoreProvider","DashboardProvider","TemplateVariableProvider","ViewExploreApp","ViewExplore","props","dashboardResource","datasourceApi","externalVariableDefinitions","sx","exploreTitleComponent","others","initialTimeRange","initialRefreshInterval","initialState","isEditMode","display","width","height","position","overflow","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,SAASA,GAAG,QAAkB,gBAAgB;AAC9C,SACEC,gCAAgC,EAChCC,yBAAyB,EACzBC,mBAAmB,QACd,4BAA4B;AACnC,SAASC,0BAA0B,EAAEC,wBAAwB,QAA2B,mBAAmB;AAC3G,SAASC,UAAU,EAAEC,aAAa,EAAEC,SAAS,QAAQ,yBAAyB;AAC9E,SAGEC,uBAAuB,EACvBC,iBAAiB,EACjBC,wBAAwB,QACnB,yBAAyB;AAChC,SAASC,cAAc,QAAQ,mBAAmB;AASlD,OAAO,SAASC,YAAYC,KAAuB;IACjD,MAAM,EAAEC,iBAAiB,EAAEC,aAAa,EAAEC,2BAA2B,EAAEC,EAAE,EAAEC,qBAAqB,EAAE,GAAGC,QAAQ,GAAGN;IAEhH,MAAMO,mBAAmBlB,oBAAoBC;IAC7C,MAAMkB,yBAAyBpB,0BAA0BG;IAEzD,qBACE,KAACI;QAAwBM,mBAAmBA;QAAmBC,eAAeA;kBAC5E,cAAA,KAACN;YAAkBa,cAAc;gBAAER;gBAAmBS,YAAY;YAAK;sBACrE,cAAA,KAACvB;gBACCoB,kBAAkBA;gBAClBC,wBAAwBA;0BAExB,cAAA,KAACX;oBAAyBM,6BAA6BA;8BACrD,cAAA,KAACjB;wBACCkB,IAAIV,UACF;4BACEiB,SAAS;4BACTC,OAAO;4BACPC,QAAQ;4BACRC,UAAU;4BACVC,UAAU;wBACZ,GACAX;wBAED,GAAGE,MAAM;kCAEV,cAAA,KAACb;4BAAcuB,mBAAmBxB;sCAChC,cAAA,KAACM;gCAAeO,uBAAuBA;;;;;;;;AAQvD"}
1
+ {"version":3,"sources":["../../../src/views/ViewExplore/ViewExplore.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, BoxProps } from '@mui/material';\nimport {\n TimeRangeProviderWithQueryParams,\n useInitialRefreshInterval,\n useInitialTimeRange,\n} from '@perses-dev/plugin-system';\nimport { DEFAULT_DASHBOARD_DURATION, DEFAULT_REFRESH_INTERVAL } from '@perses-dev/core';\nimport { ErrorAlert, ErrorBoundary, combineSx } from '@perses-dev/components';\nimport {\n DatasourceStoreProviderProps,\n TemplateVariableProviderProps,\n DatasourceStoreProvider,\n TemplateVariableProvider,\n} from '@perses-dev/dashboards';\nimport React from 'react';\nimport { ViewExploreApp } from './ViewExploreApp';\n\nexport interface ViewExploreProps extends Omit<BoxProps, 'children'> {\n datasourceApi: DatasourceStoreProviderProps['datasourceApi'];\n externalVariableDefinitions?: TemplateVariableProviderProps['externalVariableDefinitions'];\n exploreTitleComponent?: React.ReactNode;\n}\n\nexport function ViewExplore(props: ViewExploreProps) {\n const { datasourceApi, externalVariableDefinitions, sx, exploreTitleComponent, ...others } = props;\n\n const initialTimeRange = useInitialTimeRange(DEFAULT_DASHBOARD_DURATION);\n const initialRefreshInterval = useInitialRefreshInterval(DEFAULT_REFRESH_INTERVAL);\n\n return (\n <DatasourceStoreProvider datasourceApi={datasourceApi}>\n <TimeRangeProviderWithQueryParams\n initialTimeRange={initialTimeRange}\n initialRefreshInterval={initialRefreshInterval}\n >\n <TemplateVariableProvider externalVariableDefinitions={externalVariableDefinitions}>\n <Box\n sx={combineSx(\n {\n display: 'flex',\n width: '100%',\n height: '100%',\n position: 'relative',\n overflow: 'hidden',\n },\n sx\n )}\n {...others}\n >\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <ViewExploreApp exploreTitleComponent={exploreTitleComponent} />\n </ErrorBoundary>\n </Box>\n </TemplateVariableProvider>\n </TimeRangeProviderWithQueryParams>\n </DatasourceStoreProvider>\n );\n}\n"],"names":["Box","TimeRangeProviderWithQueryParams","useInitialRefreshInterval","useInitialTimeRange","DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL","ErrorAlert","ErrorBoundary","combineSx","DatasourceStoreProvider","TemplateVariableProvider","React","ViewExploreApp","ViewExplore","props","datasourceApi","externalVariableDefinitions","sx","exploreTitleComponent","others","initialTimeRange","initialRefreshInterval","display","width","height","position","overflow","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,SAASA,GAAG,QAAkB,gBAAgB;AAC9C,SACEC,gCAAgC,EAChCC,yBAAyB,EACzBC,mBAAmB,QACd,4BAA4B;AACnC,SAASC,0BAA0B,EAAEC,wBAAwB,QAAQ,mBAAmB;AACxF,SAASC,UAAU,EAAEC,aAAa,EAAEC,SAAS,QAAQ,yBAAyB;AAC9E,SAGEC,uBAAuB,EACvBC,wBAAwB,QACnB,yBAAyB;AAChC,OAAOC,WAAW,QAAQ;AAC1B,SAASC,cAAc,QAAQ,mBAAmB;AAQlD,OAAO,SAASC,YAAYC,KAAuB;IACjD,MAAM,EAAEC,aAAa,EAAEC,2BAA2B,EAAEC,EAAE,EAAEC,qBAAqB,EAAE,GAAGC,QAAQ,GAAGL;IAE7F,MAAMM,mBAAmBjB,oBAAoBC;IAC7C,MAAMiB,yBAAyBnB,0BAA0BG;IAEzD,qBACE,KAACI;QAAwBM,eAAeA;kBACtC,cAAA,KAACd;YACCmB,kBAAkBA;YAClBC,wBAAwBA;sBAExB,cAAA,KAACX;gBAAyBM,6BAA6BA;0BACrD,cAAA,KAAChB;oBACCiB,IAAIT,UACF;wBACEc,SAAS;wBACTC,OAAO;wBACPC,QAAQ;wBACRC,UAAU;wBACVC,UAAU;oBACZ,GACAT;oBAED,GAAGE,MAAM;8BAEV,cAAA,KAACZ;wBAAcoB,mBAAmBrB;kCAChC,cAAA,KAACM;4BAAeM,uBAAuBA;;;;;;;AAOrD"}
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export interface ViewAppProps {
3
- exploreTitleComponent?: JSX.Element;
3
+ exploreTitleComponent?: React.ReactNode;
4
4
  }
5
5
  export declare function ViewExploreApp(props: ViewAppProps): import("react/jsx-runtime").JSX.Element;
6
6
  //# sourceMappingURL=ViewExploreApp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ViewExploreApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewExplore/ViewExploreApp.tsx"],"names":[],"mappings":";AAkBA,MAAM,WAAW,YAAY;IAC3B,qBAAqB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACrC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,2CAoCjD"}
1
+ {"version":3,"file":"ViewExploreApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewExplore/ViewExploreApp.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,YAAY;IAC3B,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,2CAoBjD"}