From 5f44603db2d85a0d1ecb4c796e87e6b7f10fe492 Mon Sep 17 00:00:00 2001 From: Aleksey Alekseev <108272065+AlexeyAlexeevXperienceAI@users.noreply.github.com> Date: Wed, 28 Sep 2022 14:36:08 +0400 Subject: [PATCH] add link to create of many tasks from project page (#5002) * add link to create of many tasks from project page * add dropdown for task actions * add return to project after multi tasks creating --- .../cvat-dropdown-menu-paper/index.scss | 30 +++++++++++++++ .../common/cvat-dropdown-menu-paper/index.tsx | 12 ++++++ .../create-task-page/create-task-content.tsx | 8 +++- .../components/project-page/project-page.tsx | 38 ++++++++++++++++--- cvat-ui/src/components/tasks-page/styles.scss | 25 ------------ cvat-ui/src/components/tasks-page/top-bar.tsx | 7 ++-- ...ng_more_one_tasks_from_project_per_time.js | 1 + tests/cypress/support/commands.js | 7 +--- 8 files changed, 87 insertions(+), 41 deletions(-) create mode 100644 cvat-ui/src/components/common/cvat-dropdown-menu-paper/index.scss create mode 100644 cvat-ui/src/components/common/cvat-dropdown-menu-paper/index.tsx diff --git a/cvat-ui/src/components/common/cvat-dropdown-menu-paper/index.scss b/cvat-ui/src/components/common/cvat-dropdown-menu-paper/index.scss new file mode 100644 index 00000000..a0460c65 --- /dev/null +++ b/cvat-ui/src/components/common/cvat-dropdown-menu-paper/index.scss @@ -0,0 +1,30 @@ +// Copyright (C) 2022 Intel Corporation +// +// SPDX-License-Identifier: MIT + +@import '../../../base.scss'; + +.cvat-dropdown-menu-paper { + display: flex; + flex-direction: column; + background: $background-color-1; + padding: $grid-unit-size; + border-radius: 4px; + box-shadow: $box-shadow-base; + + > * { + &:not(:first-child) { + margin-top: $grid-unit-size; + } + + width: 100%; + + .ant-upload { + width: 100%; + + button { + width: 100%; + } + } + } +} diff --git a/cvat-ui/src/components/common/cvat-dropdown-menu-paper/index.tsx b/cvat-ui/src/components/common/cvat-dropdown-menu-paper/index.tsx new file mode 100644 index 00000000..d0dd5e3a --- /dev/null +++ b/cvat-ui/src/components/common/cvat-dropdown-menu-paper/index.tsx @@ -0,0 +1,12 @@ +// Copyright (C) 2022 Intel Corporation +// +// SPDX-License-Identifier: MIT + +import React from 'react'; +import './index.scss'; + +export default function DropdownMenuPaper({ children }: { children: React.ReactNode }): JSX.Element { + return ( +
{children}
+ ); +} diff --git a/cvat-ui/src/components/create-task-page/create-task-content.tsx b/cvat-ui/src/components/create-task-page/create-task-content.tsx index c0a24ee8..f6e0a1d6 100644 --- a/cvat-ui/src/components/create-task-page/create-task-content.tsx +++ b/cvat-ui/src/components/create-task-page/create-task-content.tsx @@ -600,8 +600,12 @@ class CreateTaskContent extends React.PureComponent { - const { history } = this.props; - history.push('/tasks/'); + const { history, projectId } = this.props; + if (projectId) { + history.push(`/projects/${projectId}`); + } else { + history.push('/tasks/'); + } }; private handleRetryCancelledMultiTasks = (): void => { diff --git a/cvat-ui/src/components/project-page/project-page.tsx b/cvat-ui/src/components/project-page/project-page.tsx index 98bfaba0..cf2e0d07 100644 --- a/cvat-ui/src/components/project-page/project-page.tsx +++ b/cvat-ui/src/components/project-page/project-page.tsx @@ -11,8 +11,10 @@ import Spin from 'antd/lib/spin'; import { Row, Col } from 'antd/lib/grid'; import Result from 'antd/lib/result'; import Button from 'antd/lib/button'; +import Dropdown from 'antd/lib/dropdown'; import Title from 'antd/lib/typography/Title'; import Pagination from 'antd/lib/pagination'; +import { MutliPlusIcon } from 'icons'; import { PlusOutlined } from '@ant-design/icons'; import Empty from 'antd/lib/empty'; import Input from 'antd/lib/input'; @@ -26,6 +28,7 @@ import ModelRunnerDialog from 'components/model-runner-modal/model-runner-dialog import { SortingComponent, ResourceFilterHOC, defaultVisibility, updateHistoryFromQuery, } from 'components/resource-sorting-filtering'; +import CvatDropdownMenuPaper from 'components/common/cvat-dropdown-menu-paper'; import DetailsComponent from './details'; import ProjectTopBar from './top-bar'; @@ -225,13 +228,36 @@ export default function ProjectPageComponent(): JSX.Element { }} /> + + + + + )} + > + - + )} >