@@ -7,6 +7,7 @@ import { Button, Card, ClipboardButton, Link } from '@gravity-ui/uikit';
77import { uiFactory } from 'src/factory' ;
88import type { TaskResult } from 'src/models/Task' ;
99import { TaskState } from 'src/models/Task' ;
10+ import { getFormat , isDiffTaskResult } from 'src/utils/renderingFormat' ;
1011import { setPageTitle } from 'src/utils/title' ;
1112
1213import type { DefinitionListItem } from '../DefinitionList/DefinitionList' ;
@@ -36,6 +37,10 @@ export const TaskCard: React.FC<TaskCardProps> = props => {
3637 const query = spec ?. Query ;
3738 const traceId = task ?. Spec ?. TraceBaggage ?. Baggage ?. traceparent ?. match ( / ^ [ ^ - ] { 2 } - ( [ ^ - ] * ) - .* / ) ?. [ 1 ] ;
3839
40+ const isDiff = isDiffTaskResult ( props . task ) ;
41+ const isLegacyFormat = isDiff && 'FlamegraphOptions' in ( props . task ?. Spec ?. DiffProfiles || { } ) ;
42+ const format = getFormat ( spec ?. Format ) ?? getFormat ( diffSpec ?. RenderFormat ) ?? ( isLegacyFormat ? 'Flamegraph' : undefined ) ;
43+
3944 React . useMemo ( ( ) => {
4045 if ( query ?. Selector ) {
4146 setPageTitle ( `Profile: ${ query ?. Selector } ` ) ;
@@ -91,7 +96,7 @@ export const TaskCard: React.FC<TaskCardProps> = props => {
9196 [ 'Baseline sample count' , diffSpec ?. BaselineQuery ?. MaxSamples ] ,
9297 [ 'Diff sample count' , diffSpec ?. DiffQuery ?. MaxSamples ] ,
9398 [ 'Trace' , renderTraceLink ( ) ] ,
94- [ 'Flamegraph format' , 'JSONFlamegraph' in ( spec ?. Format || { } ) ? undefined : 'HTML' ] ,
99+ [ 'Flamegraph format' , format === 'Flamegraph' ? 'HTML' : undefined ] ,
95100 ] ;
96101
97102 return (
0 commit comments