|
|
@ -60,7 +60,6 @@ var groupId, username;
|
|
|
|
* Setting-up global variables.
|
|
|
|
* Setting-up global variables.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
var deviceCheckbox = "#ast-container-parent .ctrl-wr-asset .itm-select input[type='checkbox']";
|
|
|
|
var deviceCheckbox = "#ast-container-parent .ctrl-wr-asset .itm-select input[type='checkbox']";
|
|
|
|
var assetContainerParent = "#ast-container-parent";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* DOM ready functions.
|
|
|
|
* DOM ready functions.
|
|
|
@ -88,7 +87,6 @@ $(document).ready(function () {
|
|
|
|
|
|
|
|
|
|
|
|
groupId = $("#request-group-id").data("groupid");
|
|
|
|
groupId = $("#request-group-id").data("groupid");
|
|
|
|
loadDevices();
|
|
|
|
loadDevices();
|
|
|
|
attachGroupAdding();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -475,66 +473,6 @@ var errorHandler = function () {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function attachGroupAdding() {
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Following click function would execute
|
|
|
|
|
|
|
|
* when a user clicks on "Remove" link
|
|
|
|
|
|
|
|
* on Group Management page in WSO2 IoT Server Console.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
$("a.add-group-link").click(function () {
|
|
|
|
|
|
|
|
var addGroupApi = "/iotserver/api/group/add";
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#add-group-modal-content').html());
|
|
|
|
|
|
|
|
showPopup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("a#add-group-yes-link").click(function () {
|
|
|
|
|
|
|
|
var newGroupName = $('#add-group-name').val();
|
|
|
|
|
|
|
|
var newGroupDescription = $('#add-group-description').val();
|
|
|
|
|
|
|
|
var group = {"name": newGroupName, "description": newGroupDescription};
|
|
|
|
|
|
|
|
invokerUtil.post(
|
|
|
|
|
|
|
|
addGroupApi,
|
|
|
|
|
|
|
|
group,
|
|
|
|
|
|
|
|
function (data, txtStatus, jqxhr) {
|
|
|
|
|
|
|
|
var status = jqxhr.status;
|
|
|
|
|
|
|
|
if (status == 200) {
|
|
|
|
|
|
|
|
if (data != "false") {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#add-group-200-content').html());
|
|
|
|
|
|
|
|
loadDevices();
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
}, 2000);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#group-400-content').html());
|
|
|
|
|
|
|
|
$("a#group-400-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (status == 400) {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#group-400-content').html());
|
|
|
|
|
|
|
|
$("a#group-400-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if (status == 403) {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#agroup-403-content').html());
|
|
|
|
|
|
|
|
$("a#group-403-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if (status == 409) {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#group-409-content').html());
|
|
|
|
|
|
|
|
$("a#group-409-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, errorHandler
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("a#add-group-cancel-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Following functions should be triggered after AJAX request is made.
|
|
|
|
* Following functions should be triggered after AJAX request is made.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|