diff --git a/src/views/Operations/Firmware/Firmware.vue b/src/views/Operations/Firmware/Firmware.vue index 915ecc9894..a9fd18ea56 100644 --- a/src/views/Operations/Firmware/Firmware.vue +++ b/src/views/Operations/Firmware/Firmware.vue @@ -118,7 +118,13 @@ const isOperationInProgress = computed(() => { const isPageDisabled = computed(() => { if (isServerPowerOffRequired.value) { - return !isServerOff.value || loading.value || isOperationInProgress.value; + // Only disable if server is explicitly on (not off and not unreachable) + // If power status is unavailable (unreachable), allow operations + const shouldDisableForPower = + serverStatus.value !== 'unreachable' && !isServerOff.value; + return ( + shouldDisableForPower || loading.value || isOperationInProgress.value + ); } return isLoading.value || isOperationInProgress.value; }); diff --git a/src/views/Operations/Firmware/FirmwareCardsBmc.vue b/src/views/Operations/Firmware/FirmwareCardsBmc.vue index 30c26704e6..6eeaf43b0f 100644 --- a/src/views/Operations/Firmware/FirmwareCardsBmc.vue +++ b/src/views/Operations/Firmware/FirmwareCardsBmc.vue @@ -54,7 +54,11 @@ variant="link" size="sm" class="py-0 px-1 mt-2" - :disabled="isPageDisabled || !backup || !isServerOff" + :disabled=" + isPageDisabled || + !backup || + (serverStatus !== 'unreachable' && !isServerOff) + " @click="showConfirmationModal" > @@ -102,14 +106,14 @@ defineProps({ }, }); +const serverStatus = computed(() => { + return globalStore.serverStatusGetter; +}); + const switchToBackupImageDisabled = ref( import.meta.env.VITE_APP_SWITCH_TO_BACKUP_IMAGE_DISABLED === 'true', ); -const bootProgress = computed(() => { - return globalStore.bootProgressGetter; -}); - const isSingleFileUploadEnabled = computed(() => { return firmwareStore.isSingleFileUploadEnabled; }); @@ -164,7 +168,6 @@ function showConfirmationModal() { function switchToRunning() { startLoader(); emit('loadingStatus', loading.value); - console.log('confirm'); // Step 1 - Switch firmware const switchFirmware = () => { @@ -207,15 +210,20 @@ function switchToRunning() { i18n.global.t('pageFirmware.toast.errorSwitchImages'), ); } - globalStore.getBootProgress().then(() => { - if (bootProgress.value) { + + // Check if BMC is back online by verifying API response + globalStore + .getSystemInfo() + .then(() => { + // BMC is responding, go to step 3 step3(); - } else { + }) + .catch(() => { + // BMC not responding yet, retry in 1 minute setTimeout(() => { timer(checkCounter); - }, 60000); // 1 minute; - } - }); + }, 60000); + }); }; timer(); }; diff --git a/src/views/Operations/Firmware/FirmwareFormUpdate.vue b/src/views/Operations/Firmware/FirmwareFormUpdate.vue index 44cad277c1..0577e0d0a3 100644 --- a/src/views/Operations/Firmware/FirmwareFormUpdate.vue +++ b/src/views/Operations/Firmware/FirmwareFormUpdate.vue @@ -86,10 +86,6 @@ const bmcPowerState = computed(() => { return bmcStore.bmcGetter?.powerState; }); -const bootProgress = computed(() => { - return globalStore.bootProgressGetter; -}); - const rules = computed(() => ({ file: { required: required, @@ -200,20 +196,37 @@ function updateFirmware() { timestamp: true, }); - const rebootProgress = async () => { - setTimeout(async () => { + const rebootProgress = (checkCounter = 0) => { + checkCounter++; + + // This counter goes up by 1 every time this function runs + // If the function successfully goes to last toast, it won't run anymore + // if this function runs more than 36 times, it won't run anymore + if (checkCounter > 36) { + endLoader(); + return errorToast(i18n.global.t('pageFirmware.toast.errorActivation')); + } + + setTimeout(() => { bmcStore .getBmcInfo() .then(() => { - if (bmcPowerState.value === 'On') { - activationComplete(); + if (bmcPowerState.value) { + // Power state is available — original logic + if (bmcPowerState.value === 'On') { + activationComplete(); + } else { + rebootProgress(checkCounter); + } } else { - rebootProgress(); + // Power state unavailable (passive BMC) — + // getBmcInfo() responding is sufficient to confirm BMC is back + activationComplete(); } }) - .catch(({ message }) => { - endLoader(); - errorToast(message); + .catch(() => { + // BMC not responding yet, retry + rebootProgress(checkCounter); }); }, 180000); // 3 minutes };