2021-07-06 09:20:59 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Button, ProgressBar } from 'react-bootstrap';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
import constants from 'utils/strings/constants';
|
|
|
|
import InProgressIcon from './icons/InProgressIcon';
|
|
|
|
import MessageDialog from './MessageDialog';
|
|
|
|
import { Label, Row, Value } from './Container';
|
2021-07-07 07:44:26 +00:00
|
|
|
import { ExportState, ExportStats } from './ExportModal';
|
2021-07-06 09:20:59 +00:00
|
|
|
|
2021-07-06 11:23:13 +00:00
|
|
|
export const ComfySpan = styled.span`
|
|
|
|
word-spacing:1rem;
|
2021-07-06 09:20:59 +00:00
|
|
|
color:#ddd;
|
|
|
|
`;
|
2021-07-07 07:44:26 +00:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
show: boolean
|
|
|
|
onHide: () => void
|
|
|
|
updateExportState: (newState: ExportState) => void;
|
|
|
|
exportFolder: string
|
|
|
|
exportSize: string
|
|
|
|
exportState: ExportState
|
|
|
|
exportStats: ExportStats
|
|
|
|
exportFiles: () => void;
|
|
|
|
cancelExport: () => void
|
|
|
|
}
|
|
|
|
export default function ExportInProgress(props: Props) {
|
|
|
|
const pauseExport = () => {
|
|
|
|
props.updateExportState(ExportState.PAUSED);
|
|
|
|
props.cancelExport();
|
|
|
|
};
|
|
|
|
const cancelExport = () => {
|
|
|
|
props.updateExportState(ExportState.FINISHED);
|
|
|
|
props.cancelExport();
|
|
|
|
};
|
2021-07-06 09:20:59 +00:00
|
|
|
return (
|
|
|
|
<MessageDialog
|
|
|
|
show={props.show}
|
|
|
|
onHide={props.onHide}
|
|
|
|
attributes={{
|
|
|
|
title: constants.EXPORT_DATA,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<div style={{ borderBottom: '1px solid #444', marginBottom: '20px', padding: '0 5%' }}>
|
2021-07-07 07:44:26 +00:00
|
|
|
<Row >
|
|
|
|
<Label width="40%">{constants.EXPORT_IN_PROGRESS}</Label> <Value width="60%"> <InProgressIcon /></Value>
|
2021-07-06 09:20:59 +00:00
|
|
|
</Row>
|
|
|
|
<Row>
|
2021-07-07 07:44:26 +00:00
|
|
|
<Label width="40%">{constants.DESTINATION}</Label>
|
|
|
|
<Value width="60%">
|
|
|
|
<span style={{ overflow: 'hidden', direction: 'rtl', height: '1.5rem', width: '90%', whiteSpace: 'nowrap' }}>
|
|
|
|
{props.exportFolder}
|
|
|
|
</span>
|
|
|
|
</Value>
|
2021-07-06 09:20:59 +00:00
|
|
|
</Row>
|
|
|
|
<Row>
|
2021-07-07 07:44:26 +00:00
|
|
|
<Label width="40%">{constants.TOTAL_EXPORT_SIZE} </Label><Value width="60%">24GB</Value>
|
2021-07-06 09:20:59 +00:00
|
|
|
</Row>
|
|
|
|
</div>
|
|
|
|
<div style={{ marginBottom: '30px', padding: '0 5%', display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
|
|
|
|
<div style={{ marginBottom: '10px' }}>
|
2021-07-07 07:44:26 +00:00
|
|
|
<ComfySpan> {props.exportStats.current} / {props.exportStats.total} </ComfySpan> <span style={{ marginLeft: '10px' }}> files exported</span>
|
2021-07-06 09:20:59 +00:00
|
|
|
</div>
|
|
|
|
<div style={{ width: '100%', marginBottom: '30px' }}>
|
|
|
|
<ProgressBar
|
2021-07-07 07:44:26 +00:00
|
|
|
now={Math.round(props.exportStats.current * 100 / props.exportStats.total)}
|
2021-07-06 09:20:59 +00:00
|
|
|
animated
|
|
|
|
variant="upload-progress-bar"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div style={{ width: '100%', display: 'flex', justifyContent: 'space-around' }}>
|
2021-07-07 07:44:26 +00:00
|
|
|
{props.exportState === ExportState.PAUSED ?
|
|
|
|
<Button block variant={'outline-secondary'} onClick={props.exportFiles}>{constants.RESUME}</Button> :
|
|
|
|
<Button block variant={'outline-secondary'} onClick={pauseExport}>{constants.PAUSE}</Button>
|
|
|
|
}
|
2021-07-06 09:20:59 +00:00
|
|
|
<div style={{ width: '30px' }} />
|
2021-07-07 07:44:26 +00:00
|
|
|
<Button block variant={'outline-danger'} onClick={cancelExport}>{constants.CANCEL}</Button>
|
2021-07-06 09:20:59 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</MessageDialog >
|
|
|
|
);
|
|
|
|
}
|