From 3b2f73e7b5993e63d30791835f5d483f8eb2db4d Mon Sep 17 00:00:00 2001 From: Kirill Lakhov Date: Mon, 21 Aug 2023 19:41:18 +0300 Subject: [PATCH] Fixed removing job assignee (#6712) ### Motivation and context Resolves #6700 Fix + tests ### How has this been tested? ### Checklist - [x] I submit my changes into the `develop` branch - [x] I have added a description of my changes into the [CHANGELOG](https://github.com/opencv/cvat/blob/develop/CHANGELOG.md) file - ~~[ ] I have updated the documentation accordingly~~ - [x] I have added tests to cover my changes - [x] I have linked related issues (see [GitHub docs]( https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)) - [x] I have increased versions of npm packages if it is necessary ([cvat-canvas](https://github.com/opencv/cvat/tree/develop/cvat-canvas#versioning), [cvat-core](https://github.com/opencv/cvat/tree/develop/cvat-core#versioning), [cvat-data](https://github.com/opencv/cvat/tree/develop/cvat-data#versioning) and [cvat-ui](https://github.com/opencv/cvat/tree/develop/cvat-ui#versioning)) ### License - [x] I submit _my code changes_ under the same [MIT License]( https://github.com/opencv/cvat/blob/develop/LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern. --------- Co-authored-by: Boris Sekachev --- CHANGELOG.md | 1 + cvat-core/package.json | 2 +- cvat-core/src/session.ts | 2 +- cvat-ui/package.json | 2 +- cvat-ui/src/components/job-item/job-item.tsx | 6 ++---- .../case_4_assign_task_job_users.js | 2 ++ .../support/commands_review_pipeline.js | 19 ++++++++++++------- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e5176f32c3b..664fcc0dfe30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Removing job assignee () - Fixed switching from organization to sandbox while getting a resource () ### Security diff --git a/cvat-core/package.json b/cvat-core/package.json index b832b1da0673..67efac501ab0 100644 --- a/cvat-core/package.json +++ b/cvat-core/package.json @@ -1,6 +1,6 @@ { "name": "cvat-core", - "version": "11.0.1", + "version": "11.0.2", "description": "Part of Computer Vision Tool which presents an interface for client-side integration", "main": "src/api.ts", "scripts": { diff --git a/cvat-core/src/session.ts b/cvat-core/src/session.ts index 8f07ba7d070c..923687195d05 100644 --- a/cvat-core/src/session.ts +++ b/cvat-core/src/session.ts @@ -317,7 +317,7 @@ function buildDuplicatedAPI(prototype) { export class Session {} export class Job extends Session { - public assignee: User; + public assignee: User | null; public stage: JobStage; public state: JobState; public readonly id: number; diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 7e5f886c46f1..a235f864534a 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.55.2", + "version": "1.55.3", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/components/job-item/job-item.tsx b/cvat-ui/src/components/job-item/job-item.tsx index d9a80e5cff1f..614d058d3426 100644 --- a/cvat-ui/src/components/job-item/job-item.tsx +++ b/cvat-ui/src/components/job-item/job-item.tsx @@ -156,10 +156,8 @@ function JobItem(props: Props): JSX.Element { value={job.assignee} onSelect={(user: User | null): void => { if (job?.assignee?.id === user?.id) return; - if (user) { - job.assignee = user; - onJobUpdate(job); - } + job.assignee = user; + onJobUpdate(job); }} /> diff --git a/tests/cypress/e2e/actions_users/registration_involved/case_4_assign_task_job_users.js b/tests/cypress/e2e/actions_users/registration_involved/case_4_assign_task_job_users.js index 7859cc3f70ca..186247f0e641 100644 --- a/tests/cypress/e2e/actions_users/registration_involved/case_4_assign_task_job_users.js +++ b/tests/cypress/e2e/actions_users/registration_involved/case_4_assign_task_job_users.js @@ -115,6 +115,7 @@ context('Multiple users. Assign task, job. Deactivating users.', () => { cy.goToTaskList(); cy.openTask(taskName); cy.assignTaskToUser(secondUserName); + cy.assignJobToUser(0, secondUserName); cy.openJob(); // Getting the task and job id cy.url().then((url) => { @@ -140,6 +141,7 @@ context('Multiple users. Assign task, job. Deactivating users.', () => { it('First user login and assign the job to the third user. Logout', () => { cy.login(); cy.openTask(taskName); + cy.assignJobToUser(0, null); cy.assignJobToUser(0, thirdUserName); cy.logout(); }); diff --git a/tests/cypress/support/commands_review_pipeline.js b/tests/cypress/support/commands_review_pipeline.js index 93ed4a15a561..4196dad1ad59 100644 --- a/tests/cypress/support/commands_review_pipeline.js +++ b/tests/cypress/support/commands_review_pipeline.js @@ -21,16 +21,21 @@ Cypress.Commands.add('assignJobToUser', (jobID, user) => { cy.get('.cvat-jobs-list') .contains('a', `Job #${$job}`) .parents('.cvat-job-item') - .find('.cvat-job-assignee-selector') - .click(); + .find('.cvat-job-assignee-selector input') + .click() + .clear(); }); cy.intercept('PATCH', '/api/jobs/**').as('patchJobAssignee'); - cy.get('.ant-select-dropdown') - .should('be.visible') - .not('.ant-select-dropdown-hidden') - .contains(new RegExp(`^${user}$`, 'g')) - .click(); + if (user) { + cy.get('.ant-select-dropdown') + .should('be.visible') + .not('.ant-select-dropdown-hidden') + .contains(new RegExp(`^${user}$`, 'g')) + .click(); + } else { + cy.get('body').type('{Enter}'); + } cy.wait('@patchJobAssignee').its('response.statusCode').should('equal', 200); cy.get('.cvat-spinner').should('not.exist');