diff --git a/src/components/Dashboard/Management/AppUpdates/AppUpdateProgress.jsx b/src/components/Dashboard/Management/AppUpdates/AppUpdateProgress.jsx index f875f576..e36637d5 100644 --- a/src/components/Dashboard/Management/AppUpdates/AppUpdateProgress.jsx +++ b/src/components/Dashboard/Management/AppUpdates/AppUpdateProgress.jsx @@ -5,8 +5,7 @@ import { Button, Flex, Modal, Typography, theme, Divider } from 'antd' import CloudIcon from '../../../Icons/CloudIcon' import HostIcon from '../../../Icons/HostIcon' import ReloadIcon from '../../../Icons/ReloadIcon' -import HProgress from '../../common/HProgress' -import ElipsisText from '../../common/ElipsisText' +import ProgressDisplay from '../../common/ProgressDisplay' import CheckCircleIcon from '../../../Icons/CheckCircleIcon' import XMarkCircleIcon from '../../../Icons/XMarkCircleIcon' @@ -136,19 +135,16 @@ const UpdateStage = ({ stage, status, percent, detail }) => { {config.labels[status]} {showProgress && ( - - - {detail && ( - - {detail} - - )} - + + {detail} + )} diff --git a/src/components/Dashboard/common/ProgressDisplay.jsx b/src/components/Dashboard/common/ProgressDisplay.jsx new file mode 100644 index 00000000..f1832303 --- /dev/null +++ b/src/components/Dashboard/common/ProgressDisplay.jsx @@ -0,0 +1,61 @@ +import PropTypes from 'prop-types' +import { Flex } from 'antd' +import HProgress from './HProgress' +import ElipsisText from './ElipsisText' + +const ProgressDisplay = ({ + children, + labelPosition = 'top', + labelType, + percent, + status, + showInfo, + style +}) => { + const label = children ? ( + + {children} + + ) : null + + const progress = ( + + ) + + return ( + + {labelPosition === 'bottom' ? ( + <> + {progress} + {label} + + ) : ( + <> + {label} + {progress} + + )} + + ) +} + +ProgressDisplay.propTypes = { + children: PropTypes.node, + labelPosition: PropTypes.oneOf(['top', 'bottom']), + labelType: PropTypes.oneOf(['secondary']), + percent: PropTypes.number, + status: PropTypes.oneOf(['normal', 'exception', 'active', 'success']), + showInfo: PropTypes.bool, + style: PropTypes.object +} + +export default ProgressDisplay diff --git a/src/components/Dashboard/common/TemplatePreview.jsx b/src/components/Dashboard/common/TemplatePreview.jsx index e587c845..6f0aff15 100644 --- a/src/components/Dashboard/common/TemplatePreview.jsx +++ b/src/components/Dashboard/common/TemplatePreview.jsx @@ -7,7 +7,7 @@ import { useCallback } from 'react' import PropTypes from 'prop-types' -import { Flex, Button, Input, Select, Typography, Card } from 'antd' +import { Flex, Button, Input, Select, Card } from 'antd' import PlusIcon from '../../Icons/PlusIcon.jsx' import MinusIcon from '../../Icons/MinusIcon.jsx' import InfoCircleIcon from '../../Icons/InfoCircleIcon.jsx' @@ -17,9 +17,7 @@ import ObjectProperty from '../common/ObjectProperty.jsx' import PDFViewer from './PDFViewer.jsx' import ScrollBox from './ScrollBox.jsx' import { ApiServerContext } from '../context/ApiServerContext.jsx' -import HProgress from './HProgress.jsx' - -const { Text } = Typography +import ProgressDisplay from './ProgressDisplay.jsx' const noop = () => {} @@ -224,7 +222,7 @@ const TemplatePreview = ({ stopRenderProgressListener() setPDFBlob(null) setReloadLoading(true) - setDownloadProgress({ progress: 0, message: 'Starting render' }) + setDownloadProgress({ progress: 0, message: 'Starting render...' }) const startDownload = async () => { try { @@ -590,17 +588,14 @@ const TemplatePreview = ({ }} styles={{ body: { padding: 18 } }} > - - - {downloadProgress.message || 'Rendering...'} - - - + + {downloadProgress.message || 'Rendering...'} + ) : null}