Skip to content

Commit

Permalink
Remove limit on maximum number of manifest files that can be added fo…
Browse files Browse the repository at this point in the history
…r cloud storage (#5660)
  • Loading branch information
Marishka17 committed Feb 2, 2023
1 parent 4df7c4c commit ba49fc4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- TDB

### Removed
- TDB
- Limit on the maximum number of manifest files that can be added for cloud storage (<https://github.com/opencv/cvat/pull/5660>)

### Fixed
- Helm: Empty password for Redis (<https://github.com/opencv/cvat/pull/5520>)
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.48.0",
"version": "1.48.1",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2023 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

import React, { useEffect, useRef, useState } from 'react';
import React, { useEffect } from 'react';
import { DeleteOutlined, PlusCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import Button from 'antd/lib/button';
import Col from 'antd/lib/col';
import Form, { RuleObject } from 'antd/lib/form';
import { FormListFieldData, FormListOperation } from 'antd/lib/form/FormList';
import Input from 'antd/lib/input';
import Row from 'antd/lib/row';
import notification from 'antd/lib/notification';
import Tooltip from 'antd/lib/tooltip';
import config from 'config';

Expand All @@ -22,8 +22,6 @@ interface Props {

export default function ManifestsManager(props: Props): JSX.Element {
const { form, manifestNames, setManifestNames } = props;
const maxManifestsCount = useRef(5);
const [limitingAddingManifestNotification, setLimitingAddingManifestNotification] = useState(false);
const { DATASET_MANIFEST_GUIDE_URL } = config;

const updateManifestFields = (): void => {
Expand All @@ -40,34 +38,18 @@ export default function ManifestsManager(props: Props): JSX.Element {
updateManifestFields();
}, [manifestNames]);

useEffect(() => {
if (limitingAddingManifestNotification) {
notification.warning({
message: `Unable to add manifest. The maximum number of files is ${maxManifestsCount.current}`,
className: 'cvat-notification-limiting-adding-manifest',
});
}
}, [limitingAddingManifestNotification]);

const onChangeManifestPath = (manifestName: string | undefined, manifestId: number): void => {
if (manifestName !== undefined) {
setManifestNames(manifestNames.map((name, idx) => (idx !== manifestId ? name : manifestName)));
}
};

const onDeleteManifestItem = (key: number): void => {
if (maxManifestsCount.current === manifestNames.length && limitingAddingManifestNotification) {
setLimitingAddingManifestNotification(false);
}
setManifestNames(manifestNames.filter((name, idx) => idx !== key));
};

const onAddManifestItem = (): void => {
if (maxManifestsCount.current <= manifestNames.length) {
setLimitingAddingManifestNotification(true);
} else {
setManifestNames(manifestNames.concat(['']));
}
setManifestNames(manifestNames.concat(['']));
};

return (
Expand Down

0 comments on commit ba49fc4

Please sign in to comment.