Change to comply with JAX-RS update

application-manager-new
charithag 9 years ago
parent 570a8ba0ba
commit 1eb60aa8c5

@ -67,9 +67,8 @@ if (uriMatcher.match("/{context}/api/group/add")) {
groupId = uriMatcher.elements().groupId;
//URL: DELETE https://localhost:9443/devicecloud/group_manager/group/id/{groupId}
endPoint = deviceCloudService + "/group/id/" + groupId;
data = {"username": user.username};
result = del(endPoint, data, "json");
endPoint = deviceCloudService + "/group/id/" + groupId + "?username=" + user.username;
result = del(endPoint, {}, "json");
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}")) {
groupId = uriMatcher.elements().groupId;
@ -139,9 +138,8 @@ if (uriMatcher.match("/{context}/api/group/add")) {
role = request.getContent()["role"];
//URL: DELETE https://localhost:9443/devicecloud/group_manager/group/id/{groupId}/role
endPoint = deviceCloudService + "/group/id/" + groupId + "/role";
data = {"username": user.username, "role": role};
result = del(endPoint, data, "json");
endPoint = deviceCloudService + "/group/id/" + groupId + "/role/" + role;
result = del(endPoint, {}, "json");
} else if (uriMatcher.match("/{context}/api/group/id/{groupId}/role/all")) {

@ -176,7 +176,7 @@
<h3>Exception at backend. Try Later.</h3>
<div class="buttons">
<a href="#" id="remove-user-400-link" class="btn-operations">
<a href="#" id="device-400-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
@ -189,10 +189,10 @@
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Action not permitted.</h3>
<h3>Operation not permitted.</h3>
<div class="buttons">
<a href="#" id="remove-device-403-link" class="btn-operations">
<a href="#" id="device-403-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
@ -217,22 +217,6 @@
</div>
</div>
<div id="device-unexpected-error-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Device does not exist.</h3>
<div class="buttons">
<a href="#" id="remove-device-unexpected-error-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
<div id="share-group-w1-modal-content" class="hide">
<div class="content">
<div class="row">
@ -403,14 +387,14 @@
</div>
</div>
<div id="group-unexpected-error-content" class="hide">
<div id="unexpected-error-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group does not exist.</h3>
<h3>Unexpected error occurred!</h3>
<div class="buttons">
<a href="#" id="group-unexpected-error-link" class="btn-operations">
<a href="#" id="unexpected-error-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>

@ -200,8 +200,8 @@ function loadDevices() {
}
};
invokerUtil.get(serviceURL,
successCallback, function (message) {
console.log(message);
successCallback, function (jqXHR) {
displayDeviceErrors(jqXHR);
});
});
}
@ -286,28 +286,12 @@ function attachDeviceEvents() {
setTimeout(function () {
hidePopup();
}, 2000);
} else if (status == 400) {
$(modalPopupContent).html($('#remove-device-400-content').html());
$("a#remove-device-400-link").click(function () {
hidePopup();
});
} else if (status == 403) {
$(modalPopupContent).html($('#remove-device-403-content').html());
$("a#remove-device-403-link").click(function () {
hidePopup();
});
} else if (status == 409) {
$(modalPopupContent).html($('#remove-device-409-content').html());
$("a#remove-device-409-link").click(function () {
hidePopup();
});
} else {
displayDeviceErrors(jqXHR);
}
},
function () {
$(modalPopupContent).html($('#remove-device-unexpected-error-content').html());
$("a#remove-device-unexpected-error-link").click(function () {
hidePopup();
});
function (jqXHR) {
displayDeviceErrors(jqXHR);
}
);
});
@ -347,28 +331,12 @@ function attachDeviceEvents() {
setTimeout(function () {
hidePopup();
}, 2000);
} else if (status == 400) {
$(modalPopupContent).html($('#device-400-content').html());
$("a#device-400-link").click(function () {
hidePopup();
});
} else if (status == 403) {
$(modalPopupContent).html($('#device-403-content').html());
$("a#device-403-link").click(function () {
hidePopup();
});
} else if (status == 409) {
$(modalPopupContent).html($('#device-409-content').html());
$("a#device-409-link").click(function () {
hidePopup();
});
} else {
displayDeviceErrors(jqXHR);
}
},
function () {
$(modalPopupContent).html($('#device-unexpected-error-content').html());
$("a#device-unexpected-error-link").click(function () {
hidePopup();
});
function (jqXHR) {
displayDeviceErrors(jqXHR);
}
);
});
@ -425,39 +393,21 @@ function attachDeviceEvents() {
setTimeout(function () {
hidePopup();
}, 2000);
} else if (status == 400) {
$(modalPopupContent).html($('#device-400-content').html());
$("a#device-400-link").click(function () {
hidePopup();
});
} else if (status == 403) {
$(modalPopupContent).html($('#device-403-content').html());
$("a#device-403-link").click(function () {
hidePopup();
});
} else if (status == 409) {
$(modalPopupContent).html($('#device-409-content').html());
$("a#device-409-link").click(function () {
hidePopup();
});
} else {
displayDeviceErrors(jqXHR);
}
},
function () {
$(modalPopupContent).html($('#device-unexpected-error-content').html());
$("a#device-unexpected-error-link").click(function () {
hidePopup();
});
});
function (jqXHR) {
displayDeviceErrors(jqXHR);
}
);
});
}
},
function () {
$(modalPopupContent).html($('#device-unexpected-error-content').html());
$("a#device-unexpected-error-link").click(function () {
hidePopup();
});
});
function (jqXHR) {
displayDeviceErrors(jqXHR);
}
);
$("a#group-device-cancel-link").click(function () {
hidePopup();
});
@ -466,13 +416,6 @@ function attachDeviceEvents() {
}
}
var errorHandler = function () {
$(modalPopupContent).html($('#add-group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
};
/**
* Following functions should be triggered after AJAX request is made.
*/
@ -556,22 +499,31 @@ function attachGroupEvents() {
hidePopup();
}, 2000);
} else {
displayErrors(status);
displayGroupErrors(status);
}
}, errorHandler);
}, function (jqXHR) {
displayGroupErrors(jqXHR);
}
);
});
} else {
displayErrors(status);
displayGroupErrors(status);
}
}, errorHandler);
}, function (jqXHR) {
displayGroupErrors(jqXHR);
}
);
$("a#share-group-w2-cancel-link").click(function () {
hidePopup();
});
});
} else {
displayErrors(status);
displayGroupErrors(status);
}
}, errorHandler);
}, function (jqXHR) {
displayGroupErrors(jqXHR);
}
);
$("a#share-group-w1-cancel-link").click(function () {
hidePopup();
@ -603,14 +555,11 @@ function attachGroupEvents() {
hidePopup();
}, 2000);
} else {
displayErrors(status);
displayGroupErrors(status);
}
},
function () {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
function (jqXHR) {
displayGroupErrors(jqXHR);
}
);
});
@ -660,14 +609,11 @@ function attachGroupEvents() {
});
}
} else {
displayErrors(status);
displayGroupErrors(status);
}
},
function () {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
function (jqXHR) {
displayGroupErrors(jqXHR);
}
);
});
@ -678,21 +624,55 @@ function attachGroupEvents() {
});
}
function displayErrors(status) {
if (status == 400) {
function displayDeviceErrors(jqXHR) {
showPopup();
if (jqXHR.status == 400) {
$(modalPopupContent).html($('#group-400-content').html());
$("a#group-400-link").click(function () {
hidePopup();
});
} else if (status == 403) {
} else if (jqXHR.status == 403) {
$(modalPopupContent).html($('#group-403-content').html());
$("a#group-403-link").click(function () {
hidePopup();
});
} else if (status == 409) {
} else if (jqXHR.status == 409) {
$(modalPopupContent).html($('#group-409-content').html());
$("a#group-409-link").click(function () {
hidePopup();
});
} else {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
console.log("Error code: " + jqXHR.status);
}
}
function displayGroupErrors(jqXHR) {
showPopup();
if (jqXHR.status == 400) {
$(modalPopupContent).html($('#group-400-content').html());
$("a#group-400-link").click(function () {
hidePopup();
});
} else if (jqXHR.status == 403) {
$(modalPopupContent).html($('#group-403-content').html());
$("a#group-403-link").click(function () {
hidePopup();
});
} else if (jqXHR.status == 409) {
$(modalPopupContent).html($('#group-409-content').html());
$("a#group-409-link").click(function () {
hidePopup();
});
} else {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
console.log("Error code: " + jqXHR.status);
}
}

@ -173,7 +173,7 @@
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Action not permitted.</h3>
<h3>Operation not permitted.</h3>
<div class="buttons">
<a href="#" id="group-403-link" class="btn-operations">
@ -205,7 +205,7 @@
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group does not exist.</h3>
<h3>Unexpected error occurred!</h3>
<div class="buttons">
<a href="#" id="group-unexpected-error-link" class="btn-operations">

@ -165,8 +165,8 @@ function loadGroups(searchType, searchParam) {
}
};
invokerUtil.get(serviceURL,
successCallback, function (message) {
console.log(message);
successCallback, function (jqXHR) {
displayErrors(jqXHR);
});
});
}
@ -222,13 +222,6 @@ function hidePopup() {
$(modalPopup).hide();
}
var errorHandler = function () {
$(modalPopupContent).html($('#add-group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
};
/**
* Following functions should be triggered after AJAX request is made.
*/
@ -324,12 +317,18 @@ function attachEvents() {
} else {
displayErrors(status);
}
}, errorHandler);
}, function (jqXHR) {
displayErrors(jqXHR);
}
);
});
} else {
displayErrors(status);
}
}, errorHandler);
}, function (jqXHR) {
displayErrors(jqXHR);
}
);
$("a#share-group-w2-cancel-link").click(function () {
hidePopup();
});
@ -337,7 +336,10 @@ function attachEvents() {
} else {
displayErrors(status);
}
}, errorHandler);
}, function (jqXHR) {
displayErrors(jqXHR);
}
);
$("a#share-group-w1-cancel-link").click(function () {
hidePopup();
@ -372,11 +374,8 @@ function attachEvents() {
displayErrors(status);
}
},
function () {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
function (jqXHR) {
displayErrors(jqXHR);
}
);
});
@ -429,11 +428,8 @@ function attachEvents() {
displayErrors(status);
}
},
function () {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
function (jqXHR) {
displayErrors(jqXHR);
}
);
});
@ -444,21 +440,28 @@ function attachEvents() {
});
}
function displayErrors(status) {
if (status == 400) {
function displayErrors(jqXHR) {
showPopup();
if (jqXHR.status == 400) {
$(modalPopupContent).html($('#group-400-content').html());
$("a#group-400-link").click(function () {
hidePopup();
});
} else if (status == 403) {
} else if (jqXHR.status == 403) {
$(modalPopupContent).html($('#group-403-content').html());
$("a#group-403-link").click(function () {
hidePopup();
});
} else if (status == 409) {
} else if (jqXHR.status == 409) {
$(modalPopupContent).html($('#group-409-content').html());
$("a#group-409-link").click(function () {
hidePopup();
});
} else {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
hidePopup();
});
console.log("Error code: " + jqXHR.status);
}
}

Loading…
Cancel
Save