Add frontend support for the new clientca type

The frontend is modified to filter certificates from selector lists
so only non-clientca certificate types can be set as server certificates.
This commit is contained in:
Will Rouesnel
2023-05-25 00:37:27 +10:00
parent c664e864ce
commit d5b3e53140
4 changed files with 34 additions and 3 deletions

View File

@ -632,6 +632,37 @@ module.exports = {
return getAllObjects('nginx/certificates', expand, query); return getAllObjects('nginx/certificates', expand, query);
}, },
/**
* Retrieve all certificates which have a type suitable for use as
* server certificates. This filters by provider for returned rows.
*
* @param {Array} [expand]
* @param {String} [query]
* @returns {Promise}
*/
getAllServerCertificates: function (expand, query) {
return getAllObjects('nginx/certificates', expand, query)
.then(rows => {
return rows.filter( row => row.provider !== 'clientca' );
})
},
/**
* Retrieve all certificates which have a type suitable for use as
* client authentication certificates. This filters by provider for
* returned rows.
*
* @param {Array} [expand]
* @param {String} [query]
* @returns {Promise}
*/
getAllClientCertificates: function (expand, query) {
return getAllObjects('nginx/certificates', expand, query)
.then(rows => {
return rows.filter( row => row.provider === 'clientca' );
})
},
/** /**
* @param {Object} data * @param {Object} data
*/ */

View File

@ -263,7 +263,7 @@ module.exports = Mn.View.extend({
} }
}, },
load: function (query, callback) { load: function (query, callback) {
App.Api.Nginx.Certificates.getAll() App.Api.Nginx.Certificates.getAllServerCertificates()
.then(rows => { .then(rows => {
callback(rows); callback(rows);
}) })

View File

@ -331,7 +331,7 @@ module.exports = Mn.View.extend({
} }
}, },
load: function (query, callback) { load: function (query, callback) {
App.Api.Nginx.Certificates.getAll() App.Api.Nginx.Certificates.getAllServerCertificates()
.then(rows => { .then(rows => {
callback(rows); callback(rows);
}) })

View File

@ -265,7 +265,7 @@ module.exports = Mn.View.extend({
} }
}, },
load: function (query, callback) { load: function (query, callback) {
App.Api.Nginx.Certificates.getAll() App.Api.Nginx.Certificates.getAllServerCertificates()
.then(rows => { .then(rows => {
callback(rows); callback(rows);
}) })