summaryrefslogtreecommitdiff
path: root/src/store/modules/AccessControl/SslCertificatesStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/modules/AccessControl/SslCertificatesStore.js')
-rw-r--r--src/store/modules/AccessControl/SslCertificatesStore.js54
1 files changed, 27 insertions, 27 deletions
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;