mirror of https://github.com/apache/cloudstack.git
bug 14023: add "update SSL Certificate" button in the first screen in Infrastructure page.
This commit is contained in:
parent
e1a3a6f2d9
commit
58add196be
|
|
@ -909,8 +909,11 @@
|
|||
<!-- System dashboard -->
|
||||
<div class="system-dashboard-view">
|
||||
<div class="toolbar">
|
||||
<div class="button refresh">
|
||||
<div class="button refresh" id="refresh_button">
|
||||
<span><fmt:message key="label.refresh"/></span>
|
||||
</div>
|
||||
<div class="button refresh" id="update_ssl_button">
|
||||
<span><fmt:message key="label.update.ssl"/></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,62 @@
|
|||
});
|
||||
|
||||
return function(args) {
|
||||
$dashboard.find('.button.refresh').click(function() {
|
||||
$dashboard.find('#update_ssl_button').click(function() {
|
||||
cloudStack.dialog.createForm({
|
||||
form: {
|
||||
title: 'label.update.ssl',
|
||||
fields: {
|
||||
certificate: { label: 'label.certificate' },
|
||||
privatekey: { label: 'label.privatekey' },
|
||||
domainsuffix: { label: 'label.domain.suffix' }
|
||||
}
|
||||
},
|
||||
after: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('uploadCustomCertificate'),
|
||||
data: {
|
||||
certificate: args.data.certificate,
|
||||
privatekey: args.data.privatekey,
|
||||
domainsuffix: args.data.domainsuffix
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
var jid = json.uploadcustomcertificateresponse.jobid;
|
||||
var timerKey = "uploadcustomcertificatejob_" + jid;
|
||||
$("body").everyTime(2000, timerKey, function() {
|
||||
$.ajax({
|
||||
url: createURL("queryAsyncJobResult&jobId=" + jid),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
}
|
||||
else {
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) {
|
||||
cloudStack.dialog.notice({ message: 'Update SSL Certiciate succeeded' });
|
||||
}
|
||||
else if (result.jobstatus == 2) {
|
||||
cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate. ' + fromdb(result.jobresult.errortext) });
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate. ' + parseXMLHttpResponse(XMLHttpResponse) });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
context: {}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
$dashboard.find('#refresh_button').click(function() {
|
||||
getData();
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue