Skip to content

Commit

Permalink
Fixed creation task problem (#3454)
Browse files Browse the repository at this point in the history
* Fixed existng labels issue

* Added CHANGELOG, increased package versions

* Fixed project search field

* Fixed cypress test
  • Loading branch information
ActiveChooN authored Jul 26, 2021
1 parent 056b7d8 commit e3616df
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed issue when save filtered object in AAM (<https://github.com/openvinotoolkit/cvat/pull/3401>)
- Context image disappears after undo/redo (<https://github.com/openvinotoolkit/cvat/pull/3416>)
- Using combined data sources (directory and image) when create a task (<https://github.com/openvinotoolkit/cvat/pull/3424>)
- Creating task with labels in project (<https://github.com/openvinotoolkit/cvat/pull/3454>)

### Security

Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.21.0",
"version": "1.21.1",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
10 changes: 6 additions & 4 deletions cvat-ui/src/components/create-task-page/create-task-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps,

this.fileManagerContainer.reset();

this.setState({
this.setState((state) => ({
...defaultState,
});
projectId: state.projectId,
}));
}
}

Expand All @@ -127,10 +128,11 @@ class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps,
private handleProjectIdChange = (value: null | number): void => {
const { projectId, subset } = this.state;

this.setState({
this.setState((state) => ({
projectId: value,
subset: value && value === projectId ? subset : '',
});
labels: value ? [] : state.labels,
}));
};

private handleSubmitBasicConfiguration = (values: BaseConfiguration): void => {
Expand Down
14 changes: 5 additions & 9 deletions cvat-ui/src/components/create-task-page/project-search-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ export default function ProjectSearchField(props: Props): JSX.Element {
const [projects, setProjects] = useState<Project[]>([]);

const handleSearch = (searchValue: string): void => {
if (searchValue) {
core.projects.searchNames(searchValue).then((result: Project[]) => {
if (result) {
setProjects(result);
}
});
} else {
setProjects([]);
}
core.projects.searchNames(searchValue).then((result: Project[]) => {
if (result) {
setProjects(result);
}
});
setSearchPhrase(searchValue);
onSelect(null);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,11 @@ context('Create more than one task per time when create from project.', () => {
const imagesFolder = `cypress/fixtures/${imageFileName}`;
const directoryToArchive = imagesFolder;

function createTask(nameTaskToCreate, repeatCreation) {
let projectSearchField;
if (!repeatCreation) {
projectSearchField = projectName;
} else {
projectSearchField = '';
}
function createTask(nameTaskToCreate) {
cy.get('[id="name"]').clear().type(nameTaskToCreate);
cy.get('.cvat-project-search-field').within(() => {
cy.get('[type="search"]').should('have.value', projectSearchField);
cy.get('[type="search"]').should('have.value', projectName);
});
if (repeatCreation) {
cy.get('.cvat-project-search-field').click();
cy.get('.ant-select-dropdown')
.not('.ant-select-dropdown-hidden')
.within(() => {
cy.get(`.ant-select-item-option[title="${projectName}"]`).click();
});
}
cy.get('.cvat-constructor-viewer-new-item').should('not.exist');
cy.get('input[type="file"]').attachFile(archiveName, { subjectType: 'drag-n-drop' });
cy.contains('button', 'Submit').click();
Expand All @@ -59,8 +45,8 @@ context('Create more than one task per time when create from project.', () => {
describe(`Testing "Issue ${issueID}"`, () => {
it('Create more than one task per time from project.', () => {
cy.get('#cvat-create-task-button').click();
createTask(taskName.firstTask, false);
createTask(taskName.secondTask, true);
createTask(taskName.firstTask);
createTask(taskName.secondTask);
});

it('The tasks successfully created. Remove the project.', () => {
Expand Down

0 comments on commit e3616df

Please sign in to comment.