Automatically sort DNS challenge providers by display name on render

This commit is contained in:
chaptergy 2021-05-15 19:12:43 +02:00
parent 24d8cd57da
commit 4c3632d3e7
No known key found for this signature in database
GPG Key ID: 4AC3BC8E9F82CD91

View File

@ -4,11 +4,20 @@ const App = require('../../main');
const CertificateModel = require('../../../models/certificate');
const template = require('./form.ejs');
const i18n = require('../../i18n');
const dns_providers = require('../../../../../global/certbot-dns-plugins');
const dns_providers = sortProvidersAlphabetically(require('../../../../../global/certbot-dns-plugins'));
require('jquery-serializejson');
require('selectize');
function sortProvidersAlphabetically(obj) {
return Object.entries(obj)
.sort((a,b) => a[1].display_name.toLowerCase() > b[1].display_name.toLowerCase())
.reduce((result, entry) => {
result[entry[0]] = entry[1];
return result;
}, {});
}
module.exports = Mn.View.extend({
template: template,
className: 'modal-dialog',