From d9f06b477109e048977489be08f9f63c7f1ff601 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 25 Feb 2021 18:30:02 +0300 Subject: [PATCH 1/6] Squashed commits --- cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- cvat-ui/src/actions/review-actions.ts | 8 +++++++- cvat-ui/src/reducers/review-reducer.ts | 16 +++++++++++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 0462142f3b3a..ee40a1ec739d 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.14.3", + "version": "1.14.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 69ac386801b9..e6ddda280c69 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.14.3", + "version": "1.14.4", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/actions/review-actions.ts b/cvat-ui/src/actions/review-actions.ts index b433d96872fa..3013acb29c58 100644 --- a/cvat-ui/src/actions/review-actions.ts +++ b/cvat-ui/src/actions/review-actions.ts @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -98,6 +98,12 @@ export const finishIssueAsync = (message: string): ThunkAction => async (dispatc review: { activeReview, newIssuePosition }, } = state; + if (!newIssuePosition) { + // do not create issue if position was not specified + // for example in cases when we try to create several issues for one object + return; + } + try { const issue = await activeReview.openIssue({ frame: frameNumber, diff --git a/cvat-ui/src/reducers/review-reducer.ts b/cvat-ui/src/reducers/review-reducer.ts index 919ea7bad54c..01d6cbcf1e36 100644 --- a/cvat-ui/src/reducers/review-reducer.ts +++ b/cvat-ui/src/reducers/review-reducer.ts @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -97,6 +97,20 @@ export default function (state: ReviewState = defaultState, action: any): Review } case ReviewActionTypes.START_ISSUE: { const { position } = action.payload; + const { frameIssues } = state; + + const epsilon = 5; // px + for (const issue of frameIssues) { + if ( + issue.position.length === position.length && + issue.position.every((val: number, index: number) => Math.abs(val - position[index]) < epsilon) + ) { + return { + ...state, + }; + } + } + return { ...state, newIssuePosition: position, From 0a385c668dc9c2cafcd6cdaf6ec9282cc6248c92 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 25 Feb 2021 18:37:13 +0300 Subject: [PATCH 2/6] Merged develop --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 690e7a7eb7dc..8c26ff4a328a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Annotation page popups (ai tools, drawing) reset state after detecting, tracking, drawing () - Polygon editing using trailing point () - Fixed of receiving function variable () +- Prevented creating several issues for the same object () ### Security From cccb203005eda69136553e77b5fae25fd0f61ba4 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 2 Mar 2021 11:04:34 +0300 Subject: [PATCH 3/6] Aborted chanegs --- cvat-ui/src/actions/review-actions.ts | 8 +---- cvat-ui/src/reducers/review-reducer.ts | 41 +++++++++----------------- 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/cvat-ui/src/actions/review-actions.ts b/cvat-ui/src/actions/review-actions.ts index 3013acb29c58..b433d96872fa 100644 --- a/cvat-ui/src/actions/review-actions.ts +++ b/cvat-ui/src/actions/review-actions.ts @@ -1,4 +1,4 @@ -// Copyright (C) 2021 Intel Corporation +// Copyright (C) 2020 Intel Corporation // // SPDX-License-Identifier: MIT @@ -98,12 +98,6 @@ export const finishIssueAsync = (message: string): ThunkAction => async (dispatc review: { activeReview, newIssuePosition }, } = state; - if (!newIssuePosition) { - // do not create issue if position was not specified - // for example in cases when we try to create several issues for one object - return; - } - try { const issue = await activeReview.openIssue({ frame: frameNumber, diff --git a/cvat-ui/src/reducers/review-reducer.ts b/cvat-ui/src/reducers/review-reducer.ts index 01d6cbcf1e36..eb1758f93189 100644 --- a/cvat-ui/src/reducers/review-reducer.ts +++ b/cvat-ui/src/reducers/review-reducer.ts @@ -1,4 +1,4 @@ -// Copyright (C) 2021 Intel Corporation +// Copyright (C) 2020 Intel Corporation // // SPDX-License-Identifier: MIT @@ -97,19 +97,6 @@ export default function (state: ReviewState = defaultState, action: any): Review } case ReviewActionTypes.START_ISSUE: { const { position } = action.payload; - const { frameIssues } = state; - - const epsilon = 5; // px - for (const issue of frameIssues) { - if ( - issue.position.length === position.length && - issue.position.every((val: number, index: number) => Math.abs(val - position[index]) < epsilon) - ) { - return { - ...state, - }; - } - } return { ...state, @@ -122,19 +109,19 @@ export default function (state: ReviewState = defaultState, action: any): Review return { ...state, - latestComments: state.latestComments.includes(issue.comments[0].message) ? - state.latestComments : - Array.from( - new Set( - [...state.latestComments, issue.comments[0].message].filter( - (message: string): boolean => - ![ - consts.QUICK_ISSUE_INCORRECT_POSITION_TEXT, - consts.QUICK_ISSUE_INCORRECT_ATTRIBUTE_TEXT, - ].includes(message), - ), - ), - ).slice(-consts.LATEST_COMMENTS_SHOWN_QUICK_ISSUE), + latestComments: state.latestComments.includes(issue.comments[0].message) + ? state.latestComments + : Array.from( + new Set( + [...state.latestComments, issue.comments[0].message].filter( + (message: string): boolean => + ![ + consts.QUICK_ISSUE_INCORRECT_POSITION_TEXT, + consts.QUICK_ISSUE_INCORRECT_ATTRIBUTE_TEXT, + ].includes(message), + ), + ), + ).slice(-consts.LATEST_COMMENTS_SHOWN_QUICK_ISSUE), frameIssues, newIssuePosition: null, }; From b46852a6621657575103948fb4e6dc6064e49733 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 2 Mar 2021 11:51:43 +0300 Subject: [PATCH 4/6] Added ability to scroll issues --- .../annotation-page/review/hidden-issue-label.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cvat-ui/src/components/annotation-page/review/hidden-issue-label.tsx b/cvat-ui/src/components/annotation-page/review/hidden-issue-label.tsx index 579bec3129f0..1be37564d951 100644 --- a/cvat-ui/src/components/annotation-page/review/hidden-issue-label.tsx +++ b/cvat-ui/src/components/annotation-page/review/hidden-issue-label.tsx @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MIT -import React, { ReactPortal, useEffect } from 'react'; +import React, { ReactPortal, useEffect, useRef } from 'react'; import ReactDOM from 'react-dom'; import Tag from 'antd/lib/tag'; import { CheckOutlined, CloseCircleOutlined } from '@ant-design/icons'; @@ -25,6 +25,8 @@ export default function HiddenIssueLabel(props: Props): ReactPortal { id, message, top, left, resolved, onClick, highlight, blur, } = props; + const ref = useRef(null); + useEffect(() => { if (!resolved) { setTimeout(highlight); @@ -37,10 +39,21 @@ export default function HiddenIssueLabel(props: Props): ReactPortal { return ReactDOM.createPortal( { + if (ref.current !== null) { + const selfElement = ref.current; + if (event.deltaX > 0) { + selfElement.parentElement?.appendChild(selfElement); + } else { + selfElement.parentElement?.prepend(selfElement); + } + } + }} style={{ top, left }} className='cvat-hidden-issue-label' > From 3c4c0feccdd1feb2f3cc463ea23043e1179a215f Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 2 Mar 2021 11:57:02 +0300 Subject: [PATCH 5/6] Aborted change --- cvat-ui/src/reducers/review-reducer.ts | 27 +++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/cvat-ui/src/reducers/review-reducer.ts b/cvat-ui/src/reducers/review-reducer.ts index eb1758f93189..919ea7bad54c 100644 --- a/cvat-ui/src/reducers/review-reducer.ts +++ b/cvat-ui/src/reducers/review-reducer.ts @@ -97,7 +97,6 @@ export default function (state: ReviewState = defaultState, action: any): Review } case ReviewActionTypes.START_ISSUE: { const { position } = action.payload; - return { ...state, newIssuePosition: position, @@ -109,19 +108,19 @@ export default function (state: ReviewState = defaultState, action: any): Review return { ...state, - latestComments: state.latestComments.includes(issue.comments[0].message) - ? state.latestComments - : Array.from( - new Set( - [...state.latestComments, issue.comments[0].message].filter( - (message: string): boolean => - ![ - consts.QUICK_ISSUE_INCORRECT_POSITION_TEXT, - consts.QUICK_ISSUE_INCORRECT_ATTRIBUTE_TEXT, - ].includes(message), - ), - ), - ).slice(-consts.LATEST_COMMENTS_SHOWN_QUICK_ISSUE), + latestComments: state.latestComments.includes(issue.comments[0].message) ? + state.latestComments : + Array.from( + new Set( + [...state.latestComments, issue.comments[0].message].filter( + (message: string): boolean => + ![ + consts.QUICK_ISSUE_INCORRECT_POSITION_TEXT, + consts.QUICK_ISSUE_INCORRECT_ATTRIBUTE_TEXT, + ].includes(message), + ), + ), + ).slice(-consts.LATEST_COMMENTS_SHOWN_QUICK_ISSUE), frameIssues, newIssuePosition: null, }; From 3b15baf31ee250ac02aac9cb6bbb2f2c6647654a Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 2 Mar 2021 11:57:32 +0300 Subject: [PATCH 6/6] Updated version --- cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 0cd1ddc4cb36..a51ba06021b3 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.15.1", + "version": "1.15.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 5d8bf3b4b3ee..027fffe58974 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.15.1", + "version": "1.15.2", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": {