@perses-dev/explore 0.45.0 → 0.46.0-rc1

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 (46) hide show
  1. package/dist/cjs/components/ExploreManager/ExploreManager.js +86 -0
  2. package/dist/cjs/components/ExploreManager/ExplorerManagerProvider.js +163 -0
  3. package/dist/cjs/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js +64 -0
  4. package/dist/cjs/components/ExploreManager/MetricsExplorer.js +158 -0
  5. package/dist/cjs/components/ExploreManager/TracesExplorer.js +103 -0
  6. package/dist/cjs/components/ExploreManager/constants.js +32 -0
  7. package/dist/cjs/components/ExploreManager/index.js +30 -0
  8. package/dist/cjs/views/ViewExplore/ViewExploreApp.js +6 -9
  9. package/dist/components/ExploreManager/ExploreManager.d.ts +6 -0
  10. package/dist/components/ExploreManager/ExploreManager.d.ts.map +1 -0
  11. package/dist/components/ExploreManager/ExploreManager.js +78 -0
  12. package/dist/components/ExploreManager/ExploreManager.js.map +1 -0
  13. package/dist/components/ExploreManager/ExplorerManagerProvider.d.ts +26 -0
  14. package/dist/components/ExploreManager/ExplorerManagerProvider.d.ts.map +1 -0
  15. package/dist/components/ExploreManager/ExplorerManagerProvider.js +106 -0
  16. package/dist/components/ExploreManager/ExplorerManagerProvider.js.map +1 -0
  17. package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.d.ts +7 -0
  18. package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.d.ts.map +1 -0
  19. package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js +51 -0
  20. package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js.map +1 -0
  21. package/dist/components/ExploreManager/MetricsExplorer.d.ts +2 -0
  22. package/dist/components/ExploreManager/MetricsExplorer.d.ts.map +1 -0
  23. package/dist/components/ExploreManager/MetricsExplorer.js +145 -0
  24. package/dist/components/ExploreManager/MetricsExplorer.js.map +1 -0
  25. package/dist/components/ExploreManager/TracesExplorer.d.ts +2 -0
  26. package/dist/components/ExploreManager/TracesExplorer.d.ts.map +1 -0
  27. package/dist/components/ExploreManager/TracesExplorer.js +90 -0
  28. package/dist/components/ExploreManager/TracesExplorer.js.map +1 -0
  29. package/dist/components/ExploreManager/constants.d.ts +3 -0
  30. package/dist/components/ExploreManager/constants.d.ts.map +1 -0
  31. package/dist/components/ExploreManager/constants.js +16 -0
  32. package/dist/components/ExploreManager/constants.js.map +1 -0
  33. package/dist/components/ExploreManager/index.d.ts +2 -0
  34. package/dist/components/ExploreManager/index.d.ts.map +1 -0
  35. package/dist/components/ExploreManager/index.js +15 -0
  36. package/dist/components/ExploreManager/index.js.map +1 -0
  37. package/dist/views/ViewExplore/ViewExploreApp.d.ts +2 -2
  38. package/dist/views/ViewExplore/ViewExploreApp.d.ts.map +1 -1
  39. package/dist/views/ViewExplore/ViewExploreApp.js +6 -4
  40. package/dist/views/ViewExplore/ViewExploreApp.js.map +1 -1
  41. package/package.json +8 -8
  42. package/dist/cjs/components/TimeSeriesExplorer/TimeSeriesExplorer.js +0 -169
  43. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.d.ts +0 -11
  44. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.d.ts.map +0 -1
  45. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.js +0 -112
  46. package/dist/components/TimeSeriesExplorer/TimeSeriesExplorer.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2024 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
