@perses-dev/explore 0.46.0-rc1 → 0.47.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.
- package/dist/cjs/components/ExploreManager/ExploreManager.js +4 -2
- package/dist/cjs/components/ExploreManager/ExplorerManagerProvider.js +40 -65
- package/dist/cjs/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js +11 -26
- package/dist/cjs/components/ExploreManager/TracesExplorer.js +118 -48
- package/dist/cjs/views/ViewExplore/ViewExplore.js +2 -2
- package/dist/components/ExploreManager/ExploreManager.js +4 -2
- package/dist/components/ExploreManager/ExploreManager.js.map +1 -1
- package/dist/components/ExploreManager/ExplorerManagerProvider.d.ts +10 -12
- package/dist/components/ExploreManager/ExplorerManagerProvider.d.ts.map +1 -1
- package/dist/components/ExploreManager/ExplorerManagerProvider.js +41 -66
- package/dist/components/ExploreManager/ExplorerManagerProvider.js.map +1 -1
- package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.d.ts.map +1 -1
- package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js +12 -27
- package/dist/components/ExploreManager/ExplorerManagerProviderWithQueryParams.js.map +1 -1
- package/dist/components/ExploreManager/TracesExplorer.d.ts.map +1 -1
- package/dist/components/ExploreManager/TracesExplorer.js +124 -49
- package/dist/components/ExploreManager/TracesExplorer.js.map +1 -1
- package/dist/views/ViewExplore/ViewExplore.d.ts +2 -2
- package/dist/views/ViewExplore/ViewExplore.d.ts.map +1 -1
- package/dist/views/ViewExplore/ViewExplore.js +3 -3
- package/dist/views/ViewExplore/ViewExplore.js.map +1 -1
- package/package.json +9 -9
|
@@ -62,9 +62,11 @@ function ExploreManager(props) {
|
|
|
62
62
|
},
|
|
63
63
|
children: [
|
|
64
64
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tab, {
|
|
65
|
+
value: "metrics",
|
|
65
66
|
label: "Metrics"
|
|
66
67
|
}),
|
|
67
68
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tab, {
|
|
69
|
+
value: "traces",
|
|
68
70
|
label: "Traces"
|
|
69
71
|
})
|
|
70
72
|
]
|
|
@@ -75,8 +77,8 @@ function ExploreManager(props) {
|
|
|
75
77
|
width: '100%'
|
|
76
78
|
},
|
|
77
79
|
children: [
|
|
78
|
-
explorer ===
|
|
79
|
-
explorer ===
|
|
80
|
+
explorer === 'metrics' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_MetricsExplorer.MetricsExplorer, {}),
|
|
81
|
+
explorer === 'traces' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_TracesExplorer.TracesExplorer, {})
|
|
80
82
|
]
|
|
81
83
|
})
|
|
82
84
|
]
|
|
@@ -72,75 +72,50 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
72
72
|
return newObj;
|
|
73
73
|
}
|
|
74
74
|
const ExplorerManagerContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
function ExplorerManagerProvider({ children, store: externalStore }) {
|
|
76
|
+
// cache the state of currently not rendered explore UIs
|
|
77
|
+
const [explorerStateCache, setExplorerStateCache] = (0, _react.useState)({});
|
|
78
|
+
// local store in case external store is not provided by prop
|
|
79
|
+
const localStore = (0, _react.useState)({
|
|
80
|
+
explorer: 'metrics',
|
|
81
|
+
tab: 0,
|
|
82
|
+
queries: []
|
|
83
|
+
});
|
|
84
|
+
// use store provided by 'store' prop if available, otherwise use local store
|
|
85
|
+
const [explorerState, setExplorerState] = externalStore ? externalStore : localStore;
|
|
86
|
+
const { explorer, tab, queries } = explorerState;
|
|
87
|
+
function setExplorer(newExplorer) {
|
|
88
|
+
// store current explorer state
|
|
89
|
+
explorerStateCache[explorer] = {
|
|
90
|
+
tab,
|
|
91
|
+
queries
|
|
92
|
+
};
|
|
93
|
+
setExplorerStateCache(explorerStateCache);
|
|
94
|
+
var _explorerStateCache_newExplorer;
|
|
95
|
+
// restore previous explorer state (if any)
|
|
96
|
+
const state = (_explorerStateCache_newExplorer = explorerStateCache[newExplorer]) !== null && _explorerStateCache_newExplorer !== void 0 ? _explorerStateCache_newExplorer : {
|
|
97
|
+
tab: 0,
|
|
98
|
+
queries: []
|
|
82
99
|
};
|
|
100
|
+
setExplorerState({
|
|
101
|
+
explorer: newExplorer,
|
|
102
|
+
tab: state.tab,
|
|
103
|
+
queries: state.queries
|
|
104
|
+
});
|
|
83
105
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const tab = (0, _react.useMemo)(()=>{
|
|
91
|
-
var _explorerStates_explorer;
|
|
92
|
-
var _explorerStates_explorer_tab;
|
|
93
|
-
return (_explorerStates_explorer_tab = (_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.tab) !== null && _explorerStates_explorer_tab !== void 0 ? _explorerStates_explorer_tab : 0;
|
|
94
|
-
}, [
|
|
95
|
-
explorer,
|
|
96
|
-
explorerStates
|
|
97
|
-
]);
|
|
98
|
-
const queries = (0, _react.useMemo)(()=>{
|
|
99
|
-
var _explorerStates_explorer;
|
|
100
|
-
var _explorerStates_explorer_queries;
|
|
101
|
-
return (_explorerStates_explorer_queries = (_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.queries) !== null && _explorerStates_explorer_queries !== void 0 ? _explorerStates_explorer_queries : [];
|
|
102
|
-
}, [
|
|
103
|
-
explorer,
|
|
104
|
-
explorerStates
|
|
105
|
-
]);
|
|
106
|
-
function setExplorer(explorer) {
|
|
107
|
-
setInternalExplorer(explorer);
|
|
108
|
-
if (initialState === null || initialState === void 0 ? void 0 : initialState.setExplorer) {
|
|
109
|
-
var _explorerStates_explorer, _explorerStates_explorer1;
|
|
110
|
-
initialState.setExplorer(explorer);
|
|
111
|
-
initialState.setTab((_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.tab);
|
|
112
|
-
initialState.setQueries((_explorerStates_explorer1 = explorerStates[explorer]) === null || _explorerStates_explorer1 === void 0 ? void 0 : _explorerStates_explorer1.queries);
|
|
113
|
-
}
|
|
106
|
+
function setTab(newTab) {
|
|
107
|
+
setExplorerState({
|
|
108
|
+
explorer,
|
|
109
|
+
tab: newTab,
|
|
110
|
+
queries
|
|
111
|
+
});
|
|
114
112
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
...explorerStates
|
|
119
|
-
];
|
|
120
|
-
var _state_explorer_queries;
|
|
121
|
-
state[explorer] = {
|
|
113
|
+
function setQueries(newQueries) {
|
|
114
|
+
setExplorerState({
|
|
115
|
+
explorer,
|
|
122
116
|
tab,
|
|
123
|
-
queries:
|
|
124
|
-
};
|
|
125
|
-
setExplorerStates(state);
|
|
126
|
-
if (initialState === null || initialState === void 0 ? void 0 : initialState.setTab) {
|
|
127
|
-
initialState.setTab(tab);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function setQueries(queries) {
|
|
131
|
-
var _state_explorer;
|
|
132
|
-
const state = [
|
|
133
|
-
...explorerStates
|
|
134
|
-
];
|
|
135
|
-
var _state_explorer_tab;
|
|
136
|
-
state[explorer] = {
|
|
137
|
-
tab: (_state_explorer_tab = (_state_explorer = state[explorer]) === null || _state_explorer === void 0 ? void 0 : _state_explorer.tab) !== null && _state_explorer_tab !== void 0 ? _state_explorer_tab : 0,
|
|
138
|
-
queries: queries
|
|
139
|
-
};
|
|
140
|
-
setExplorerStates(state);
|
|
141
|
-
if (initialState === null || initialState === void 0 ? void 0 : initialState.setQueries) {
|
|
142
|
-
initialState === null || initialState === void 0 ? void 0 : initialState.setQueries(queries);
|
|
143
|
-
}
|
|
117
|
+
queries: newQueries
|
|
118
|
+
});
|
|
144
119
|
}
|
|
145
120
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(ExplorerManagerContext.Provider, {
|
|
146
121
|
value: {
|
|
@@ -30,35 +30,20 @@ function _interop_require_default(obj) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
const exploreQueryConfig = {
|
|
33
|
-
explorer: _usequeryparams.
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
explorer: (0, _usequeryparams.withDefault)((0, _usequeryparams.createEnumParam)([
|
|
34
|
+
'metrics',
|
|
35
|
+
'traces'
|
|
36
|
+
]), 'metrics'),
|
|
37
|
+
tab: (0, _usequeryparams.withDefault)(_usequeryparams.NumberParam, 0),
|
|
38
|
+
queries: (0, _usequeryparams.withDefault)(_usequeryparams.JsonParam, [])
|
|
36
39
|
};
|
|
37
40
|
function ExplorerManagerProviderWithQueryParams({ children }) {
|
|
38
|
-
const [queryParams, setQueryParams] = (0, _usequeryparams.useQueryParams)(exploreQueryConfig
|
|
39
|
-
updateType: 'replaceIn'
|
|
40
|
-
});
|
|
41
|
-
var _queryParams_explorer, _queryParams_tab;
|
|
42
|
-
const initialState = {
|
|
43
|
-
explorer: (_queryParams_explorer = queryParams.explorer) !== null && _queryParams_explorer !== void 0 ? _queryParams_explorer : undefined,
|
|
44
|
-
tab: (_queryParams_tab = queryParams.tab) !== null && _queryParams_tab !== void 0 ? _queryParams_tab : undefined,
|
|
45
|
-
queries: queryParams.queries ? queryParams.queries : undefined,
|
|
46
|
-
setExplorer: (explorer)=>{
|
|
47
|
-
setQueryParams({
|
|
48
|
-
explorer,
|
|
49
|
-
queries: undefined,
|
|
50
|
-
tab: undefined
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
setTab: (tab)=>setQueryParams({
|
|
54
|
-
tab
|
|
55
|
-
}),
|
|
56
|
-
setQueries: (queries)=>setQueryParams({
|
|
57
|
-
queries
|
|
58
|
-
})
|
|
59
|
-
};
|
|
41
|
+
const [queryParams, setQueryParams] = (0, _usequeryparams.useQueryParams)(exploreQueryConfig);
|
|
60
42
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ExplorerManagerProvider.ExplorerManagerProvider, {
|
|
61
|
-
|
|
43
|
+
store: [
|
|
44
|
+
queryParams,
|
|
45
|
+
setQueryParams
|
|
46
|
+
],
|
|
62
47
|
children: children
|
|
63
48
|
});
|
|
64
49
|
}
|
|
@@ -23,20 +23,111 @@ Object.defineProperty(exports, "TracesExplorer", {
|
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
25
|
const _material = require("@mui/material");
|
|
26
|
-
const _panelsplugin = require("@perses-dev/panels-plugin");
|
|
27
26
|
const _components = require("@perses-dev/components");
|
|
28
|
-
const
|
|
27
|
+
const _dashboards = require("@perses-dev/dashboards");
|
|
28
|
+
const _core = require("@perses-dev/core");
|
|
29
29
|
const _constants = require("./constants");
|
|
30
30
|
const _ExplorerManagerProvider = require("./ExplorerManagerProvider");
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
function SearchResultsPanel({ queries }) {
|
|
32
|
+
const { isFetching, isLoading, queryResults } = (0, _pluginsystem.useDataQueries)('TraceQuery');
|
|
33
|
+
// no query executed, show empty panel
|
|
34
|
+
if (queryResults.length === 0) {
|
|
35
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {});
|
|
36
|
+
}
|
|
37
|
+
if (isLoading || isFetching) {
|
|
38
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.LoadingOverlay, {});
|
|
39
|
+
}
|
|
40
|
+
const queryError = queryResults.find((d)=>d.error);
|
|
41
|
+
if (queryError) {
|
|
42
|
+
throw queryError.error;
|
|
43
|
+
}
|
|
44
|
+
const tracesFound = queryResults.some((traceData)=>{
|
|
45
|
+
var _traceData_data;
|
|
46
|
+
var _traceData_data_searchResult;
|
|
47
|
+
return ((_traceData_data_searchResult = (_traceData_data = traceData.data) === null || _traceData_data === void 0 ? void 0 : _traceData_data.searchResult) !== null && _traceData_data_searchResult !== void 0 ? _traceData_data_searchResult : []).length > 0;
|
|
48
|
+
});
|
|
49
|
+
if (!tracesFound) {
|
|
50
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.NoDataOverlay, {
|
|
51
|
+
resource: "traces"
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
55
|
+
sx: {
|
|
56
|
+
height: '100%'
|
|
57
|
+
},
|
|
58
|
+
gap: 2,
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
61
|
+
sx: {
|
|
62
|
+
height: '35%',
|
|
63
|
+
flexShrink: 0
|
|
64
|
+
},
|
|
65
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.Panel, {
|
|
66
|
+
panelOptions: {
|
|
67
|
+
hideHeader: true
|
|
68
|
+
},
|
|
69
|
+
definition: {
|
|
70
|
+
kind: 'Panel',
|
|
71
|
+
spec: {
|
|
72
|
+
queries,
|
|
73
|
+
display: {
|
|
74
|
+
name: ''
|
|
75
|
+
},
|
|
76
|
+
plugin: {
|
|
77
|
+
kind: 'ScatterChart',
|
|
78
|
+
spec: {}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.Panel, {
|
|
85
|
+
sx: {
|
|
86
|
+
flexGrow: 1
|
|
87
|
+
},
|
|
88
|
+
panelOptions: {
|
|
89
|
+
hideHeader: true
|
|
90
|
+
},
|
|
91
|
+
definition: {
|
|
92
|
+
kind: 'Panel',
|
|
93
|
+
spec: {
|
|
94
|
+
queries,
|
|
95
|
+
display: {
|
|
96
|
+
name: ''
|
|
97
|
+
},
|
|
98
|
+
plugin: {
|
|
99
|
+
kind: 'TraceTable',
|
|
100
|
+
spec: {}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
]
|
|
106
|
+
});
|
|
35
107
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
108
|
+
function TracingGanttChartPanel({ queries }) {
|
|
109
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.Panel, {
|
|
110
|
+
panelOptions: {
|
|
111
|
+
hideHeader: true
|
|
112
|
+
},
|
|
113
|
+
definition: {
|
|
114
|
+
kind: 'Panel',
|
|
115
|
+
spec: {
|
|
116
|
+
queries,
|
|
117
|
+
display: {
|
|
118
|
+
name: ''
|
|
119
|
+
},
|
|
120
|
+
plugin: {
|
|
121
|
+
kind: 'TracingGanttChart',
|
|
122
|
+
spec: {}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function TracesExplorer() {
|
|
129
|
+
var _queries_, _queries_1, _queries_2;
|
|
130
|
+
const { queries, setQueries } = (0, _ExplorerManagerProvider.useExplorerManagerContext)();
|
|
40
131
|
// map TraceQueryDefinition to Definition<UnknownSpec>
|
|
41
132
|
const definitions = queries.length ? queries.map((query)=>{
|
|
42
133
|
return {
|
|
@@ -44,26 +135,9 @@ function TracePanel({ queries }) {
|
|
|
44
135
|
spec: query.spec.plugin.spec
|
|
45
136
|
};
|
|
46
137
|
}) : [];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DataQueriesProvider, {
|
|
51
|
-
definitions: definitions,
|
|
52
|
-
options: {
|
|
53
|
-
suggestedStepMs
|
|
54
|
-
},
|
|
55
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_panelsplugin.ScatterChart.PanelComponent, {
|
|
56
|
-
contentDimensions: {
|
|
57
|
-
width: width !== null && width !== void 0 ? width : _constants.PANEL_PREVIEW_DEFAULT_WIDTH,
|
|
58
|
-
height
|
|
59
|
-
},
|
|
60
|
-
spec: {}
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function TracesExplorer() {
|
|
66
|
-
const { tab, queries, setTab, setQueries } = (0, _ExplorerManagerProvider.useExplorerManagerContext)();
|
|
138
|
+
var _queries__spec_plugin_spec_query;
|
|
139
|
+
// Cannot cast to TempoTraceQuerySpec because 'tempo-plugin' types are not accessible in @perses-dev/explore
|
|
140
|
+
const isSingleTrace = queries.length === 1 && ((_queries_ = queries[0]) === null || _queries_ === void 0 ? void 0 : _queries_.kind) === 'TraceQuery' && ((_queries_1 = queries[0]) === null || _queries_1 === void 0 ? void 0 : _queries_1.spec.plugin.kind) === 'TempoTraceQuery' && (0, _core.isValidTraceId)((_queries__spec_plugin_spec_query = ((_queries_2 = queries[0]) === null || _queries_2 === void 0 ? void 0 : _queries_2.spec.plugin.spec).query) !== null && _queries__spec_plugin_spec_query !== void 0 ? _queries__spec_plugin_spec_query : ''); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
67
141
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
68
142
|
gap: 2,
|
|
69
143
|
sx: {
|
|
@@ -77,24 +151,20 @@ function TracesExplorer() {
|
|
|
77
151
|
onChange: setQueries,
|
|
78
152
|
queries: queries
|
|
79
153
|
}),
|
|
80
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
95
|
-
FallbackComponent: _components.ErrorAlert,
|
|
96
|
-
children: tab === 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(TracePanel, {
|
|
97
|
-
queries: queries
|
|
154
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
155
|
+
FallbackComponent: _components.ErrorAlert,
|
|
156
|
+
resetKeys: [
|
|
157
|
+
queries
|
|
158
|
+
],
|
|
159
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DataQueriesProvider, {
|
|
160
|
+
definitions: definitions,
|
|
161
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
162
|
+
height: _constants.PANEL_PREVIEW_HEIGHT,
|
|
163
|
+
children: isSingleTrace ? /*#__PURE__*/ (0, _jsxruntime.jsx)(TracingGanttChartPanel, {
|
|
164
|
+
queries: queries
|
|
165
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(SearchResultsPanel, {
|
|
166
|
+
queries: queries
|
|
167
|
+
})
|
|
98
168
|
})
|
|
99
169
|
})
|
|
100
170
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -42,7 +42,7 @@ function ViewExplore(props) {
|
|
|
42
42
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProviderWithQueryParams, {
|
|
43
43
|
initialTimeRange: initialTimeRange,
|
|
44
44
|
initialRefreshInterval: initialRefreshInterval,
|
|
45
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.
|
|
45
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_dashboards.VariableProvider, {
|
|
46
46
|
externalVariableDefinitions: externalVariableDefinitions,
|
|
47
47
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
48
48
|
sx: (0, _components.combineSx)({
|
|
@@ -52,9 +52,11 @@ export function ExploreManager(props) {
|
|
|
52
52
|
},
|
|
53
53
|
children: [
|
|
54
54
|
/*#__PURE__*/ _jsx(Tab, {
|
|
55
|
+
value: "metrics",
|
|
55
56
|
label: "Metrics"
|
|
56
57
|
}),
|
|
57
58
|
/*#__PURE__*/ _jsx(Tab, {
|
|
59
|
+
value: "traces",
|
|
58
60
|
label: "Traces"
|
|
59
61
|
})
|
|
60
62
|
]
|
|
@@ -65,8 +67,8 @@ export function ExploreManager(props) {
|
|
|
65
67
|
width: '100%'
|
|
66
68
|
},
|
|
67
69
|
children: [
|
|
68
|
-
explorer ===
|
|
69
|
-
explorer ===
|
|
70
|
+
explorer === 'metrics' && /*#__PURE__*/ _jsx(MetricsExplorer, {}),
|
|
71
|
+
explorer === 'traces' && /*#__PURE__*/ _jsx(TracesExplorer, {})
|
|
70
72
|
]
|
|
71
73
|
})
|
|
72
74
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ExploreManager/ExploreManager.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Card, Stack, Tab, Tabs, useMediaQuery } from '@mui/material';\nimport { ReactNode } from 'react';\nimport { ExploreToolbar } from '../ExploreToolbar';\nimport { TracesExplorer } from './TracesExplorer';\nimport { MetricsExplorer } from './MetricsExplorer';\nimport { useExplorerManagerContext } from './ExplorerManagerProvider';\n\nexport interface ExploreManagerProps {\n exploreTitleComponent?: ReactNode;\n}\n\nexport function ExploreManager(props: ExploreManagerProps) {\n const { exploreTitleComponent } = props;\n const { explorer, setExplorer } = useExplorerManagerContext();\n\n const smallScreen = useMediaQuery('(max-width: 768px)');\n return (\n <Stack sx={{ width: '100%' }} px={2} pb={2} pt={1.5} gap={3}>\n <ExploreToolbar exploreTitleComponent={exploreTitleComponent} />\n\n <Stack direction={smallScreen ? 'column' : 'row'} gap={2} sx={{ width: '100%' }}>\n <Tabs\n orientation={smallScreen ? 'horizontal' : 'vertical'}\n value={explorer}\n onChange={(_, state) => setExplorer(state)}\n variant={smallScreen ? 'fullWidth' : 'scrollable'}\n sx={{\n borderRight: smallScreen ? 0 : 1,\n borderBottom: smallScreen ? 1 : 0,\n borderColor: 'divider',\n minWidth: '100px',\n }}\n >\n <Tab label=\"Metrics\" />\n <Tab label=\"Traces\" />\n </Tabs>\n <Card sx={{ padding: '10px', width: '100%' }}>\n {explorer ===
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ExploreManager/ExploreManager.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Card, Stack, Tab, Tabs, useMediaQuery } from '@mui/material';\nimport { ReactNode } from 'react';\nimport { ExploreToolbar } from '../ExploreToolbar';\nimport { TracesExplorer } from './TracesExplorer';\nimport { MetricsExplorer } from './MetricsExplorer';\nimport { useExplorerManagerContext } from './ExplorerManagerProvider';\n\nexport interface ExploreManagerProps {\n exploreTitleComponent?: ReactNode;\n}\n\nexport function ExploreManager(props: ExploreManagerProps) {\n const { exploreTitleComponent } = props;\n const { explorer, setExplorer } = useExplorerManagerContext();\n\n const smallScreen = useMediaQuery('(max-width: 768px)');\n return (\n <Stack sx={{ width: '100%' }} px={2} pb={2} pt={1.5} gap={3}>\n <ExploreToolbar exploreTitleComponent={exploreTitleComponent} />\n\n <Stack direction={smallScreen ? 'column' : 'row'} gap={2} sx={{ width: '100%' }}>\n <Tabs\n orientation={smallScreen ? 'horizontal' : 'vertical'}\n value={explorer}\n onChange={(_, state) => setExplorer(state)}\n variant={smallScreen ? 'fullWidth' : 'scrollable'}\n sx={{\n borderRight: smallScreen ? 0 : 1,\n borderBottom: smallScreen ? 1 : 0,\n borderColor: 'divider',\n minWidth: '100px',\n }}\n >\n <Tab value=\"metrics\" label=\"Metrics\" />\n <Tab value=\"traces\" label=\"Traces\" />\n </Tabs>\n <Card sx={{ padding: '10px', width: '100%' }}>\n {explorer === 'metrics' && <MetricsExplorer />}\n {explorer === 'traces' && <TracesExplorer />}\n </Card>\n </Stack>\n </Stack>\n );\n}\n"],"names":["Card","Stack","Tab","Tabs","useMediaQuery","ExploreToolbar","TracesExplorer","MetricsExplorer","useExplorerManagerContext","ExploreManager","props","exploreTitleComponent","explorer","setExplorer","smallScreen","sx","width","px","pb","pt","gap","direction","orientation","value","onChange","_","state","variant","borderRight","borderBottom","borderColor","minWidth","label","padding"],"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,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,aAAa,QAAQ,gBAAgB;AAEtE,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,yBAAyB,QAAQ,4BAA4B;AAMtE,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,qBAAqB,EAAE,GAAGD;IAClC,MAAM,EAAEE,QAAQ,EAAEC,WAAW,EAAE,GAAGL;IAElC,MAAMM,cAAcV,cAAc;IAClC,qBACE,MAACH;QAAMc,IAAI;YAAEC,OAAO;QAAO;QAAGC,IAAI;QAAGC,IAAI;QAAGC,IAAI;QAAKC,KAAK;;0BACxD,KAACf;gBAAeM,uBAAuBA;;0BAEvC,MAACV;gBAAMoB,WAAWP,cAAc,WAAW;gBAAOM,KAAK;gBAAGL,IAAI;oBAAEC,OAAO;gBAAO;;kCAC5E,MAACb;wBACCmB,aAAaR,cAAc,eAAe;wBAC1CS,OAAOX;wBACPY,UAAU,CAACC,GAAGC,QAAUb,YAAYa;wBACpCC,SAASb,cAAc,cAAc;wBACrCC,IAAI;4BACFa,aAAad,cAAc,IAAI;4BAC/Be,cAAcf,cAAc,IAAI;4BAChCgB,aAAa;4BACbC,UAAU;wBACZ;;0CAEA,KAAC7B;gCAAIqB,OAAM;gCAAUS,OAAM;;0CAC3B,KAAC9B;gCAAIqB,OAAM;gCAASS,OAAM;;;;kCAE5B,MAAChC;wBAAKe,IAAI;4BAAEkB,SAAS;4BAAQjB,OAAO;wBAAO;;4BACxCJ,aAAa,2BAAa,KAACL;4BAC3BK,aAAa,0BAAY,KAACN;;;;;;;AAKrC"}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { QueryDefinition } from '@perses-dev/core';
|
|
3
|
+
interface ExplorerState {
|
|
4
|
+
explorer: string;
|
|
5
|
+
tab: number;
|
|
6
|
+
queries: QueryDefinition[];
|
|
7
|
+
}
|
|
3
8
|
interface ExplorerManagerContextType {
|
|
4
|
-
|
|
9
|
+
/** observability signal, for example metrics or traces */
|
|
10
|
+
explorer: string;
|
|
5
11
|
tab: number;
|
|
6
12
|
queries: QueryDefinition[];
|
|
7
|
-
setExplorer: (explorer:
|
|
13
|
+
setExplorer: (explorer: string) => void;
|
|
8
14
|
setTab: (tab: number) => void;
|
|
9
15
|
setQueries: (queries: QueryDefinition[]) => void;
|
|
10
16
|
}
|
|
11
|
-
interface ExplorerManagerInitialState {
|
|
12
|
-
explorer?: number;
|
|
13
|
-
tab?: number;
|
|
14
|
-
queries?: QueryDefinition[];
|
|
15
|
-
setExplorer: (explorer: number | undefined) => void;
|
|
16
|
-
setTab: (tab: number | undefined) => void;
|
|
17
|
-
setQueries: (queries: QueryDefinition[] | undefined) => void;
|
|
18
|
-
}
|
|
19
17
|
interface ExplorerManagerProviderProps {
|
|
20
18
|
children: ReactNode;
|
|
21
|
-
|
|
19
|
+
store?: [ExplorerState, (state: ExplorerState) => void];
|
|
22
20
|
}
|
|
23
|
-
export declare function ExplorerManagerProvider({ children,
|
|
21
|
+
export declare function ExplorerManagerProvider({ children, store: externalStore }: ExplorerManagerProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
24
22
|
export declare function useExplorerManagerContext(): ExplorerManagerContextType;
|
|
25
23
|
export {};
|
|
26
24
|
//# sourceMappingURL=ExplorerManagerProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplorerManagerProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAiB,SAAS,
|
|
1
|
+
{"version":3,"file":"ExplorerManagerProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAiB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,UAAU,0BAA0B;IAClC,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,UAAU,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAClD;AAID,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC,CAAC;CACzD;AAED,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,4BAA4B,2CAgCvG;AAED,wBAAgB,yBAAyB,IAAI,0BAA0B,CAMtE"}
|
|
@@ -11,77 +11,52 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import React, { createContext, useContext,
|
|
14
|
+
import React, { createContext, useContext, useState } from 'react';
|
|
15
15
|
const ExplorerManagerContext = /*#__PURE__*/ createContext(undefined);
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
export function ExplorerManagerProvider({ children, store: externalStore }) {
|
|
17
|
+
// cache the state of currently not rendered explore UIs
|
|
18
|
+
const [explorerStateCache, setExplorerStateCache] = useState({});
|
|
19
|
+
// local store in case external store is not provided by prop
|
|
20
|
+
const localStore = useState({
|
|
21
|
+
explorer: 'metrics',
|
|
22
|
+
tab: 0,
|
|
23
|
+
queries: []
|
|
24
|
+
});
|
|
25
|
+
// use store provided by 'store' prop if available, otherwise use local store
|
|
26
|
+
const [explorerState, setExplorerState] = externalStore ? externalStore : localStore;
|
|
27
|
+
const { explorer, tab, queries } = explorerState;
|
|
28
|
+
function setExplorer(newExplorer) {
|
|
29
|
+
// store current explorer state
|
|
30
|
+
explorerStateCache[explorer] = {
|
|
31
|
+
tab,
|
|
32
|
+
queries
|
|
33
|
+
};
|
|
34
|
+
setExplorerStateCache(explorerStateCache);
|
|
35
|
+
var _explorerStateCache_newExplorer;
|
|
36
|
+
// restore previous explorer state (if any)
|
|
37
|
+
const state = (_explorerStateCache_newExplorer = explorerStateCache[newExplorer]) !== null && _explorerStateCache_newExplorer !== void 0 ? _explorerStateCache_newExplorer : {
|
|
38
|
+
tab: 0,
|
|
39
|
+
queries: []
|
|
23
40
|
};
|
|
41
|
+
setExplorerState({
|
|
42
|
+
explorer: newExplorer,
|
|
43
|
+
tab: state.tab,
|
|
44
|
+
queries: state.queries
|
|
45
|
+
});
|
|
24
46
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const tab = useMemo(()=>{
|
|
32
|
-
var _explorerStates_explorer;
|
|
33
|
-
var _explorerStates_explorer_tab;
|
|
34
|
-
return (_explorerStates_explorer_tab = (_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.tab) !== null && _explorerStates_explorer_tab !== void 0 ? _explorerStates_explorer_tab : 0;
|
|
35
|
-
}, [
|
|
36
|
-
explorer,
|
|
37
|
-
explorerStates
|
|
38
|
-
]);
|
|
39
|
-
const queries = useMemo(()=>{
|
|
40
|
-
var _explorerStates_explorer;
|
|
41
|
-
var _explorerStates_explorer_queries;
|
|
42
|
-
return (_explorerStates_explorer_queries = (_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.queries) !== null && _explorerStates_explorer_queries !== void 0 ? _explorerStates_explorer_queries : [];
|
|
43
|
-
}, [
|
|
44
|
-
explorer,
|
|
45
|
-
explorerStates
|
|
46
|
-
]);
|
|
47
|
-
function setExplorer(explorer) {
|
|
48
|
-
setInternalExplorer(explorer);
|
|
49
|
-
if (initialState === null || initialState === void 0 ? void 0 : initialState.setExplorer) {
|
|
50
|
-
var _explorerStates_explorer, _explorerStates_explorer1;
|
|
51
|
-
initialState.setExplorer(explorer);
|
|
52
|
-
initialState.setTab((_explorerStates_explorer = explorerStates[explorer]) === null || _explorerStates_explorer === void 0 ? void 0 : _explorerStates_explorer.tab);
|
|
53
|
-
initialState.setQueries((_explorerStates_explorer1 = explorerStates[explorer]) === null || _explorerStates_explorer1 === void 0 ? void 0 : _explorerStates_explorer1.queries);
|
|
54
|
-
}
|
|
47
|
+
function setTab(newTab) {
|
|
48
|
+
setExplorerState({
|
|
49
|
+
explorer,
|
|
50
|
+
tab: newTab,
|
|
51
|
+
queries
|
|
52
|
+
});
|
|
55
53
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
...explorerStates
|
|
60
|
-
];
|
|
61
|
-
var _state_explorer_queries;
|
|
62
|
-
state[explorer] = {
|
|
54
|
+
function setQueries(newQueries) {
|
|
55
|
+
setExplorerState({
|
|
56
|
+
explorer,
|
|
63
57
|
tab,
|
|
64
|
-
queries:
|
|
65
|
-
};
|
|
66
|
-
setExplorerStates(state);
|
|
67
|
-
if (initialState === null || initialState === void 0 ? void 0 : initialState.setTab) {
|
|
68
|
-
initialState.setTab(tab);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function setQueries(queries) {
|
|
72
|
-
var _state_explorer;
|
|
73
|
-
const state = [
|
|
74
|
-
...explorerStates
|
|
75
|
-
];
|
|
76
|
-
var _state_explorer_tab;
|
|
77
|
-
state[explorer] = {
|
|
78
|
-
tab: (_state_explorer_tab = (_state_explorer = state[explorer]) === null || _state_explorer === void 0 ? void 0 : _state_explorer.tab) !== null && _state_explorer_tab !== void 0 ? _state_explorer_tab : 0,
|
|
79
|
-
queries: queries
|
|
80
|
-
};
|
|
81
|
-
setExplorerStates(state);
|
|
82
|
-
if (initialState === null || initialState === void 0 ? void 0 : initialState.setQueries) {
|
|
83
|
-
initialState === null || initialState === void 0 ? void 0 : initialState.setQueries(queries);
|
|
84
|
-
}
|
|
58
|
+
queries: newQueries
|
|
59
|
+
});
|
|
85
60
|
}
|
|
86
61
|
return /*#__PURE__*/ _jsx(ExplorerManagerContext.Provider, {
|
|
87
62
|
value: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, ReactNode, useContext,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProvider.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, ReactNode, useContext, useState } from 'react';\nimport { QueryDefinition } from '@perses-dev/core';\n\ninterface ExplorerState {\n explorer: string;\n tab: number;\n queries: QueryDefinition[];\n}\n\ninterface ExplorerManagerContextType {\n /** observability signal, for example metrics or traces */\n explorer: string;\n tab: number;\n queries: QueryDefinition[];\n setExplorer: (explorer: string) => void;\n setTab: (tab: number) => void;\n setQueries: (queries: QueryDefinition[]) => void;\n}\n\nconst ExplorerManagerContext = createContext<ExplorerManagerContextType | undefined>(undefined);\n\ninterface ExplorerManagerProviderProps {\n children: ReactNode;\n store?: [ExplorerState, (state: ExplorerState) => void];\n}\n\nexport function ExplorerManagerProvider({ children, store: externalStore }: ExplorerManagerProviderProps) {\n // cache the state of currently not rendered explore UIs\n const [explorerStateCache, setExplorerStateCache] = useState<Record<string, Omit<ExplorerState, 'explorer'>>>({});\n // local store in case external store is not provided by prop\n const localStore = useState<ExplorerState>({ explorer: 'metrics', tab: 0, queries: [] });\n // use store provided by 'store' prop if available, otherwise use local store\n const [explorerState, setExplorerState] = externalStore ? externalStore : localStore;\n const { explorer, tab, queries } = explorerState;\n\n function setExplorer(newExplorer: string) {\n // store current explorer state\n explorerStateCache[explorer] = { tab, queries };\n setExplorerStateCache(explorerStateCache);\n\n // restore previous explorer state (if any)\n const state = explorerStateCache[newExplorer] ?? { tab: 0, queries: [] };\n setExplorerState({ explorer: newExplorer, tab: state.tab, queries: state.queries });\n }\n\n function setTab(newTab: number) {\n setExplorerState({ explorer, tab: newTab, queries });\n }\n\n function setQueries(newQueries: QueryDefinition[]) {\n setExplorerState({ explorer, tab, queries: newQueries });\n }\n\n return (\n <ExplorerManagerContext.Provider value={{ explorer, tab, queries, setExplorer, setTab, setQueries }}>\n {children}\n </ExplorerManagerContext.Provider>\n );\n}\n\nexport function useExplorerManagerContext(): ExplorerManagerContextType {\n const ctx = useContext(ExplorerManagerContext);\n if (ctx === undefined) {\n throw new Error('No ExplorerManagerContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n"],"names":["React","createContext","useContext","useState","ExplorerManagerContext","undefined","ExplorerManagerProvider","children","store","externalStore","explorerStateCache","setExplorerStateCache","localStore","explorer","tab","queries","explorerState","setExplorerState","setExplorer","newExplorer","state","setTab","newTab","setQueries","newQueries","Provider","value","useExplorerManagerContext","ctx","Error"],"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,OAAOA,SAASC,aAAa,EAAaC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAmB9E,MAAMC,uCAAyBH,cAAsDI;AAOrF,OAAO,SAASC,wBAAwB,EAAEC,QAAQ,EAAEC,OAAOC,aAAa,EAAgC;IACtG,wDAAwD;IACxD,MAAM,CAACC,oBAAoBC,sBAAsB,GAAGR,SAA0D,CAAC;IAC/G,6DAA6D;IAC7D,MAAMS,aAAaT,SAAwB;QAAEU,UAAU;QAAWC,KAAK;QAAGC,SAAS,EAAE;IAAC;IACtF,6EAA6E;IAC7E,MAAM,CAACC,eAAeC,iBAAiB,GAAGR,gBAAgBA,gBAAgBG;IAC1E,MAAM,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,OAAO,EAAE,GAAGC;IAEnC,SAASE,YAAYC,WAAmB;QACtC,+BAA+B;QAC/BT,kBAAkB,CAACG,SAAS,GAAG;YAAEC;YAAKC;QAAQ;QAC9CJ,sBAAsBD;YAGRA;QADd,2CAA2C;QAC3C,MAAMU,QAAQV,CAAAA,kCAAAA,kBAAkB,CAACS,YAAY,cAA/BT,6CAAAA,kCAAmC;YAAEI,KAAK;YAAGC,SAAS,EAAE;QAAC;QACvEE,iBAAiB;YAAEJ,UAAUM;YAAaL,KAAKM,MAAMN,GAAG;YAAEC,SAASK,MAAML,OAAO;QAAC;IACnF;IAEA,SAASM,OAAOC,MAAc;QAC5BL,iBAAiB;YAAEJ;YAAUC,KAAKQ;YAAQP;QAAQ;IACpD;IAEA,SAASQ,WAAWC,UAA6B;QAC/CP,iBAAiB;YAAEJ;YAAUC;YAAKC,SAASS;QAAW;IACxD;IAEA,qBACE,KAACpB,uBAAuBqB,QAAQ;QAACC,OAAO;YAAEb;YAAUC;YAAKC;YAASG;YAAaG;YAAQE;QAAW;kBAC/FhB;;AAGP;AAEA,OAAO,SAASoB;IACd,MAAMC,MAAM1B,WAAWE;IACvB,IAAIwB,QAAQvB,WAAW;QACrB,MAAM,IAAIwB,MAAM;IAClB;IACA,OAAOD;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplorerManagerProviderWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ExplorerManagerProviderWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWzC,UAAU,2CAA2C;IACnD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sCAAsC,CAAC,EAAE,QAAQ,EAAE,EAAE,2CAA2C,2CAI/G"}
|
|
@@ -12,38 +12,23 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import React from 'react';
|
|
15
|
-
import { JsonParam, NumberParam, useQueryParams } from 'use-query-params';
|
|
15
|
+
import { createEnumParam, JsonParam, NumberParam, useQueryParams, withDefault } from 'use-query-params';
|
|
16
16
|
import { ExplorerManagerProvider } from './ExplorerManagerProvider';
|
|
17
17
|
const exploreQueryConfig = {
|
|
18
|
-
explorer:
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
explorer: withDefault(createEnumParam([
|
|
19
|
+
'metrics',
|
|
20
|
+
'traces'
|
|
21
|
+
]), 'metrics'),
|
|
22
|
+
tab: withDefault(NumberParam, 0),
|
|
23
|
+
queries: withDefault(JsonParam, [])
|
|
21
24
|
};
|
|
22
25
|
export function ExplorerManagerProviderWithQueryParams({ children }) {
|
|
23
|
-
const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig
|
|
24
|
-
updateType: 'replaceIn'
|
|
25
|
-
});
|
|
26
|
-
var _queryParams_explorer, _queryParams_tab;
|
|
27
|
-
const initialState = {
|
|
28
|
-
explorer: (_queryParams_explorer = queryParams.explorer) !== null && _queryParams_explorer !== void 0 ? _queryParams_explorer : undefined,
|
|
29
|
-
tab: (_queryParams_tab = queryParams.tab) !== null && _queryParams_tab !== void 0 ? _queryParams_tab : undefined,
|
|
30
|
-
queries: queryParams.queries ? queryParams.queries : undefined,
|
|
31
|
-
setExplorer: (explorer)=>{
|
|
32
|
-
setQueryParams({
|
|
33
|
-
explorer,
|
|
34
|
-
queries: undefined,
|
|
35
|
-
tab: undefined
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
setTab: (tab)=>setQueryParams({
|
|
39
|
-
tab
|
|
40
|
-
}),
|
|
41
|
-
setQueries: (queries)=>setQueryParams({
|
|
42
|
-
queries
|
|
43
|
-
})
|
|
44
|
-
};
|
|
26
|
+
const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig);
|
|
45
27
|
return /*#__PURE__*/ _jsx(ExplorerManagerProvider, {
|
|
46
|
-
|
|
28
|
+
store: [
|
|
29
|
+
queryParams,
|
|
30
|
+
setQueryParams
|
|
31
|
+
],
|
|
47
32
|
children: children
|
|
48
33
|
});
|
|
49
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { ReactNode } from 'react';\n\nimport { JsonParam, NumberParam, useQueryParams } from 'use-query-params';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ExploreManager/ExplorerManagerProviderWithQueryParams.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { ReactNode } from 'react';\n\nimport { createEnumParam, JsonParam, NumberParam, useQueryParams, withDefault } from 'use-query-params';\nimport { ExplorerManagerProvider } from './ExplorerManagerProvider';\n\nconst exploreQueryConfig = {\n explorer: withDefault(createEnumParam(['metrics', 'traces']), 'metrics'),\n tab: withDefault(NumberParam, 0),\n queries: withDefault(JsonParam, []),\n};\n\ninterface ExplorerManagerProviderWithQueryParamsProps {\n children: ReactNode;\n}\n\nexport function ExplorerManagerProviderWithQueryParams({ children }: ExplorerManagerProviderWithQueryParamsProps) {\n const [queryParams, setQueryParams] = useQueryParams(exploreQueryConfig);\n\n return <ExplorerManagerProvider store={[queryParams, setQueryParams]}>{children}</ExplorerManagerProvider>;\n}\n"],"names":["React","createEnumParam","JsonParam","NumberParam","useQueryParams","withDefault","ExplorerManagerProvider","exploreQueryConfig","explorer","tab","queries","ExplorerManagerProviderWithQueryParams","children","queryParams","setQueryParams","store"],"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,OAAOA,WAA0B,QAAQ;AAEzC,SAASC,eAAe,EAAEC,SAAS,EAAEC,WAAW,EAAEC,cAAc,EAAEC,WAAW,QAAQ,mBAAmB;AACxG,SAASC,uBAAuB,QAAQ,4BAA4B;AAEpE,MAAMC,qBAAqB;IACzBC,UAAUH,YAAYJ,gBAAgB;QAAC;QAAW;KAAS,GAAG;IAC9DQ,KAAKJ,YAAYF,aAAa;IAC9BO,SAASL,YAAYH,WAAW,EAAE;AACpC;AAMA,OAAO,SAASS,uCAAuC,EAAEC,QAAQ,EAA+C;IAC9G,MAAM,CAACC,aAAaC,eAAe,GAAGV,eAAeG;IAErD,qBAAO,KAACD;QAAwBS,OAAO;YAACF;YAAaC;SAAe;kBAAGF;;AACzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TracesExplorer.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/TracesExplorer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TracesExplorer.d.ts","sourceRoot":"","sources":["../../../src/components/ExploreManager/TracesExplorer.tsx"],"names":[],"mappings":"AAwFA,wBAAgB,cAAc,4CAiC7B"}
|
|
@@ -10,18 +10,114 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { DataQueriesProvider, MultiQueryEditor,
|
|
15
|
-
import { Box, Stack
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { DataQueriesProvider, MultiQueryEditor, useDataQueries } from '@perses-dev/plugin-system';
|
|
15
|
+
import { Box, Stack } from '@mui/material';
|
|
16
|
+
import { ErrorAlert, ErrorBoundary, LoadingOverlay, NoDataOverlay } from '@perses-dev/components';
|
|
17
|
+
import { Panel } from '@perses-dev/dashboards';
|
|
18
|
+
import { isValidTraceId } from '@perses-dev/core';
|
|
19
|
+
import { PANEL_PREVIEW_HEIGHT } from './constants';
|
|
20
20
|
import { useExplorerManagerContext } from './ExplorerManagerProvider';
|
|
21
|
-
function
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
function SearchResultsPanel({ queries }) {
|
|
22
|
+
const { isFetching, isLoading, queryResults } = useDataQueries('TraceQuery');
|
|
23
|
+
// no query executed, show empty panel
|
|
24
|
+
if (queryResults.length === 0) {
|
|
25
|
+
return /*#__PURE__*/ _jsx(_Fragment, {});
|
|
26
|
+
}
|
|
27
|
+
if (isLoading || isFetching) {
|
|
28
|
+
return /*#__PURE__*/ _jsx(LoadingOverlay, {});
|
|
29
|
+
}
|
|
30
|
+
const queryError = queryResults.find((d)=>d.error);
|
|
31
|
+
if (queryError) {
|
|
32
|
+
throw queryError.error;
|
|
33
|
+
}
|
|
34
|
+
const tracesFound = queryResults.some((traceData)=>{
|
|
35
|
+
var _traceData_data;
|
|
36
|
+
var _traceData_data_searchResult;
|
|
37
|
+
return ((_traceData_data_searchResult = (_traceData_data = traceData.data) === null || _traceData_data === void 0 ? void 0 : _traceData_data.searchResult) !== null && _traceData_data_searchResult !== void 0 ? _traceData_data_searchResult : []).length > 0;
|
|
38
|
+
});
|
|
39
|
+
if (!tracesFound) {
|
|
40
|
+
return /*#__PURE__*/ _jsx(NoDataOverlay, {
|
|
41
|
+
resource: "traces"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
45
|
+
sx: {
|
|
46
|
+
height: '100%'
|
|
47
|
+
},
|
|
48
|
+
gap: 2,
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
51
|
+
sx: {
|
|
52
|
+
height: '35%',
|
|
53
|
+
flexShrink: 0
|
|
54
|
+
},
|
|
55
|
+
children: /*#__PURE__*/ _jsx(Panel, {
|
|
56
|
+
panelOptions: {
|
|
57
|
+
hideHeader: true
|
|
58
|
+
},
|
|
59
|
+
definition: {
|
|
60
|
+
kind: 'Panel',
|
|
61
|
+
spec: {
|
|
62
|
+
queries,
|
|
63
|
+
display: {
|
|
64
|
+
name: ''
|
|
65
|
+
},
|
|
66
|
+
plugin: {
|
|
67
|
+
kind: 'ScatterChart',
|
|
68
|
+
spec: {}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ _jsx(Panel, {
|
|
75
|
+
sx: {
|
|
76
|
+
flexGrow: 1
|
|
77
|
+
},
|
|
78
|
+
panelOptions: {
|
|
79
|
+
hideHeader: true
|
|
80
|
+
},
|
|
81
|
+
definition: {
|
|
82
|
+
kind: 'Panel',
|
|
83
|
+
spec: {
|
|
84
|
+
queries,
|
|
85
|
+
display: {
|
|
86
|
+
name: ''
|
|
87
|
+
},
|
|
88
|
+
plugin: {
|
|
89
|
+
kind: 'TraceTable',
|
|
90
|
+
spec: {}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function TracingGanttChartPanel({ queries }) {
|
|
99
|
+
return /*#__PURE__*/ _jsx(Panel, {
|
|
100
|
+
panelOptions: {
|
|
101
|
+
hideHeader: true
|
|
102
|
+
},
|
|
103
|
+
definition: {
|
|
104
|
+
kind: 'Panel',
|
|
105
|
+
spec: {
|
|
106
|
+
queries,
|
|
107
|
+
display: {
|
|
108
|
+
name: ''
|
|
109
|
+
},
|
|
110
|
+
plugin: {
|
|
111
|
+
kind: 'TracingGanttChart',
|
|
112
|
+
spec: {}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export function TracesExplorer() {
|
|
119
|
+
var _queries_, _queries_1, _queries_2;
|
|
120
|
+
const { queries, setQueries } = useExplorerManagerContext();
|
|
25
121
|
// map TraceQueryDefinition to Definition<UnknownSpec>
|
|
26
122
|
const definitions = queries.length ? queries.map((query)=>{
|
|
27
123
|
return {
|
|
@@ -29,26 +125,9 @@ function TracePanel({ queries }) {
|
|
|
29
125
|
spec: query.spec.plugin.spec
|
|
30
126
|
};
|
|
31
127
|
}) : [];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
children: /*#__PURE__*/ _jsx(DataQueriesProvider, {
|
|
36
|
-
definitions: definitions,
|
|
37
|
-
options: {
|
|
38
|
-
suggestedStepMs
|
|
39
|
-
},
|
|
40
|
-
children: /*#__PURE__*/ _jsx(ScatterChart.PanelComponent, {
|
|
41
|
-
contentDimensions: {
|
|
42
|
-
width: width !== null && width !== void 0 ? width : PANEL_PREVIEW_DEFAULT_WIDTH,
|
|
43
|
-
height
|
|
44
|
-
},
|
|
45
|
-
spec: {}
|
|
46
|
-
})
|
|
47
|
-
})
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
export function TracesExplorer() {
|
|
51
|
-
const { tab, queries, setTab, setQueries } = useExplorerManagerContext();
|
|
128
|
+
var _queries__spec_plugin_spec_query;
|
|
129
|
+
// Cannot cast to TempoTraceQuerySpec because 'tempo-plugin' types are not accessible in @perses-dev/explore
|
|
130
|
+
const isSingleTrace = queries.length === 1 && ((_queries_ = queries[0]) === null || _queries_ === void 0 ? void 0 : _queries_.kind) === 'TraceQuery' && ((_queries_1 = queries[0]) === null || _queries_1 === void 0 ? void 0 : _queries_1.spec.plugin.kind) === 'TempoTraceQuery' && isValidTraceId((_queries__spec_plugin_spec_query = ((_queries_2 = queries[0]) === null || _queries_2 === void 0 ? void 0 : _queries_2.spec.plugin.spec).query) !== null && _queries__spec_plugin_spec_query !== void 0 ? _queries__spec_plugin_spec_query : ''); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
52
131
|
return /*#__PURE__*/ _jsxs(Stack, {
|
|
53
132
|
gap: 2,
|
|
54
133
|
sx: {
|
|
@@ -62,24 +141,20 @@ export function TracesExplorer() {
|
|
|
62
141
|
onChange: setQueries,
|
|
63
142
|
queries: queries
|
|
64
143
|
}),
|
|
65
|
-
/*#__PURE__*/ _jsx(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
children: /*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
80
|
-
FallbackComponent: ErrorAlert,
|
|
81
|
-
children: tab === 0 && /*#__PURE__*/ _jsx(TracePanel, {
|
|
82
|
-
queries: queries
|
|
144
|
+
/*#__PURE__*/ _jsx(ErrorBoundary, {
|
|
145
|
+
FallbackComponent: ErrorAlert,
|
|
146
|
+
resetKeys: [
|
|
147
|
+
queries
|
|
148
|
+
],
|
|
149
|
+
children: /*#__PURE__*/ _jsx(DataQueriesProvider, {
|
|
150
|
+
definitions: definitions,
|
|
151
|
+
children: /*#__PURE__*/ _jsx(Box, {
|
|
152
|
+
height: PANEL_PREVIEW_HEIGHT,
|
|
153
|
+
children: isSingleTrace ? /*#__PURE__*/ _jsx(TracingGanttChartPanel, {
|
|
154
|
+
queries: queries
|
|
155
|
+
}) : /*#__PURE__*/ _jsx(SearchResultsPanel, {
|
|
156
|
+
queries: queries
|
|
157
|
+
})
|
|
83
158
|
})
|
|
84
159
|
})
|
|
85
160
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ExploreManager/TracesExplorer.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DataQueriesProvider, MultiQueryEditor,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ExploreManager/TracesExplorer.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DataQueriesProvider, MultiQueryEditor, useDataQueries } from '@perses-dev/plugin-system';\nimport { Box, Stack } from '@mui/material';\nimport { ErrorAlert, ErrorBoundary, LoadingOverlay, NoDataOverlay } from '@perses-dev/components';\nimport { Panel } from '@perses-dev/dashboards';\nimport { QueryDefinition, isValidTraceId } from '@perses-dev/core';\nimport { PANEL_PREVIEW_HEIGHT } from './constants';\nimport { useExplorerManagerContext } from './ExplorerManagerProvider';\n\ninterface SearchResultsPanelProps {\n queries: QueryDefinition[];\n}\n\nfunction SearchResultsPanel({ queries }: SearchResultsPanelProps) {\n const { isFetching, isLoading, queryResults } = useDataQueries('TraceQuery');\n\n // no query executed, show empty panel\n if (queryResults.length === 0) {\n return <></>;\n }\n\n if (isLoading || isFetching) {\n return <LoadingOverlay />;\n }\n\n const queryError = queryResults.find((d) => d.error);\n if (queryError) {\n throw queryError.error;\n }\n\n const tracesFound = queryResults.some((traceData) => (traceData.data?.searchResult ?? []).length > 0);\n if (!tracesFound) {\n return <NoDataOverlay resource=\"traces\" />;\n }\n\n return (\n <Stack sx={{ height: '100%' }} gap={2}>\n <Box sx={{ height: '35%', flexShrink: 0 }}>\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: { queries, display: { name: '' }, plugin: { kind: 'ScatterChart', spec: {} } },\n }}\n />\n </Box>\n <Panel\n sx={{ flexGrow: 1 }}\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: { queries, display: { name: '' }, plugin: { kind: 'TraceTable', spec: {} } },\n }}\n />\n </Stack>\n );\n}\n\nfunction TracingGanttChartPanel({ queries }: { queries: QueryDefinition[] }) {\n return (\n <Panel\n panelOptions={{\n hideHeader: true,\n }}\n definition={{\n kind: 'Panel',\n spec: { queries, display: { name: '' }, plugin: { kind: 'TracingGanttChart', spec: {} } },\n }}\n />\n );\n}\n\nexport function TracesExplorer() {\n const { queries, setQueries } = useExplorerManagerContext();\n\n // map TraceQueryDefinition 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 // Cannot cast to TempoTraceQuerySpec because 'tempo-plugin' types are not accessible in @perses-dev/explore\n const isSingleTrace =\n queries.length === 1 &&\n queries[0]?.kind === 'TraceQuery' &&\n queries[0]?.spec.plugin.kind === 'TempoTraceQuery' &&\n isValidTraceId((queries[0]?.spec.plugin.spec as any).query ?? ''); // eslint-disable-line @typescript-eslint/no-explicit-any\n\n return (\n <Stack gap={2} sx={{ width: '100%' }}>\n <MultiQueryEditor queryTypes={['TraceQuery']} onChange={setQueries} queries={queries} />\n\n <ErrorBoundary FallbackComponent={ErrorAlert} resetKeys={[queries]}>\n <DataQueriesProvider definitions={definitions}>\n <Box height={PANEL_PREVIEW_HEIGHT}>\n {isSingleTrace ? <TracingGanttChartPanel queries={queries} /> : <SearchResultsPanel queries={queries} />}\n </Box>\n </DataQueriesProvider>\n </ErrorBoundary>\n </Stack>\n );\n}\n"],"names":["DataQueriesProvider","MultiQueryEditor","useDataQueries","Box","Stack","ErrorAlert","ErrorBoundary","LoadingOverlay","NoDataOverlay","Panel","isValidTraceId","PANEL_PREVIEW_HEIGHT","useExplorerManagerContext","SearchResultsPanel","queries","isFetching","isLoading","queryResults","length","queryError","find","d","error","tracesFound","some","traceData","data","searchResult","resource","sx","height","gap","flexShrink","panelOptions","hideHeader","definition","kind","spec","display","name","plugin","flexGrow","TracingGanttChartPanel","TracesExplorer","setQueries","definitions","map","query","isSingleTrace","width","queryTypes","onChange","FallbackComponent","resetKeys"],"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,cAAc,QAAQ,4BAA4B;AAClG,SAASC,GAAG,EAAEC,KAAK,QAAQ,gBAAgB;AAC3C,SAASC,UAAU,EAAEC,aAAa,EAAEC,cAAc,EAAEC,aAAa,QAAQ,yBAAyB;AAClG,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAA0BC,cAAc,QAAQ,mBAAmB;AACnE,SAASC,oBAAoB,QAAQ,cAAc;AACnD,SAASC,yBAAyB,QAAQ,4BAA4B;AAMtE,SAASC,mBAAmB,EAAEC,OAAO,EAA2B;IAC9D,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAEC,YAAY,EAAE,GAAGf,eAAe;IAE/D,sCAAsC;IACtC,IAAIe,aAAaC,MAAM,KAAK,GAAG;QAC7B,qBAAO;IACT;IAEA,IAAIF,aAAaD,YAAY;QAC3B,qBAAO,KAACR;IACV;IAEA,MAAMY,aAAaF,aAAaG,IAAI,CAAC,CAACC,IAAMA,EAAEC,KAAK;IACnD,IAAIH,YAAY;QACd,MAAMA,WAAWG,KAAK;IACxB;IAEA,MAAMC,cAAcN,aAAaO,IAAI,CAAC,CAACC;YAAeA;YAAAA;eAAD,AAACA,CAAAA,CAAAA,gCAAAA,kBAAAA,UAAUC,IAAI,cAAdD,sCAAAA,gBAAgBE,YAAY,cAA5BF,0CAAAA,+BAAgC,EAAE,AAAD,EAAGP,MAAM,GAAG;IAAA;IACnG,IAAI,CAACK,aAAa;QAChB,qBAAO,KAACf;YAAcoB,UAAS;;IACjC;IAEA,qBACE,MAACxB;QAAMyB,IAAI;YAAEC,QAAQ;QAAO;QAAGC,KAAK;;0BAClC,KAAC5B;gBAAI0B,IAAI;oBAAEC,QAAQ;oBAAOE,YAAY;gBAAE;0BACtC,cAAA,KAACvB;oBACCwB,cAAc;wBACZC,YAAY;oBACd;oBACAC,YAAY;wBACVC,MAAM;wBACNC,MAAM;4BAAEvB;4BAASwB,SAAS;gCAAEC,MAAM;4BAAG;4BAAGC,QAAQ;gCAAEJ,MAAM;gCAAgBC,MAAM,CAAC;4BAAE;wBAAE;oBACrF;;;0BAGJ,KAAC5B;gBACCoB,IAAI;oBAAEY,UAAU;gBAAE;gBAClBR,cAAc;oBACZC,YAAY;gBACd;gBACAC,YAAY;oBACVC,MAAM;oBACNC,MAAM;wBAAEvB;wBAASwB,SAAS;4BAAEC,MAAM;wBAAG;wBAAGC,QAAQ;4BAAEJ,MAAM;4BAAcC,MAAM,CAAC;wBAAE;oBAAE;gBACnF;;;;AAIR;AAEA,SAASK,uBAAuB,EAAE5B,OAAO,EAAkC;IACzE,qBACE,KAACL;QACCwB,cAAc;YACZC,YAAY;QACd;QACAC,YAAY;YACVC,MAAM;YACNC,MAAM;gBAAEvB;gBAASwB,SAAS;oBAAEC,MAAM;gBAAG;gBAAGC,QAAQ;oBAAEJ,MAAM;oBAAqBC,MAAM,CAAC;gBAAE;YAAE;QAC1F;;AAGN;AAEA,OAAO,SAASM;QAgBZ7B,WACAA,YACgBA;IAjBlB,MAAM,EAAEA,OAAO,EAAE8B,UAAU,EAAE,GAAGhC;IAEhC,sDAAsD;IACtD,MAAMiC,cAAc/B,QAAQI,MAAM,GAC9BJ,QAAQgC,GAAG,CAAC,CAACC;QACX,OAAO;YACLX,MAAMW,MAAMV,IAAI,CAACG,MAAM,CAACJ,IAAI;YAC5BC,MAAMU,MAAMV,IAAI,CAACG,MAAM,CAACH,IAAI;QAC9B;IACF,KACA,EAAE;QAOW;IALjB,4GAA4G;IAC5G,MAAMW,gBACJlC,QAAQI,MAAM,KAAK,KACnBJ,EAAAA,YAAAA,OAAO,CAAC,EAAE,cAAVA,gCAAAA,UAAYsB,IAAI,MAAK,gBACrBtB,EAAAA,aAAAA,OAAO,CAAC,EAAE,cAAVA,iCAAAA,WAAYuB,IAAI,CAACG,MAAM,CAACJ,IAAI,MAAK,qBACjC1B,eAAe,CAAA,mCAAA,EAACI,aAAAA,OAAO,CAAC,EAAE,cAAVA,iCAAAA,WAAYuB,IAAI,CAACG,MAAM,CAACH,IAAI,EAASU,KAAK,cAA3C,8CAAA,mCAA+C,KAAK,yDAAyD;IAE9H,qBACE,MAAC3C;QAAM2B,KAAK;QAAGF,IAAI;YAAEoB,OAAO;QAAO;;0BACjC,KAAChD;gBAAiBiD,YAAY;oBAAC;iBAAa;gBAAEC,UAAUP;gBAAY9B,SAASA;;0BAE7E,KAACR;gBAAc8C,mBAAmB/C;gBAAYgD,WAAW;oBAACvC;iBAAQ;0BAChE,cAAA,KAACd;oBAAoB6C,aAAaA;8BAChC,cAAA,KAAC1C;wBAAI2B,QAAQnB;kCACVqC,8BAAgB,KAACN;4BAAuB5B,SAASA;2CAAc,KAACD;4BAAmBC,SAASA;;;;;;;AAMzG"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BoxProps } from '@mui/material';
|
|
2
|
-
import { DatasourceStoreProviderProps,
|
|
2
|
+
import { DatasourceStoreProviderProps, VariableProviderProps } from '@perses-dev/dashboards';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export interface ViewExploreProps extends Omit<BoxProps, 'children'> {
|
|
5
5
|
datasourceApi: DatasourceStoreProviderProps['datasourceApi'];
|
|
6
|
-
externalVariableDefinitions?:
|
|
6
|
+
externalVariableDefinitions?: VariableProviderProps['externalVariableDefinitions'];
|
|
7
7
|
exploreTitleComponent?: React.ReactNode;
|
|
8
8
|
}
|
|
9
9
|
export declare function ViewExplore(props: ViewExploreProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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;AAQ9C,OAAO,EACL,4BAA4B,EAC5B,
|
|
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,qBAAqB,EAGtB,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,qBAAqB,CAAC,6BAA6B,CAAC,CAAC;IACnF,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAkClD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -15,7 +15,7 @@ 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,
|
|
18
|
+
import { DatasourceStoreProvider, VariableProvider } from '@perses-dev/dashboards';
|
|
19
19
|
import React from 'react';
|
|
20
20
|
import { ViewExploreApp } from './ViewExploreApp';
|
|
21
21
|
export function ViewExplore(props) {
|
|
@@ -27,7 +27,7 @@ export function ViewExplore(props) {
|
|
|
27
27
|
children: /*#__PURE__*/ _jsx(TimeRangeProviderWithQueryParams, {
|
|
28
28
|
initialTimeRange: initialTimeRange,
|
|
29
29
|
initialRefreshInterval: initialRefreshInterval,
|
|
30
|
-
children: /*#__PURE__*/ _jsx(
|
|
30
|
+
children: /*#__PURE__*/ _jsx(VariableProvider, {
|
|
31
31
|
externalVariableDefinitions: externalVariableDefinitions,
|
|
32
32
|
children: /*#__PURE__*/ _jsx(Box, {
|
|
33
33
|
sx: combineSx({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/views/ViewExplore/ViewExplore.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/views/ViewExplore/ViewExplore.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { 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 VariableProviderProps,\n DatasourceStoreProvider,\n VariableProvider,\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?: VariableProviderProps['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 <VariableProvider 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 </VariableProvider>\n </TimeRangeProviderWithQueryParams>\n </DatasourceStoreProvider>\n );\n}\n"],"names":["Box","TimeRangeProviderWithQueryParams","useInitialRefreshInterval","useInitialTimeRange","DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL","ErrorAlert","ErrorBoundary","combineSx","DatasourceStoreProvider","VariableProvider","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,gBAAgB,QACX,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;gBAAiBM,6BAA6BA;0BAC7C,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/explore",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0-rc0",
|
|
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.
|
|
31
|
-
"@perses-dev/core": "0.
|
|
32
|
-
"@perses-dev/panels-plugin": "0.
|
|
33
|
-
"@perses-dev/plugin-system": "0.
|
|
34
|
-
"@perses-dev/dashboards": "0.
|
|
30
|
+
"@perses-dev/components": "0.47.0-rc0",
|
|
31
|
+
"@perses-dev/core": "0.47.0-rc0",
|
|
32
|
+
"@perses-dev/panels-plugin": "0.47.0-rc0",
|
|
33
|
+
"@perses-dev/plugin-system": "0.47.0-rc0",
|
|
34
|
+
"@perses-dev/dashboards": "0.47.0-rc0",
|
|
35
35
|
"@types/react-grid-layout": "^1.3.2",
|
|
36
36
|
"date-fns": "^2.28.0",
|
|
37
37
|
"immer": "^9.0.15",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"zustand": "^4.3.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@perses-dev/internal-utils": "0.
|
|
49
|
-
"@perses-dev/storybook": "0.
|
|
48
|
+
"@perses-dev/internal-utils": "0.47.0-rc0",
|
|
49
|
+
"@perses-dev/storybook": "0.47.0-rc0",
|
|
50
50
|
"history": "^5.3.0",
|
|
51
51
|
"intersection-observer": "^0.12.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@mui/material": "^5.
|
|
54
|
+
"@mui/material": "^5.15.20",
|
|
55
55
|
"@tanstack/react-query": "^4.7.1",
|
|
56
56
|
"react": "^17.0.2 || ^18.0.0",
|
|
57
57
|
"react-dom": "^17.0.2 || ^18.0.0"
|