From 32a9ff18ac5f494b44bddae4df84761f7edd6c01 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 18 May 2016 10:48:52 +0530 Subject: [PATCH] Fixing IOTS-159: Adding meaningfull messages --- .../public/js/operation-bar.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.operation-bar/public/js/operation-bar.js b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.operation-bar/public/js/operation-bar.js index 514508077f..3978e44e20 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.operation-bar/public/js/operation-bar.js +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.device.operation-bar/public/js/operation-bar.js @@ -61,9 +61,15 @@ function submitForm(formId) { var statusIcon = content.find("#status-icon"); var description = content.find("#description"); var successCallBack = function (response) { + var res = response; + try { + res = JSON.parse(response).messageFromServer; + } catch (err) { + //do nothing + } title.html("Response Received!"); - statusIcon.attr("class", defaultStatusClasses + " fw-success"); - description.html(response); + statusIcon.attr("class", defaultStatusClasses + " fw-check"); + description.html(res); $(modalPopupContent).html(content.html()); }; var errorCallBack = function (response) { @@ -94,9 +100,9 @@ function submitForm(formId) { $(document).on('submit', 'form', function (e) { e.preventDefault(); var postOperationRequest = $.ajax({ - url: $(this).attr("action") + '&' + $(this).serialize(), - method: "post" - }); + url: $(this).attr("action") + '&' + $(this).serialize(), + method: "post" + }); var btnSubmit = $('#btnSend', this); btnSubmit.addClass('hidden');