diff --git a/CHANGELOG.md b/CHANGELOG.md index 26e3bafcdd66..2c160fe3b2d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Issue loading openvino models for semi-automatic and automatic annotation () - Basic functions of CVAT works without activated nuclio dashboard +- Fixed error with creating task with labels with the same name () ### Security - diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 8def8aaa4709..1f47f08107da 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.7.1", + "version": "1.7.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index f20e3eb6da67..f1a563ee4e8e 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.7.1", + "version": "1.7.2", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/actions/tasks-actions.ts b/cvat-ui/src/actions/tasks-actions.ts index 4097f0198e85..c61c12d756eb 100644 --- a/cvat-ui/src/actions/tasks-actions.ts +++ b/cvat-ui/src/actions/tasks-actions.ts @@ -344,10 +344,12 @@ function createTask(): AnyAction { return action; } -function createTaskSuccess(): AnyAction { +function createTaskSuccess(taskId: number): AnyAction { const action = { type: TasksActionTypes.CREATE_TASK_SUCCESS, - payload: {}, + payload: { + taskId, + }, }; return action; @@ -433,10 +435,10 @@ ThunkAction, {}, {}, AnyAction> { dispatch(createTask()); try { - await taskInstance.save((status: string): void => { + const savedTask = await taskInstance.save((status: string): void => { dispatch(createTaskUpdateStatus(status)); }); - dispatch(createTaskSuccess()); + dispatch(createTaskSuccess(savedTask.id)); } catch (error) { dispatch(createTaskFailed(error)); } diff --git a/cvat-ui/src/components/create-task-page/create-task-content.tsx b/cvat-ui/src/components/create-task-page/create-task-content.tsx index 7ee99a6a1e5e..18de3d7aa348 100644 --- a/cvat-ui/src/components/create-task-page/create-task-content.tsx +++ b/cvat-ui/src/components/create-task-page/create-task-content.tsx @@ -3,6 +3,8 @@ // SPDX-License-Identifier: MIT import React from 'react'; +import { RouteComponentProps } from 'react-router'; +import { withRouter } from 'react-router-dom'; import { Row, Col } from 'antd/lib/grid'; import Alert from 'antd/lib/alert'; import Button from 'antd/lib/button'; @@ -26,6 +28,7 @@ export interface CreateTaskData { interface Props { onCreate: (data: CreateTaskData) => void; status: string; + taskId: number | null; installedGit: boolean; } @@ -48,22 +51,31 @@ const defaultState = { }, }; -export default class CreateTaskContent extends React.PureComponent { +class CreateTaskContent extends React.PureComponent { private basicConfigurationComponent: any; private advancedConfigurationComponent: any; private fileManagerContainer: any; - public constructor(props: Props) { + public constructor(props: Props & RouteComponentProps) { super(props); this.state = { ...defaultState }; } public componentDidUpdate(prevProps: Props): void { - const { status } = this.props; + const { status, history, taskId } = this.props; if (status === 'CREATED' && prevProps.status !== 'CREATED') { + const btn = ( + + ); + notification.info({ message: 'The task has been created', + btn, }); this.basicConfigurationComponent.resetFields(); @@ -252,3 +264,5 @@ export default class CreateTaskContent extends React.PureComponent ); } } + +export default withRouter(CreateTaskContent); diff --git a/cvat-ui/src/components/create-task-page/create-task-page.tsx b/cvat-ui/src/components/create-task-page/create-task-page.tsx index 15c5f18c47a6..39549ea68dd8 100644 --- a/cvat-ui/src/components/create-task-page/create-task-page.tsx +++ b/cvat-ui/src/components/create-task-page/create-task-page.tsx @@ -16,6 +16,7 @@ interface Props { onCreate: (data: CreateTaskData) => void; status: string; error: string; + taskId: number | null; installedGit: boolean; } @@ -23,6 +24,7 @@ export default function CreateTaskPage(props: Props): JSX.Element { const { error, status, + taskId, onCreate, installedGit, } = props; @@ -66,6 +68,7 @@ export default function CreateTaskPage(props: Props): JSX.Element { Create a new task props.history.push('/tasks?page=1') + (event: React.MouseEvent): void => { + event.preventDefault(); + props.history.push('/tasks?page=1'); + } } > Tasks @@ -184,8 +188,12 @@ function HeaderContainer(props: Props): JSX.Element { className='cvat-header-button' type='link' value='models' + href='/models' onClick={ - (): void => props.history.push('/models') + (event: React.MouseEvent): void => { + event.preventDefault(); + props.history.push('/models'); + } } > Models @@ -195,8 +203,10 @@ function HeaderContainer(props: Props): JSX.Element {