From 92e402460177d82aa750d20231bdfb0765818216 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 16 Nov 2020 15:41:30 +0300 Subject: [PATCH 1/7] Fixed: Value must be a user instance --- cvat-ui/src/components/task-page/user-selector.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cvat-ui/src/components/task-page/user-selector.tsx b/cvat-ui/src/components/task-page/user-selector.tsx index 0cc42db9b2a8..f5fdcf0b8efa 100644 --- a/cvat-ui/src/components/task-page/user-selector.tsx +++ b/cvat-ui/src/components/task-page/user-selector.tsx @@ -83,13 +83,7 @@ export default function UserSelector(props: Props): JSX.Element { if (value && !users.filter((user) => user.id === value.id).length) { core.users.get({ id: value.id }).then((result: User[]) => { const [user] = result; - setUsers([ - ...users, - { - id: user.id, - username: user.username, - }, - ]); + setUsers([...users, user]); setSearchPhrase(user.username); }); } From 47a26a58b4e5420dc69f93208b4543b848041c70 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 16 Nov 2020 15:44:03 +0300 Subject: [PATCH 2/7] Updated changelog --- CHANGELOG.md | 1 + cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f3fa16205e..1ecf60178fce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Django templates for email and user guide () - Saving relative paths in dummy chunks instead of absolute() +- Exception: "Value must be a user instance" () ### Security diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index c8a305a6e15c..faee78bd35f0 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.0", + "version": "1.10.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 1afed2a47d4a..d685b08e9dc6 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.0", + "version": "1.10.4", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { From fabd5a9134a14d1ceb7f0dd62eef9be87238d96f Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 16 Nov 2020 16:44:12 +0300 Subject: [PATCH 3/7] Fixed issue: Cannot read property label of undefined --- .../canvas-context-menu.tsx | 15 ++++- .../objects-side-bar/object-item.tsx | 65 ++++++++----------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/cvat-ui/src/containers/annotation-page/standard-workspace/canvas-context-menu.tsx b/cvat-ui/src/containers/annotation-page/standard-workspace/canvas-context-menu.tsx index 43b2ad4a40c7..c172abb58809 100644 --- a/cvat-ui/src/containers/annotation-page/standard-workspace/canvas-context-menu.tsx +++ b/cvat-ui/src/containers/annotation-page/standard-workspace/canvas-context-menu.tsx @@ -24,7 +24,10 @@ function mapStateToProps(state: CombinedState): StateToProps { annotation: { annotations: { activatedStateID, collapsed, states: objectStates }, canvas: { - contextMenu: { visible, top, left, type }, + contextMenu: { + visible, top, left, type, + }, + ready, }, }, } = state; @@ -33,7 +36,11 @@ function mapStateToProps(state: CombinedState): StateToProps { activatedStateID, collapsed: activatedStateID !== null ? collapsed[activatedStateID] : undefined, objectStates, - visible, + visible: + activatedStateID !== null && + visible && + ready && + objectStates.map((_state: any): number => _state.clientID).includes(activatedStateID), left, top, type, @@ -166,7 +173,9 @@ class CanvasContextMenuContainer extends React.PureComponent { public render(): JSX.Element { const { left, top } = this.state; - const { visible, activatedStateID, objectStates, type } = this.props; + const { + visible, activatedStateID, objectStates, type, + } = this.props; return ( <> diff --git a/cvat-ui/src/containers/annotation-page/standard-workspace/objects-side-bar/object-item.tsx b/cvat-ui/src/containers/annotation-page/standard-workspace/objects-side-bar/object-item.tsx index 2d2e6f516ca2..987598f77f74 100644 --- a/cvat-ui/src/containers/annotation-page/standard-workspace/objects-side-bar/object-item.tsx +++ b/cvat-ui/src/containers/annotation-page/standard-workspace/objects-side-bar/object-item.tsx @@ -7,7 +7,9 @@ import copy from 'copy-to-clipboard'; import { connect } from 'react-redux'; import { LogType } from 'cvat-logger'; -import { ActiveControl, CombinedState, ColorBy, ShapeType } from 'reducers/interfaces'; +import { + ActiveControl, CombinedState, ColorBy, ShapeType, +} from 'reducers/interfaces'; import { collapseObjectItems, updateAnnotationsAsync, @@ -83,40 +85,25 @@ function mapStateToProps(state: CombinedState, own: OwnProps): StateToProps { const stateIDs = states.map((_state: any): number => _state.clientID); const index = stateIDs.indexOf(clientID); - try { - const collapsedState = - typeof statesCollapsed[clientID] === 'undefined' ? initialCollapsed : statesCollapsed[clientID]; - - return { - objectState: states[index], - collapsed: collapsedState, - attributes: jobAttributes[states[index].label.id], - labels, - ready, - activeControl, - colorBy, - jobInstance, - frameNumber, - activated: activatedStateID === clientID, - minZLayer, - maxZLayer, - normalizedKeyMap, - aiToolsRef, - }; - } catch (exception) { - // we have an exception here sometimes - // but I cannot understand when it happens and what is the root reason - // maybe this temporary hack helps us - const dataObject = { - index, - frameNumber, - clientID: own.clientID, - stateIDs, - }; - throw new Error( - `${exception.toString()} in mapStateToProps of ObjectItemContainer. Data are ${JSON.stringify(dataObject)}`, - ); - } + const collapsedState = + typeof statesCollapsed[clientID] === 'undefined' ? initialCollapsed : statesCollapsed[clientID]; + + return { + objectState: states[index], + collapsed: collapsedState, + attributes: jobAttributes[states[index].label.id], + labels, + ready, + activeControl, + colorBy, + jobInstance, + frameNumber, + activated: activatedStateID === clientID, + minZLayer, + maxZLayer, + normalizedKeyMap, + aiToolsRef, + }; } function mapDispatchToProps(dispatch: any): DispatchToProps { @@ -219,7 +206,9 @@ class ObjectItemContainer extends React.PureComponent { }; private activate = (): void => { - const { activateObject, objectState, ready, activeControl } = this.props; + const { + activateObject, objectState, ready, activeControl, + } = this.props; if (ready && activeControl === ActiveControl.CURSOR) { activateObject(objectState.clientID); @@ -324,7 +313,9 @@ class ObjectItemContainer extends React.PureComponent { } public render(): JSX.Element { - const { objectState, collapsed, labels, attributes, activated, colorBy, normalizedKeyMap } = this.props; + const { + objectState, collapsed, labels, attributes, activated, colorBy, normalizedKeyMap, + } = this.props; let stateColor = ''; if (colorBy === ColorBy.INSTANCE) { From c0d92ed90d482d52a542d060af1a7486d5c257f4 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 16 Nov 2020 16:52:52 +0300 Subject: [PATCH 4/7] Updated changelog --- CHANGELOG.md | 1 + cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f3fa16205e..0e4a1693daaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Django templates for email and user guide () - Saving relative paths in dummy chunks instead of absolute() +- UI fails with the error "Cannot read property 'label' of undefined" () ### Security diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index c8a305a6e15c..803412bbf396 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.0", + "version": "1.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 1afed2a47d4a..05039ea4a164 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.0", + "version": "1.10.1", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { From 5bfe7cb873c227136ef972ed2f7947ec7a2db60f Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 16 Nov 2020 16:57:27 +0300 Subject: [PATCH 5/7] Fixed package 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 faee78bd35f0..803412bbf396 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.4", + "version": "1.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index d685b08e9dc6..05039ea4a164 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.4", + "version": "1.10.1", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { From 68603ec4cf74b834fc80d6238d0838c3bdd8284a Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 16 Nov 2020 17:28:06 +0300 Subject: [PATCH 6/7] Reset zoom option works in tag annotation mode --- .../standard-workspace/canvas-wrapper.tsx | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/canvas-wrapper.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/canvas-wrapper.tsx index d760411ab66a..acc697ae0990 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/canvas-wrapper.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/canvas-wrapper.tsx @@ -10,7 +10,9 @@ import Icon from 'antd/lib/icon'; import Layout from 'antd/lib/layout/layout'; import Slider, { SliderValue } from 'antd/lib/slider'; -import { ColorBy, GridColor, ObjectType, ContextMenuType, Workspace, ShapeType } from 'reducers/interfaces'; +import { + ColorBy, GridColor, ObjectType, ContextMenuType, Workspace, ShapeType, +} from 'reducers/interfaces'; import { LogType } from 'cvat-logger'; import { Canvas } from 'cvat-canvas-wrapper'; import getCore from 'cvat-core-wrapper'; @@ -217,10 +219,7 @@ export default class CanvasWrapperComponent extends React.PureComponent { this.updateCanvas(); } - if ( - prevProps.frame !== frameData.number && - ((resetZoom && workspace !== Workspace.ATTRIBUTE_ANNOTATION) || workspace === Workspace.TAG_ANNOTATION) - ) { + if (prevProps.frame !== frameData.number && resetZoom && workspace !== Workspace.ATTRIBUTE_ANNOTATION) { canvasInstance.html().addEventListener( 'canvas.setup', () => { @@ -304,7 +303,9 @@ export default class CanvasWrapperComponent extends React.PureComponent { } private onCanvasShapeDrawn = (event: any): void => { - const { jobInstance, activeLabelID, activeObjectType, frame, onShapeDrawn, onCreateAnnotations } = this.props; + const { + jobInstance, activeLabelID, activeObjectType, frame, onShapeDrawn, onCreateAnnotations, + } = this.props; if (!event.detail.continue) { onShapeDrawn(); @@ -327,7 +328,9 @@ export default class CanvasWrapperComponent extends React.PureComponent { }; private onCanvasObjectsMerged = (event: any): void => { - const { jobInstance, frame, onMergeAnnotations, onMergeObjects } = this.props; + const { + jobInstance, frame, onMergeAnnotations, onMergeObjects, + } = this.props; onMergeObjects(false); @@ -340,7 +343,9 @@ export default class CanvasWrapperComponent extends React.PureComponent { }; private onCanvasObjectsGroupped = (event: any): void => { - const { jobInstance, frame, onGroupAnnotations, onGroupObjects } = this.props; + const { + jobInstance, frame, onGroupAnnotations, onGroupObjects, + } = this.props; onGroupObjects(false); @@ -349,7 +354,9 @@ export default class CanvasWrapperComponent extends React.PureComponent { }; private onCanvasTrackSplitted = (event: any): void => { - const { jobInstance, frame, onSplitAnnotations, onSplitTrack } = this.props; + const { + jobInstance, frame, onSplitAnnotations, onSplitTrack, + } = this.props; onSplitTrack(false); @@ -429,7 +436,9 @@ export default class CanvasWrapperComponent extends React.PureComponent { }; private onCanvasCursorMoved = async (event: any): Promise => { - const { jobInstance, activatedStateID, workspace, onActivateObject } = this.props; + const { + jobInstance, activatedStateID, workspace, onActivateObject, + } = this.props; if (workspace !== Workspace.STANDARD) { return; @@ -560,7 +569,9 @@ export default class CanvasWrapperComponent extends React.PureComponent { } private updateShapesView(): void { - const { annotations, opacity, colorBy, outlined, outlineColor } = this.props; + const { + annotations, opacity, colorBy, outlined, outlineColor, + } = this.props; for (const state of annotations) { let shapeColor = ''; @@ -588,7 +599,9 @@ export default class CanvasWrapperComponent extends React.PureComponent { } private updateCanvas(): void { - const { curZLayer, annotations, frameData, canvasInstance } = this.props; + const { + curZLayer, annotations, frameData, canvasInstance, + } = this.props; if (frameData !== null) { canvasInstance.setup( From cf9e287e9d0e0e18f963f68e5bd439e9540bc959 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 16 Nov 2020 17:30:37 +0300 Subject: [PATCH 7/7] Updated changelog --- CHANGELOG.md | 1 + cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f3fa16205e..1927e9c937c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Django templates for email and user guide () - Saving relative paths in dummy chunks instead of absolute() +- Reset zoom option doesn't work in tag annotation mode () ### Security diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 213d48575fd1..13a43d682e4c 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.0", + "version": "1.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index ac1e2ef2677b..a023aff6f07f 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.0", + "version": "1.10.1", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": {