diff --git a/cvat-ui/src/actions/cloud-storage-actions.ts b/cvat-ui/src/actions/cloud-storage-actions.ts index 8562b19baa9a..a95b6ad8f727 100644 --- a/cvat-ui/src/actions/cloud-storage-actions.ts +++ b/cvat-ui/src/actions/cloud-storage-actions.ts @@ -107,15 +107,9 @@ export function getCloudStoragesAsync(query: Partial): Thunk } const array = Array.from(result); - // const promises = array.map((cloudStorage: CloudStorage): string => - // (cloudStorage as any).getPreview().catch((error: any) => { - // dispatch(cloudStoragesActions.getCloudStoragePreiewFailed(cloudStorage.id, error)); - // return ''; - // })); dispatch(cloudStoragesActions.getCloudStoragesSuccess( array, - // await Promise.all(promises), result.count, query, )); diff --git a/cvat-ui/src/components/cloud-storages-page/cloud-storage-item.tsx b/cvat-ui/src/components/cloud-storages-page/cloud-storage-item.tsx index f94988a3fed7..ee415b3e40b5 100644 --- a/cvat-ui/src/components/cloud-storages-page/cloud-storage-item.tsx +++ b/cvat-ui/src/components/cloud-storages-page/cloud-storage-item.tsx @@ -23,15 +23,14 @@ import Status from './cloud-storage-status'; import Preview from './cloud-storage-preview'; interface Props { - cloudStorageInstance: CloudStorage; + cloudStorage: CloudStorage; } export default function CloudStorageItemComponent(props: Props): JSX.Element { const history = useHistory(); const dispatch = useDispatch(); - // cloudStorageInstance: {storage, preview} - const { cloudStorageInstance } = props; + const { cloudStorage } = props; const { id, displayName, @@ -40,10 +39,9 @@ export default function CloudStorageItemComponent(props: Props): JSX.Element { createdDate, updatedDate, description, - } = cloudStorageInstance.storage; - // const { preview } = cloudStorageInstance; + } = cloudStorage; const deletes = useSelector((state: CombinedState) => state.cloudStorages.activities.deletes); - const deleted = cloudStorageInstance.storage.id in deletes ? deletes[cloudStorageInstance.storage.id] : false; + const deleted = cloudStorage.id in deletes ? deletes[cloudStorage.id] : false; const style: React.CSSProperties = {}; @@ -62,7 +60,7 @@ export default function CloudStorageItemComponent(props: Props): JSX.Element { content: `You are going to remove the cloudstorage "${displayName}". Continue?`, className: 'cvat-delete-cloud-storage-modal', onOk: () => { - dispatch(deleteCloudStorageAsync(cloudStorageInstance.storage)); + dispatch(deleteCloudStorageAsync(cloudStorage)); }, okButtonProps: { type: 'primary', @@ -70,13 +68,13 @@ export default function CloudStorageItemComponent(props: Props): JSX.Element { }, okText: 'Delete', }); - }, [cloudStorageInstance.storage.id]); + }, [cloudStorage.id]); return ( - + {description ? ( @@ -111,7 +109,7 @@ export default function CloudStorageItemComponent(props: Props): JSX.Element { Last updated {moment(updatedDate).fromNow()} - + diff --git a/cvat-ui/src/components/cloud-storages-page/cloud-storage-preview.tsx b/cvat-ui/src/components/cloud-storages-page/cloud-storage-preview.tsx index c897108221ed..6c5806b7d021 100644 --- a/cvat-ui/src/components/cloud-storages-page/cloud-storage-preview.tsx +++ b/cvat-ui/src/components/cloud-storages-page/cloud-storage-preview.tsx @@ -44,13 +44,11 @@ export default function Preview(props: Props): JSX.Element { } return ( - <> - Preview image - + Preview image ); } diff --git a/cvat-ui/src/components/cloud-storages-page/cloud-storage-status.tsx b/cvat-ui/src/components/cloud-storages-page/cloud-storage-status.tsx index 849b48e4b6e7..b12b87588048 100644 --- a/cvat-ui/src/components/cloud-storages-page/cloud-storage-status.tsx +++ b/cvat-ui/src/components/cloud-storages-page/cloud-storage-status.tsx @@ -27,28 +27,19 @@ export default function Status(props: Props): JSX.Element { } }, [status]); + let message: JSX.Element; if (!status || (status && status.fetching)) { - return ( - - Status: - Loading ... - - ); - } - - if (status.initialized && status.error) { - return ( - - Status: - Error - - ); + message = Loading ...; + } else if (status.initialized && status.error) { + message = Error; + } else { + message = {status.status}; } return ( Status: - {status.status} + {message} ); } diff --git a/cvat-ui/src/components/cloud-storages-page/cloud-storages-list.tsx b/cvat-ui/src/components/cloud-storages-page/cloud-storages-list.tsx index eec476975fb6..85917431a0b9 100644 --- a/cvat-ui/src/components/cloud-storages-page/cloud-storages-list.tsx +++ b/cvat-ui/src/components/cloud-storages-page/cloud-storages-list.tsx @@ -11,7 +11,6 @@ import CloudStorageItemComponent from './cloud-storage-item'; interface Props { storages: CloudStorage[]; - // previews: string[]; totalCount: number; page: number; onChangePage(page: number): void; @@ -25,17 +24,10 @@ export default function StoragesList(props: Props): JSX.Element { const groupedStorages = storages.reduce( (acc: CloudStorage[][], storage: CloudStorage, index: number): CloudStorage[][] => { if (index && index % 4) { - acc[acc.length - 1].push({ - storage, - // preview: previews[index], - }); + acc[acc.length - 1].push(storage); } else { - acc.push([{ - storage, - // preview: previews[index], - }]); + acc.push([storage]); } - return acc; }, [], @@ -47,10 +39,10 @@ export default function StoragesList(props: Props): JSX.Element { {groupedStorages.map( (instances: CloudStorage[]): JSX.Element => ( - + {instances.map((instance: CloudStorage) => ( - - + + ))} diff --git a/cvat-ui/src/components/cloud-storages-page/cloud-storages-page.tsx b/cvat-ui/src/components/cloud-storages-page/cloud-storages-page.tsx index a5124a43ab7d..bd2517e14bb4 100644 --- a/cvat-ui/src/components/cloud-storages-page/cloud-storages-page.tsx +++ b/cvat-ui/src/components/cloud-storages-page/cloud-storages-page.tsx @@ -22,9 +22,6 @@ export default function StoragesPageComponent(): JSX.Element { const totalCount = useSelector((state: CombinedState) => state.cloudStorages.count); const isFetching = useSelector((state: CombinedState) => state.cloudStorages.fetching); const current = useSelector((state: CombinedState) => state.cloudStorages.current); - // .map((cloudStrage: CloudStorage) => cloudStrage.instance); - // const previews = useSelector((state: CombinedState) => state.cloudStorages.current) - // .map((cloudStrage: CloudStorage) => cloudStrage.preview as string); const query = useSelector((state: CombinedState) => state.cloudStorages.gettingQuery); const onSearch = useCallback( (_query: CloudStoragesQuery) => { @@ -96,7 +93,6 @@ export default function StoragesPageComponent(): JSX.Element { totalCount={totalCount} page={query.page} storages={current} - // previews={previews} onChangePage={onChangePage} /> ) : ( diff --git a/cvat-ui/src/reducers/cloud-storages-reducer.ts b/cvat-ui/src/reducers/cloud-storages-reducer.ts index 81d4e95be9dd..2153525171b6 100644 --- a/cvat-ui/src/reducers/cloud-storages-reducer.ts +++ b/cvat-ui/src/reducers/cloud-storages-reducer.ts @@ -74,12 +74,6 @@ export default ( case CloudStorageActionTypes.GET_CLOUD_STORAGE_SUCCESS: { const { count, query, array } = action.payload; - // const combined = action.payload.array.map( - // (cloudStorage: any, index: number): CloudStorage => ({ - // instance: cloudStorage, - // preview: action.payload.previews[index], - // }), - // ); return { ...state, initialized: true, @@ -309,13 +303,6 @@ export default ( fetching: false, }; } - // TODO - // } else { - // statuses.push({ - // id: cloudStorageID, - // status, - // }); - // } return { ...state, ...statuses, @@ -371,13 +358,6 @@ export default ( fetching: false, }; } - // TODO - // } else { - // statuses.push({ - // id: cloudStorageID, - // status, - // }); - // } return { ...state, ...previews,