+ export * from './ExploreManager';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/ExploreManager/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './ExploreManager';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
@@ -1,6 +1,6 @@
1
- import React from 'react';
1
+ import { ReactNode } from 'react';
2
2
  export interface ViewAppProps {
3
- exploreTitleComponent?: React.ReactNode;
3
+ exploreTitleComponent?: 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":"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"}
1
+ {"version":3,"file":"ViewExploreApp.d.ts","sourceRoot":"","sources":["../../../src/views/ViewExplore/ViewExploreApp.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlC,MAAM,WAAW,YAAY;IAC3B,qBAAqB,CAAC,EAAE,SAAS,CAAC;CACnC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,2CAsBjD"}
@@ -13,8 +13,8 @@
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { Box } from '@mui/material';
15
15
  import { ChartsProvider, useChartsTheme } from '@perses-dev/components';
16
- import React from 'react';
17
- import { TimeSeriesExplorer } from '../../components/TimeSeriesExplorer/TimeSeriesExplorer';
16
+ import { ExploreManager } from '../../components/ExploreManager';
17
+ import { ExplorerManagerProviderWithQueryParams } from '../../components/ExploreManager/ExplorerManagerProviderWithQueryParams';
18
18
  export function ViewExploreApp(props) {
19
19
  const { exploreTitleComponent } = props;
20
20
  const chartsTheme = useChartsTheme();
@@ -29,8 +29,10 @@ export function ViewExploreApp(props) {
29
29
  children: /*#__PURE__*/ _jsx(ChartsProvider, {
30
30
  chartsTheme: chartsTheme,
31
31
  enablePinning: false,
32
- children: /*#__PURE__*/ _jsx(TimeSeriesExplorer, {
33
- exploreTitleComponent: exploreTitleComponent
32
+ children: /*#__PURE__*/ _jsx(ExplorerManagerProviderWithQueryParams, {
33
+ children: /*#__PURE__*/ _jsx(ExploreManager, {
34
+ exploreTitleComponent: exploreTitleComponent
35
+ })
34
36
  })
35
37
  })
36
38
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/views/ViewExplore/ViewExploreApp.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 } from '@mui/material';\nimport { ChartsProvider, useChartsTheme } from '@perses-dev/components';\nimport React from 'react';\nimport { TimeSeriesExplorer } from '../../components/TimeSeriesExplorer/TimeSeriesExplorer';\n\nexport interface ViewAppProps {\n exploreTitleComponent?: React.ReactNode;\n}\n\nexport function ViewExploreApp(props: ViewAppProps) {\n const { exploreTitleComponent } = props;\n\n const chartsTheme = useChartsTheme();\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 <ChartsProvider chartsTheme={chartsTheme} enablePinning={false}>\n <TimeSeriesExplorer exploreTitleComponent={exploreTitleComponent} />\n </ChartsProvider>\n </Box>\n );\n}\n"],"names":["Box","ChartsProvider","useChartsTheme","React","TimeSeriesExplorer","ViewExploreApp","props","exploreTitleComponent","chartsTheme","sx","flexGrow","overflowX","overflowY","display","flexDirection","enablePinning"],"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,QAAQ,gBAAgB;AACpC,SAASC,cAAc,EAAEC,cAAc,QAAQ,yBAAyB;AACxE,OAAOC,WAAW,QAAQ;AAC1B,SAASC,kBAAkB,QAAQ,yDAAyD;AAM5F,OAAO,SAASC,eAAeC,KAAmB;IAChD,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAElC,MAAME,cAAcN;IAEpB,qBACE,KAACF;QACCS,IAAI;YACFC,UAAU;YACVC,WAAW;YACXC,WAAW;YACXC,SAAS;YACTC,eAAe;QACjB;kBAEA,cAAA,KAACb;YAAeO,aAAaA;YAAaO,eAAe;sBACvD,cAAA,KAACX;gBAAmBG,uBAAuBA;;;;AAInD"}
1
+ {"version":3,"sources":["../../../src/views/ViewExplore/ViewExploreApp.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 } from '@mui/material';\nimport { ChartsProvider, useChartsTheme } from '@perses-dev/components';\nimport { ReactNode } from 'react';\nimport { ExploreManager } from '../../components/ExploreManager';\nimport { ExplorerManagerProviderWithQueryParams } from '../../components/ExploreManager/ExplorerManagerProviderWithQueryParams';\n\nexport interface ViewAppProps {\n exploreTitleComponent?: ReactNode;\n}\n\nexport function ViewExploreApp(props: ViewAppProps) {\n const { exploreTitleComponent } = props;\n\n const chartsTheme = useChartsTheme();\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 <ChartsProvider chartsTheme={chartsTheme} enablePinning={false}>\n <ExplorerManagerProviderWithQueryParams>\n <ExploreManager exploreTitleComponent={exploreTitleComponent} />\n </ExplorerManagerProviderWithQueryParams>\n </ChartsProvider>\n </Box>\n );\n}\n"],"names":["Box","ChartsProvider","useChartsTheme","ExploreManager","ExplorerManagerProviderWithQueryParams","ViewExploreApp","props","exploreTitleComponent","chartsTheme","sx","flexGrow","overflowX","overflowY","display","flexDirection","enablePinning"],"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,QAAQ,gBAAgB;AACpC,SAASC,cAAc,EAAEC,cAAc,QAAQ,yBAAyB;AAExE,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,sCAAsC,QAAQ,yEAAyE;AAMhI,OAAO,SAASC,eAAeC,KAAmB;IAChD,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAElC,MAAME,cAAcN;IAEpB,qBACE,KAACF;QACCS,IAAI;YACFC,UAAU;YACVC,WAAW;YACXC,WAAW;YACXC,SAAS;YACTC,eAAe;QACjB;kBAEA,cAAA,KAACb;YAAeO,aAAaA;YAAaO,eAAe;sBACvD,cAAA,KAACX;0BACC,cAAA,KAACD;oBAAeI,uBAAuBA;;;;;AAKjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/explore",
3
- "version": "0.45.0",
3
+ "version": "0.46.0-rc1",
4
4
  "description": "The explore feature in Perses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -27,11 +27,11 @@
27
27
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
28
28
  },
29
29
  "dependencies": {
30
- "@perses-dev/components": "0.45.0",
31
- "@perses-dev/core": "0.45.0",
32
- "@perses-dev/panels-plugin": "0.45.0",
33
- "@perses-dev/plugin-system": "0.45.0",
34
- "@perses-dev/dashboards": "0.45.0",
30
+ "@perses-dev/components": "0.46.0-rc1",
31
+ "@perses-dev/core": "0.46.0-rc1",
32
+ "@perses-dev/panels-plugin": "0.46.0-rc1",
33
+ "@perses-dev/plugin-system": "0.46.0-rc1",
34
+ "@perses-dev/dashboards": "0.46.0-rc1",
35
35
  "@types/react-grid-layout": "^1.3.2",
36
36
  "date-fns": "^2.28.0",
37
37
  "immer": "^9.0.15",
@@ -45,8 +45,8 @@
45
45
  "zustand": "^4.3.3"
46
46
  },
47
47
  "devDependencies": {
48
- "@perses-dev/internal-utils": "0.45.0",
49
- "@perses-dev/storybook": "0.45.0",
48
+ "@perses-dev/internal-utils": "0.46.0-rc1",
49
+ "@perses-dev/storybook": "0.46.0-rc1",
50
50
  "history": "^5.3.0",
51
51
  "intersection-observer": "^0.12.2"
52
52
  },
@@ -1,169 +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
- 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
- }
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,112 +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, 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
@@ -1 +0,0 @@
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"}