|
|
@@ -19,11 +19,9 @@ const G2GDataTransfer = (): JSX.Element => {
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
const [collections, setCollections] = useState<any[]>([]);
|
|
|
- const [zipFileStats, setZipFileStats] = useState<any[]>([]);
|
|
|
- const [progressList, setProgressList] = useState<any[]>([]);
|
|
|
const [isExportModalOpen, setExportModalOpen] = useState(false);
|
|
|
const [isExporting, setExporting] = useState(false);
|
|
|
- const [isZipping, setZipping] = useState(false);
|
|
|
+ // TODO: データのエクスポートが完了したことが分かるようにする
|
|
|
const [isExported, setExported] = useState(false);
|
|
|
const [transferKey, setTransferKey] = useState('');
|
|
|
|
|
|
@@ -32,18 +30,14 @@ const G2GDataTransfer = (): JSX.Element => {
|
|
|
apiv3Get<{collections: any[]}>('/mongo/collections', {}),
|
|
|
apiv3Get<{status: { zipFileStats: any[], isExporting: boolean, progressList: any[] }}>('/export/status', {}),
|
|
|
]);
|
|
|
- // TODO: toastSuccess, toastError
|
|
|
|
|
|
// filter only not ignored collection names
|
|
|
const filteredCollections = collectionsData.collections.filter((collectionName) => {
|
|
|
return !IGNORED_COLLECTION_NAMES.includes(collectionName);
|
|
|
});
|
|
|
|
|
|
- const { zipFileStats, isExporting, progressList } = statusData.status;
|
|
|
setCollections(filteredCollections);
|
|
|
- setZipFileStats(zipFileStats);
|
|
|
- setExporting(isExporting);
|
|
|
- setProgressList(progressList);
|
|
|
+ setExporting(statusData.status.isExporting);
|
|
|
}, []);
|
|
|
|
|
|
const setupWebsocketEventHandler = useCallback(() => {
|
|
|
@@ -51,21 +45,13 @@ const G2GDataTransfer = (): JSX.Element => {
|
|
|
// websocket event
|
|
|
socket.on('admin:onProgressForExport', ({ currentCount, totalCount, progressList }) => {
|
|
|
setExporting(true);
|
|
|
- setProgressList(progressList);
|
|
|
- });
|
|
|
-
|
|
|
- // websocket event
|
|
|
- socket.on('admin:onStartZippingForExport', () => {
|
|
|
- setZipping(true);
|
|
|
});
|
|
|
|
|
|
// websocket event
|
|
|
socket.on('admin:onTerminateForExport', ({ addedZipFileStat }) => {
|
|
|
|
|
|
setExporting(false);
|
|
|
- setZipping(false);
|
|
|
setExported(true);
|
|
|
- setZipFileStats(prev => prev.concat([addedZipFileStat]));
|
|
|
|
|
|
// TODO: toastSuccess, toastError
|
|
|
toastr.success(undefined, `New Archive Data '${addedZipFileStat.fileName}' is added`, {
|