From 06d54b6e7e5de8e03c4e8dfce8b3785680a0ddd1 Mon Sep 17 00:00:00 2001 From: dzeranov Date: Thu, 21 Oct 2021 18:02:42 +0300 Subject: [PATCH 1/2] Admins now couldn't be a job assignee; Disable link to a job if there is no assignee on it; Forbid to finish a job in case it's without assignee --- cvat-ui/src/components/task-page/job-list.tsx | 45 ++++++++++--------- cvat/apps/engine/serializers.py | 39 ++++++++++++++++ 2 files changed, 64 insertions(+), 20 deletions(-) diff --git a/cvat-ui/src/components/task-page/job-list.tsx b/cvat-ui/src/components/task-page/job-list.tsx index 9418418ed771..9b0b7b54fe69 100644 --- a/cvat-ui/src/components/task-page/job-list.tsx +++ b/cvat-ui/src/components/task-page/job-list.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { RouteComponentProps } from 'react-router'; import { withRouter } from 'react-router-dom'; import { Row, Col } from 'antd/lib/grid'; -import { QuestionCircleOutlined, CopyOutlined } from '@ant-design/icons'; +import { CopyOutlined } from '@ant-design/icons'; import { ColumnFilterItem } from 'antd/lib/table/interface'; import Table from 'antd/lib/table'; import Button from 'antd/lib/button'; @@ -81,18 +81,24 @@ function JobListComponent(props: Props & RouteComponentProps): JSX.Element { title: 'Job', dataIndex: 'job', key: 'job', - render: (id: number): JSX.Element => ( + render: (jobInstance: any): JSX.Element => (
- + +
), }, @@ -107,8 +113,7 @@ function JobListComponent(props: Props & RouteComponentProps): JSX.Element { dataIndex: 'status', key: 'status', className: 'cvat-job-item-status', - render: (jobInstance: any): JSX.Element => { - const { status } = jobInstance; + render: (status: string): JSX.Element => { let progressColor = null; if (status === 'completed') { progressColor = 'cvat-job-completed-color'; @@ -122,12 +127,12 @@ function JobListComponent(props: Props & RouteComponentProps): JSX.Element { ); }, - sorter: sorter('status.status'), + sorter: sorter('status'), filters: [ { text: 'annotation', value: 'annotation' }, { text: 'completed', value: 'completed' }, ], - onFilter: (value: string | number | boolean, record: any) => record.status.status === value, + onFilter: (value: string | number | boolean, record: any) => record.status === value, }, { title: 'Started on', @@ -143,8 +148,8 @@ function JobListComponent(props: Props & RouteComponentProps): JSX.Element { }, { title: 'Assignee', - dataIndex: 'assignee', - key: 'assignee', + dataIndex: 'job', + key: 'job', className: 'cvat-job-item-assignee', render: (jobInstance: any): JSX.Element => ( Date: Thu, 28 Oct 2021 14:35:48 +0300 Subject: [PATCH 2/2] Assignee filter & sorter fixed --- cvat-ui/src/components/task-page/job-list.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cvat-ui/src/components/task-page/job-list.tsx b/cvat-ui/src/components/task-page/job-list.tsx index 9b0b7b54fe69..8c8d0ecb76fc 100644 --- a/cvat-ui/src/components/task-page/job-list.tsx +++ b/cvat-ui/src/components/task-page/job-list.tsx @@ -162,10 +162,10 @@ function JobListComponent(props: Props & RouteComponentProps): JSX.Element { }} /> ), - sorter: sorter('assignee.assignee.username'), + sorter: sorter('job.assignee.username'), filters: collectUsers('assignee'), onFilter: (value: string | number | boolean, record: any) => - (record.assignee.assignee?.username || false) === value, + (record.job.assignee?.username || false) === value, }, ]; @@ -180,8 +180,7 @@ function JobListComponent(props: Props & RouteComponentProps): JSX.Element { const now = moment(moment.now()); acc.push({ key: job.id, - // eslint-disable-next-line object-shorthand - job: job, + job, frames: `${job.startFrame}-${job.stopFrame}`, status: job.status, started: `${created.format('MMMM Do YYYY HH:MM')}`,