diff --git a/CHANGELOG.md b/CHANGELOG.md index 1927e9c9..76f65521 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Django templates for email and user guide () -- Saving relative paths in dummy chunks instead of absolute() +- Saving relative paths in dummy chunks instead of absolute () +- Objects with a specific label cannot be displayed if at least one tag with the label exist () +- Wrong attribute can be removed in labels editor () +- UI fails with the error "Cannot read property 'label' of undefined" () +- Exception: "Value must be a user instance" () - 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 13a43d68..25cfefe6 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.1", + "version": "1.10.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index a023aff6..acda045f 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.10.1", + "version": "1.10.5", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/components/labels-editor/label-form.tsx b/cvat-ui/src/components/labels-editor/label-form.tsx index b292f41f..3e1a4f58 100644 --- a/cvat-ui/src/components/labels-editor/label-form.tsx +++ b/cvat-ui/src/components/labels-editor/label-form.tsx @@ -18,7 +18,9 @@ import ColorPicker from 'components/annotation-page/standard-workspace/objects-s import { ColorizeIcon } from 'icons'; import patterns from 'utils/validation-patterns'; import consts from 'consts'; -import { equalArrayHead, idGenerator, Label, Attribute } from './common'; +import { + equalArrayHead, idGenerator, Label, Attribute, +} from './common'; export enum AttributeType { SELECT = 'SELECT', @@ -318,9 +320,9 @@ class LabelForm extends React.PureComponent { ); } - private renderAttribute = (key: number, index: number): JSX.Element => { + private renderAttribute = (key: number): JSX.Element => { const { label, form } = this.props; - const attr = label && index < label.attributes.length ? label.attributes[index] : null; + const attr = label ? label.attributes.filter((_attr: any): boolean => _attr.id === key)[0] : null; return ( diff --git a/cvat-ui/src/components/task-page/user-selector.tsx b/cvat-ui/src/components/task-page/user-selector.tsx index 0cc42db9..f5fdcf0b 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); }); } 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 43b2ad4a..c172abb5 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/label-item.tsx b/cvat-ui/src/containers/annotation-page/standard-workspace/objects-side-bar/label-item.tsx index 8c74f714..8e89e244 100644 --- a/cvat-ui/src/containers/annotation-page/standard-workspace/objects-side-bar/label-item.tsx +++ b/cvat-ui/src/containers/annotation-page/standard-workspace/objects-side-bar/label-item.tsx @@ -8,7 +8,7 @@ import { connect } from 'react-redux'; import { updateAnnotationsAsync } from 'actions/annotation-actions'; import LabelItemComponent from 'components/annotation-page/standard-workspace/objects-side-bar/label-item'; -import { CombinedState } from 'reducers/interfaces'; +import { CombinedState, ObjectType } from 'reducers/interfaces'; interface OwnProps { labelID: number; @@ -92,8 +92,8 @@ class LabelItemContainer extends React.PureComponent { let statesLocked = true; ownObjectStates.forEach((objectState: any) => { - const { lock } = objectState; - if (!lock) { + const { lock, objectType } = objectState; + if (!lock && objectType !== ObjectType.TAG) { statesHidden = statesHidden && objectState.hidden; statesLocked = statesLocked && objectState.lock; } 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 2d2e6f51..987598f7 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) {