From 9dc9f5c9247644f9b2d3c10a0c6a76351045c444 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 25 Aug 2022 23:14:23 +0300 Subject: [PATCH 1/5] Added track removing confirmation --- .../standard-workspace/remove-confirm.tsx | 37 ++++++++++++++++--- cvat-ui/src/consts.ts | 2 + 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/remove-confirm.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/remove-confirm.tsx index c25e50afd3e8..8f7a9643d917 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/remove-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/remove-confirm.tsx @@ -1,18 +1,21 @@ // Copyright (C) 2022 Intel Corporation +// Copyright (C) CVAT.ai corp // // SPDX-License-Identifier: MIT import React, { useCallback, useEffect, useState } from 'react'; - import { useDispatch, useSelector } from 'react-redux'; -import { CombinedState } from 'reducers'; - +import { CombinedState, ObjectType } from 'reducers'; +import Text from 'antd/lib/typography/Text'; import Modal from 'antd/lib/modal'; + +import consts from 'consts'; import { removeObjectAsync, removeObject as removeObjectAction } from 'actions/annotation-actions'; export default function RemoveConfirmComponent(): JSX.Element | null { const [visible, setVisible] = useState(false); const [title, setTitle] = useState(''); + const [description, setDescription] = useState(<>); const objectState = useSelector((state: CombinedState) => state.annotation.remove.objectState); const force = useSelector((state: CombinedState) => state.annotation.remove.force); const jobInstance = useSelector((state: CombinedState) => state.annotation.job.instance); @@ -21,13 +24,37 @@ export default function RemoveConfirmComponent(): JSX.Element | null { const onOk = useCallback(() => { dispatch(removeObjectAsync(jobInstance, objectState, true)); }, [jobInstance, objectState]); + const onCancel = useCallback(() => { dispatch(removeObjectAction(null, false)); }, []); useEffect(() => { - const newVisible = !!objectState && !force && objectState.lock; + const newVisible = (!!objectState && !force && objectState.lock) || + (objectState?.objectType === ObjectType.TRACK && !force); setTitle(objectState?.lock ? 'Object is locked' : 'Remove object'); + let descriptionMessage: string | JSX.Element = 'Are you sure you want to remove it?'; + + if (objectState?.objectType === ObjectType.TRACK && !force) { + descriptionMessage = ( + <> + + { + `The object you are trying to remove is a track. + If you continue, it removes many drawn objects on different frames. + If you want to hide it only on this frame, use the outside feature instead. + ${descriptionMessage}` + } + +
+ {/* eslint-disable-next-line */} + +
+ + ); + } + + setDescription(descriptionMessage); setVisible(newVisible); if (!newVisible && objectState) { dispatch(removeObjectAsync(jobInstance, objectState, true)); @@ -46,7 +73,7 @@ export default function RemoveConfirmComponent(): JSX.Element | null { className='cvat-modal-confirm' >
- Are you sure you want to remove it? + {description}
); diff --git a/cvat-ui/src/consts.ts b/cvat-ui/src/consts.ts index 34f04f21906f..7ff346d1f3c9 100644 --- a/cvat-ui/src/consts.ts +++ b/cvat-ui/src/consts.ts @@ -25,6 +25,7 @@ const DEFAULT_PROJECT_SUBSETS = ['Train', 'Test', 'Validation']; const INTEL_TERMS_OF_USE_URL = 'https://www.intel.com/content/www/us/en/legal/terms-of-use.html'; const INTEL_COOKIES_URL = 'https://www.intel.com/content/www/us/en/privacy/intel-cookie-notice.html'; const INTEL_PRIVACY_URL = 'https://www.intel.com/content/www/us/en/privacy/intel-privacy-notice.html'; +const OUTSIDE_PIC_URL = 'https://opencv.github.io/cvat/images/image019.jpg'; const DEFAULT_AWS_S3_REGIONS: string[][] = [ ['us-east-1', 'US East (N. Virginia)'], ['us-east-2', 'US East (Ohio)'], @@ -108,4 +109,5 @@ export default { INTEL_PRIVACY_URL, DEFAULT_AWS_S3_REGIONS, DEFAULT_GOOGLE_CLOUD_STORAGE_LOCATIONS, + OUTSIDE_PIC_URL, }; From a0bed23bc58f7b90e98bb646351f83ac85291134 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 25 Aug 2022 23:17:21 +0300 Subject: [PATCH 2/5] Updated version & changelog --- CHANGELOG.md | 1 + cvat-ui/package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a46838f8ca4..aa343a555c8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Publishing dev version of CVAT docker images () - Support of Human Pose Estimation, Facial Landmarks (and similar) use-cases, new shape type: Skeleton () - Added helm chart support for serverless functions and analytics () +- Added confirmation when remove a track () ### Changed - Bumped nuclio version to 1.8.14 diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 83d516c96b42..6dbdd730cefb 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.41.0", + "version": "1.41.1", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { From 3c0805ff64a96e2af6c2131b662d3468ee2cc829 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 25 Aug 2022 23:22:20 +0300 Subject: [PATCH 3/5] Adjusted styles --- .../annotation-page/standard-workspace/remove-confirm.tsx | 2 +- .../annotation-page/standard-workspace/styles.scss | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/remove-confirm.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/remove-confirm.tsx index 8f7a9643d917..f817dd0b48af 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/remove-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/remove-confirm.tsx @@ -46,7 +46,7 @@ export default function RemoveConfirmComponent(): JSX.Element | null { ${descriptionMessage}` } -
+
{/* eslint-disable-next-line */}
diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/styles.scss b/cvat-ui/src/components/annotation-page/standard-workspace/styles.scss index 7a8d31c19df9..154e447f8696 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/styles.scss +++ b/cvat-ui/src/components/annotation-page/standard-workspace/styles.scss @@ -328,3 +328,9 @@ margin: 0 5px; } } + +.cvat-remove-object-confirm-wrapper { + display: flex; + justify-content: center; + margin-top: $grid-unit-size * 2; +} \ No newline at end of file From 290003d35593fe84cbb87dae619623c098dd72af Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 25 Aug 2022 23:25:33 +0300 Subject: [PATCH 4/5] Fixed styles --- .../components/annotation-page/standard-workspace/styles.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/styles.scss b/cvat-ui/src/components/annotation-page/standard-workspace/styles.scss index 154e447f8696..aed8b52f49d1 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/styles.scss +++ b/cvat-ui/src/components/annotation-page/standard-workspace/styles.scss @@ -333,4 +333,4 @@ display: flex; justify-content: center; margin-top: $grid-unit-size * 2; -} \ No newline at end of file +} From d97a413e77be933bb503ce06420ccac72ef0d325 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 29 Aug 2022 15:40:11 +0300 Subject: [PATCH 5/5] Updated package.json --- cvat-ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 9245ca361365..a2824e7a3eb1 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.41.1", + "version": "1.41.2", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": {