From ee01e2fc46107979698e21e32a3e84886cff926f Mon Sep 17 00:00:00 2001 From: Dmitry Kalinin Date: Sun, 28 Feb 2021 21:31:00 +0300 Subject: [PATCH 1/3] Fixed label form validator --- cvat-ui/src/components/labels-editor/label-form.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cvat-ui/src/components/labels-editor/label-form.tsx b/cvat-ui/src/components/labels-editor/label-form.tsx index c0f78329a53c..23f16c962c68 100644 --- a/cvat-ui/src/components/labels-editor/label-form.tsx +++ b/cvat-ui/src/components/labels-editor/label-form.tsx @@ -390,10 +390,11 @@ export default class LabelForm extends React.Component { message: patterns.validateAttributeName.message, }, { - validator: async (_rule: any, labelName: string, callback: Function) => { + validator: (_rule: any, labelName: string) => { if (labelNames && labelNames.includes(labelName)) { - callback('Label name must be unique for the task'); + return Promise.reject(new Error('Label name must be unique for the task')); } + return Promise.resolve(); }, }, ]} @@ -522,7 +523,7 @@ export default class LabelForm extends React.Component { public render(): JSX.Element { return (
- + {this.renderLabelNameInput()} {this.renderChangeColorButton()} @@ -531,7 +532,7 @@ export default class LabelForm extends React.Component { {this.renderNewAttributeButton()} - + {this.renderAttributes()} From b0a33af14736f456d57513d9aa3ff8489f400c5e Mon Sep 17 00:00:00 2001 From: Dmitry Kalinin Date: Sun, 28 Feb 2021 21:40:39 +0300 Subject: [PATCH 2/3] Added CHANGELOG and increased package npm version --- 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 28020188943a..a7752c79ec20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated the path to python for DL models inside automatic annotation documentation () - Fixed of receiving function variable () - Shortcuts with CAPSLOCK enabled and with non-US languages activated () +- Fixed label editor name field validator () ### Security diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index ce87ebabe05a..77c1b71d2a41 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.15.0", + "version": "1.15.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 49d93b64f86d..4e3423d8af46 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.15.0", + "version": "1.15.1", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { From ebdfdbe9fe16e5b984882cdaaaf71339de1eefc2 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Mon, 1 Mar 2021 13:03:43 +0300 Subject: [PATCH 3/3] Update Cypress test "Creating a label with existing label name" for PR 2879 (#2883) * Fix case 43 for PR 2879 * Try restart CI --- .../case_43_create_label_with_existing_label_name.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_43_create_label_with_existing_label_name.js b/tests/cypress/integration/actions_tasks_objects/case_43_create_label_with_existing_label_name.js index 198f77889868..796e41d1a57b 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_43_create_label_with_existing_label_name.js +++ b/tests/cypress/integration/actions_tasks_objects/case_43_create_label_with_existing_label_name.js @@ -24,11 +24,10 @@ context('Creating a label with existing label name.', () => { // Try to create a label with existing label name cy.get('.cvat-constructor-viewer-new-item').click(); cy.get('[placeholder="Label name"]').type(firstLabelName); - cy.contains('[type="submit"]', 'Done').click(); + cy.contains('[role="alert"]', 'Label name must be unique for the task') // Checking alert visibility + .should('exist') + .and('be.visible'); }); - cy.get('.cvat-notification-notice-update-task-failed') - .should('exist') - .and('contain.text', 'label names must be unique'); }); }); });