From 951c4e76fa124d46dc2fb9d17b216826016ad00d Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 5 Sep 2023 14:12:56 +0300 Subject: [PATCH 1/4] Removed git app from client --- cvat-ui/src/actions/tasks-actions.ts | 17 +- .../advanced-configuration-form.tsx | 105 +-------- .../create-task-page/create-task-content.tsx | 6 - .../create-task-page/create-task-page.tsx | 63 +---- cvat-ui/src/components/header/header.tsx | 2 - cvat-ui/src/components/task-page/details.tsx | 214 +---------------- cvat-ui/src/components/task-page/styles.scss | 35 --- .../create-task-page/create-task-page.tsx | 17 +- cvat-ui/src/reducers/index.ts | 1 - cvat-ui/src/reducers/plugins-reducer.ts | 6 - cvat-ui/src/utils/git-utils.ts | 217 ------------------ cvat-ui/src/utils/validation-patterns.ts | 9 +- 12 files changed, 15 insertions(+), 677 deletions(-) delete mode 100644 cvat-ui/src/utils/git-utils.ts diff --git a/cvat-ui/src/actions/tasks-actions.ts b/cvat-ui/src/actions/tasks-actions.ts index 3ab967e1a458..be82865267ee 100644 --- a/cvat-ui/src/actions/tasks-actions.ts +++ b/cvat-ui/src/actions/tasks-actions.ts @@ -258,27 +258,12 @@ ThunkAction, {}, {}, AnyAction> { taskInstance.serverFiles = data.files.share.concat(data.files.cloudStorage); taskInstance.remoteFiles = data.files.remote; - if (data.advanced.repository) { - const [gitPlugin] = (await cvat.plugins.list()).filter((plugin: any): boolean => plugin.name === 'Git'); - - if (gitPlugin) { - gitPlugin.callbacks.onStatusChange = (status: string): void => { - onProgress?.(status); - }; - gitPlugin.data.task = taskInstance; - gitPlugin.data.repos = data.advanced.repository; - gitPlugin.data.format = data.advanced.format; - gitPlugin.data.lfs = data.advanced.lfs; - } - } - try { const savedTask = await taskInstance.save((status: RQStatus, progress: number, message: string): void => { if (status === RQStatus.UNKNOWN) { onProgress?.(`${message} ${progress ? `${Math.floor(progress * 100)}%` : ''}`); } else if ([RQStatus.QUEUED, RQStatus.STARTED].includes(status)) { - const helperMessage = data.advanced.repository ? - 'Do not leave the page' : 'You may close the window.'; + const helperMessage = 'You may close the window.'; onProgress?.(`${message} ${progress ? `${Math.floor(progress * 100)}%` : ''}. ${helperMessage}`); } else { onProgress?.(`${status}: ${message}`); diff --git a/cvat-ui/src/components/create-task-page/advanced-configuration-form.tsx b/cvat-ui/src/components/create-task-page/advanced-configuration-form.tsx index 30ce8a552db7..73d6faabca5e 100644 --- a/cvat-ui/src/components/create-task-page/advanced-configuration-form.tsx +++ b/cvat-ui/src/components/create-task-page/advanced-configuration-form.tsx @@ -1,5 +1,5 @@ // Copyright (C) 2020-2022 Intel Corporation -// Copyright (C) 2022 CVAT.ai Corporation +// Copyright (C) 2022-2023 CVAT.ai Corporation // // SPDX-License-Identifier: MIT @@ -7,7 +7,6 @@ import React, { RefObject } from 'react'; import { Row, Col } from 'antd/lib/grid'; import { PercentageOutlined, QuestionCircleOutlined } from '@ant-design/icons'; import Input from 'antd/lib/input'; -import Select from 'antd/lib/select'; import Space from 'antd/lib/space'; import Switch from 'antd/lib/switch'; import Tooltip from 'antd/lib/tooltip'; @@ -26,8 +25,6 @@ import { getCore, Storage, StorageData } from 'cvat-core-wrapper'; const core = getCore(); -const { Option } = Select; - export enum SortingMethod { LEXICOGRAPHICAL = 'lexicographical', NATURAL = 'natural', @@ -43,9 +40,6 @@ export interface AdvancedConfiguration { startFrame?: number; stopFrame?: number; frameFilter?: string; - lfs: boolean; - format?: string, - repository?: string; useZipChunks: boolean; dataChunkSize?: number; useCache: boolean; @@ -59,7 +53,6 @@ export interface AdvancedConfiguration { const initialValues: AdvancedConfiguration = { imageQuality: 70, - lfs: false, useZipChunks: true, useCache: true, copyData: false, @@ -83,12 +76,10 @@ interface Props { onChangeUseProjectTargetStorage(value: boolean): void; onChangeSourceStorageLocation: (value: StorageLocation) => void; onChangeTargetStorageLocation: (value: StorageLocation) => void; - installedGit: boolean; projectId: number | null; useProjectSourceStorage: boolean; useProjectTargetStorage: boolean; activeFileManagerTab: string; - dumpers: []; sourceStorageLocation: StorageLocation; targetStorageLocation: StorageLocation; } @@ -101,23 +92,6 @@ function validateURL(_: RuleObject, value: string): Promise { return Promise.resolve(); } -function validateRepositoryPath(_: RuleObject, value: string): Promise { - if (value && !patterns.validatePath.pattern.test(value)) { - return Promise.reject(new Error('Repository path is not a valid path')); - } - - return Promise.resolve(); -} - -function validateRepository(_: RuleObject, value: string): Promise<[void, void]> | Promise { - if (value) { - const [url, path] = value.split(/\s+/); - return Promise.all([validateURL(_, url), validateRepositoryPath(_, path)]); - } - - return Promise.resolve(); -} - const isInteger = ({ min, max }: { min?: number; max?: number }) => ( _: RuleObject, value?: number | string, @@ -352,79 +326,6 @@ class AdvancedConfigurationForm extends React.PureComponent { ); } - private renderGitLFSBox(): JSX.Element { - return ( - - - - - Use LFS (Large File Support): - - - - - ); - } - - private renderGitRepositoryURL(): JSX.Element { - return ( - - - - ); - } - - private renderGitFormat(): JSX.Element { - const { dumpers } = this.props; - return ( - - - - ); - } - - private renderGit(): JSX.Element { - return ( - <> - - {this.renderGitRepositoryURL()} - - - {this.renderGitFormat()} - - - {this.renderGitLFSBox()} - - - - ); - } - private renderBugTracker(): JSX.Element { return ( { } public render(): JSX.Element { - const { installedGit, activeFileManagerTab } = this.props; + const { activeFileManagerTab } = this.props; return (
@@ -584,8 +485,6 @@ class AdvancedConfigurationForm extends React.PureComponent { {this.renderChunkSize()} - {installedGit ? this.renderGit() : null} - {this.renderBugTracker()} 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 d792a7307664..4cbca2dfaea8 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 @@ -50,8 +50,6 @@ enum SupportedShareTypes { interface Props { onCreate: (data: CreateTaskData, onProgress?: (status: string, progress?: number) => void) => Promise; projectId: number | null; - installedGit: boolean; - dumpers:[]; many: boolean; } @@ -71,7 +69,6 @@ const defaultState: State = { }, subset: '', advanced: { - lfs: false, useZipChunks: true, useCache: true, sortingMethod: SortingMethod.LEXICOGRAPHICAL, @@ -815,7 +812,6 @@ class CreateTaskContent extends React.PureComponent Advanced configuration}> void) => Promise; - installedGit: boolean; - dumpers: [] } export default function CreateTaskPage(props: Props): JSX.Element { - const { - onCreate, installedGit, dumpers, - } = props; + const { onCreate } = props; const location = useLocation(); - const [error, setError] = useState(''); let projectId = null; const params = new URLSearchParams(location.search); @@ -34,58 +26,13 @@ export default function CreateTaskPage(props: Props): JSX.Element { projectId = +(params.get('projectId') as string); } const many = params.get('many') === 'true'; - const handleCreate: typeof onCreate = (...onCreateParams) => onCreate(...onCreateParams) - .catch((err) => { - setError(err.toString()); - throw err; - }); - - useEffect(() => { - if (error) { - let errorCopy = error; - const sshKeys: string[] = []; - while (errorCopy.length) { - const startIndex = errorCopy.search(/'ssh/); - if (startIndex === -1) break; - let sshKey = errorCopy.slice(startIndex + 1); - const stopIndex = sshKey.search(/'/); - sshKey = sshKey.slice(0, stopIndex); - sshKeys.push(sshKey); - errorCopy = errorCopy.slice(stopIndex + 1); - } - - if (sshKeys.length) { - Modal.error({ - width: 800, - title: 'Could not clone the repository', - className: 'cvat-create-task-clone-repository-fail', - content: ( - <> - - Please make sure it exists and you have access - - - Consider adding the following public ssh keys to git: - -