diff --git a/src/components/Dashboard/Management/AppUpdates/AppUpdateProgress.jsx b/src/components/Dashboard/Management/AppUpdates/AppUpdateProgress.jsx index 6f4e62f..482c3f8 100644 --- a/src/components/Dashboard/Management/AppUpdates/AppUpdateProgress.jsx +++ b/src/components/Dashboard/Management/AppUpdates/AppUpdateProgress.jsx @@ -4,6 +4,7 @@ import { Button, Flex, Modal, Progress, Typography, theme, Divider } from 'antd' import CloudIcon from '../../../Icons/CloudIcon' import HostIcon from '../../../Icons/HostIcon' +import ReloadIcon from '../../../Icons/ReloadIcon' import CheckCircleIcon from '../../../Icons/CheckCircleIcon' import XMarkCircleIcon from '../../../Icons/XMarkCircleIcon' @@ -45,6 +46,15 @@ const STAGE_CONFIG = { complete: 'Installed', error: 'Install failed' } + }, + restart: { + icon: ReloadIcon, + labels: { + pending: 'Restart', + active: 'Restarting...', + complete: 'Restarted', + error: 'Restart failed' + } } } @@ -69,7 +79,8 @@ const isInstallComplete = (phase, message) => { return ( normalized.includes('complete') || - normalized.includes('successful') + normalized.includes('successful') || + normalized.includes('restarting') ) } @@ -80,6 +91,12 @@ const getInstallStageStatus = (phase, isError, message) => { return 'pending' } +const getRestartStageStatus = (phase, isError, message) => { + if (isError && isInstallComplete(phase, message)) return 'error' + if (isInstallComplete(phase, message)) return 'active' + return 'pending' +} + const getProgressStatus = (stageStatus) => { if (stageStatus === 'error') return 'exception' if (stageStatus === 'complete') return 'success' @@ -95,7 +112,7 @@ const UpdateStage = ({ stage, status, percent, detail }) => { const resolvedStatus = status !== 'error' && resolvedPercent === 100 ? 'complete' : status const color = getStageColor(resolvedStatus, token) - const showProgress = resolvedStatus === 'active' + const showProgress = resolvedStatus === 'active' && stage !== 'restart' const StatusIcon = resolvedStatus === 'complete' @@ -126,7 +143,7 @@ const UpdateStage = ({ stage, status, percent, detail }) => { } UpdateStage.propTypes = { - stage: PropTypes.oneOf(['download', 'install']).isRequired, + stage: PropTypes.oneOf(['download', 'install', 'restart']).isRequired, status: PropTypes.oneOf(['pending', 'active', 'complete', 'error']) .isRequired, percent: PropTypes.number, @@ -148,6 +165,7 @@ const AppUpdateProgress = ({ progress, update, onClose }) => { const downloadStatus = getDownloadStageStatus(phase, isError) const installStatus = getInstallStageStatus(phase, isError, message) + const restartStatus = getRestartStageStatus(phase, isError, message) const downloadPercent = downloadStatus === 'active' ? (phase === 'preparing' ? 0 : percent) : null @@ -184,6 +202,7 @@ const AppUpdateProgress = ({ progress, update, onClose }) => { percent={installPercent} detail={installDetail} /> + { if (/Installation success or error status:\s*0\b/.test(line)) { percent = 100 - message = 'Installation complete.' + message = 'Installation complete. Restarting Farm Control...' matchedLines.push('install-success') } } @@ -427,7 +427,7 @@ export const launchWindowsInstaller = async ( sendProgress( { phase: 'installing', percent: percent ?? 100, - message: message || 'Installation complete.' + message: message || 'Installation complete. Restarting Farm Control...' }) debugLog('installer completed successfully')