Skip to content

Commit

Permalink
Remove TFTP support in the GUI (#261)
Browse files Browse the repository at this point in the history
- Removed code that supported TFTP server upload in the Firmware
page.


Signed-off-by: Nikhil Ashoka <[email protected]>
  • Loading branch information
Nikhil-Ashoka authored Aug 1, 2024
1 parent 70880e3 commit d6e3684
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 132 deletions.
1 change: 0 additions & 1 deletion .env.ibm
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ CUSTOM_APP_NAV=true
CUSTOM_ROUTER=true
CUSTOM_STORE=true
VUE_APP_SERVER_OFF_REQUIRED=true
VUE_APP_TFTP_SERVER=false
VUE_APP_ACF_UPLOAD_REQUIRED=true
2 changes: 0 additions & 2 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,6 @@
"imageFile": "Image file",
"manageAccessKeys": "Manage access keys",
"startUpdate": "Start update",
"tftpServer": "TFTP server",
"tftpServerInfo": "<server_ip>/<file_name>.tar",
"workstation": "Workstation"
}
},
Expand Down
32 changes: 0 additions & 32 deletions src/store/modules/Operations/FirmwareStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ const FirmwareStore = {
bmcActiveFirmwareId: null,
hostActiveFirmwareId: null,
applyTime: null,
tftpAvailable: false,
firmwareBootSide: null,
},
getters: {
isTftpUploadAvailable: (state) => state.tftpAvailable,
isSingleFileUploadEnabled: (state) => state.hostFirmware.length === 0,
activeBmcFirmware: (state) => {
return state.bmcFirmware.find(
Expand Down Expand Up @@ -45,8 +43,6 @@ const FirmwareStore = {
setBmcFirmware: (state, firmware) => (state.bmcFirmware = firmware),
setHostFirmware: (state, firmware) => (state.hostFirmware = firmware),
setApplyTime: (state, applyTime) => (state.applyTime = applyTime),
setTftpUploadAvailable: (state, tftpAvailable) =>
(state.tftpAvailable = tftpAvailable),
setFirmwareBootSide: (state, firmwareBootSide) =>
(state.firmwareBootSide = firmwareBootSide),
},
Expand Down Expand Up @@ -124,15 +120,7 @@ const FirmwareStore = {
.then(({ data }) => {
const applyTime =
data.HttpPushUriOptions.HttpPushUriApplyTime.ApplyTime;
const allowableActions =
data?.Actions?.['#UpdateService.SimpleUpdate']?.[
'[email protected]'
];

commit('setApplyTime', applyTime);
if (allowableActions?.includes('TFTP')) {
commit('setTftpUploadAvailable', true);
}
})
.catch((error) => console.log(error));
},
Expand Down Expand Up @@ -164,26 +152,6 @@ const FirmwareStore = {
throw new Error(i18n.t('pageFirmware.toast.errorUploadFirmware'));
});
},
async uploadFirmwareTFTP({ state, dispatch }, fileAddress) {
const data = {
TransferProtocol: 'TFTP',
ImageURI: fileAddress,
};
if (state.applyTime !== 'Immediate') {
// ApplyTime must be set to Immediate before making
// request to update firmware
await dispatch('setApplyTimeImmediate');
}
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
117 changes: 20 additions & 97 deletions src/views/Operations/Firmware/FirmwareFormUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,26 @@
<div>
<div class="form-background p-3">
<b-form @submit.prevent="onSubmitUpload">
<!-- Workstation Upload -->
<b-form-group
v-if="isTftpUploadAvailable && tftpServer"
:label="$t('pageFirmware.form.updateFirmware.fileSource')"
:disabled="isPageDisabled"
:label="$t('pageFirmware.form.updateFirmware.imageFile')"
label-for="image-file"
>
<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') }}
<span
><info-tooltip
class="info-icon"
:title="$t('pageFirmware.form.updateFirmware.tftpServerInfo')"
/></span>
</b-form-radio>
</b-form-group>

<!-- Workstation Upload -->
<template v-if="isWorkstationSelected">
<b-form-group
:label="$t('pageFirmware.form.updateFirmware.imageFile')"
label-for="image-file"
<form-file
id="image-file"
:disabled="isPageDisabled"
accept=".tar"
:state="getValidationState($v.file)"
aria-describedby="image-file-help-block"
@input="onFileUpload($event)"
>
<form-file
id="image-file"
:disabled="isPageDisabled"
accept=".tar"
:state="getValidationState($v.file)"
aria-describedby="image-file-help-block"
@input="onFileUpload($event)"
>
<template #invalid>
<b-form-invalid-feedback role="alert">
{{ $t('global.form.required') }}
</b-form-invalid-feedback>
</template>
</form-file>
</b-form-group>
</template>

<!-- TFTP Server Upload -->
<template v-if="tftpServer">
<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">
<template v-if="!$v.tftpFileAddress.required">
{{ $t('global.form.fieldRequired') }}
</template>
</b-form-invalid-feedback>
</b-form-group>
</template>
<template #invalid>
<b-form-invalid-feedback role="alert">
{{ $t('global.form.required') }}
</b-form-invalid-feedback>
</template>
</form-file>
</b-form-group>
<b-btn
data-test-id="firmware-button-startUpdate"
type="submit"
Expand All @@ -81,18 +39,16 @@
</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';
import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
import InfoTooltip from '@/components/Global/InfoTooltip';
import FormFile from '@/components/Global/FormFile';
import ModalUpdateFirmware from './FirmwareModalUpdateFirmware';
export default {
name: 'FormUpdate',
components: {
InfoTooltip,
FormFile,
ModalUpdateFirmware,
},
Expand All @@ -107,12 +63,9 @@ export default {
data() {
return {
loading,
isWorkstationSelected: true,
file: null,
tftpFileAddress: null,
isServerPowerOffRequired:
process.env.VUE_APP_SERVER_OFF_REQUIRED === 'true',
tftpServer: process.env.VUE_APP_TFTP_SERVER === 'true',
};
},
computed: {
Expand All @@ -122,31 +75,16 @@ export default {
bootProgress() {
return this.$store.getters['global/bootProgress'];
},
isTftpUploadAvailable() {
return this.$store.getters['firmware/isTftpUploadAvailable'];
},
},
watch: {
isWorkstationSelected: function () {
this.$v.$reset();
this.file = null;
this.tftpFileAddress = null;
},
loading: function (value) {
this.$emit('loadingStatus', value);
},
},
validations() {
return {
file: {
required: requiredIf(function () {
return this.isWorkstationSelected;
}),
},
tftpFileAddress: {
required: requiredIf(function () {
return !this.isWorkstationSelected;
}),
required: required,
},
};
},
Expand All @@ -168,11 +106,7 @@ export default {
timestamp: true,
}
);
if (this.isWorkstationSelected) {
this.dispatchWorkstationUpload(activateFirmware);
} else {
this.dispatchTftpUpload(activateFirmware);
}
this.dispatchWorkstationUpload(activateFirmware);
};
// Step 2 - Activation
Expand Down Expand Up @@ -301,17 +235,6 @@ export default {
this.errorToast(message);
});
},
dispatchTftpUpload(activateFirmware) {
this.$store
.dispatch('firmware/uploadFirmwareTFTP', this.tftpFileAddress)
.then(({ data }) => {
activateFirmware(data);
})
.catch(({ message }) => {
this.endLoader();
this.errorToast(message);
});
},
onSubmitUpload() {
this.$v.$touch();
if (this.$v.$invalid) return;
Expand Down

0 comments on commit d6e3684

Please sign in to comment.