Adding commit 'added change device status to device view page'

4.x.x
lakshani 8 years ago committed by Susinda
parent 3f90b403c0
commit 9e5574dccc

@ -1994,10 +1994,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
int tenantId = this.getTenantId();
switch (newStatus) {
case ACTIVE:
updateEnrollment(deviceId, enrolmentInfo, tenantId);
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
break;
case INACTIVE:
updateEnrollment(deviceId, enrolmentInfo, tenantId);
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
break;
case REMOVED:
isDeviceUpdated = disenrollDevice(deviceIdentifier);
@ -2010,12 +2010,16 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
private boolean updateEnrollment(int deviceId, EnrolmentInfo enrolmentInfo, int tenantId)
throws DeviceManagementException {
boolean isUpdatedEnrollment = false;
boolean isAutoCommit = true;
try {
DeviceManagementDAOFactory.openConnection();
isAutoCommit = DeviceManagementDAOFactory.getConnection().getAutoCommit();
DeviceManagementDAOFactory.getConnection().setAutoCommit(true);
enrollmentDAO.updateEnrollment(deviceId, enrolmentInfo, tenantId);
int updatedRows = enrollmentDAO.updateEnrollment(deviceId, enrolmentInfo, tenantId);
if (updatedRows > 0) {
isUpdatedEnrollment = true;
}
} catch (SQLException e) {
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
} catch (DeviceManagementDAOException e) {
@ -2029,7 +2033,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
DeviceManagementDAOFactory.closeConnection();
}
return true;
return isUpdatedEnrollment;
}

@ -202,4 +202,4 @@
"backendRestEndpoints": {
"deviceMgt": "/api/device-mgt/v1.0"
}
}
}

@ -18,8 +18,6 @@
function onRequest(context) {
var log = new Log("detail.js");
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var permissions = userModule.getUIPermissions();
var device = context.unit.params.device;
return {"device": device, "permissions":permissions};
return {"device": device};
}

@ -53,25 +53,25 @@
{{#if permissions.CHANGE_DEVICE_STATUS}}
{{#equal device.status "ACTIVE"}}<span><i id="statusIcon"
class="fw fw-success icon-success"></i>
<a href="#" id="status" data-type="select" data-pk="1" data-url="/post"
<a href="#" id="status" data-type="select" data-pk="1"
data-title="Select status"
selectedValue="Active"></a>
</span>{{/equal}}
{{#equal device.status "INACTIVE"}}<span><i id="statusIcon"
class="fw fw-warning icon-warning"></i>
<a href="#" id="status" data-type="select" data-pk="1" data-url="/post"
<a href="#" id="status" data-type="select" data-pk="1"
data-title="Select status"
selectedValue="Inactive"></a>
</span>{{/equal}}
{{#equal device.status "BLOCKED"}}<span><i id="statusIcon"
class="fw fw-remove icon-danger"></i>
<a href="#" id="status" data-type="select" data-pk="1" data-url="/post"
<a href="#" id="status" data-type="select" data-pk="1"
data-title="Select status"
selectedValue="Blocked"></a>
</span>{{/equal}}
{{#equal device.status "REMOVED"}}<span><i id="statusIcon"
class="fw fw-delete icon-danger"></i>
<a href="#" id="status" data-type="select" data-pk="1" data-url="/post"
<a href="#" id="status" data-type="select" data-pk="1"
data-title="Select status"
selectedValue="Removed"></a>
</span>{{/equal}}

@ -15,6 +15,7 @@
specific language governing permissions and limitations
under the License.
}}
{{unit "cdmf.unit.lib.editable"}}
{{#zone "content"}}
{{#if deviceFound}}
{{#if isAuthorized}}

@ -6609,4 +6609,11 @@ header.header-default {
.tooltip-overflow-fix{
overflow: visible !important;
.editable-input select{
height: 35px !important;
}
.editable-submit, .editable-cancel{
padding: 8px 15px !important;
line-height: 0px !important;
}

Loading…
Cancel
Save