|
|
|
@ -6,11 +6,13 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
|
import { DeleteOutlined, PlusCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
|
|
import { DeleteOutlined, PlusCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
|
|
|
import Button from 'antd/lib/button';
|
|
|
|
import Button from 'antd/lib/button';
|
|
|
|
import Col from 'antd/lib/col';
|
|
|
|
import Col from 'antd/lib/col';
|
|
|
|
import Form from 'antd/lib/form';
|
|
|
|
import Form, { RuleObject } from 'antd/lib/form';
|
|
|
|
|
|
|
|
import { FormListFieldData, FormListOperation } from 'antd/lib/form/FormList';
|
|
|
|
import Input from 'antd/lib/input';
|
|
|
|
import Input from 'antd/lib/input';
|
|
|
|
import Row from 'antd/lib/row';
|
|
|
|
import Row from 'antd/lib/row';
|
|
|
|
import notification from 'antd/lib/notification';
|
|
|
|
import notification from 'antd/lib/notification';
|
|
|
|
import Tooltip from 'antd/lib/tooltip';
|
|
|
|
import Tooltip from 'antd/lib/tooltip';
|
|
|
|
|
|
|
|
import consts from 'consts';
|
|
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
interface Props {
|
|
|
|
form: any;
|
|
|
|
form: any;
|
|
|
|
@ -22,6 +24,7 @@ export default function ManifestsManager(props: Props): JSX.Element {
|
|
|
|
const { form, manifestNames, setManifestNames } = props;
|
|
|
|
const { form, manifestNames, setManifestNames } = props;
|
|
|
|
const maxManifestsCount = useRef(5);
|
|
|
|
const maxManifestsCount = useRef(5);
|
|
|
|
const [limitingAddingManifestNotification, setLimitingAddingManifestNotification] = useState(false);
|
|
|
|
const [limitingAddingManifestNotification, setLimitingAddingManifestNotification] = useState(false);
|
|
|
|
|
|
|
|
const { DATASET_MANIFEST_GUIDE_URL } = consts;
|
|
|
|
|
|
|
|
|
|
|
|
const updateManifestFields = (): void => {
|
|
|
|
const updateManifestFields = (): void => {
|
|
|
|
const newManifestFormItems = manifestNames.map((name, idx) => ({
|
|
|
|
const newManifestFormItems = manifestNames.map((name, idx) => ({
|
|
|
|
@ -70,7 +73,6 @@ export default function ManifestsManager(props: Props): JSX.Element {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
name='manifests'
|
|
|
|
|
|
|
|
className='cvat-manifests-manager-form-item'
|
|
|
|
className='cvat-manifests-manager-form-item'
|
|
|
|
label={(
|
|
|
|
label={(
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
@ -80,18 +82,29 @@ export default function ManifestsManager(props: Props): JSX.Element {
|
|
|
|
type='link'
|
|
|
|
type='link'
|
|
|
|
target='_blank'
|
|
|
|
target='_blank'
|
|
|
|
className='cvat-cloud-storage-help-button'
|
|
|
|
className='cvat-cloud-storage-help-button'
|
|
|
|
href='https://opencv.github.io/cvat/docs/manual/advanced/dataset_manifest/'
|
|
|
|
href={DATASET_MANIFEST_GUIDE_URL}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<QuestionCircleOutlined />
|
|
|
|
<QuestionCircleOutlined />
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
</Tooltip>
|
|
|
|
</Tooltip>
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
rules={[{ required: true, message: 'Please, specify at least one manifest file' }]}
|
|
|
|
required
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<Form.List name='manifests'>
|
|
|
|
<Form.List
|
|
|
|
|
|
|
|
name='manifests'
|
|
|
|
|
|
|
|
rules={[
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
validator: async (_: RuleObject, names: string[]): Promise<void> => {
|
|
|
|
|
|
|
|
if (!names || !names.length) {
|
|
|
|
|
|
|
|
throw new Error('Please, specify at least one manifest file');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
]}
|
|
|
|
|
|
|
|
>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(fields) => (
|
|
|
|
(fields: FormListFieldData[], _: FormListOperation, { errors }: { errors: React.ReactNode[] }) => (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
{fields.map((field, idx): JSX.Element => (
|
|
|
|
{fields.map((field, idx): JSX.Element => (
|
|
|
|
<Form.Item key={idx} shouldUpdate>
|
|
|
|
<Form.Item key={idx} shouldUpdate>
|
|
|
|
@ -123,6 +136,7 @@ export default function ManifestsManager(props: Props): JSX.Element {
|
|
|
|
</Row>
|
|
|
|
</Row>
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
))}
|
|
|
|
))}
|
|
|
|
|
|
|
|
<Form.ErrorList errors={errors} />
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|