4.x.x
charithag 9 years ago
parent a2cb6937c1
commit fd531555a3

@ -384,7 +384,7 @@ public class GroupDAOImpl implements GroupDAO {
Connection conn = GroupManagementDAOFactory.getConnection();
String sql = "SELECT COUNT(gm.ID) AS DEVICE_COUNT FROM DM_DEVICE_GROUP_MAP gm, (SELECT ID " +
"FROM DM_GROUP WHERE GROUP_NAME = ? AND OWNER = ? AND TENANT_ID = ?) dg " +
"WHERE gm.GROUP_ID = dg.ID AND dm.TENANT_ID = ?";
"WHERE gm.GROUP_ID = dg.ID AND gm.TENANT_ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, groupName);
stmt.setString(2, owner);

@ -55,6 +55,11 @@
{{/zone}}
{{#zone "content"}}
<div class="row wr-device-board" style="margin-top: -10px;">
<div class="col-lg-12 wr-secondary-bar">
<span class="page-sub-title">{{title}}</span>
</div>
</div>
<div class="wr-device-list row">
<div class="wr-hidden-operations wr-advance-operations"></div>
<div class="col-md-12 wr-page-content">
@ -275,7 +280,7 @@
<div id="device-400-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Exception at backend. Try Later.</h3>
<br/>
<div class="buttons">
@ -291,7 +296,7 @@
<div id="device-403-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Operation not permitted.</h3>
<br/>
<div class="buttons">
@ -304,10 +309,30 @@
</div>
</div>
<div id="group-404-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>You don't have any groups to add this device. Please add group first.</h3>
<br/>
<div class="buttons">
<a href="{{@app.context}}/group/add" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Add New Group&nbsp;&nbsp;&nbsp;&nbsp;
</a>
&nbsp;&nbsp;
<a href="#" id="cancel-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-409-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Device does not exist.</h3>
<br/>
<div class="buttons">

@ -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*/
$('[data-toggle="tooltip"]').tooltip();
@ -532,10 +520,6 @@ function attachDeviceEvents() {
invokerUtil.get(serviceURL, function (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;">';
for (var i = 0; i < groups.length; i++) {
str += '<option value="' + groups[i].owner + "/name/" + groups[i].name + '">' +
@ -554,12 +538,19 @@ function attachDeviceEvents() {
hidePopup();
location.reload(false);
}, 2000);
}, function (message) {
}, function (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);
}
});
$("a#group-device-cancel-link").click(function () {
@ -636,23 +627,23 @@ function attachDeviceEvents() {
function displayDeviceErrors(jqXHR) {
showPopup();
if (jqXHR.status == 400) {
$(modalPopupContent).html($('#group-400-content').html());
$("a#group-400-link").click(function () {
$(modalPopupContent).html($('#device-400-content').html());
$("a#device-400-link").click(function () {
hidePopup();
});
} else if (jqXHR.status == 403) {
$(modalPopupContent).html($('#group-403-content').html());
$("a#group-403-link").click(function () {
$(modalPopupContent).html($('#device-403-content').html());
$("a#device-403-link").click(function () {
hidePopup();
});
} else if (jqXHR.status == 409) {
$(modalPopupContent).html($('#group-409-content').html());
$("a#group-409-link").click(function () {
$(modalPopupContent).html($('#device-409-content').html());
$("a#device-409-link").click(function () {
hidePopup();
});
} else {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
$("a#group-unexpected-error-link").click(function () {
$(modalPopupContent).html($('#device-unexpected-error-content').html());
$("a#device-unexpected-error-link").click(function () {
hidePopup();
});
console.log("Error code: " + jqXHR.status);

Loading…
Cancel
Save