Skip to content

Commit f5369ba

Browse files
[ENHANCEMENT] Tempo: update more-traces-available alert styling (#538)
Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>
1 parent fcced9a commit f5369ba

2 files changed

Lines changed: 36 additions & 6 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 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+
14+
import { useCallback, useState } from 'react';
15+
import { Alert, AlertProps } from '@mui/material';
16+
17+
export function ClosableAlert(props: AlertProps) {
18+
const [isVisible, setVisible] = useState(true);
19+
20+
const handleClose = useCallback(() => {
21+
setVisible(false);
22+
}, [setVisible]);
23+
24+
if (!isVisible) {
25+
return null;
26+
}
27+
28+
return <Alert {...props} onClose={handleClose} />;
29+
}

tempo/src/explore/TempoExplorer.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
import { Alert, Box, Stack } from '@mui/material';
14+
import { Box, Stack } from '@mui/material';
1515
import { ErrorAlert, ErrorBoundary, LoadingOverlay, NoDataOverlay } from '@perses-dev/components';
1616
import { QueryDefinition, isValidTraceId } from '@perses-dev/core';
1717
import { Panel } from '@perses-dev/dashboards';
1818
import { useExplorerManagerContext } from '@perses-dev/explore';
1919
import { DataQueriesProvider, MultiQueryEditor, useDataQueries } from '@perses-dev/plugin-system';
2020
import { ReactElement, useState } from 'react';
2121
import { TempoTraceQuerySpec } from '../model';
22+
import { ClosableAlert } from '../components/ClosableAlert';
2223
import { linkToSpan, linkToTrace } from './links';
2324

2425
interface TracesExplorerQueryParams {
@@ -56,6 +57,11 @@ function SearchResultsPanel({ queries }: SearchResultsPanelProps): ReactElement
5657

5758
return (
5859
<Stack sx={{ height: '100%' }} gap={2}>
60+
{hasMoreResults && (
61+
<ClosableAlert severity="warning">
62+
Not all matching traces are currently visible. Increase the display limit to view more.
63+
</ClosableAlert>
64+
)}
5965
<Box sx={{ height: '35%', flexShrink: 0 }}>
6066
<Panel
6167
panelOptions={{
@@ -97,11 +103,6 @@ function SearchResultsPanel({ queries }: SearchResultsPanelProps): ReactElement
97103
},
98104
}}
99105
/>
100-
{hasMoreResults && (
101-
<Alert severity="info">
102-
Not all matching traces are currently displayed. Increase the result limit to view additional traces.
103-
</Alert>
104-
)}
105106
</Stack>
106107
);
107108
}

0 commit comments

Comments
 (0)