Skip to content

Commit

Permalink
Fixed removing job assignee (#6712)
Browse files Browse the repository at this point in the history
<!-- Raise an issue to propose your change
(https://github.com/opencv/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution
guide](https://opencv.github.io/cvat/docs/contributing/). -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->
Resolves #6700 
Fix + tests

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [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 <boris.sekachev@yandex.ru>
  • Loading branch information
klakhov and bsekachev authored Aug 21, 2023
1 parent 64fe3a2 commit 3b2f73e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Removing job assignee (<https://github.com/opencv/cvat/pull/6712>)
- Fixed switching from organization to sandbox while getting a resource (<https://github.com/opencv/cvat/pull/6689>)

### Security
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
6 changes: 2 additions & 4 deletions cvat-ui/src/components/job-item/job-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}}
/>
</Col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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();
});
Expand Down
19 changes: 12 additions & 7 deletions tests/cypress/support/commands_review_pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 3b2f73e

Please sign in to comment.