|
|
@ -442,18 +442,6 @@ $(document).ready(function () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$(".ast-container").on("click", ".claim-btn", function(e) {
|
|
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
var deviceId = $(this).data("deviceid");
|
|
|
|
|
|
|
|
var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser;
|
|
|
|
|
|
|
|
var deviceIdentifier = {id: deviceId, type: "TemperatureController"};
|
|
|
|
|
|
|
|
invokerUtil.put(serviceURL, deviceIdentifier, function(message) {
|
|
|
|
|
|
|
|
console.log(message);
|
|
|
|
|
|
|
|
}, function(message){
|
|
|
|
|
|
|
|
console.log(message.content);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* for data tables*/
|
|
|
|
/* for data tables*/
|
|
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
|
|
|
|
|
|
|
|
|
@ -532,10 +520,6 @@ function attachDeviceEvents() {
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.get(serviceURL, function (data) {
|
|
|
|
invokerUtil.get(serviceURL, function (data) {
|
|
|
|
var groups = JSON.parse(data);
|
|
|
|
var groups = JSON.parse(data);
|
|
|
|
if (groups.length <= 0) {
|
|
|
|
|
|
|
|
$('#user-groups').html("There is no any groups available");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var str = '<br /><select id="assign-group-selector" style="color:#3f3f3f;padding:5px;width:250px;">';
|
|
|
|
var str = '<br /><select id="assign-group-selector" style="color:#3f3f3f;padding:5px;width:250px;">';
|
|
|
|
for (var i = 0; i < groups.length; i++) {
|
|
|
|
for (var i = 0; i < groups.length; i++) {
|
|
|
|
str += '<option value="' + groups[i].owner + "/name/" + groups[i].name + '">' +
|
|
|
|
str += '<option value="' + groups[i].owner + "/name/" + groups[i].name + '">' +
|
|
|
@ -554,12 +538,19 @@ function attachDeviceEvents() {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
|
location.reload(false);
|
|
|
|
location.reload(false);
|
|
|
|
}, 2000);
|
|
|
|
}, 2000);
|
|
|
|
}, function (message) {
|
|
|
|
}, function (jqXHR) {
|
|
|
|
displayDeviceErrors(jqXHR);
|
|
|
|
displayDeviceErrors(jqXHR);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, function (message) {
|
|
|
|
}, function (jqXHR) {
|
|
|
|
|
|
|
|
if (jqXHR.status == 404) {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($('#group-404-content').html());
|
|
|
|
|
|
|
|
$("a#cancel-link").click(function () {
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
displayDeviceErrors(jqXHR);
|
|
|
|
displayDeviceErrors(jqXHR);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$("a#group-device-cancel-link").click(function () {
|
|
|
|
$("a#group-device-cancel-link").click(function () {
|
|
|
@ -636,23 +627,23 @@ function attachDeviceEvents() {
|
|
|
|
function displayDeviceErrors(jqXHR) {
|
|
|
|
function displayDeviceErrors(jqXHR) {
|
|
|
|
showPopup();
|
|
|
|
showPopup();
|
|
|
|
if (jqXHR.status == 400) {
|
|
|
|
if (jqXHR.status == 400) {
|
|
|
|
$(modalPopupContent).html($('#group-400-content').html());
|
|
|
|
$(modalPopupContent).html($('#device-400-content').html());
|
|
|
|
$("a#group-400-link").click(function () {
|
|
|
|
$("a#device-400-link").click(function () {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (jqXHR.status == 403) {
|
|
|
|
} else if (jqXHR.status == 403) {
|
|
|
|
$(modalPopupContent).html($('#group-403-content').html());
|
|
|
|
$(modalPopupContent).html($('#device-403-content').html());
|
|
|
|
$("a#group-403-link").click(function () {
|
|
|
|
$("a#device-403-link").click(function () {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (jqXHR.status == 409) {
|
|
|
|
} else if (jqXHR.status == 409) {
|
|
|
|
$(modalPopupContent).html($('#group-409-content').html());
|
|
|
|
$(modalPopupContent).html($('#device-409-content').html());
|
|
|
|
$("a#group-409-link").click(function () {
|
|
|
|
$("a#device-409-link").click(function () {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$(modalPopupContent).html($('#group-unexpected-error-content').html());
|
|
|
|
$(modalPopupContent).html($('#device-unexpected-error-content').html());
|
|
|
|
$("a#group-unexpected-error-link").click(function () {
|
|
|
|
$("a#device-unexpected-error-link").click(function () {
|
|
|
|
hidePopup();
|
|
|
|
hidePopup();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
console.log("Error code: " + jqXHR.status);
|
|
|
|
console.log("Error code: " + jqXHR.status);
|
|
|
|