Added missing dialog for renewing certs

This commit is contained in:
Jamie Curnow 2019-05-08 15:34:14 +10:00
parent 22e8961c80
commit 92fcae9c54
2 changed files with 45 additions and 0 deletions

View File

@ -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>

View File

@ -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);
});
}
});