diff --git a/ui/index.jsp b/ui/index.jsp index d42dfa265cc..a41509cf758 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -909,8 +909,11 @@
-
+
+
+
+
diff --git a/ui/scripts/ui-custom/physicalResources.js b/ui/scripts/ui-custom/physicalResources.js index 21bf89b4a81..efda1f36473 100644 --- a/ui/scripts/ui-custom/physicalResources.js +++ b/ui/scripts/ui-custom/physicalResources.js @@ -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;