Skip to content

Commit

Permalink
Removed TFTP code update option
Browse files Browse the repository at this point in the history
- Removed TFTP server firmware update ability in the UI.

Signed-off-by: Nikhil Ashoka <[email protected]>
Change-Id: Icbeddc7a3faa262f12e85268206ae70850f37905
  • Loading branch information
Nikhil-Ashoka committed Jul 16, 2024
1 parent 210b127 commit bc49e09
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 98 deletions.
1 change: 0 additions & 1 deletion src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@
"fileSource": "File source",
"imageFile": "Image file",
"startUpdate": "Start update",
"tftpServer": "TFTP server",
"workstation": "Workstation"
}
},
Expand Down
1 change: 0 additions & 1 deletion src/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@
"fileSource": "Источник файла",
"imageFile": "Файл образа",
"startUpdate": "Начать обновление",
"tftpServer": "TFTP сервер",
"workstation": "Рабочая станция"
}
},
Expand Down
26 changes: 0 additions & 26 deletions src/store/modules/Operations/FirmwareStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ const FirmwareStore = {
hostActiveFirmwareId: null,
applyTime: null,
httpPushUri: null,
tftpAvailable: false,
},
getters: {
isTftpUploadAvailable: (state) => state.tftpAvailable,
isSingleFileUploadEnabled: (state) => state.hostFirmware.length === 0,
activeBmcFirmware: (state) => {
return state.bmcFirmware.find(
Expand Down Expand Up @@ -43,8 +41,6 @@ const FirmwareStore = {
setHostFirmware: (state, firmware) => (state.hostFirmware = firmware),
setApplyTime: (state, applyTime) => (state.applyTime = applyTime),
setHttpPushUri: (state, httpPushUri) => (state.httpPushUri = httpPushUri),
setTftpUploadAvailable: (state, tftpAvailable) =>
(state.tftpAvailable = tftpAvailable),
},
actions: {
async getFirmwareInformation({ dispatch }) {
Expand Down Expand Up @@ -111,16 +107,9 @@ const FirmwareStore = {
.then(({ data }) => {
const applyTime =
data.HttpPushUriOptions.HttpPushUriApplyTime.ApplyTime;
const allowableActions =
data?.Actions?.['#UpdateService.SimpleUpdate']?.[
'[email protected]'
];
commit('setApplyTime', applyTime);
const httpPushUri = data.HttpPushUri;
commit('setHttpPushUri', httpPushUri);
if (allowableActions?.includes('TFTP')) {
commit('setTftpUploadAvailable', true);
}
})
.catch((error) => console.log(error));
},
Expand All @@ -134,21 +123,6 @@ const FirmwareStore = {
throw new Error(i18n.t('pageFirmware.toast.errorUpdateFirmware'));
});
},
async uploadFirmwareTFTP(fileAddress) {
const data = {
TransferProtocol: 'TFTP',
ImageURI: fileAddress,
};
return await api
.post(
'/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate',
data,
)
.catch((error) => {
console.log(error);
throw new Error(i18n.t('pageFirmware.toast.errorUpdateFirmware'));
});
},
async switchBmcFirmwareAndReboot({ getters }) {
const backupLocation = getters.backupBmcFirmware.location;
const data = {
Expand Down
74 changes: 4 additions & 70 deletions src/views/Operations/Firmware/FirmwareFormUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,8 @@
<div>
<div class="form-background p-3">
<b-form @submit.prevent="onSubmitUpload">
<b-form-group
v-if="isTftpUploadAvailable"
:label="$t('pageFirmware.form.updateFirmware.fileSource')"
:disabled="isPageDisabled"
>
<b-form-radio v-model="isWorkstationSelected" :value="true">
{{ $t('pageFirmware.form.updateFirmware.workstation') }}
</b-form-radio>
<b-form-radio v-model="isWorkstationSelected" :value="false">
{{ $t('pageFirmware.form.updateFirmware.tftpServer') }}
</b-form-radio>
</b-form-group>

<!-- Workstation Upload -->
<template v-if="isWorkstationSelected">
<template>
<b-form-group
:label="$t('pageFirmware.form.updateFirmware.imageFile')"
label-for="image-file"
Expand All @@ -37,25 +24,6 @@
</b-form-group>
</template>

<!-- TFTP Server Upload -->
<template v-else>
<b-form-group
:label="$t('pageFirmware.form.updateFirmware.fileAddress')"
label-for="tftp-address"
>
<b-form-input
id="tftp-address"
v-model="tftpFileAddress"
type="text"
:state="getValidationState($v.tftpFileAddress)"
:disabled="isPageDisabled"
@input="$v.tftpFileAddress.$touch()"
/>
<b-form-invalid-feedback role="alert">
{{ $t('global.form.fieldRequired') }}
</b-form-invalid-feedback>
</b-form-group>
</template>
<b-btn
data-test-id="firmware-button-startUpdate"
type="submit"
Expand All @@ -73,7 +41,7 @@
</template>

<script>
import { requiredIf } from 'vuelidate/lib/validators';
import { required } from 'vuelidate/lib/validators';
import BVToastMixin from '@/components/Mixins/BVToastMixin';
import LoadingBarMixin, { loading } from '@/components/Mixins/LoadingBarMixin';
Expand All @@ -99,36 +67,15 @@ export default {
data() {
return {
loading,
isWorkstationSelected: true,
file: null,
tftpFileAddress: null,
isServerPowerOffRequired:
process.env.VUE_APP_SERVER_OFF_REQUIRED === 'true',
};
},
computed: {
isTftpUploadAvailable() {
return this.$store.getters['firmware/isTftpUploadAvailable'];
},
},
watch: {
isWorkstationSelected: function () {
this.$v.$reset();
this.file = null;
this.tftpFileAddress = null;
},
},
validations() {
return {
file: {
required: requiredIf(function () {
return this.isWorkstationSelected;
}),
},
tftpFileAddress: {
required: requiredIf(function () {
return !this.isWorkstationSelected;
}),
required,
},
};
},
Expand All @@ -149,11 +96,7 @@ export default {
title: this.$t('pageFirmware.toast.updateStarted'),
timestamp: true,
});
if (this.isWorkstationSelected) {
this.dispatchWorkstationUpload(timerId);
} else {
this.dispatchTftpUpload(timerId);
}
this.dispatchWorkstationUpload(timerId);
},
dispatchWorkstationUpload(timerId) {
this.$store
Expand All @@ -164,15 +107,6 @@ export default {
clearTimeout(timerId);
});
},
dispatchTftpUpload(timerId) {
this.$store
.dispatch('firmware/uploadFirmwareTFTP', this.tftpFileAddress)
.catch(({ message }) => {
this.endLoader();
this.errorToast(message);
clearTimeout(timerId);
});
},
onSubmitUpload() {
this.$v.$touch();
if (this.$v.$invalid) return;
Expand Down

0 comments on commit bc49e09

Please sign in to comment.