diff --git a/frontend/js/app/audit-log/main.js b/frontend/js/app/audit-log/main.js
index ec9b5368..0d03c5ca 100644
--- a/frontend/js/app/audit-log/main.js
+++ b/frontend/js/app/audit-log/main.js
@@ -12,39 +12,68 @@ module.exports = Mn.View.extend({
ui: {
list_region: '.list-region',
- dimmer: '.dimmer'
+ dimmer: '.dimmer',
+ search: '.search-form',
+ query: 'input[name="source-query"]'
+ },
+
+ fetch: App.Api.AuditLog.getAll,
+
+ showData: function(response) {
+ this.showChildView('list_region', new ListView({
+ collection: new AuditLogModel.Collection(response)
+ }));
+ },
+
+ showError: function(err) {
+ this.showChildView('list_region', new ErrorView({
+ code: err.code,
+ message: err.message,
+ retry: function () {
+ App.Controller.showAuditLog();
+ }
+ }));
+
+ console.error(err);
+ },
+
+ showEmpty: function() {
+ this.showChildView('list_region', new EmptyView({
+ title: App.i18n('audit-log', 'empty'),
+ subtitle: App.i18n('audit-log', 'empty-subtitle')
+ }));
},
regions: {
list_region: '@ui.list_region'
},
+ events: {
+ 'submit @ui.search': function (e) {
+ e.preventDefault();
+ let query = this.ui.query.val();
+
+ this.fetch(['user'], query)
+ .then(response => this.showData(response))
+ .catch(err => {
+ this.showError(err);
+ });
+ }
+ },
+
onRender: function () {
let view = this;
- App.Api.AuditLog.getAll(['user'])
+ view.fetch(['user'])
.then(response => {
if (!view.isDestroyed() && response && response.length) {
- view.showChildView('list_region', new ListView({
- collection: new AuditLogModel.Collection(response)
- }));
+ view.showData(response);
} else {
- view.showChildView('list_region', new EmptyView({
- title: App.i18n('audit-log', 'empty'),
- subtitle: App.i18n('audit-log', 'empty-subtitle')
- }));
+ view.showEmpty();
}
})
.catch(err => {
- view.showChildView('list_region', new ErrorView({
- code: err.code,
- message: err.message,
- retry: function () {
- App.Controller.showAuditLog();
- }
- }));
-
- console.error(err);
+ view.showError(err);
})
.then(() => {
view.ui.dimmer.removeClass('active');
diff --git a/frontend/js/app/controller.js b/frontend/js/app/controller.js
index 902659be..ccb2978a 100644
--- a/frontend/js/app/controller.js
+++ b/frontend/js/app/controller.js
@@ -366,6 +366,19 @@ module.exports = {
}
},
+ /**
+ * Certificate Test Reachability
+ *
+ * @param model
+ */
+ showNginxCertificateTestReachability: function (model) {
+ if (Cache.User.isAdmin() || Cache.User.canManage('certificates')) {
+ require(['./main', './nginx/certificates/test'], function (App, View) {
+ App.UI.showModalDialog(new View({model: model}));
+ });
+ }
+ },
+
/**
* Audit Log
*/
diff --git a/frontend/js/app/nginx/access/main.ejs b/frontend/js/app/nginx/access/main.ejs
index c245ff4a..97585936 100644
--- a/frontend/js/app/nginx/access/main.ejs
+++ b/frontend/js/app/nginx/access/main.ejs
@@ -3,6 +3,14 @@
diff --git a/frontend/js/app/nginx/certificates/form.js b/frontend/js/app/nginx/certificates/form.js
index 65a54b69..a56c3f8e 100644
--- a/frontend/js/app/nginx/certificates/form.js
+++ b/frontend/js/app/nginx/certificates/form.js
@@ -29,6 +29,8 @@ module.exports = Mn.View.extend({
non_loader_content: '.non-loader-content',
le_error_info: '#le-error-info',
domain_names: 'input[name="domain_names"]',
+ test_domains_container: '.test-domains-container',
+ test_domains_button: '.test-domains',
buttons: '.modal-footer button',
cancel: 'button.cancel',
save: 'button.save',
@@ -56,10 +58,12 @@ module.exports = Mn.View.extend({
this.ui.dns_provider_credentials.prop('required', 'required');
}
this.ui.dns_challenge_content.show();
+ this.ui.test_domains_container.hide();
} else {
this.ui.dns_provider.prop('required', false);
this.ui.dns_provider_credentials.prop('required', false);
- this.ui.dns_challenge_content.hide();
+ this.ui.dns_challenge_content.hide();
+ this.ui.test_domains_container.show();
}
},
@@ -205,6 +209,23 @@ module.exports = Mn.View.extend({
this.ui.non_loader_content.show();
});
},
+ 'click @ui.test_domains_button': function (e) {
+ e.preventDefault();
+ const domainNames = this.ui.domain_names[0].value.split(',');
+ if (domainNames && domainNames.length > 0) {
+ this.model.set('domain_names', domainNames);
+ this.model.set('back_to_add', true);
+ App.Controller.showNginxCertificateTestReachability(this.model);
+ }
+ },
+ 'change @ui.domain_names': function(e){
+ const domainNames = e.target.value.split(',');
+ if (domainNames && domainNames.length > 0) {
+ this.ui.test_domains_button.prop('disabled', false);
+ } else {
+ this.ui.test_domains_button.prop('disabled', true);
+ }
+ },
'change @ui.other_certificate_key': function(e){
this.setFileName("other_certificate_key_label", e)
},
@@ -257,6 +278,12 @@ module.exports = Mn.View.extend({
this.ui.credentials_file_content.hide();
this.ui.loader_content.hide();
this.ui.le_error_info.hide();
+ if (this.ui.domain_names[0]) {
+ const domainNames = this.ui.domain_names[0].value.split(',');
+ if (!domainNames || domainNames.length === 0 || (domainNames.length === 1 && domainNames[0] === "")) {
+ this.ui.test_domains_button.prop('disabled', true);
+ }
+ }
},
initialize: function (options) {
diff --git a/frontend/js/app/nginx/certificates/list/item.ejs b/frontend/js/app/nginx/certificates/list/item.ejs
index 87930dce..bdeeecad 100644
--- a/frontend/js/app/nginx/certificates/list/item.ejs
+++ b/frontend/js/app/nginx/certificates/list/item.ejs
@@ -41,6 +41,10 @@
<% if (provider === 'letsencrypt') { %>
<%- i18n('certificates', 'force-renew') %>
+
<%- i18n('certificates', 'download') %>
+ <% if (meta.dns_challenge === false) { %>
+
<%- i18n('certificates', 'test-reachability') %>
+ <% } %>
<% } %>
<%- i18n('str', 'delete') %>
diff --git a/frontend/js/app/nginx/certificates/list/item.js b/frontend/js/app/nginx/certificates/list/item.js
index c967fdb8..7fa1c681 100644
--- a/frontend/js/app/nginx/certificates/list/item.js
+++ b/frontend/js/app/nginx/certificates/list/item.js
@@ -2,7 +2,7 @@ const Mn = require('backbone.marionette');
const moment = require('moment');
const App = require('../../../main');
const template = require('./item.ejs');
-const dns_providers = require('../../../../../../global/certbot-dns-plugins')
+const dns_providers = require('../../../../../../global/certbot-dns-plugins');
module.exports = Mn.View.extend({
template: template,
@@ -11,7 +11,9 @@ module.exports = Mn.View.extend({
ui: {
host_link: '.host-link',
renew: 'a.renew',
- delete: 'a.delete'
+ delete: 'a.delete',
+ download: 'a.download',
+ test: 'a.test'
},
events: {
@@ -29,7 +31,17 @@ module.exports = Mn.View.extend({
e.preventDefault();
let win = window.open($(e.currentTarget).attr('rel'), '_blank');
win.focus();
- }
+ },
+
+ 'click @ui.download': function (e) {
+ e.preventDefault();
+ App.Api.Nginx.Certificates.download(this.model.get('id'));
+ },
+
+ 'click @ui.test': function (e) {
+ e.preventDefault();
+ App.Controller.showNginxCertificateTestReachability(this.model);
+ },
},
templateContext: {
diff --git a/frontend/js/app/nginx/certificates/main.ejs b/frontend/js/app/nginx/certificates/main.ejs
index cc3624d5..dbd6fa85 100644
--- a/frontend/js/app/nginx/certificates/main.ejs
+++ b/frontend/js/app/nginx/certificates/main.ejs
@@ -3,6 +3,14 @@