From 602e98aa32f82fd3b0c3d250c7cc1f8da971db24 Mon Sep 17 00:00:00 2001 From: Derick Montague Date: Wed, 21 Oct 2020 16:20:00 -0500 Subject: Update linting packages to use latest - 99% of changes were small syntax changes that were changed by the lint command. There were a couple of small manual changes to meet the property order patterns established as part of the vue:recommended guidelines. There are rules that were set from errors to warnings and new stories are being opened to address those issues. Testing: - Successfully ran npm run serve - Successfully ran npm run lint - Verified functionality works as expected, e.g. success and failure use cases - Resolved any JavaScript errors thrown to the console Signed-off-by: Derick Montague Change-Id: Ie082f31c73ccbe8a60afa8f88a9ef6dbf33d9fd2 --- .../modules/Configuration/DateTimeSettingsStore.js | 24 ++++---- src/store/modules/Configuration/FirmwareStore.js | 72 +++++++++++----------- .../modules/Configuration/NetworkSettingsStore.js | 40 ++++++------ 3 files changed, 68 insertions(+), 68 deletions(-) (limited to 'src/store/modules/Configuration') diff --git a/src/store/modules/Configuration/DateTimeSettingsStore.js b/src/store/modules/Configuration/DateTimeSettingsStore.js index 08489905..f431a740 100644 --- a/src/store/modules/Configuration/DateTimeSettingsStore.js +++ b/src/store/modules/Configuration/DateTimeSettingsStore.js @@ -5,36 +5,36 @@ const DateTimeStore = { namespaced: true, state: { ntpServers: [], - isNtpProtocolEnabled: null + isNtpProtocolEnabled: null, }, getters: { - ntpServers: state => state.ntpServers, - isNtpProtocolEnabled: state => state.isNtpProtocolEnabled + ntpServers: (state) => state.ntpServers, + isNtpProtocolEnabled: (state) => state.isNtpProtocolEnabled, }, mutations: { setNtpServers: (state, ntpServers) => (state.ntpServers = ntpServers), setIsNtpProtocolEnabled: (state, isNtpProtocolEnabled) => - (state.isNtpProtocolEnabled = isNtpProtocolEnabled) + (state.isNtpProtocolEnabled = isNtpProtocolEnabled), }, actions: { async getNtpData({ commit }) { return await api .get('/redfish/v1/Managers/bmc/NetworkProtocol') - .then(response => { + .then((response) => { const ntpServers = response.data.NTP.NTPServers; const isNtpProtocolEnabled = response.data.NTP.ProtocolEnabled; commit('setNtpServers', ntpServers); commit('setIsNtpProtocolEnabled', isNtpProtocolEnabled); }) - .catch(error => { + .catch((error) => { console.log(error); }); }, async updateDateTimeSettings({ state }, dateTimeForm) { const ntpData = { NTP: { - ProtocolEnabled: dateTimeForm.ntpProtocolEnabled - } + ProtocolEnabled: dateTimeForm.ntpProtocolEnabled, + }, }; if (dateTimeForm.ntpProtocolEnabled) { ntpData.NTP.NTPServers = dateTimeForm.ntpServersArray; @@ -44,7 +44,7 @@ const DateTimeStore = { .then(async () => { if (!dateTimeForm.ntpProtocolEnabled) { const dateTimeData = { - DateTime: dateTimeForm.updatedDateTime + DateTime: dateTimeForm.updatedDateTime, }; /** * https://github.com/openbmc/phosphor-time-manager/blob/master/README.md#special-note-on-changing-ntp-setting @@ -72,14 +72,14 @@ const DateTimeStore = { 'pageDateTimeSettings.toast.successSaveDateTimeSettings' ); }) - .catch(error => { + .catch((error) => { console.log(error); throw new Error( i18n.t('pageDateTimeSettings.toast.errorSaveDateTimeSettings') ); }); - } - } + }, + }, }; export default DateTimeStore; diff --git a/src/store/modules/Configuration/FirmwareStore.js b/src/store/modules/Configuration/FirmwareStore.js index c99e7eb8..be9f50b6 100644 --- a/src/store/modules/Configuration/FirmwareStore.js +++ b/src/store/modules/Configuration/FirmwareStore.js @@ -10,8 +10,8 @@ import i18n from '@/i18n'; */ function getBackupFirmwareLocation(list, currentLocation) { return list - .map(item => item['@odata.id']) - .find(location => { + .map((item) => item['@odata.id']) + .find((location) => { const id = location.split('/').pop(); const currentId = currentLocation.split('/').pop(); return id !== currentId; @@ -27,7 +27,7 @@ const FirmwareStore = { currentLocation: null, backupVersion: null, backupState: null, - backupLocation: null + backupLocation: null, }, hostFirmware: { currentVersion: null, @@ -35,19 +35,19 @@ const FirmwareStore = { currentLocation: null, backupVersion: null, backupState: null, - backupLocation: null + backupLocation: null, }, - applyTime: null + applyTime: null, }, getters: { - bmcFirmwareCurrentVersion: state => state.bmcFirmware.currentVersion, - bmcFirmwareCurrentState: state => state.bmcFirmware.currentState, - bmcFirmwareBackupVersion: state => state.bmcFirmware.backupVersion, - bmcFirmwareBackupState: state => state.bmcFirmware.backupState, - hostFirmwareCurrentVersion: state => state.hostFirmware.currentVersion, - hostFirmwareCurrentState: state => state.hostFirmware.currentState, - hostFirmwareBackupVersion: state => state.hostFirmware.backupVersion, - hostFirmwareBackupState: state => state.hostFirmware.backupState + bmcFirmwareCurrentVersion: (state) => state.bmcFirmware.currentVersion, + bmcFirmwareCurrentState: (state) => state.bmcFirmware.currentState, + bmcFirmwareBackupVersion: (state) => state.bmcFirmware.backupVersion, + bmcFirmwareBackupState: (state) => state.bmcFirmware.backupState, + hostFirmwareCurrentVersion: (state) => state.hostFirmware.currentVersion, + hostFirmwareCurrentState: (state) => state.hostFirmware.currentState, + hostFirmwareBackupVersion: (state) => state.hostFirmware.backupVersion, + hostFirmwareBackupState: (state) => state.hostFirmware.backupState, }, mutations: { setBmcFirmwareCurrent: (state, { version, location, status }) => { @@ -70,13 +70,13 @@ const FirmwareStore = { state.hostFirmware.backupState = status; state.hostFirmware.backupLocation = location; }, - setApplyTime: (state, applyTime) => (state.applyTime = applyTime) + setApplyTime: (state, applyTime) => (state.applyTime = applyTime), }, actions: { async getFirmwareInformation({ dispatch }) { return await api.all([ dispatch('getBmcFirmware'), - dispatch('getHostFirmware') + dispatch('getHostFirmware'), ]); }, async getBmcFirmware({ commit }) { @@ -102,15 +102,15 @@ const FirmwareStore = { commit('setBmcFirmwareCurrent', { version: currentData?.data?.Version, location: currentData?.data?.['@odata.id'], - status: currentData?.data?.Status?.State + status: currentData?.data?.Status?.State, }); commit('setBmcFirmwareBackup', { version: backupData.data?.Version, location: backupData.data?.['@odata.id'], - status: backupData.data?.Status?.State + status: backupData.data?.Status?.State, }); }) - .catch(error => console.log(error)); + .catch((error) => console.log(error)); }, async getHostFirmware({ commit }) { return await api @@ -134,15 +134,15 @@ const FirmwareStore = { commit('setHostFirmwareCurrent', { version: currentData?.data?.Version, location: currentData?.data?.['@odata.id'], - status: currentData?.data?.Status?.State + status: currentData?.data?.Status?.State, }); commit('setHostFirmwareBackup', { version: backupData.data?.Version, location: backupData.data?.['@odata.id'], - status: backupData.data?.Status?.State + status: backupData.data?.Status?.State, }); }) - .catch(error => console.log(error)); + .catch((error) => console.log(error)); }, getUpdateServiceApplyTime({ commit }) { api @@ -152,20 +152,20 @@ const FirmwareStore = { data.HttpPushUriOptions.HttpPushUriApplyTime.ApplyTime; commit('setApplyTime', applyTime); }) - .catch(error => console.log(error)); + .catch((error) => console.log(error)); }, setApplyTimeImmediate({ commit }) { const data = { HttpPushUriOptions: { HttpPushUriApplyTime: { - ApplyTime: 'Immediate' - } - } + ApplyTime: 'Immediate', + }, + }, }; return api .patch('/redfish/v1/UpdateService', data) .then(() => commit('setApplyTime', 'Immediate')) - .catch(error => console.log(error)); + .catch((error) => console.log(error)); }, async uploadFirmware({ state, dispatch }, image) { if (state.applyTime !== 'Immediate') { @@ -175,11 +175,11 @@ const FirmwareStore = { } return await api .post('/redfish/v1/UpdateService', image, { - headers: { 'Content-Type': 'application/octet-stream' } + headers: { 'Content-Type': 'application/octet-stream' }, }) .then(() => dispatch('getSystemFirwareVersion')) .then(() => i18n.t('pageFirmware.toast.successUploadMessage')) - .catch(error => { + .catch((error) => { console.log(error); throw new Error(i18n.t('pageFirmware.toast.errorUploadAndReboot')); }); @@ -187,7 +187,7 @@ const FirmwareStore = { async uploadFirmwareTFTP({ state, dispatch }, { address, filename }) { const data = { TransferProtocol: 'TFTP', - ImageURI: `${address}/${filename}` + ImageURI: `${address}/${filename}`, }; if (state.applyTime !== 'Immediate') { // ApplyTime must be set to Immediate before making @@ -201,7 +201,7 @@ const FirmwareStore = { ) .then(() => dispatch('getSystemFirwareVersion')) .then(() => i18n.t('pageFirmware.toast.successUploadMessage')) - .catch(error => { + .catch((error) => { console.log(error); throw new Error(i18n.t('pageFirmware.toast.errorUploadAndReboot')); }); @@ -211,19 +211,19 @@ const FirmwareStore = { const data = { Links: { ActiveSoftwareImage: { - '@odata.id': backupLoaction - } - } + '@odata.id': backupLoaction, + }, + }, }; return await api .patch('/redfish/v1/Managers/bmc', data) .then(() => i18n.t('pageFirmware.toast.successRebootFromBackup')) - .catch(error => { + .catch((error) => { console.log(error); throw new Error(i18n.t('pageFirmware.toast.errorRebootFromBackup')); }); - } - } + }, + }, }; export default FirmwareStore; diff --git a/src/store/modules/Configuration/NetworkSettingsStore.js b/src/store/modules/Configuration/NetworkSettingsStore.js index ae1de3d2..9cdcd415 100644 --- a/src/store/modules/Configuration/NetworkSettingsStore.js +++ b/src/store/modules/Configuration/NetworkSettingsStore.js @@ -7,12 +7,12 @@ const NetworkSettingsStore = { state: { defaultGateway: '', ethernetData: [], - interfaceOptions: [] + interfaceOptions: [], }, getters: { - defaultGateway: state => state.defaultGateway, - ethernetData: state => state.ethernetData, - interfaceOptions: state => state.interfaceOptions + defaultGateway: (state) => state.defaultGateway, + ethernetData: (state) => state.ethernetData, + interfaceOptions: (state) => state.interfaceOptions, }, mutations: { setDefaultGateway: (state, defaultGateway) => @@ -20,35 +20,35 @@ const NetworkSettingsStore = { setEthernetData: (state, ethernetData) => (state.ethernetData = ethernetData), setInterfaceOptions: (state, interfaceOptions) => - (state.interfaceOptions = interfaceOptions) + (state.interfaceOptions = interfaceOptions), }, actions: { async getEthernetData({ commit }) { return await api .get('/redfish/v1/Managers/bmc/EthernetInterfaces') - .then(response => + .then((response) => response.data.Members.map( - ethernetInterface => ethernetInterface['@odata.id'] + (ethernetInterface) => ethernetInterface['@odata.id'] ) ) - .then(ethernetInterfaceIds => + .then((ethernetInterfaceIds) => api.all( - ethernetInterfaceIds.map(ethernetInterface => + ethernetInterfaceIds.map((ethernetInterface) => api.get(ethernetInterface) ) ) ) - .then(ethernetInterfaces => { + .then((ethernetInterfaces) => { const ethernetData = ethernetInterfaces.map( - ethernetInterface => ethernetInterface.data + (ethernetInterface) => ethernetInterface.data ); const interfaceOptions = ethernetInterfaces.map( - ethernetName => ethernetName.data.Id + (ethernetName) => ethernetName.data.Id ); const addresses = ethernetData[0].IPv4StaticAddresses; // Default gateway manually set to first gateway saved on the first interface. Default gateway property is WIP on backend - const defaultGateway = addresses.map(ipv4 => { + const defaultGateway = addresses.map((ipv4) => { return ipv4.Gateway; }); @@ -56,7 +56,7 @@ const NetworkSettingsStore = { commit('setEthernetData', ethernetData); commit('setInterfaceOptions', interfaceOptions); }) - .catch(error => { + .catch((error) => { console.log('Network Data:', error); }); }, @@ -67,10 +67,10 @@ const NetworkSettingsStore = { state.ethernetData[networkSettingsForm.selectedInterfaceIndex] .IPv4StaticAddresses; - const addressArray = originalAddresses.map(item => { + const addressArray = originalAddresses.map((item) => { const address = item.Address; if (find(updatedAddresses, { Address: address })) { - remove(updatedAddresses, item => { + remove(updatedAddresses, (item) => { return item.Address === address; }); return {}; @@ -81,7 +81,7 @@ const NetworkSettingsStore = { const data = { HostName: networkSettingsForm.hostname, - MACAddress: networkSettingsForm.macAddress + MACAddress: networkSettingsForm.macAddress, }; // If DHCP disabled, update static DNS or static ipv4 @@ -99,14 +99,14 @@ const NetworkSettingsStore = { .then(() => { return i18n.t('pageNetworkSettings.toast.successSaveNetworkSettings'); }) - .catch(error => { + .catch((error) => { console.log(error); throw new Error( i18n.t('pageNetworkSettings.toast.errorSaveNetworkSettings') ); }); - } - } + }, + }, }; export default NetworkSettingsStore; -- cgit v1.2.3