From 796991a1aaca3b4c0ea95b308253a1cc58f4ba2a Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 17 Jan 2022 11:13:58 +0300 Subject: [PATCH] Added intelligent function when paste labels to another task (#4161) * Added intelligent paste labels function, added notification when remove labels from raw editor * Adjusted raw tab behaviour * Fixed issue with selection * Updated version and changelog, removed previous implementation * Removed outdated comment * Additional checks on the server * Added check for default boolean attr * Updated version * Conditionally show lost labels/attributes * Remove labels only when create Co-authored-by: Nikita Manovich --- CHANGELOG.md | 2 + cvat-core/src/session.js | 3 +- cvat-ui/package-lock.json | 4 +- cvat-ui/package.json | 2 +- .../src/components/labels-editor/common.ts | 6 +- .../components/labels-editor/label-form.tsx | 17 ++- .../labels-editor/labels-editor.tsx | 33 +---- .../components/labels-editor/raw-viewer.tsx | 129 +++++++++++++++--- cvat/apps/engine/serializers.py | 8 ++ 9 files changed, 141 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f8eb6cf..273b5861 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,10 +53,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Order in an annotation file() - Fixed task data upload progressbar () - Email in org invitations is case sensitive () +- Added intelligent function when paste labels to another task () - Uncaught TypeError: this.el.node.getScreenCTM() is null in Firefox () - Bug: canvas is busy when start playing, start resizing a shape and do not release the mouse cursor () - Fixed tus upload error over https () + ### Security - Updated ELK to 6.8.22 which uses log4j 2.17.0 () diff --git a/cvat-core/src/session.js b/cvat-core/src/session.js index f2e86cb3..84ca252a 100644 --- a/cvat-core/src/session.js +++ b/cvat-core/src/session.js @@ -1,4 +1,4 @@ -// Copyright (C) 2019-2021 Intel Corporation +// Copyright (C) 2019-2022 Intel Corporation // // SPDX-License-Identifier: MIT @@ -1434,7 +1434,6 @@ }, }, /** - * After task has been created value can be appended only. * @name labels * @type {module:API.cvat.classes.Label[]} * @memberof module:API.cvat.classes.Task diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 141bc22c..e3786750 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "cvat-ui", - "version": "1.33.1", + "version": "1.33.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "cvat-ui", - "version": "1.33.1", + "version": "1.33.2", "license": "MIT", "dependencies": { "@ant-design/icons": "^4.6.3", diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 0cf3930a..02e2f6b9 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.33.1", + "version": "1.33.2", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/components/labels-editor/common.ts b/cvat-ui/src/components/labels-editor/common.ts index 72501f0e..cbaab4d5 100644 --- a/cvat-ui/src/components/labels-editor/common.ts +++ b/cvat-ui/src/components/labels-editor/common.ts @@ -1,4 +1,4 @@ -// Copyright (C) 2021 Intel Corporation +// Copyright (C) 2021-2022 Intel Corporation // // SPDX-License-Identifier: MIT @@ -64,11 +64,11 @@ export function validateParsedLabel(label: Label): void { ); } - if (typeof label.color !== 'string') { + if (label.color && typeof label.color !== 'string') { throw new Error(`Label "${label.name}". Label color must be a string. Got ${typeof label.color}`); } - if (!label.color.match(/^#[0-9a-fA-F]{6}$|^$/)) { + if (label.color && !label.color.match(/^#[0-9a-fA-F]{6}$|^$/)) { throw new Error( `Label "${label.name}". ` + `Type of label color must be only a valid color string. Got value ${label.color}`, diff --git a/cvat-ui/src/components/labels-editor/label-form.tsx b/cvat-ui/src/components/labels-editor/label-form.tsx index 2d46af2f..165be588 100644 --- a/cvat-ui/src/components/labels-editor/label-form.tsx +++ b/cvat-ui/src/components/labels-editor/label-form.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2021 Intel Corporation +// Copyright (C) 2020-2022 Intel Corporation // // SPDX-License-Identifier: MIT @@ -205,13 +205,20 @@ export default class LabelForm extends React.Component { ); } - private renderBooleanValueInput(fieldInstance: any, attr: Attribute | null): JSX.Element { + private renderBooleanValueInput(fieldInstance: any): JSX.Element { const { key } = fieldInstance; - const value = attr ? attr.values[0] : 'false'; return ( - +