diff --git a/cvat-ui/src/actions/tasks-actions.ts b/cvat-ui/src/actions/tasks-actions.ts index 818aadedf6b7..6920034cf619 100644 --- a/cvat-ui/src/actions/tasks-actions.ts +++ b/cvat-ui/src/actions/tasks-actions.ts @@ -42,11 +42,11 @@ function getTasksSuccess(array: any[], previews: string[], return action; } -function getTasksFailed(gettingTasksError: any, gettingQuery: TasksQuery): AnyAction { +function getTasksFailed(tasksFetchingError: any, gettingQuery: TasksQuery): AnyAction { const action = { type: TasksActionTypes.GET_TASKS_FAILED, payload: { - gettingTasksError, + tasksFetchingError, gettingQuery, }, }; @@ -70,8 +70,8 @@ ThunkAction, {}, {}, AnyAction> { let result = null; try { result = await cvat.tasks.get(filteredQuery); - } catch (gettingTasksError) { - dispatch(getTasksFailed(gettingTasksError, gettingQuery)); + } catch (tasksFetchingError) { + dispatch(getTasksFailed(tasksFetchingError, gettingQuery)); return; } diff --git a/cvat-ui/src/components/tasks-page/task-item.tsx b/cvat-ui/src/components/tasks-page/task-item.tsx index bd13aa5cc880..d941393c1e88 100644 --- a/cvat-ui/src/components/tasks-page/task-item.tsx +++ b/cvat-ui/src/components/tasks-page/task-item.tsx @@ -16,18 +16,13 @@ import { ClickParam } from 'antd/lib/menu/index'; import { UploadChangeParam } from 'antd/lib/upload'; import { RcFile } from 'antd/lib/upload'; -import { - Task, - LoadState, - DumpState, -} from '../../reducers/interfaces'; - import moment from 'moment'; export interface TaskItemProps { - task: Task; - activeLoading: LoadState | null; - activeDumpings: DumpState[]; + taskInstance: any; + previewImage: string; + dumpActivities: string[] | null; + loadActivity: string | null; loaders: any[]; dumpers: any[]; onDumpAnnotation: (task: any, dumper: any) => void; @@ -45,7 +40,7 @@ export default class VisibleTaskItem extends React.PureComponent } private handleMenuClick(params: ClickParam) { - const tracker = this.props.task.instance.bugTracker; + const tracker = this.props.taskInstance.bugTracker; if (params.keyPath.length === 2) { // dump or upload @@ -77,12 +72,10 @@ export default class VisibleTaskItem extends React.PureComponent } private renderPreview() { - const preview = this.props.task.preview; - return (
- Preview + Preview
) @@ -90,7 +83,7 @@ export default class VisibleTaskItem extends React.PureComponent private renderDescription() { // Task info - const task = this.props.task.instance; + const task = this.props.taskInstance; const { id } = task; const owner = task.owner ? task.owner.username : null; const updated = moment(task.updatedDate).fromNow(); @@ -115,9 +108,10 @@ export default class VisibleTaskItem extends React.PureComponent } private renderProgress() { + const task = this.props.taskInstance; // Count number of jobs and performed jobs - const numOfJobs = this.props.task.instance.jobs.length; - const numOfCompleted = this.props.task.instance.jobs.filter( + const numOfJobs = task.jobs.length; + const numOfCompleted = task.jobs.filter( (job: any) => job.status === 'completed' ).length; @@ -158,17 +152,19 @@ export default class VisibleTaskItem extends React.PureComponent } private renderDumperItem(dumper: any) { - const mode = this.props.task.instance.mode; - const dumpWithThisDumper = this.props.activeDumpings - .filter((dump: DumpState) => dump.dumperName === dumper.name)[0]; + const task = this.props.taskInstance; + const { mode } = task; + + const dumpingWithThisDumper = (this.props.dumpActivities || []) + .filter((_dumper: string) => _dumper === dumper.name)[0]; - const pending = !!dumpWithThisDumper; + const pending = !!dumpingWithThisDumper; return (