@perses-dev/explore 0.0.0-snapshot-scatter-chart-embed-8efdfab
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.
- package/LICENSE +201 -0
- package/dist/cjs/components/ExploreToolbar/ExploreToolbar.js +50 -0
- package/dist/cjs/components/ExploreToolbar/index.js +30 -0
- package/dist/cjs/components/PanelEditor/PanelEditorForm.js +138 -0
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +51 -0
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +96 -0
- package/dist/cjs/components/TimeSeriesQueryEditor/index.js +30 -0
- package/dist/cjs/context/usePanelEditor.js +89 -0
- package/dist/cjs/context/useTimeSeriesQueryEditorActions.js +132 -0
- package/dist/cjs/index.js +30 -0
- package/dist/cjs/test/setup-tests.js +23 -0
- package/dist/cjs/views/ViewExplore/ViewExplore.js +67 -0
- package/dist/cjs/views/ViewExplore/ViewExploreApp.js +64 -0
- package/dist/cjs/views/ViewExplore/index.js +30 -0
- package/dist/cjs/views/index.js +30 -0
- package/dist/components/ExploreToolbar/ExploreToolbar.d.ts +6 -0
- package/dist/components/ExploreToolbar/ExploreToolbar.d.ts.map +1 -0
- package/dist/components/ExploreToolbar/ExploreToolbar.js +42 -0
- package/dist/components/ExploreToolbar/ExploreToolbar.js.map +1 -0
- package/dist/components/ExploreToolbar/index.d.ts +2 -0
- package/dist/components/ExploreToolbar/index.d.ts.map +1 -0
- package/dist/components/ExploreToolbar/index.js +15 -0
- package/dist/components/ExploreToolbar/index.js.map +1 -0
- package/dist/components/PanelEditor/PanelEditorForm.d.ts +15 -0
- package/dist/components/PanelEditor/PanelEditorForm.d.ts.map +1 -0
- package/dist/components/PanelEditor/PanelEditorForm.js +125 -0
- package/dist/components/PanelEditor/PanelEditorForm.js.map +1 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +12 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +43 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +12 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +1 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +83 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -0
- package/dist/components/TimeSeriesQueryEditor/index.d.ts +2 -0
- package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +1 -0
- package/dist/components/TimeSeriesQueryEditor/index.js +15 -0
- package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -0
- package/dist/context/usePanelEditor.d.ts +15 -0
- package/dist/context/usePanelEditor.d.ts.map +1 -0
- package/dist/context/usePanelEditor.js +84 -0
- package/dist/context/usePanelEditor.js.map +1 -0
- package/dist/context/useTimeSeriesQueryEditorActions.d.ts +14 -0
- package/dist/context/useTimeSeriesQueryEditorActions.d.ts.map +1 -0
- package/dist/context/useTimeSeriesQueryEditorActions.js +119 -0
- package/dist/context/useTimeSeriesQueryEditorActions.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/test/setup-tests.d.ts +2 -0
- package/dist/test/setup-tests.d.ts.map +1 -0
- package/dist/test/setup-tests.js +22 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/views/ViewExplore/ViewExplore.d.ts +12 -0
- package/dist/views/ViewExplore/ViewExplore.d.ts.map +1 -0
- package/dist/views/ViewExplore/ViewExplore.js +59 -0
- package/dist/views/ViewExplore/ViewExplore.js.map +1 -0
- package/dist/views/ViewExplore/ViewExploreApp.d.ts +6 -0
- package/dist/views/ViewExplore/ViewExploreApp.d.ts.map +1 -0
- package/dist/views/ViewExplore/ViewExploreApp.js +56 -0
- package/dist/views/ViewExplore/ViewExploreApp.js.map +1 -0
- package/dist/views/ViewExplore/index.d.ts +2 -0
- package/dist/views/ViewExplore/index.d.ts.map +1 -0
- package/dist/views/ViewExplore/index.js +15 -0
- package/dist/views/ViewExplore/index.js.map +1 -0
- package/dist/views/index.d.ts +2 -0
- package/dist/views/index.d.ts.map +1 -0
- package/dist/views/index.js +15 -0
- package/dist/views/index.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,89 @@
|
|
|
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, "usePanelEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return usePanelEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _react = require("react");
|
|
24
|
+
const usePanelEditor = (panelDefinition)=>{
|
|
25
|
+
const { display , plugin: pluginDefinition , queries: initialQueries } = panelDefinition.spec;
|
|
26
|
+
const [name, setName] = (0, _react.useState)(display.name);
|
|
27
|
+
const [description, setDescription] = (0, _react.useState)(display.description);
|
|
28
|
+
const [plugin, setPlugin] = (0, _react.useState)(pluginDefinition);
|
|
29
|
+
// need to keep track of prevQueries if switching from a panel with no queries (ex: markdown) to one with queries
|
|
30
|
+
const [prevQueries, setPrevQueries] = (0, _react.useState)(initialQueries);
|
|
31
|
+
const [currentQueries, setCurrentQueries] = (0, _react.useState)(initialQueries);
|
|
32
|
+
/**
|
|
33
|
+
* If hideQueryEditor is true, set panelDefinition.spec.queries to undefined.
|
|
34
|
+
* If hideQueryEditor is false and query is undefined, set panelDefinition.spec.queries to previous queries.
|
|
35
|
+
*/ const setQueries = (0, _react.useCallback)((queries, hideQueryEditor)=>{
|
|
36
|
+
if (hideQueryEditor) {
|
|
37
|
+
setPrevQueries(currentQueries);
|
|
38
|
+
setCurrentQueries(undefined);
|
|
39
|
+
} else {
|
|
40
|
+
setCurrentQueries(queries === undefined ? prevQueries : queries);
|
|
41
|
+
}
|
|
42
|
+
}, [
|
|
43
|
+
setCurrentQueries,
|
|
44
|
+
currentQueries,
|
|
45
|
+
setPrevQueries,
|
|
46
|
+
prevQueries
|
|
47
|
+
]);
|
|
48
|
+
// reset panel definition
|
|
49
|
+
const setPanelDefinition = (0, _react.useCallback)((panelDefinition)=>{
|
|
50
|
+
const { display , plugin , queries } = panelDefinition.spec;
|
|
51
|
+
setName(display.name);
|
|
52
|
+
setDescription(display.description);
|
|
53
|
+
setPlugin(plugin);
|
|
54
|
+
setQueries(queries);
|
|
55
|
+
}, [
|
|
56
|
+
setName,
|
|
57
|
+
setDescription,
|
|
58
|
+
setPlugin,
|
|
59
|
+
setQueries
|
|
60
|
+
]);
|
|
61
|
+
return (0, _react.useMemo)(()=>({
|
|
62
|
+
panelDefinition: {
|
|
63
|
+
kind: 'Panel',
|
|
64
|
+
spec: {
|
|
65
|
+
display: {
|
|
66
|
+
name,
|
|
67
|
+
description
|
|
68
|
+
},
|
|
69
|
+
plugin,
|
|
70
|
+
queries: currentQueries
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
setName,
|
|
74
|
+
setDescription,
|
|
75
|
+
setQueries,
|
|
76
|
+
setPlugin,
|
|
77
|
+
setPanelDefinition
|
|
78
|
+
}), [
|
|
79
|
+
name,
|
|
80
|
+
description,
|
|
81
|
+
plugin,
|
|
82
|
+
currentQueries,
|
|
83
|
+
setName,
|
|
84
|
+
setDescription,
|
|
85
|
+
setQueries,
|
|
86
|
+
setPlugin,
|
|
87
|
+
setPanelDefinition
|
|
88
|
+
]);
|
|
89
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
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, "useTimeSeriesQueryEditorActions", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return useTimeSeriesQueryEditorActions;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
24
|
+
const _immer = /*#__PURE__*/ _interop_require_default(require("immer"));
|
|
25
|
+
const _react = require("react");
|
|
26
|
+
function _interop_require_default(obj) {
|
|
27
|
+
return obj && obj.__esModule ? obj : {
|
|
28
|
+
default: obj
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const DEFAULT_QUERY_PLUGIN_TYPE = 'TimeSeriesQuery';
|
|
32
|
+
const useTimeSeriesQueryEditorActions = (props)=>{
|
|
33
|
+
const { queries , onChange } = props;
|
|
34
|
+
const { defaultPluginKinds } = (0, _pluginsystem.usePluginRegistry)();
|
|
35
|
+
var _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE;
|
|
36
|
+
const defaultTimeSeriesQueryKind = (_defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds[DEFAULT_QUERY_PLUGIN_TYPE]) !== null && _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE !== void 0 ? _defaultPluginKinds_DEFAULT_QUERY_PLUGIN_TYPE : '';
|
|
37
|
+
const { data: defaultQueryPlugin } = (0, _pluginsystem.usePlugin)(DEFAULT_QUERY_PLUGIN_TYPE, defaultTimeSeriesQueryKind, {
|
|
38
|
+
useErrorBoundary: true,
|
|
39
|
+
enabled: true
|
|
40
|
+
});
|
|
41
|
+
const [queriesCollapsed, setQueriesCollapsed] = (0, _react.useState)(queries.map(()=>false));
|
|
42
|
+
const handleQueryChange = (0, _react.useCallback)((index, queryDef)=>{
|
|
43
|
+
onChange((0, _immer.default)(queries, (draft)=>{
|
|
44
|
+
if (draft) {
|
|
45
|
+
draft[index] = queryDef;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
draft = [
|
|
49
|
+
queryDef
|
|
50
|
+
];
|
|
51
|
+
}));
|
|
52
|
+
}, [
|
|
53
|
+
onChange,
|
|
54
|
+
queries
|
|
55
|
+
]);
|
|
56
|
+
const handleQueryAdd = (0, _react.useCallback)(()=>{
|
|
57
|
+
if (!defaultQueryPlugin) return;
|
|
58
|
+
onChange((0, _immer.default)(queries, (draft)=>{
|
|
59
|
+
const queryDef = {
|
|
60
|
+
kind: DEFAULT_QUERY_PLUGIN_TYPE,
|
|
61
|
+
spec: {
|
|
62
|
+
plugin: {
|
|
63
|
+
kind: defaultTimeSeriesQueryKind,
|
|
64
|
+
spec: defaultQueryPlugin.createInitialOptions()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
if (draft) {
|
|
69
|
+
draft.push(queryDef);
|
|
70
|
+
} else {
|
|
71
|
+
draft = [
|
|
72
|
+
...queries,
|
|
73
|
+
queryDef
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
setQueriesCollapsed((queriesCollapsed)=>{
|
|
78
|
+
queriesCollapsed.push(false);
|
|
79
|
+
return [
|
|
80
|
+
...queriesCollapsed
|
|
81
|
+
];
|
|
82
|
+
});
|
|
83
|
+
}, [
|
|
84
|
+
defaultQueryPlugin,
|
|
85
|
+
defaultTimeSeriesQueryKind,
|
|
86
|
+
onChange,
|
|
87
|
+
queries,
|
|
88
|
+
setQueriesCollapsed
|
|
89
|
+
]);
|
|
90
|
+
const handleQueryDelete = (0, _react.useCallback)((index)=>{
|
|
91
|
+
onChange((0, _immer.default)(queries, (draft)=>{
|
|
92
|
+
draft.splice(index, 1);
|
|
93
|
+
}));
|
|
94
|
+
setQueriesCollapsed((queriesCollapsed)=>{
|
|
95
|
+
queriesCollapsed.splice(index, 1);
|
|
96
|
+
return [
|
|
97
|
+
...queriesCollapsed
|
|
98
|
+
];
|
|
99
|
+
});
|
|
100
|
+
}, [
|
|
101
|
+
onChange,
|
|
102
|
+
setQueriesCollapsed,
|
|
103
|
+
queries
|
|
104
|
+
]);
|
|
105
|
+
const handleQueryCollapseExpand = (0, _react.useCallback)((index)=>{
|
|
106
|
+
setQueriesCollapsed((queriesCollapsed)=>{
|
|
107
|
+
queriesCollapsed[index] = !queriesCollapsed[index];
|
|
108
|
+
return [
|
|
109
|
+
...queriesCollapsed
|
|
110
|
+
];
|
|
111
|
+
});
|
|
112
|
+
}, [
|
|
113
|
+
setQueriesCollapsed
|
|
114
|
+
]);
|
|
115
|
+
return (0, _react.useMemo)(()=>{
|
|
116
|
+
return {
|
|
117
|
+
handleQueryChange,
|
|
118
|
+
handleQueryAdd,
|
|
119
|
+
handleQueryDelete,
|
|
120
|
+
handleQueryCollapseExpand,
|
|
121
|
+
queriesCollapsed,
|
|
122
|
+
defaultTimeSeriesQueryKind
|
|
123
|
+
};
|
|
124
|
+
}, [
|
|
125
|
+
handleQueryChange,
|
|
126
|
+
handleQueryAdd,
|
|
127
|
+
handleQueryDelete,
|
|
128
|
+
handleQueryCollapseExpand,
|
|
129
|
+
queriesCollapsed,
|
|
130
|
+
defaultTimeSeriesQueryKind
|
|
131
|
+
]);
|
|
132
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
_export_star(require("./views"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const _reactintersectionobserver = require("react-intersection-observer");
|
|
18
|
+
require("@testing-library/jest-dom/extend-expect");
|
|
19
|
+
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
20
|
+
jest.mock('echarts/core');
|
|
21
|
+
// Tell react-intersection-observer that everything should be considered in-view for tests (see package documentation
|
|
22
|
+
// for other options)
|
|
23
|
+
(0, _reactintersectionobserver.defaultFallbackInView)(true);
|
|
@@ -0,0 +1,67 @@
|
|
|
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, "ViewExplore", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return ViewExplore;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
26
|
+
const _core = require("@perses-dev/core");
|
|
27
|
+
const _components = require("@perses-dev/components");
|
|
28
|
+
const _dashboards = require("@perses-dev/dashboards");
|
|
29
|
+
const _ViewExploreApp = require("./ViewExploreApp");
|
|
30
|
+
function ViewExplore(props) {
|
|
31
|
+
const { dashboardResource , datasourceApi , externalVariableDefinitions , sx , exploreTitleComponent , ...others } = props;
|
|
32
|
+
const initialTimeRange = (0, _pluginsystem.useInitialTimeRange)(_core.DEFAULT_DASHBOARD_DURATION);
|
|
33
|
+
const initialRefreshInterval = (0, _pluginsystem.useInitialRefreshInterval)(_core.DEFAULT_REFRESH_INTERVAL);
|
|
34
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.DatasourceStoreProvider, {
|
|
35
|
+
dashboardResource: dashboardResource,
|
|
36
|
+
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
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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, "ViewExploreApp", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return ViewExploreApp;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _components = require("@perses-dev/components");
|
|
26
|
+
const _PanelEditorForm = require("../../components/PanelEditor/PanelEditorForm");
|
|
27
|
+
function ViewExploreApp(props) {
|
|
28
|
+
const { exploreTitleComponent } = props;
|
|
29
|
+
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
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
47
|
+
sx: {
|
|
48
|
+
flexGrow: 1,
|
|
49
|
+
overflowX: 'hidden',
|
|
50
|
+
overflowY: 'auto',
|
|
51
|
+
display: 'flex',
|
|
52
|
+
flexDirection: 'column'
|
|
53
|
+
},
|
|
54
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ChartsProvider, {
|
|
55
|
+
chartsTheme: chartsTheme,
|
|
56
|
+
enablePinning: false,
|
|
57
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PanelEditorForm.PanelEditorForm, {
|
|
58
|
+
initialAction: "update",
|
|
59
|
+
initialValues: data,
|
|
60
|
+
exploreTitleComponent: exploreTitleComponent
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
_export_star(require("./ViewExplore"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
_export_star(require("./ViewExplore"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
|
@@ -0,0 +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,gBAuBxD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { Stack, Box, useTheme, useMediaQuery } from '@mui/material';
|
|
15
|
+
import { TimeRangeControls } from '@perses-dev/dashboards';
|
|
16
|
+
export const ExploreToolbar = (props)=>{
|
|
17
|
+
const { exploreTitleComponent } = props;
|
|
18
|
+
const isBiggerThanLg = useMediaQuery(useTheme().breakpoints.up('lg'));
|
|
19
|
+
const testId = 'explore-toolbar';
|
|
20
|
+
return /*#__PURE__*/ _jsx(Stack, {
|
|
21
|
+
"data-testid": testId,
|
|
22
|
+
children: /*#__PURE__*/ _jsxs(Box, {
|
|
23
|
+
sx: {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
width: '100%'
|
|
26
|
+
},
|
|
27
|
+
children: [
|
|
28
|
+
exploreTitleComponent,
|
|
29
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
30
|
+
direction: "row",
|
|
31
|
+
spacing: 1,
|
|
32
|
+
ml: "auto",
|
|
33
|
+
flexWrap: isBiggerThanLg ? 'nowrap' : 'wrap-reverse',
|
|
34
|
+
justifyContent: "end",
|
|
35
|
+
children: /*#__PURE__*/ _jsx(TimeRangeControls, {})
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=ExploreToolbar.js.map
|
|
@@ -0,0 +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,sBAAqB,EAAE,GAAGD;IAElC,MAAME,iBAAiBL,cAAcD,WAAWO,YAAYC,GAAG;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreToolbar/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export * from './ExploreToolbar';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ExploreToolbar/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './ExploreToolbar';\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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PanelEditorValues } from '@perses-dev/dashboards';
|
|
3
|
+
import { Action, PanelDefinition, QueryDefinition, UnknownSpec } from '@perses-dev/core';
|
|
4
|
+
export interface PanelEditorProps {
|
|
5
|
+
initialValues: PanelEditorValues;
|
|
6
|
+
initialAction: Action;
|
|
7
|
+
exploreTitleComponent?: JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
export interface PanelSpecEditorProps {
|
|
10
|
+
panelDefinition: PanelDefinition;
|
|
11
|
+
onQueriesChange: (queries: QueryDefinition[]) => void;
|
|
12
|
+
onPluginSpecChange: (spec: UnknownSpec) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function PanelEditorForm(props: PanelEditorProps): JSX.Element;
|
|
15
|
+
//# sourceMappingURL=PanelEditorForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/PanelEditor/PanelEditorForm.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,iBAAiB,EAAgB,MAAM,wBAAwB,CAAC;AAMzE,OAAO,EAAE,MAAM,EAAc,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAOrG,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,iBAAiB,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IACtD,kBAAkB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CACjD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,eAyEtD"}
|