Skip to content

Commit

Permalink
feat(Query): progress for spyt engine [YTFRONT-3981]
Browse files Browse the repository at this point in the history
  • Loading branch information
SimbiozizV committed Mar 26, 2024
1 parent ed36636 commit 14a59b0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, {FC} from 'react';
import {Progress, Tooltip} from '@gravity-ui/uikit';
import {QueryItem, QueryStatus} from '../../module/api';

type Props = {
query: QueryItem;
};

export const QueryProgress: FC<Props> = ({query}) => {
if (
query.engine !== 'spyt' ||
!(query.state === QueryStatus.RUNNING || query.state === QueryStatus.COMPLETING)
)
return null;

const percent = query.progress?.spyt_progress
? Math.round(query.progress.spyt_progress * 100)
: 0;

return (
<Tooltip content={`${percent}%`}>
<div>
<Progress theme="info" size="xs" value={percent} />
</div>
</Tooltip>
);
};
2 changes: 2 additions & 0 deletions packages/ui/src/ui/pages/query-tracker/QueryResults/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import PlanActions from '../Plan/PlanActions';

import './index.scss';
import {ErrorTree} from './ErrorTree';
import {QueryProgress} from './QueryResultActions/QueryProgress';

const b = block('query-results');

Expand Down Expand Up @@ -58,6 +59,7 @@ export const QueryResults = React.memo(function QueryResults({
<QueryMetaInfo className={b('meta-info')} query={query} />
<div className={b('toolbar')}>{toolbar}</div>
</div>
<QueryProgress query={query} />
<NotRenderUntilFirstVisible className={b('result', {minimized})} hide={minimized}>
<PlanProvider
plan={query.progress?.yql_plan}
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/ui/pages/query-tracker/module/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export interface QueryItem extends DraftQuery {
yql_plan?: Plan;
yql_statistics?: YQLSstatistics;
yql_progress?: Progress;
spyt_progress?: number;
};
access_control_object: string;
error?: QueryError;
Expand Down

0 comments on commit 14a59b0

Please # to comment.