add device group deleting and updating fixes

revert-70aa11f8
sameera910409 8 years ago
parent 41f367abfa
commit fef7c07cb2

@ -59,7 +59,7 @@ $(function () {
} }
}; };
invokerUtil.post("/devicemgt_admin/groups", group, invokerUtil.post("/api/device-mgt/v1.0/groups", group,
successCallback, function (message) { successCallback, function (message) {
displayErrors(message); displayErrors(message);
}); });

@ -170,10 +170,10 @@ function loadGroups() {
'<span class="hidden-xs hidden-on-grid-view">Share</span></a>'; '<span class="hidden-xs hidden-on-grid-view">Share</span></a>';
html += '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-group-link" data-group-name="' + row.name + '" ' + html += '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-group-link" data-group-name="' + row.name + '" ' +
'data-group-owner="' + row.owner + '" data-group-description="' + row.description + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' + 'data-group-owner="' + row.owner + '" data-group-description="' + row.description + '" data-group-id="'+row.groupId+'"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-edit fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>'; '<i class="fw fw-edit fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
html += '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-group-link" data-group-name="' + row.name + '" ' + html += '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-group-link" data-group-id="' + row.groupId + '" ' +
'data-group-owner="' + row.owner + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i>' + 'data-group-owner="' + row.owner + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-delete fw-stack-1x"></i>' +
'</span><span class="hidden-xs hidden-on-grid-view">Delete</span></a>'; '</span><span class="hidden-xs hidden-on-grid-view">Delete</span></a>';
@ -351,7 +351,7 @@ function attachEvents() {
* on Group Management page in WSO2 IoT Server Console. * on Group Management page in WSO2 IoT Server Console.
*/ */
$("a.remove-group-link").click(function () { $("a.remove-group-link").click(function () {
var groupName = $(this).data("group-name"); var groupId = $(this).data("group-id");
var groupOwner = $(this).data("group-owner"); var groupOwner = $(this).data("group-owner");
$(modalPopupContent).html($('#remove-group-modal-content').html()); $(modalPopupContent).html($('#remove-group-modal-content').html());
@ -359,7 +359,6 @@ function attachEvents() {
$("a#remove-group-yes-link").click(function () { $("a#remove-group-yes-link").click(function () {
var successCallback = function (data, textStatus, xhr) { var successCallback = function (data, textStatus, xhr) {
data = JSON.parse(data);
if (xhr.status == 200) { if (xhr.status == 200) {
$(modalPopupContent).html($('#remove-group-200-content').html()); $(modalPopupContent).html($('#remove-group-200-content').html());
setTimeout(function () { 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) { successCallback, function (message) {
displayErrors(message); displayErrors(message);
}); });
@ -389,6 +388,7 @@ function attachEvents() {
* on Device Management page in WSO2 MDM Console. * on Device Management page in WSO2 MDM Console.
*/ */
$("a.edit-group-link").click(function () { $("a.edit-group-link").click(function () {
var groupId = $(this).data("group-id");
var groupName = $(this).data("group-name"); var groupName = $(this).data("group-name");
var groupOwner = $(this).data("group-owner"); var groupOwner = $(this).data("group-owner");
var groupDescription = $(this).data("group-description"); var groupDescription = $(this).data("group-description");
@ -404,8 +404,8 @@ function attachEvents() {
var group = {"name": newGroupName, "description": newGroupDescription, "owner": groupOwner}; var group = {"name": newGroupName, "description": newGroupDescription, "owner": groupOwner};
var successCallback = function (data, textStatus, xhr) { var successCallback = function (data, textStatus, xhr) {
data = JSON.parse(data);
if (xhr.status == 200) { if (xhr.status == 200) {
$(modalPopupContent).html($('#edit-group-200-content').html());
setTimeout(function () { setTimeout(function () {
hidePopup(); hidePopup();
location.reload(false); 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) { successCallback, function (message) {
displayErrors(message); displayErrors(message);
}); });

Loading…
Cancel
Save