|
1 |
| -import React from 'react'; |
2 |
| - |
3 | 1 | import {ArrowUpRightFromSquare} from '@gravity-ui/icons';
|
4 | 2 | import {Button} from '@gravity-ui/uikit';
|
5 | 3 |
|
6 | 4 | import {useClusterBaseInfo} from '../../../../../../store/reducers/cluster/cluster';
|
7 |
| -import {traceApi} from '../../../../../../store/reducers/trace'; |
8 | 5 | import {replaceParams} from '../../../utils/replaceParams';
|
9 | 6 | import i18n from '../../i18n';
|
10 | 7 |
|
11 | 8 | interface TraceUrlButtonProps {
|
12 | 9 | traceId: string;
|
13 |
| - isTraceReady?: true; |
14 | 10 | }
|
15 | 11 |
|
16 |
| -export function TraceButton({traceId, isTraceReady}: TraceUrlButtonProps) { |
17 |
| - const {traceCheck, traceView} = useClusterBaseInfo(); |
| 12 | +export function TraceButton({traceId}: TraceUrlButtonProps) { |
| 13 | + const {traceView} = useClusterBaseInfo(); |
18 | 14 |
|
19 |
| - const checkTraceUrl = traceCheck?.url ? replaceParams(traceCheck.url, {traceId}) : ''; |
20 | 15 | const traceUrl = traceView?.url ? replaceParams(traceView.url, {traceId}) : '';
|
21 | 16 |
|
22 |
| - const [checkTrace, {isLoading, isUninitialized}] = traceApi.useLazyCheckTraceQuery(); |
23 |
| - |
24 |
| - React.useEffect(() => { |
25 |
| - let checkTraceMutation: {abort: () => void} | null; |
26 |
| - if (checkTraceUrl && !isTraceReady) { |
27 |
| - checkTraceMutation = checkTrace({url: checkTraceUrl}); |
28 |
| - } |
29 |
| - |
30 |
| - return () => checkTraceMutation?.abort(); |
31 |
| - }, [checkTrace, checkTraceUrl, isTraceReady]); |
32 |
| - |
33 |
| - if (!traceUrl || (isUninitialized && !isTraceReady)) { |
| 17 | + if (!traceUrl) { |
34 | 18 | return null;
|
35 | 19 | }
|
36 | 20 |
|
37 | 21 | return (
|
38 |
| - <Button |
39 |
| - view={isLoading ? 'flat-secondary' : 'flat-info'} |
40 |
| - loading={isLoading} |
41 |
| - href={traceUrl} |
42 |
| - target="_blank" |
43 |
| - > |
| 22 | + <Button view={'flat-info'} href={traceUrl} target="_blank"> |
44 | 23 | {i18n('trace')}
|
45 | 24 | <Button.Icon>
|
46 | 25 | <ArrowUpRightFromSquare />
|
|
0 commit comments