summaryrefslogtreecommitdiff
path: root/src/store/modules
diff options
context:
space:
mode:
authorDerick Montague <derick.montague@ibm.com>2020-10-22 00:20:00 +0300
committerDerick Montague <derick.montague@ibm.com>2020-11-03 19:47:51 +0300
commit602e98aa32f82fd3b0c3d250c7cc1f8da971db24 (patch)
tree2894194868ff987718a8b19f112b8106d662aa83 /src/store/modules
parent47165201c79b3d2c4ccc62a49a9c75d038ee8fe6 (diff)
downloadwebui-vue-602e98aa32f82fd3b0c3d250c7cc1f8da971db24.tar.xz
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 <derick.montague@ibm.com> Change-Id: Ie082f31c73ccbe8a60afa8f88a9ef6dbf33d9fd2
Diffstat (limited to 'src/store/modules')
-rw-r--r--src/store/modules/AccessControl/LdapStore.js64
-rw-r--r--src/store/modules/AccessControl/LocalUserMangementStore.js64
-rw-r--r--src/store/modules/AccessControl/SslCertificatesStore.js54
-rw-r--r--src/store/modules/Authentication/AuthenticanStore.js20
-rw-r--r--src/store/modules/Configuration/DateTimeSettingsStore.js24
-rw-r--r--src/store/modules/Configuration/FirmwareStore.js72
-rw-r--r--src/store/modules/Configuration/NetworkSettingsStore.js40
-rw-r--r--src/store/modules/Control/BootSettingsStore.js30
-rw-r--r--src/store/modules/Control/ControlStore.js34
-rw-r--r--src/store/modules/Control/PowerControlStore.js20
-rw-r--r--src/store/modules/Control/ServerLedStore.js16
-rw-r--r--src/store/modules/Control/VirtualMediaStore.js44
-rw-r--r--src/store/modules/GlobalStore.js32
-rw-r--r--src/store/modules/Health/BmcStore.js12
-rw-r--r--src/store/modules/Health/ChassisStore.js24
-rw-r--r--src/store/modules/Health/EventLogStore.js29
-rw-r--r--src/store/modules/Health/FanStore.js16
-rw-r--r--src/store/modules/Health/MemoryStore.js18
-rw-r--r--src/store/modules/Health/PowerSupplyStore.js18
-rw-r--r--src/store/modules/Health/ProcessorStore.js24
-rw-r--r--src/store/modules/Health/SensorsStore.js40
-rw-r--r--src/store/modules/Health/SystemStore.js12
22 files changed, 355 insertions, 352 deletions
diff --git a/src/store/modules/AccessControl/LdapStore.js b/src/store/modules/AccessControl/LdapStore.js
index 780de38e..722384c1 100644
--- a/src/store/modules/AccessControl/LdapStore.js
+++ b/src/store/modules/AccessControl/LdapStore.js
@@ -13,7 +13,7 @@ const LdapStore = {
baseDn: null,
userAttribute: null,
groupsAttribute: null,
- roleGroups: []
+ roleGroups: [],
},
activeDirectory: {
serviceEnabled: null,
@@ -22,14 +22,14 @@ const LdapStore = {
baseDn: null,
userAttribute: null,
groupsAttribute: null,
- roleGroups: []
- }
+ roleGroups: [],
+ },
},
getters: {
- isServiceEnabled: state => state.isServiceEnabled,
- ldap: state => state.ldap,
- activeDirectory: state => state.activeDirectory,
- isActiveDirectoryEnabled: state => {
+ isServiceEnabled: (state) => state.isServiceEnabled,
+ ldap: (state) => state.ldap,
+ activeDirectory: (state) => state.activeDirectory,
+ isActiveDirectoryEnabled: (state) => {
return state.activeDirectory.serviceEnabled;
},
enabledRoleGroups: (state, getters) => {
@@ -37,7 +37,7 @@ const LdapStore = {
? 'activeDirectory'
: 'ldap';
return state[serviceType].roleGroups;
- }
+ },
},
mutations: {
setServiceEnabled: (state, serviceEnabled) =>
@@ -49,7 +49,7 @@ const LdapStore = {
ServiceAddresses,
Authentication = {},
LDAPService: { SearchSettings = {} } = {},
- RemoteRoleMapping = []
+ RemoteRoleMapping = [],
}
) => {
state.ldap.serviceAddress = ServiceAddresses[0];
@@ -67,7 +67,7 @@ const LdapStore = {
ServiceAddresses,
Authentication = {},
LDAPService: { SearchSettings = {} } = {},
- RemoteRoleMapping = []
+ RemoteRoleMapping = [],
}
) => {
state.activeDirectory.serviceEnabled = ServiceEnabled;
@@ -77,7 +77,7 @@ const LdapStore = {
state.activeDirectory.userAttribute = SearchSettings.UsernameAttribute;
state.activeDirectory.groupsAttribute = SearchSettings.GroupsAttribute;
state.activeDirectory.roleGroups = RemoteRoleMapping;
- }
+ },
},
actions: {
async getAccountSettings({ commit }) {
@@ -91,21 +91,21 @@ const LdapStore = {
commit('setLdapProperties', LDAP);
commit('setActiveDirectoryProperties', ActiveDirectory);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async saveLdapSettings({ state, dispatch }, properties) {
const data = { LDAP: properties };
if (state.activeDirectory.serviceEnabled) {
// Disable Active Directory service if enabled
await api.patch('/redfish/v1/AccountService', {
- ActiveDirectory: { ServiceEnabled: false }
+ ActiveDirectory: { ServiceEnabled: false },
});
}
return await api
.patch('/redfish/v1/AccountService', data)
.then(() => dispatch('getAccountSettings'))
.then(() => i18n.t('pageLdap.toast.successSaveLdapSettings'))
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(i18n.t('pageLdap.toast.errorSaveLdapSettings'));
});
@@ -115,14 +115,14 @@ const LdapStore = {
if (state.ldap.serviceEnabled) {
// Disable LDAP service if enabled
await api.patch('/redfish/v1/AccountService', {
- LDAP: { ServiceEnabled: false }
+ LDAP: { ServiceEnabled: false },
});
}
return await api
.patch('/redfish/v1/AccountService', data)
.then(() => dispatch('getAccountSettings'))
.then(() => i18n.t('pageLdap.toast.successSaveActiveDirectorySettings'))
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(
i18n.t('pageLdap.toast.errorSaveActiveDirectorySettings')
@@ -139,7 +139,7 @@ const LdapStore = {
bindPassword,
baseDn,
userIdAttribute,
- groupIdAttribute
+ groupIdAttribute,
}
) {
const data = {
@@ -147,13 +147,13 @@ const LdapStore = {
ServiceAddresses: [serviceAddress],
Authentication: {
Username: bindDn,
- Password: bindPassword
+ Password: bindPassword,
},
LDAPService: {
SearchSettings: {
- BaseDistinguishedNames: [baseDn]
- }
- }
+ BaseDistinguishedNames: [baseDn],
+ },
+ },
};
if (groupIdAttribute)
data.LDAPService.SearchSettings.GroupsAttribute = groupIdAttribute;
@@ -177,8 +177,8 @@ const LdapStore = {
...enabledRoleGroups,
{
LocalRole: groupPrivilege,
- RemoteGroup: groupName
- }
+ RemoteGroup: groupName,
+ },
];
if (isActiveDirectoryEnabled) {
data.ActiveDirectory = { RemoteRoleMapping };
@@ -190,10 +190,10 @@ const LdapStore = {
.then(() => dispatch('getAccountSettings'))
.then(() =>
i18n.t('pageLdap.toast.successAddRoleGroup', {
- groupName
+ groupName,
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(i18n.t('pageLdap.toast.errorAddRoleGroup'));
});
@@ -202,11 +202,11 @@ const LdapStore = {
const data = {};
const enabledRoleGroups = getters['enabledRoleGroups'];
const isActiveDirectoryEnabled = getters['isActiveDirectoryEnabled'];
- const RemoteRoleMapping = enabledRoleGroups.map(group => {
+ const RemoteRoleMapping = enabledRoleGroups.map((group) => {
if (group.RemoteGroup === groupName) {
return {
RemoteGroup: groupName,
- LocalRole: groupPrivilege
+ LocalRole: groupPrivilege,
};
} else {
return {};
@@ -223,7 +223,7 @@ const LdapStore = {
.then(() =>
i18n.t('pageLdap.toast.successSaveRoleGroup', { groupName })
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(i18n.t('pageLdap.toast.errorSaveRoleGroup'));
});
@@ -232,7 +232,7 @@ const LdapStore = {
const data = {};
const enabledRoleGroups = getters['enabledRoleGroups'];
const isActiveDirectoryEnabled = getters['isActiveDirectoryEnabled'];
- const RemoteRoleMapping = enabledRoleGroups.map(group => {
+ const RemoteRoleMapping = enabledRoleGroups.map((group) => {
if (find(roleGroups, { groupName: group.RemoteGroup })) {
return null;
} else {
@@ -250,14 +250,14 @@ const LdapStore = {
.then(() =>
i18n.tc('pageLdap.toast.successDeleteRoleGroup', roleGroups.length)
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(
i18n.tc('pageLdap.toast.errorDeleteRoleGroup', roleGroups.length)
);
});
- }
- }
+ },
+ },
};
export default LdapStore;
diff --git a/src/store/modules/AccessControl/LocalUserMangementStore.js b/src/store/modules/AccessControl/LocalUserMangementStore.js
index e9de3cc1..6bc6ec5d 100644
--- a/src/store/modules/AccessControl/LocalUserMangementStore.js
+++ b/src/store/modules/AccessControl/LocalUserMangementStore.js
@@ -9,7 +9,7 @@ const LocalUserManagementStore = {
accountLockoutDuration: null,
accountLockoutThreshold: null,
accountMinPasswordLength: null,
- accountMaxPasswordLength: null
+ accountMaxPasswordLength: null,
},
getters: {
allUsers(state) {
@@ -21,15 +21,15 @@ const LocalUserManagementStore = {
accountSettings(state) {
return {
lockoutDuration: state.accountLockoutDuration,
- lockoutThreshold: state.accountLockoutThreshold
+ lockoutThreshold: state.accountLockoutThreshold,
};
},
accountPasswordRequirements(state) {
return {
minLength: state.accountMinPasswordLength,
- maxLength: state.accountMaxPasswordLength
+ maxLength: state.accountMaxPasswordLength,
};
- }
+ },
},
mutations: {
setUsers(state, allUsers) {
@@ -49,19 +49,21 @@ const LocalUserManagementStore = {
},
setAccountMaxPasswordLength(state, maxPasswordLength) {
state.accountMaxPasswordLength = maxPasswordLength;
- }
+ },
},
actions: {
async getUsers({ commit }) {
return await api
.get('/redfish/v1/AccountService/Accounts')
- .then(response => response.data.Members.map(user => user['@odata.id']))
- .then(userIds => api.all(userIds.map(user => api.get(user))))
- .then(users => {
- const userData = users.map(user => user.data);
+ .then((response) =>
+ response.data.Members.map((user) => user['@odata.id'])
+ )
+ .then((userIds) => api.all(userIds.map((user) => api.get(user))))
+ .then((users) => {
+ const userData = users.map((user) => user.data);
commit('setUsers', userData);
})
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorLoadUsers'
@@ -78,7 +80,7 @@ const LocalUserManagementStore = {
commit('setAccountMinPasswordLength', data.MinPasswordLength);
commit('setAccountMaxPasswordLength', data.MaxPasswordLength);
})
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorLoadAccountSettings'
@@ -90,29 +92,29 @@ const LocalUserManagementStore = {
api
.get('/redfish/v1/AccountService/Roles')
.then(({ data: { Members = [] } = {} }) => {
- const roles = Members.map(role => {
+ const roles = Members.map((role) => {
return role['@odata.id'].split('/').pop();
});
commit('setAccountRoles', roles);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async createUser({ dispatch }, { username, password, privilege, status }) {
const data = {
UserName: username,
Password: password,
RoleId: privilege,
- Enabled: status
+ Enabled: status,
};
return await api
.post('/redfish/v1/AccountService/Accounts', data)
.then(() => dispatch('getUsers'))
.then(() =>
i18n.t('pageLocalUserManagement.toast.successCreateUser', {
- username
+ username,
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorCreateUser',
@@ -136,10 +138,10 @@ const LocalUserManagementStore = {
.then(() => dispatch('getUsers'))
.then(() =>
i18n.t('pageLocalUserManagement.toast.successUpdateUser', {
- username: originalUsername
+ username: originalUsername,
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorUpdateUser',
@@ -154,10 +156,10 @@ const LocalUserManagementStore = {
.then(() => dispatch('getUsers'))
.then(() =>
i18n.t('pageLocalUserManagement.toast.successDeleteUser', {
- username
+ username,
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorDeleteUser',
@@ -170,14 +172,14 @@ const LocalUserManagementStore = {
const promises = users.map(({ username }) => {
return api
.delete(`/redfish/v1/AccountService/Accounts/${username}`)
- .catch(error => {
+ .catch((error) => {
console.log(error);
return error;
});
});
return await api
.all(promises)
- .then(response => {
+ .then((response) => {
dispatch('getUsers');
return response;
})
@@ -208,19 +210,19 @@ const LocalUserManagementStore = {
},
async enableUsers({ dispatch }, users) {
const data = {
- Enabled: true
+ Enabled: true,
};
const promises = users.map(({ username }) => {
return api
.patch(`/redfish/v1/AccountService/Accounts/${username}`, data)
- .catch(error => {
+ .catch((error) => {
console.log(error);
return error;
});
});
return await api
.all(promises)
- .then(response => {
+ .then((response) => {
dispatch('getUsers');
return response;
})
@@ -251,19 +253,19 @@ const LocalUserManagementStore = {
},
async disableUsers({ dispatch }, users) {
const data = {
- Enabled: false
+ Enabled: false,
};
const promises = users.map(({ username }) => {
return api
.patch(`/redfish/v1/AccountService/Accounts/${username}`, data)
- .catch(error => {
+ .catch((error) => {
console.log(error);
return error;
});
});
return await api
.all(promises)
- .then(response => {
+ .then((response) => {
dispatch('getUsers');
return response;
})
@@ -309,15 +311,15 @@ const LocalUserManagementStore = {
//GET new settings to update view
.then(() => dispatch('getAccountSettings'))
.then(() => i18n.t('pageLocalUserManagement.toast.successSaveSettings'))
- .catch(error => {
+ .catch((error) => {
console.log(error);
const message = i18n.t(
'pageLocalUserManagement.toast.errorSaveSettings'
);
throw new Error(message);
});
- }
- }
+ },
+ },
};
export default LocalUserManagementStore;
diff --git a/src/store/modules/AccessControl/SslCertificatesStore.js b/src/store/modules/AccessControl/SslCertificatesStore.js
index 73a74b23..752c2124 100644
--- a/src/store/modules/AccessControl/SslCertificatesStore.js
+++ b/src/store/modules/AccessControl/SslCertificatesStore.js
@@ -5,12 +5,12 @@ export const CERTIFICATE_TYPES = [
{
type: 'HTTPS Certificate',
location: '/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/',
- label: i18n.t('pageSslCertificates.httpsCertificate')
+ label: i18n.t('pageSslCertificates.httpsCertificate'),
},
{
type: 'LDAP Certificate',
location: '/redfish/v1/AccountService/LDAP/Certificates/',
- label: i18n.t('pageSslCertificates.ldapCertificate')
+ label: i18n.t('pageSslCertificates.ldapCertificate'),
},
{
type: 'TrustStore Certificate',
@@ -18,13 +18,13 @@ export const CERTIFICATE_TYPES = [
// Web UI will show 'CA Certificate' instead of
// 'TrustStore Certificate' after user testing revealed
// the term 'TrustStore Certificate' wasn't recognized/was unfamilar
- label: i18n.t('pageSslCertificates.caCertificate')
- }
+ label: i18n.t('pageSslCertificates.caCertificate'),
+ },
];
const getCertificateProp = (type, prop) => {
const certificate = CERTIFICATE_TYPES.find(
- certificate => certificate.type === type
+ (certificate) => certificate.type === type
);
return certificate ? certificate[prop] : null;
};
@@ -33,11 +33,11 @@ const SslCertificatesStore = {
namespaced: true,
state: {
allCertificates: [],
- availableUploadTypes: []
+ availableUploadTypes: [],
},
getters: {
- allCertificates: state => state.allCertificates,
- availableUploadTypes: state => state.availableUploadTypes
+ allCertificates: (state) => state.allCertificates,
+ availableUploadTypes: (state) => state.availableUploadTypes,
},
mutations: {
setCertificates(state, certificates) {
@@ -45,17 +45,17 @@ const SslCertificatesStore = {
},
setAvailableUploadTypes(state, availableUploadTypes) {
state.availableUploadTypes = availableUploadTypes;
- }
+ },
},
actions: {
async getCertificates({ commit }) {
return await api
.get('/redfish/v1/CertificateService/CertificateLocations')
.then(({ data: { Links: { Certificates } } }) =>
- Certificates.map(certificate => certificate['@odata.id'])
+ Certificates.map((certificate) => certificate['@odata.id'])
)
- .then(certificateLocations => {
- const promises = certificateLocations.map(location =>
+ .then((certificateLocations) => {
+ const promises = certificateLocations.map((location) =>
api.get(location)
);
api.all(promises).then(
@@ -66,7 +66,7 @@ const SslCertificatesStore = {
ValidNotAfter,
ValidNotBefore,
Issuer = {},
- Subject = {}
+ Subject = {},
} = data;
return {
type: Name,
@@ -75,13 +75,13 @@ const SslCertificatesStore = {
issuedBy: Issuer.CommonName,
issuedTo: Subject.CommonName,
validFrom: new Date(ValidNotBefore),
- validUntil: new Date(ValidNotAfter)
+ validUntil: new Date(ValidNotAfter),
};
});
const availableUploadTypes = CERTIFICATE_TYPES.filter(
({ type }) =>
!certificates
- .map(certificate => certificate.type)
+ .map((certificate) => certificate.type)
.includes(type)
);
@@ -94,15 +94,15 @@ const SslCertificatesStore = {
async addNewCertificate({ dispatch }, { file, type }) {
return await api
.post(getCertificateProp(type, 'location'), file, {
- headers: { 'Content-Type': 'application/x-pem-file' }
+ headers: { 'Content-Type': 'application/x-pem-file' },
})
.then(() => dispatch('getCertificates'))
.then(() =>
i18n.t('pageSslCertificates.toast.successAddCertificate', {
- certificate: getCertificateProp(type, 'label')
+ certificate: getCertificateProp(type, 'label'),
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(
i18n.t('pageSslCertificates.toast.errorAddCertificate')
@@ -126,10 +126,10 @@ const SslCertificatesStore = {
.then(() => dispatch('getCertificates'))
.then(() =>
i18n.t('pageSslCertificates.toast.successReplaceCertificate', {
- certificate: getCertificateProp(type, 'label')
+ certificate: getCertificateProp(type, 'label'),
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(
i18n.t('pageSslCertificates.toast.errorReplaceCertificate')
@@ -142,10 +142,10 @@ const SslCertificatesStore = {
.then(() => dispatch('getCertificates'))
.then(() =>
i18n.t('pageSslCertificates.toast.successDeleteCertificate', {
- certificate: getCertificateProp(type, 'label')
+ certificate: getCertificateProp(type, 'label'),
})
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(
i18n.t('pageSslCertificates.toast.errorDeleteCertificate')
@@ -167,12 +167,12 @@ const SslCertificatesStore = {
challengePassword,
contactPerson,
emailAddress,
- alternateName
+ alternateName,
} = userData;
const data = {};
data.CertificateCollection = {
- '@odata.id': getCertificateProp(certificateType, 'location')
+ '@odata.id': getCertificateProp(certificateType, 'location'),
};
data.Country = country;
data.State = state;
@@ -196,9 +196,9 @@ const SslCertificatesStore = {
)
//TODO: Success response also throws error so
// can't accurately show legitimate error in UI
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default SslCertificatesStore;
diff --git a/src/store/modules/Authentication/AuthenticanStore.js b/src/store/modules/Authentication/AuthenticanStore.js
index c42b9da1..e08f5b03 100644
--- a/src/store/modules/Authentication/AuthenticanStore.js
+++ b/src/store/modules/Authentication/AuthenticanStore.js
@@ -7,16 +7,16 @@ const AuthenticationStore = {
state: {
authError: false,
xsrfCookie: Cookies.get('XSRF-TOKEN'),
- isAuthenticatedCookie: Cookies.get('IsAuthenticated')
+ isAuthenticatedCookie: Cookies.get('IsAuthenticated'),
},
getters: {
- authError: state => state.authError,
- isLoggedIn: state => {
+ authError: (state) => state.authError,
+ isLoggedIn: (state) => {
return (
state.xsrfCookie !== undefined || state.isAuthenticatedCookie == 'true'
);
},
- token: state => state.xsrfCookie
+ token: (state) => state.xsrfCookie,
},
mutations: {
authSuccess(state) {
@@ -32,7 +32,7 @@ const AuthenticationStore = {
localStorage.removeItem('storedUsername');
state.xsrfCookie = undefined;
state.isAuthenticatedCookie = undefined;
- }
+ },
},
actions: {
login({ commit }, { username, password }) {
@@ -40,7 +40,7 @@ const AuthenticationStore = {
return api
.post('/login', { data: [username, password] })
.then(() => commit('authSuccess'))
- .catch(error => {
+ .catch((error) => {
commit('authError');
throw new Error(error);
});
@@ -50,20 +50,20 @@ const AuthenticationStore = {
.post('/logout', { data: [] })
.then(() => commit('logout'))
.then(() => router.go('/login'))
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async checkPasswordChangeRequired(_, username) {
return await api
.get(`/redfish/v1/AccountService/Accounts/${username}`)
.then(({ data: { PasswordChangeRequired } }) => PasswordChangeRequired)
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
resetStoreState({ state }) {
state.authError = false;
state.xsrfCookie = Cookies.get('XSRF-TOKEN');
state.isAuthenticatedCookie = Cookies.get('IsAuthenticated');
- }
- }
+ },
+ },
};
export default AuthenticationStore;
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;
diff --git a/src/store/modules/Control/BootSettingsStore.js b/src/store/modules/Control/BootSettingsStore.js
index ff5f5050..99542b88 100644
--- a/src/store/modules/Control/BootSettingsStore.js
+++ b/src/store/modules/Control/BootSettingsStore.js
@@ -7,13 +7,13 @@ const BootSettingsStore = {
bootSourceOptions: [],
bootSource: null,
overrideEnabled: null,
- tpmEnabled: null
+ tpmEnabled: null,
},
getters: {
- bootSourceOptions: state => state.bootSourceOptions,
- bootSource: state => state.bootSource,
- overrideEnabled: state => state.overrideEnabled,
- tpmEnabled: state => state.tpmEnabled
+ bootSourceOptions: (state) => state.bootSourceOptions,
+ bootSource: (state) => state.bootSource,
+ overrideEnabled: (state) => state.overrideEnabled,
+ tpmEnabled: (state) => state.tpmEnabled,
},
mutations: {
setBootSourceOptions: (state, bootSourceOptions) =>
@@ -27,7 +27,7 @@ const BootSettingsStore = {
state.overrideEnabled = false;
}
},
- setTpmPolicy: (state, tpmEnabled) => (state.tpmEnabled = tpmEnabled)
+ setTpmPolicy: (state, tpmEnabled) => (state.tpmEnabled = tpmEnabled),
},
actions: {
async getBootSettings({ commit }) {
@@ -41,7 +41,7 @@ const BootSettingsStore = {
commit('setOverrideEnabled', Boot.BootSourceOverrideEnabled);
commit('setBootSource', Boot.BootSourceOverrideTarget);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
saveBootSettings({ commit, dispatch }, { bootSource, overrideEnabled }) {
const data = { Boot: {} };
@@ -57,13 +57,13 @@ const BootSettingsStore = {
return api
.patch('/redfish/v1/Systems/system', data)
- .then(response => {
+ .then((response) => {
// If request success, commit the values
commit('setBootSource', data.Boot.BootSourceOverrideTarget);
commit('setOverrideEnabled', data.Boot.BootSourceOverrideEnabled);
return response;
})
- .catch(error => {
+ .catch((error) => {
console.log(error);
// If request error, GET saved options
dispatch('getBootSettings');
@@ -77,7 +77,7 @@ const BootSettingsStore = {
.then(({ data: { data: { TPMEnable } } }) =>
commit('setTpmPolicy', TPMEnable)
)
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
saveTpmPolicy({ commit, dispatch }, tpmEnabled) {
// TODO: switch to Redfish when available
@@ -87,12 +87,12 @@ const BootSettingsStore = {
'/xyz/openbmc_project/control/host0/TPMEnable/attr/TPMEnable',
data
)
- .then(response => {
+ .then((response) => {
// If request success, commit the values
commit('setTpmPolicy', tpmEnabled);
return response;
})
- .catch(error => {
+ .catch((error) => {
console.log(error);
// If request error, GET saved policy
dispatch('getTpmPolicy');
@@ -119,7 +119,7 @@ const BootSettingsStore = {
let message = i18n.t(
'pageServerPowerOperations.toast.successSaveSettings'
);
- responses.forEach(response => {
+ responses.forEach((response) => {
if (response instanceof Error) {
throw new Error(
i18n.t('pageServerPowerOperations.toast.errorSaveSettings')
@@ -129,8 +129,8 @@ const BootSettingsStore = {
return message;
})
);
- }
- }
+ },
+ },
};
export default BootSettingsStore;
diff --git a/src/store/modules/Control/ControlStore.js b/src/store/modules/Control/ControlStore.js
index ade5da69..82940f81 100644
--- a/src/store/modules/Control/ControlStore.js
+++ b/src/store/modules/Control/ControlStore.js
@@ -9,15 +9,15 @@ import i18n from '@/i18n';
* @param {string} hostStatus
* @returns {Promise}
*/
-const checkForHostStatus = function(hostStatus) {
- return new Promise(resolve => {
+const checkForHostStatus = function (hostStatus) {
+ return new Promise((resolve) => {
const timer = setTimeout(() => {
resolve();
unwatch();
}, 300000 /*5mins*/);
const unwatch = this.watch(
- state => state.global.hostStatus,
- value => {
+ (state) => state.global.hostStatus,
+ (value) => {
if (value === hostStatus) {
resolve();
unwatch();
@@ -33,12 +33,12 @@ const ControlStore = {
state: {
isOperationInProgress: false,
lastPowerOperationTime: null,
- lastBmcRebootTime: null
+ lastBmcRebootTime: null,
},
getters: {
- isOperationInProgress: state => state.isOperationInProgress,
- lastPowerOperationTime: state => state.lastPowerOperationTime,
- lastBmcRebootTime: state => state.lastBmcRebootTime
+ isOperationInProgress: (state) => state.isOperationInProgress,
+ lastPowerOperationTime: (state) => state.lastPowerOperationTime,
+ lastBmcRebootTime: (state) => state.lastBmcRebootTime,
},
mutations: {
setOperationInProgress: (state, inProgress) =>
@@ -46,28 +46,28 @@ const ControlStore = {
setLastPowerOperationTime: (state, lastPowerOperationTime) =>
(state.lastPowerOperationTime = lastPowerOperationTime),
setLastBmcRebootTime: (state, lastBmcRebootTime) =>
- (state.lastBmcRebootTime = lastBmcRebootTime)
+ (state.lastBmcRebootTime = lastBmcRebootTime),
},
actions: {
async getLastPowerOperationTime({ commit }) {
return await api
.get('/redfish/v1/Systems/system')
- .then(response => {
+ .then((response) => {
const lastReset = response.data.LastResetTime;
const lastPowerOperationTime = new Date(lastReset);
commit('setLastPowerOperationTime', lastPowerOperationTime);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
getLastBmcRebootTime({ commit }) {
return api
.get('/redfish/v1/Managers/bmc')
- .then(response => {
+ .then((response) => {
const lastBmcReset = response.data.LastResetTime;
const lastBmcRebootTime = new Date(lastBmcReset);
commit('setLastBmcRebootTime', lastBmcRebootTime);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async rebootBmc({ dispatch }) {
const data = { ResetType: 'GracefulRestart' };
@@ -75,7 +75,7 @@ const ControlStore = {
.post('/redfish/v1/Managers/bmc/Actions/Manager.Reset', data)
.then(() => dispatch('getLastBmcRebootTime'))
.then(() => i18n.t('pageRebootBmc.toast.successRebootStart'))
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(i18n.t('pageRebootBmc.toast.errorRebootStart'));
});
@@ -119,12 +119,12 @@ const ControlStore = {
commit('setOperationInProgress', true);
api
.post('/redfish/v1/Systems/system/Actions/ComputerSystem.Reset', data)
- .catch(error => {
+ .catch((error) => {
console.log(error);
commit('setOperationInProgress', false);
});
- }
- }
+ },
+ },
};
export default ControlStore;
diff --git a/src/store/modules/Control/PowerControlStore.js b/src/store/modules/Control/PowerControlStore.js
index 3a2434a6..9dbddf05 100644
--- a/src/store/modules/Control/PowerControlStore.js
+++ b/src/store/modules/Control/PowerControlStore.js
@@ -5,17 +5,17 @@ const PowerControlStore = {
namespaced: true,
state: {
powerCapValue: null,
- powerConsumptionValue: null
+ powerConsumptionValue: null,
},
getters: {
- powerCapValue: state => state.powerCapValue,
- powerConsumptionValue: state => state.powerConsumptionValue
+ powerCapValue: (state) => state.powerCapValue,
+ powerConsumptionValue: (state) => state.powerConsumptionValue,
},
mutations: {
setPowerCapValue: (state, powerCapValue) =>
(state.powerCapValue = powerCapValue),
setPowerConsumptionValue: (state, powerConsumptionValue) =>
- (state.powerConsumptionValue = powerConsumptionValue)
+ (state.powerConsumptionValue = powerConsumptionValue),
},
actions: {
setPowerCapUpdatedValue({ commit }, value) {
@@ -24,7 +24,7 @@ const PowerControlStore = {
async getPowerControl({ commit }) {
return await api
.get('/redfish/v1/Chassis/chassis/Power')
- .then(response => {
+ .then((response) => {
const powerControl = response.data.PowerControl;
const powerCap = powerControl[0].PowerLimit.LimitInWatts;
// If system is powered off, power consumption does not exist in the PowerControl
@@ -33,13 +33,13 @@ const PowerControlStore = {
commit('setPowerCapValue', powerCap);
commit('setPowerConsumptionValue', powerConsumption);
})
- .catch(error => {
+ .catch((error) => {
console.log('Power control', error);
});
},
async setPowerControl(_, powerCapValue) {
const data = {
- PowerControl: [{ PowerLimit: { LimitInWatts: powerCapValue } }]
+ PowerControl: [{ PowerLimit: { LimitInWatts: powerCapValue } }],
};
return await api
@@ -47,14 +47,14 @@ const PowerControlStore = {
.then(() =>
i18n.t('pageServerPowerOperations.toast.successSaveSettings')
)
- .catch(error => {
+ .catch((error) => {
console.log(error);
throw new Error(
i18n.t('pageServerPowerOperations.toast.errorSaveSettings')
);
});
- }
- }
+ },
+ },
};
export default PowerControlStore;
diff --git a/src/store/modules/Control/ServerLedStore.js b/src/store/modules/Control/ServerLedStore.js
index 2be7722f..51e09206 100644
--- a/src/store/modules/Control/ServerLedStore.js
+++ b/src/store/modules/Control/ServerLedStore.js
@@ -4,24 +4,24 @@ import i18n from '@/i18n';
const ServerLedStore = {
namespaced: true,
state: {
- indicatorValue: 'Off'
+ indicatorValue: 'Off',
},
getters: {
- getIndicatorValue: state => state.indicatorValue
+ getIndicatorValue: (state) => state.indicatorValue,
},
mutations: {
setIndicatorValue(state, indicatorValue) {
state.indicatorValue = indicatorValue;
- }
+ },
},
actions: {
async getIndicatorValue({ commit }) {
return await api
.get('/redfish/v1/Systems/system')
- .then(response => {
+ .then((response) => {
commit('setIndicatorValue', response.data.IndicatorLED);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async saveIndicatorLedValue({ commit }, payload) {
return await api
@@ -34,7 +34,7 @@ const ServerLedStore = {
return i18n.t('pageServerLed.toast.successServerLedOff');
}
})
- .catch(error => {
+ .catch((error) => {
console.log(error);
if (payload === 'Lit') {
throw new Error(i18n.t('pageServerLed.toast.errorServerLedOn'));
@@ -42,8 +42,8 @@ const ServerLedStore = {
throw new Error(i18n.t('pageServerLed.toast.errorServerLedOff'));
}
});
- }
- }
+ },
+ },
};
export default ServerLedStore;
diff --git a/src/store/modules/Control/VirtualMediaStore.js b/src/store/modules/Control/VirtualMediaStore.js
index 6785f5fd..7c183b0e 100644
--- a/src/store/modules/Control/VirtualMediaStore.js
+++ b/src/store/modules/Control/VirtualMediaStore.js
@@ -6,17 +6,17 @@ const VirtualMediaStore = {
state: {
proxyDevices: [],
legacyDevices: [],
- connections: []
+ connections: [],
},
getters: {
- proxyDevices: state => state.proxyDevices,
- legacyDevices: state => state.legacyDevices
+ proxyDevices: (state) => state.proxyDevices,
+ legacyDevices: (state) => state.legacyDevices,
},
mutations: {
setProxyDevicesData: (state, deviceData) =>
(state.proxyDevices = deviceData),
setLegacyDevicesData: (state, deviceData) =>
- (state.legacyDevices = deviceData)
+ (state.legacyDevices = deviceData),
},
actions: {
async getData({ commit }) {
@@ -30,7 +30,7 @@ const VirtualMediaStore = {
websocket: '/vm/0/0',
file: null,
transferProtocolType: 'OEM',
- isActive: false
+ isActive: false,
};
commit('setProxyDevicesData', [device]);
return;
@@ -38,43 +38,43 @@ const VirtualMediaStore = {
return await api
.get('/redfish/v1/Managers/bmc/VirtualMedia')
- .then(response =>
- response.data.Members.map(virtualMedia => virtualMedia['@odata.id'])
+ .then((response) =>
+ response.data.Members.map((virtualMedia) => virtualMedia['@odata.id'])
)
- .then(devices => api.all(devices.map(device => api.get(device))))
- .then(devices => {
- const deviceData = devices.map(device => {
+ .then((devices) => api.all(devices.map((device) => api.get(device))))
+ .then((devices) => {
+ const deviceData = devices.map((device) => {
const isActive = device.data?.Inserted === true ? true : false;
return {
id: device.data?.Id,
transferProtocolType: device.data?.TransferProtocolType,
websocket: device.data?.Oem?.OpenBMC?.WebSocketEndpoint,
- isActive: isActive
+ isActive: isActive,
};
});
const proxyDevices = deviceData
- .filter(d => d.transferProtocolType === 'OEM')
- .map(device => {
+ .filter((d) => d.transferProtocolType === 'OEM')
+ .map((device) => {
return {
...device,
- file: null
+ file: null,
};
});
const legacyDevices = deviceData
- .filter(d => !d.transferProtocolType)
- .map(device => {
+ .filter((d) => !d.transferProtocolType)
+ .map((device) => {
return {
...device,
serverUri: '',
username: '',
password: '',
- isRW: false
+ isRW: false,
};
});
commit('setProxyDevicesData', proxyDevices);
commit('setLegacyDevicesData', legacyDevices);
})
- .catch(error => {
+ .catch((error) => {
console.log('Virtual Media:', error);
});
},
@@ -84,7 +84,7 @@ const VirtualMediaStore = {
`/redfish/v1/Managers/bmc/VirtualMedia/${id}/Actions/VirtualMedia.InsertMedia`,
data
)
- .catch(error => {
+ .catch((error) => {
console.log('Mount image:', error);
throw new Error();
});
@@ -94,12 +94,12 @@ const VirtualMediaStore = {
.post(
`/redfish/v1/Managers/bmc/VirtualMedia/${id}/Actions/VirtualMedia.EjectMedia`
)
- .catch(error => {
+ .catch((error) => {
console.log('Unmount image:', error);
throw new Error();
});
- }
- }
+ },
+ },
};
export default VirtualMediaStore;
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
index 5af5dfe6..218feb67 100644
--- a/src/store/modules/GlobalStore.js
+++ b/src/store/modules/GlobalStore.js
@@ -4,10 +4,10 @@ const HOST_STATE = {
on: 'xyz.openbmc_project.State.Host.HostState.Running',
off: 'xyz.openbmc_project.State.Host.HostState.Off',
error: 'xyz.openbmc_project.State.Host.HostState.Quiesced',
- diagnosticMode: 'xyz.openbmc_project.State.Host.HostState.DiagnosticMode'
+ diagnosticMode: 'xyz.openbmc_project.State.Host.HostState.DiagnosticMode',
};
-const hostStateMapper = hostState => {
+const hostStateMapper = (hostState) => {
switch (hostState) {
case HOST_STATE.on:
case 'On': // Redfish PowerState
@@ -36,15 +36,15 @@ const GlobalStore = {
? JSON.parse(localStorage.getItem('storedUtcDisplay'))
: true,
username: localStorage.getItem('storedUsername'),
- isAuthorized: true
+ isAuthorized: true,
},
getters: {
- hostStatus: state => state.hostStatus,
- bmcTime: state => state.bmcTime,
- languagePreference: state => state.languagePreference,
- isUtcDisplay: state => state.isUtcDisplay,
- username: state => state.username,
- isAuthorized: state => state.isAuthorized
+ hostStatus: (state) => state.hostStatus,
+ bmcTime: (state) => state.bmcTime,
+ languagePreference: (state) => state.languagePreference,
+ isUtcDisplay: (state) => state.isUtcDisplay,
+ username: (state) => state.username,
+ isAuthorized: (state) => state.isAuthorized,
},
mutations: {
setBmcTime: (state, bmcTime) => (state.bmcTime = bmcTime),
@@ -54,23 +54,23 @@ const GlobalStore = {
(state.languagePreference = language),
setUsername: (state, username) => (state.username = username),
setUtcTime: (state, isUtcDisplay) => (state.isUtcDisplay = isUtcDisplay),
- setUnauthorized: state => {
+ setUnauthorized: (state) => {
state.isAuthorized = false;
window.setTimeout(() => {
state.isAuthorized = true;
}, 100);
- }
+ },
},
actions: {
async getBmcTime({ commit }) {
return await api
.get('/redfish/v1/Managers/bmc')
- .then(response => {
+ .then((response) => {
const bmcDateTime = response.data.DateTime;
const date = new Date(bmcDateTime);
commit('setBmcTime', date);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
getHostStatus({ commit }) {
api
@@ -85,9 +85,9 @@ const GlobalStore = {
commit('setHostStatus', PowerState);
}
})
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default GlobalStore;
diff --git a/src/store/modules/Health/BmcStore.js b/src/store/modules/Health/BmcStore.js
index 784bd449..73df10b8 100644
--- a/src/store/modules/Health/BmcStore.js
+++ b/src/store/modules/Health/BmcStore.js
@@ -3,10 +3,10 @@ import api from '@/store/api';
const ChassisStore = {
namespaced: true,
state: {
- bmc: null
+ bmc: null,
},
getters: {
- bmc: state => state.bmc
+ bmc: (state) => state.bmc,
},
mutations: {
setBmcInfo: (state, data) => {
@@ -32,16 +32,16 @@ const ChassisStore = {
bmc.statusState = data.Status.State;
bmc.uuid = data.UUID;
state.bmc = bmc;
- }
+ },
},
actions: {
async getBmcInfo({ commit }) {
return await api
.get('/redfish/v1/Managers/bmc')
.then(({ data }) => commit('setBmcInfo', data))
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default ChassisStore;
diff --git a/src/store/modules/Health/ChassisStore.js b/src/store/modules/Health/ChassisStore.js
index e9e58e72..251279e6 100644
--- a/src/store/modules/Health/ChassisStore.js
+++ b/src/store/modules/Health/ChassisStore.js
@@ -3,14 +3,14 @@ import api from '@/store/api';
const ChassisStore = {
namespaced: true,
state: {
- chassis: []
+ chassis: [],
},
getters: {
- chassis: state => state.chassis
+ chassis: (state) => state.chassis,
},
mutations: {
setChassisInfo: (state, data) => {
- state.chassis = data.map(chassis => {
+ state.chassis = data.map((chassis) => {
const {
Id,
Status = {},
@@ -18,7 +18,7 @@ const ChassisStore = {
SerialNumber,
ChassisType,
Manufacturer,
- PowerState
+ PowerState,
} = chassis;
return {
@@ -30,26 +30,26 @@ const ChassisStore = {
manufacturer: Manufacturer,
powerState: PowerState,
statusState: Status.State,
- healthRollup: Status.HealthRollup
+ healthRollup: Status.HealthRollup,
};
});
- }
+ },
},
actions: {
async getChassisInfo({ commit }) {
return await api
.get('/redfish/v1/Chassis')
.then(({ data: { Members = [] } }) =>
- Members.map(member => api.get(member['@odata.id']))
+ Members.map((member) => api.get(member['@odata.id']))
)
- .then(promises => api.all(promises))
- .then(response => {
+ .then((promises) => api.all(promises))
+ .then((response) => {
const data = response.map(({ data }) => data);
commit('setChassisInfo', data);
})
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default ChassisStore;
diff --git a/src/store/modules/Health/EventLogStore.js b/src/store/modules/Health/EventLogStore.js
index 79bee02a..bf1de2f4 100644
--- a/src/store/modules/Health/EventLogStore.js
+++ b/src/store/modules/Health/EventLogStore.js
@@ -17,31 +17,32 @@ const getHealthStatus = (events, loadedEvents) => {
// TODO: High priority events should also check if Log
// is resolved when the property is available in Redfish
-const getHighPriorityEvents = events =>
+const getHighPriorityEvents = (events) =>
events.filter(({ severity }) => severity === 'Critical');
const EventLogStore = {
namespaced: true,
state: {
allEvents: [],
- loadedEvents: false
+ loadedEvents: false,
},
getters: {
- allEvents: state => state.allEvents,
- highPriorityEvents: state => getHighPriorityEvents(state.allEvents),
- healthStatus: state => getHealthStatus(state.allEvents, state.loadedEvents)
+ allEvents: (state) => state.allEvents,
+ highPriorityEvents: (state) => getHighPriorityEvents(state.allEvents),
+ healthStatus: (state) =>
+ getHealthStatus(state.allEvents, state.loadedEvents),
},
mutations: {
setAllEvents: (state, allEvents) => (
(state.allEvents = allEvents), (state.loadedEvents = true)
- )
+ ),
},
actions: {
async getEventLogData({ commit }) {
return await api
.get('/redfish/v1/Systems/system/LogServices/EventLog/Entries')
.then(({ data: { Members = [] } = {} }) => {
- const eventLogs = Members.map(log => {
+ const eventLogs = Members.map((log) => {
const { Id, Severity, Created, EntryType, Message } = log;
return {
id: Id,
@@ -49,25 +50,25 @@ const EventLogStore = {
date: new Date(Created),
type: EntryType,
description: Message,
- uri: log['@odata.id']
+ uri: log['@odata.id'],
};
});
commit('setAllEvents', eventLogs);
})
- .catch(error => {
+ .catch((error) => {
console.log('Event Log Data:', error);
});
},
async deleteEventLogs({ dispatch }, uris = []) {
- const promises = uris.map(uri =>
- api.delete(uri).catch(error => {
+ const promises = uris.map((uri) =>
+ api.delete(uri).catch((error) => {
console.log(error);
return error;
})
);
return await api
.all(promises)
- .then(response => {
+ .then((response) => {
dispatch('getEventLogData');
return response;
})
@@ -95,8 +96,8 @@ const EventLogStore = {
return toastMessages;
})
);
- }
- }
+ },
+ },
};
export default EventLogStore;
diff --git a/src/store/modules/Health/FanStore.js b/src/store/modules/Health/FanStore.js
index 2de388bf..b4a4189a 100644
--- a/src/store/modules/Health/FanStore.js
+++ b/src/store/modules/Health/FanStore.js
@@ -3,33 +3,33 @@ import api from '@/store/api';
const FanStore = {
namespaced: true,
state: {
- fans: []
+ fans: [],
},
getters: {
- fans: state => state.fans
+ fans: (state) => state.fans,
},
mutations: {
setFanInfo: (state, data) => {
- state.fans = data.map(fan => {
+ state.fans = data.map((fan) => {
const { MemberId, Status = {}, PartNumber, SerialNumber } = fan;
return {
id: MemberId,
health: Status.Health,
partNumber: PartNumber,
serialNumber: SerialNumber,
- statusState: Status.State
+ statusState: Status.State,
};
});
- }
+ },
},
actions: {
async getFanInfo({ commit }) {
return await api
.get('/redfish/v1/Chassis/chassis/Thermal')
.then(({ data: { Fans = [] } }) => commit('setFanInfo', Fans))
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default FanStore;
diff --git a/src/store/modules/Health/MemoryStore.js b/src/store/modules/Health/MemoryStore.js
index 63e08e6a..cd2478de 100644
--- a/src/store/modules/Health/MemoryStore.js
+++ b/src/store/modules/Health/MemoryStore.js
@@ -3,10 +3,10 @@ import api from '@/store/api';
const MemoryStore = {
namespaced: true,
state: {
- dimms: []
+ dimms: [],
},
getters: {
- dimms: state => state.dimms
+ dimms: (state) => state.dimms,
},
mutations: {
setMemoryInfo: (state, data) => {
@@ -17,23 +17,23 @@ const MemoryStore = {
health: Status.Health,
partNumber: PartNumber,
serialNumber: SerialNumber,
- statusState: Status.State
+ statusState: Status.State,
};
});
- }
+ },
},
actions: {
async getDimms({ commit }) {
return await api
.get('/redfish/v1/Systems/system/Memory')
.then(({ data: { Members } }) => {
- const promises = Members.map(item => api.get(item['@odata.id']));
+ const promises = Members.map((item) => api.get(item['@odata.id']));
return api.all(promises);
})
- .then(response => commit('setMemoryInfo', response))
- .catch(error => console.log(error));
- }
- }
+ .then((response) => commit('setMemoryInfo', response))
+ .catch((error) => console.log(error));
+ },
+ },
};
export default MemoryStore;
diff --git a/src/store/modules/Health/PowerSupplyStore.js b/src/store/modules/Health/PowerSupplyStore.js
index 4e3d5fef..565715fa 100644
--- a/src/store/modules/Health/PowerSupplyStore.js
+++ b/src/store/modules/Health/PowerSupplyStore.js
@@ -3,14 +3,14 @@ import api from '@/store/api';
const PowerSupplyStore = {
namespaced: true,
state: {
- powerSupplies: []
+ powerSupplies: [],
},
getters: {
- powerSupplies: state => state.powerSupplies
+ powerSupplies: (state) => state.powerSupplies,
},
mutations: {
setPowerSupply: (state, data) => {
- state.powerSupplies = data.map(powerSupply => {
+ state.powerSupplies = data.map((powerSupply) => {
const {
EfficiencyPercent,
FirmwareVersion,
@@ -20,7 +20,7 @@ const PowerSupplyStore = {
PartNumber,
PowerInputWatts,
SerialNumber,
- Status
+ Status,
} = powerSupply;
return {
id: MemberId,
@@ -32,10 +32,10 @@ const PowerSupplyStore = {
indicatorLed: IndicatorLED,
model: Model,
powerInputWatts: PowerInputWatts,
- statusState: Status.State
+ statusState: Status.State,
};
});
- }
+ },
},
actions: {
async getPowerSupply({ commit }) {
@@ -44,9 +44,9 @@ const PowerSupplyStore = {
.then(({ data: { PowerSupplies } }) =>
commit('setPowerSupply', PowerSupplies)
)
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default PowerSupplyStore;
diff --git a/src/store/modules/Health/ProcessorStore.js b/src/store/modules/Health/ProcessorStore.js
index a1411eb2..4a67c6b0 100644
--- a/src/store/modules/Health/ProcessorStore.js
+++ b/src/store/modules/Health/ProcessorStore.js
@@ -3,14 +3,14 @@ import api from '@/store/api';
const ProcessorStore = {
namespaced: true,
state: {
- processors: []
+ processors: [],
},
getters: {
- processors: state => state.processors
+ processors: (state) => state.processors,
},
mutations: {
setProcessorsInfo: (state, data) => {
- state.processors = data.map(processor => {
+ state.processors = data.map((processor) => {
const {
Id,
Status = {},
@@ -22,7 +22,7 @@ const ProcessorStore = {
Name,
ProcessorArchitecture,
ProcessorType,
- TotalCores
+ TotalCores,
} = processor;
return {
id: Id,
@@ -36,26 +36,26 @@ const ProcessorStore = {
name: Name,
processorArchitecture: ProcessorArchitecture,
processorType: ProcessorType,
- totalCores: TotalCores
+ totalCores: TotalCores,
};
});
- }
+ },
},
actions: {
async getProcessorsInfo({ commit }) {
return await api
.get('/redfish/v1/Systems/system/Processors')
.then(({ data: { Members = [] } }) =>
- Members.map(member => api.get(member['@odata.id']))
+ Members.map((member) => api.get(member['@odata.id']))
)
- .then(promises => api.all(promises))
- .then(response => {
+ .then((promises) => api.all(promises))
+ .then((response) => {
const data = response.map(({ data }) => data);
commit('setProcessorsInfo', data);
})
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default ProcessorStore;
diff --git a/src/store/modules/Health/SensorsStore.js b/src/store/modules/Health/SensorsStore.js
index 5f2bf52e..1c0de0db 100644
--- a/src/store/modules/Health/SensorsStore.js
+++ b/src/store/modules/Health/SensorsStore.js
@@ -4,15 +4,15 @@ import { uniqBy } from 'lodash';
const SensorsStore = {
namespaced: true,
state: {
- sensors: []
+ sensors: [],
},
getters: {
- sensors: state => state.sensors
+ sensors: (state) => state.sensors,
},
mutations: {
setSensors: (state, sensors) => {
state.sensors = uniqBy([...state.sensors, ...sensors], 'name');
- }
+ },
},
actions: {
async getAllSensors({ dispatch }) {
@@ -30,18 +30,18 @@ const SensorsStore = {
return await api
.get('/redfish/v1/Chassis')
.then(({ data: { Members } }) =>
- Members.map(member => member['@odata.id'])
+ Members.map((member) => member['@odata.id'])
)
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async getSensors({ commit }, id) {
const sensors = await api
.get(`${id}/Sensors`)
- .then(response => response.data.Members)
- .catch(error => console.log(error));
+ .then((response) => response.data.Members)
+ .catch((error) => console.log(error));
if (!sensors) return;
- const promises = sensors.map(sensor => {
- return api.get(sensor['@odata.id']).catch(error => {
+ const promises = sensors.map((sensor) => {
+ return api.get(sensor['@odata.id']).catch((error) => {
console.log(error);
return error;
});
@@ -57,7 +57,7 @@ const SensorsStore = {
upperCaution: data.Thresholds?.UpperCaution?.Reading,
lowerCritical: data.Thresholds?.LowerCritical?.Reading,
upperCritical: data.Thresholds?.UpperCritical?.Reading,
- units: data.ReadingUnits
+ units: data.ReadingUnits,
};
});
commit('setSensors', sensorData);
@@ -69,16 +69,16 @@ const SensorsStore = {
.get(`${id}/Thermal`)
.then(({ data: { Fans = [], Temperatures = [] } }) => {
const sensorData = [];
- Fans.forEach(sensor => {
+ Fans.forEach((sensor) => {
sensorData.push({
// TODO: add upper/lower threshold
name: sensor.Name,
status: sensor.Status.Health,
currentValue: sensor.Reading,
- units: sensor.ReadingUnits
+ units: sensor.ReadingUnits,
});
});
- Temperatures.forEach(sensor => {
+ Temperatures.forEach((sensor) => {
sensorData.push({
name: sensor.Name,
status: sensor.Status.Health,
@@ -87,18 +87,18 @@ const SensorsStore = {
upperCaution: sensor.UpperThresholdNonCritical,
lowerCritical: sensor.LowerThresholdCritical,
upperCritical: sensor.UpperThresholdCritical,
- units: '℃'
+ units: '℃',
});
});
commit('setSensors', sensorData);
})
- .catch(error => console.log(error));
+ .catch((error) => console.log(error));
},
async getPowerSensors({ commit }, id) {
return await api
.get(`${id}/Power`)
.then(({ data: { Voltages = [] } }) => {
- const sensorData = Voltages.map(sensor => {
+ const sensorData = Voltages.map((sensor) => {
return {
name: sensor.Name,
status: sensor.Status.Health,
@@ -107,14 +107,14 @@ const SensorsStore = {
upperCaution: sensor.UpperThresholdNonCritical,
lowerCritical: sensor.LowerThresholdCritical,
upperCritical: sensor.UpperThresholdCritical,
- units: 'Volts'
+ units: 'Volts',
};
});
commit('setSensors', sensorData);
})
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default SensorsStore;
diff --git a/src/store/modules/Health/SystemStore.js b/src/store/modules/Health/SystemStore.js
index 828b78bd..30ae66be 100644
--- a/src/store/modules/Health/SystemStore.js
+++ b/src/store/modules/Health/SystemStore.js
@@ -3,10 +3,10 @@ import api from '@/store/api';
const SystemStore = {
namespaced: true,
state: {
- systems: []
+ systems: [],
},
getters: {
- systems: state => state.systems
+ systems: (state) => state.systems,
},
mutations: {
setSystemInfo: (state, data) => {
@@ -26,16 +26,16 @@ const SystemStore = {
system.statusState = data.Status.State;
system.systemType = data.SystemType;
state.systems = [system];
- }
+ },
},
actions: {
async getSystem({ commit }) {
return await api
.get('/redfish/v1/Systems/system')
.then(({ data }) => commit('setSystemInfo', data))
- .catch(error => console.log(error));
- }
- }
+ .catch((error) => console.log(error));
+ },
+ },
};
export default SystemStore;