Skip to content

Commit d5b3e53

Browse files
committed
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.
1 parent c664e86 commit d5b3e53

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

frontend/js/app/api.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,37 @@ module.exports = {
632632
return getAllObjects('nginx/certificates', expand, query);
633633
},
634634

635+
/**
636+
* Retrieve all certificates which have a type suitable for use as
637+
* server certificates. This filters by provider for returned rows.
638+
*
639+
* @param {Array} [expand]
640+
* @param {String} [query]
641+
* @returns {Promise}
642+
*/
643+
getAllServerCertificates: function (expand, query) {
644+
return getAllObjects('nginx/certificates', expand, query)
645+
.then(rows => {
646+
return rows.filter( row => row.provider !== 'clientca' );
647+
})
648+
},
649+
650+
/**
651+
* Retrieve all certificates which have a type suitable for use as
652+
* client authentication certificates. This filters by provider for
653+
* returned rows.
654+
*
655+
* @param {Array} [expand]
656+
* @param {String} [query]
657+
* @returns {Promise}
658+
*/
659+
getAllClientCertificates: function (expand, query) {
660+
return getAllObjects('nginx/certificates', expand, query)
661+
.then(rows => {
662+
return rows.filter( row => row.provider === 'clientca' );
663+
})
664+
},
665+
635666
/**
636667
* @param {Object} data
637668
*/

frontend/js/app/nginx/dead/form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ module.exports = Mn.View.extend({
263263
}
264264
},
265265
load: function (query, callback) {
266-
App.Api.Nginx.Certificates.getAll()
266+
App.Api.Nginx.Certificates.getAllServerCertificates()
267267
.then(rows => {
268268
callback(rows);
269269
})

frontend/js/app/nginx/proxy/form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ module.exports = Mn.View.extend({
331331
}
332332
},
333333
load: function (query, callback) {
334-
App.Api.Nginx.Certificates.getAll()
334+
App.Api.Nginx.Certificates.getAllServerCertificates()
335335
.then(rows => {
336336
callback(rows);
337337
})

frontend/js/app/nginx/redirection/form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ module.exports = Mn.View.extend({
265265
}
266266
},
267267
load: function (query, callback) {
268-
App.Api.Nginx.Certificates.getAll()
268+
App.Api.Nginx.Certificates.getAllServerCertificates()
269269
.then(rows => {
270270
callback(rows);
271271
})

0 commit comments

Comments
 (0)