From 6f71284973ee2f0b35fb22fa36a1afa883a0cc7a Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Thu, 4 Feb 2021 11:23:03 -0800 Subject: Update single file firmware upload page These updates are visible with IBM dotenv variables. Updates include changes to layout and verbiage. - Added a global application refresh listener, so app refresh can be called from components outside of the application header Signed-off-by: Yoshie Muranaka Change-Id: I5ebe6452a0360b6cced5597b648cde33e97c5a1f --- .../FirmwareSingleImage/FirmwareSingleImage.vue | 514 +++++++++++---------- .../FirmwareSingleImageModalRebootBackup.vue | 34 -- .../FirmwareSingleImageModalSwitchToRunning.vue | 31 ++ .../FirmwareSingleImageModalUpdateFirmware.vue | 44 ++ .../FirmwareSingleImageModalUpload.vue | 21 - .../FirmwareSingleImageStore.js | 17 +- src/layouts/AppLayout.vue | 3 + src/locales/en-US.json | 62 ++- 8 files changed, 392 insertions(+), 334 deletions(-) delete mode 100644 src/env/components/FirmwareSingleImage/FirmwareSingleImageModalRebootBackup.vue create mode 100644 src/env/components/FirmwareSingleImage/FirmwareSingleImageModalSwitchToRunning.vue create mode 100644 src/env/components/FirmwareSingleImage/FirmwareSingleImageModalUpdateFirmware.vue delete mode 100644 src/env/components/FirmwareSingleImage/FirmwareSingleImageModalUpload.vue diff --git a/src/env/components/FirmwareSingleImage/FirmwareSingleImage.vue b/src/env/components/FirmwareSingleImage/FirmwareSingleImage.vue index fe87e083..517e5fa1 100644 --- a/src/env/components/FirmwareSingleImage/FirmwareSingleImage.vue +++ b/src/env/components/FirmwareSingleImage/FirmwareSingleImage.vue @@ -1,219 +1,270 @@ - - diff --git a/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalRebootBackup.vue b/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalRebootBackup.vue deleted file mode 100644 index f64065a8..00000000 --- a/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalRebootBackup.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalSwitchToRunning.vue b/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalSwitchToRunning.vue new file mode 100644 index 00000000..56f505d0 --- /dev/null +++ b/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalSwitchToRunning.vue @@ -0,0 +1,31 @@ + + + diff --git a/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalUpdateFirmware.vue b/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalUpdateFirmware.vue new file mode 100644 index 00000000..51575253 --- /dev/null +++ b/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalUpdateFirmware.vue @@ -0,0 +1,44 @@ + + + diff --git a/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalUpload.vue b/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalUpload.vue deleted file mode 100644 index e544b9fd..00000000 --- a/src/env/components/FirmwareSingleImage/FirmwareSingleImageModalUpload.vue +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/src/env/store/FirmwareSingleImage/FirmwareSingleImageStore.js b/src/env/store/FirmwareSingleImage/FirmwareSingleImageStore.js index ffc4bc4b..91bcb9fe 100644 --- a/src/env/store/FirmwareSingleImage/FirmwareSingleImageStore.js +++ b/src/env/store/FirmwareSingleImage/FirmwareSingleImageStore.js @@ -13,7 +13,7 @@ const FirmwareSingleImageStore = { version: '--', id: null, location: null, - status: '--', + status: null, }, applyTime: null, }, @@ -72,7 +72,7 @@ const FirmwareSingleImageStore = { version: backupData.data?.Version, id: backupData.data?.Id, location: backupData.data?.['@odata.id'], - status: backupData.data?.Status?.State, + status: backupData.data?.Status?.Health, }); }) .catch((error) => console.log(error)); @@ -110,17 +110,15 @@ const FirmwareSingleImageStore = { .post('/redfish/v1/UpdateService', image, { headers: { 'Content-Type': 'application/octet-stream' }, }) - .then(() => dispatch('getSystemFirwareVersion')) - .then(() => i18n.t('pageFirmware.toast.successUploadMessage')) .catch((error) => { console.log(error); throw new Error(i18n.t('pageFirmware.toast.errorUploadAndReboot')); }); }, - async uploadFirmwareTFTP({ state, dispatch }, { address, filename }) { + async uploadFirmwareTFTP({ state, dispatch }, fileAddress) { const data = { TransferProtocol: 'TFTP', - ImageURI: `${address}/${filename}`, + ImageURI: fileAddress, }; if (state.applyTime !== 'Immediate') { // ApplyTime must be set to Immediate before making @@ -132,8 +130,6 @@ const FirmwareSingleImageStore = { '/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate', data ) - .then(() => dispatch('getSystemFirwareVersion')) - .then(() => i18n.t('pageFirmware.toast.successUploadMessage')) .catch((error) => { console.log(error); throw new Error(i18n.t('pageFirmware.toast.errorUploadAndReboot')); @@ -150,10 +146,11 @@ const FirmwareSingleImageStore = { }; return await api .patch('/redfish/v1/Managers/bmc', data) - .then(() => i18n.t('pageFirmware.toast.successRebootFromBackup')) .catch((error) => { console.log(error); - throw new Error(i18n.t('pageFirmware.toast.errorRebootFromBackup')); + throw new Error( + i18n.t('pageFirmware.singleFileUpload.toast.errorSwitchImages') + ); }); }, }, diff --git a/src/layouts/AppLayout.vue b/src/layouts/AppLayout.vue index 228b25cd..c2023dfb 100644 --- a/src/layouts/AppLayout.vue +++ b/src/layouts/AppLayout.vue @@ -48,6 +48,9 @@ export default { }); }, }, + mounted() { + this.$root.$on('refresh-application', () => this.refresh()); + }, methods: { refresh() { // Changing the component :key value will trigger diff --git a/src/locales/en-US.json b/src/locales/en-US.json index a4af7091..d3b6d754 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -13,6 +13,7 @@ "enable": "Enable", "export": "Export", "filter": "Filter", + "refresh": "Refresh", "replace": "Replace", "save": "Save", "saveSettings": "Save settings", @@ -261,29 +262,19 @@ }, "pageFirmware": { "backup": "Backup:", - "backupImage": "Backup image", "bmcStatus": "BMC status", - "changeAndRebootBmc": "Change image and reboot BMC", - "changeToBackupImage": "Change to backup image", "current": "Current:", "firmwareOnBmc": "Firmware on BMC", "firmwareOnHost": "Firmware on host", - "firmwareOnSystem": "Firmware on system", "hostStatus": "Host status", "makeCurrentVersion": "Make current version", "pageDescription": "Update firmware by uploading a BMC or Host image file from your workstation or TFTP server", - "pageDescriptionSingleImage": "Update firmware by uploading a system image file from your workstation or TFTP server", "running": "Running", "state": "State", "updateCode": "Update code", "alert": { - "operationInProgress": "Server power operation in progress.", - "serverShutdownRequiredBeforeUpdate": "Server shutdown required before update", - "serverShutdownRequiredInfo": "Shutdown will be orderly - OS will shutdown before the server shuts down.", - "shutDownServer": "Shut down server", "updateProcess": "Update process", - "updateProcessInfo": "The new image will be uploaded and activated. After that, the BMC or host will reboot automatically to run from the new image.", - "updateProcessInfoSingleImage": "The new image will be uploaded and activated. After that, the BMC will reboot automatically to run from the new image." + "updateProcessInfo": "The new image will be uploaded and activated. After that, the BMC or host will reboot automatically to run from the new image." }, "form": { "imageFile": "Image file", @@ -299,9 +290,6 @@ }, "modal": { "connectionToBmcWillBeLost": "Connection to BMC will be lost", - "serverShutdownMessage": "There will be a server outage until the server is powered back on. Are you sure you want to shut down?", - "serverShutdownWillCauseOutage": "Server shutdown will cause outage", - "shutDownServer": "Shut down server", "rebootFromBackup": { "message1": "A BMC reboot is required before the system can run the backup image %{backup}. The reboot will cause a disconnection, and may require logging in again.", "message2": "The current firmware image %{current} will be moved to backup. During the reboot, server cannot be powered back on.", @@ -309,13 +297,6 @@ "primaryAction": "Reboot BMC from backup image", "title": "@:pageFirmware.modal.connectionToBmcWillBeLost" }, - "uploadAndRebootSingleImage": { - "message1": "A BMC reboot is required before the system can run the new firmware image. The reboot will cause a disconnection, and may require logging in again.", - "message2": "During the reboot, the server cannot be powered back on. The backup image will be permanently deleted.", - "message3": "Are you sure you want to upload the new firmware image and reboot the BMC?", - "primaryAction": "Upload and reboot BMC", - "title": "@:pageFirmware.modal.connectionToBmcWillBeLost" - }, "uploadAndRebootBmcOrHost": { "message1": "A BMC or host reboot is required before the system can run the new firmware image. The reboot will cause a disconnection, and may require logging in again.", "message2": "The backup image will be permanently deleted.", @@ -334,6 +315,45 @@ "successRebootFromBackup": "Successfully started reboot from backup image.", "successUploadMessage": "The upload was successful. During code update, the BMC will be not be responsive. Wait for the code update notification before making any changes.", "successUploadTitle": "Code update started" + }, + "singleFileUpload": { + "backupImage": "Backup image", + "bmcAndServer": "BMC and server:", + "fileAddress": "File address", + "fileSource": "File source", + "runningImage": "Running image", + "startUpdate": "Start update", + "switchToRunning": "Switch to running", + "updateFirmware": "Update firmware", + "alert": { + "operationInProgress": "Server power operation in progress.", + "serverMustBePoweredOffTo": "Server must be powered off to:", + "serverMustBePoweredOffToUpdateFirmware": "Server must be powered off to update firmware", + "switchRunningAndBackupImages": "Switch running and backup images", + "updateFirmware": "Update firmware", + "viewServerPowerOperations": "View server power operations" + }, + "modal": { + "switchImages": "Switch images", + "switchRunningImage": "Switch running image", + "switchRunningImageInfo": "A BMC reboot is required to run the backup image. The application might be unresponsive during this time.", + "switchRunningImageInfo2": "Are you sure you want to switch to the backup image (%{backup})?", + "updateFirmwareInfo": "The BMC will reboot during the update process. The server cannot be powered on until the update is finished.", + "updateFirmwareInfo2": "The running image (%{running}) will be copied to backup and the backup image (%{backup}) will be permanently deleted.", + "updateFirmwareInfo3": "Are you sure you want to proceed with the update?" + }, + "toast": { + "errorSwitchImages": "Error switching running and backup images.", + "rebootStarted": "Reboot started", + "rebootStartedMessage": "Successfully started reboot from backup image.", + "startTime": "Start time:", + "updateStarted": "Update started", + "updateStartedMessage": "Wait for the firmware update notification before making any changes.", + "verifySwitch": "Verify switch", + "verifySwitchMessage": "Refresh the application to verify the running and backup images switched.", + "verifyUpdate": "Verify update", + "verifyUpdateMessage": "Refresh the application to verify firmware updated successfully" + } } }, "pageHardwareStatus": { -- cgit v1.2.3