diff options
author | 2018-07-11 14:21:13 +0100 | |
---|---|---|
committer | 2018-07-12 17:40:19 +0100 | |
commit | c6d74e6cee17405b9d26506b06259ccb2f38c737 (patch) | |
tree | 9f5dabe5ceffe0e6b99a2bf77be812657953ae9b /client/client-monitoring/src/main/resources/webapp/js/ApexAjax.js | |
parent | b461c6505afddacbef90e3dc0bfa9d49609a626b (diff) |
Adding client deployment module to apex-pdp
Change-Id: Idd74e9846c3fa75d305a9dde98a98d92dd0520a9
Issue-ID: POLICY-864
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'client/client-monitoring/src/main/resources/webapp/js/ApexAjax.js')
-rw-r--r-- | client/client-monitoring/src/main/resources/webapp/js/ApexAjax.js | 113 |
1 files changed, 54 insertions, 59 deletions
diff --git a/client/client-monitoring/src/main/resources/webapp/js/ApexAjax.js b/client/client-monitoring/src/main/resources/webapp/js/ApexAjax.js index e62489fa2..beb2cb11d 100644 --- a/client/client-monitoring/src/main/resources/webapp/js/ApexAjax.js +++ b/client/client-monitoring/src/main/resources/webapp/js/ApexAjax.js @@ -22,68 +22,63 @@ * Send a GET request */ function ajax_get(requestURL, callback, hostName, port, params, errorCallback) { - var data = { - hostName : hostName, - port : port - }; - for ( var p in params) { - data[p] = params[p]; - } - return $ - .ajax({ - type : 'GET', - url : requestURL, - dataType : "json", - data : data, - success : function(data, textStatus, jqXHR) { - if (callback) { - callback(data); - } - }, - error : function(jqXHR, textStatus, errorThrown) { - if (jqXHR.status == 500 || jqXHR.status == 404) { - if (jqXHR.responseText - .indexOf("cound not handshake with server") !== -1 - || jqXHR.status == 404) { - clearEngineURL(); - getEngineURL(jqXHR.responseText); - } else { - apexErrorDialog_activate(document.body, - jqXHR.responseText); - } - } - if (errorCallback) { - errorCallback(jqXHR, textStatus, errorThrown); - } - } - }); + var data = { + hostName : hostName, + port : port + }; + for ( var p in params) { + data[p] = params[p]; + } + return $.ajax({ + type : 'GET', + url : requestURL, + dataType : "json", + data : data, + success : function(data, textStatus, jqXHR) { + if (callback) { + callback(data); + } + }, + error : function(jqXHR, textStatus, errorThrown) { + if (jqXHR.status == 500 || jqXHR.status == 404) { + if (jqXHR.responseText.indexOf("cound not handshake with server") !== -1 || jqXHR.status == 404) { + clearEngineURL(); + getEngineURL(jqXHR.responseText); + } else { + apexErrorDialog_activate(document.body, jqXHR.responseText); + } + } + if (errorCallback) { + errorCallback(jqXHR, textStatus, errorThrown); + } + } + }); } /* * Send a POST request and add a file to its payload */ -function ajax_upload(requestURL, callback, hostName, port, fileUrl, - ignoreConflicts, forceUpdate) { - var formData = new FormData(); - formData.append("hostName", hostName); - formData.append("port", port); - formData.append("file", fileUrl); - formData.append("ignoreConflicts", ignoreConflicts); - formData.append("forceUpdate", forceUpdate); - return $.ajax({ - url : requestURL, - type : "POST", - contentType : false, - dataType : "text", - processData : false, - data : formData, - success : function(data, textStatus, jqXHR) { - callback(data); - }, - error : function(jqXHR, textStatus, errorThrown) { - if (jqXHR.status == 500) { - apexErrorDialog_activate(document.body, jqXHR.responseText); - } - } - }); +function ajax_upload(requestURL, callback, hostName, port, fileUrl, ignoreConflicts, forceUpdate) { + var formData = new FormData(); + formData.append("hostName", hostName); + formData.append("port", port); + formData.append("file", fileUrl); + formData.append("ignoreConflicts", ignoreConflicts); + formData.append("forceUpdate", forceUpdate); + return $.ajax({ + url : requestURL, + type : "POST", + contentType : false, + dataType : "text", + processData : false, + data : formData, + success : function(data, textStatus, jqXHR) { + callback(data); + }, + error : function(jqXHR, textStatus, errorThrown) { + if (jqXHR.status == 500) { + apexErrorDialog_activate(document.body, jqXHR.responseText); + } + } + }); } |