Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added missing dialog for renewing certs
- Loading branch information
Jamie Curnow
committed
May 8, 2019
1 parent
22e8961
commit 92fcae9
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
} | ||
}); |