Skip to content

Commit

Permalink
Added missing dialog for renewing certs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Curnow committed May 8, 2019
1 parent 22e8961 commit 92fcae9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/frontend/js/app/nginx/certificates/renew.ejs
@@ -0,0 +1,14 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><%- i18n('certificates', 'renew-title') %></h5>
</div>
<div class="modal-body">
<div class="waiting text-center">
<%= i18n('str', 'please-wait') %>
</div>
<div class="alert alert-danger error" role="alert"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary cancel" data-dismiss="modal" disabled><%- i18n('str', 'close') %></button>
</div>
</div>
31 changes: 31 additions & 0 deletions src/frontend/js/app/nginx/certificates/renew.js
@@ -0,0 +1,31 @@
const Mn = require('backbone.marionette');
const App = require('../../main');
const template = require('./renew.ejs');

module.exports = Mn.View.extend({
template: template,
className: 'modal-dialog',

ui: {
waiting: '.waiting',
error: '.error',
close: 'button.cancel'
},

onRender: function () {
this.ui.error.hide();

App.Api.Nginx.Certificates.renew(this.model.get('id'))
.then((result) => {
this.model.set(result);
setTimeout(() => {
App.UI.closeModal();
}, 1000);
})
.catch((err) => {
this.ui.waiting.hide();
this.ui.error.text(err.message).show();
this.ui.close.prop('disabled', false);
});
}
});

0 comments on commit 92fcae9

Please sign in to comment.