From fef7c07cb2fc53a7e40260b1487c9f603341b943 Mon Sep 17 00:00:00 2001 From: sameera910409 Date: Wed, 26 Oct 2016 10:08:48 +0530 Subject: [PATCH] add device group deleting and updating fixes --- .../cdmf.page.group.create/public/js/group-add.js | 2 +- .../pages/cdmf.page.groups/public/js/listing.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js index a259a6e361..2dc32ce70f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js @@ -59,7 +59,7 @@ $(function () { } }; - invokerUtil.post("/devicemgt_admin/groups", group, + invokerUtil.post("/api/device-mgt/v1.0/groups", group, successCallback, function (message) { displayErrors(message); }); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js index a9ab2d5216..140ba33559 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js @@ -170,10 +170,10 @@ function loadGroups() { ''; html += '' + + 'data-group-owner="' + row.owner + '" data-group-description="' + row.description + '" data-group-id="'+row.groupId+'">' + ''; - html += '' + ''; @@ -351,7 +351,7 @@ function attachEvents() { * on Group Management page in WSO2 IoT Server Console. */ $("a.remove-group-link").click(function () { - var groupName = $(this).data("group-name"); + var groupId = $(this).data("group-id"); var groupOwner = $(this).data("group-owner"); $(modalPopupContent).html($('#remove-group-modal-content').html()); @@ -359,7 +359,6 @@ function attachEvents() { $("a#remove-group-yes-link").click(function () { var successCallback = function (data, textStatus, xhr) { - data = JSON.parse(data); if (xhr.status == 200) { $(modalPopupContent).html($('#remove-group-200-content').html()); setTimeout(function () { @@ -371,7 +370,7 @@ function attachEvents() { } }; - invokerUtil.delete("/devicemgt_admin/groups/owner/" + groupOwner + "/name/" + groupName, + invokerUtil.delete("/api/device-mgt/v1.0/groups/id/" + groupId, successCallback, function (message) { displayErrors(message); }); @@ -389,6 +388,7 @@ function attachEvents() { * on Device Management page in WSO2 MDM Console. */ $("a.edit-group-link").click(function () { + var groupId = $(this).data("group-id"); var groupName = $(this).data("group-name"); var groupOwner = $(this).data("group-owner"); var groupDescription = $(this).data("group-description"); @@ -404,8 +404,8 @@ function attachEvents() { var group = {"name": newGroupName, "description": newGroupDescription, "owner": groupOwner}; var successCallback = function (data, textStatus, xhr) { - data = JSON.parse(data); if (xhr.status == 200) { + $(modalPopupContent).html($('#edit-group-200-content').html()); setTimeout(function () { hidePopup(); location.reload(false); @@ -415,7 +415,7 @@ function attachEvents() { } }; - invokerUtil.put("/devicemgt_admin/groups/owner/" + groupOwner + "/name/" + groupName, group, + invokerUtil.put("/api/device-mgt/v1.0/groups/id/" + groupId, group, successCallback, function (message) { displayErrors(message); });