added change device status to device view page

merge-requests/7/head
lakshani 8 years ago
parent 2d83033b26
commit a2679fde4c

@ -1979,10 +1979,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);
@ -1995,12 +1995,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) {
@ -2014,7 +2018,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
DeviceManagementDAOFactory.closeConnection();
}
return true;
return isUpdatedEnrollment;
}

@ -83,6 +83,7 @@
"perm:get-activity",
"perm:devices:delete",
"perm:devices:applications",
"perm:devices:change-status",
"perm:devices:effective-policy",
"perm:devices:compliance-data",
"perm:devices:features",

@ -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}}

@ -6580,3 +6580,11 @@ select > option:hover {
}
/** End **/
.editable-input select{
height: 35px !important;
}
.editable-submit, .editable-cancel{
padding: 8px 15px !important;
line-height: 0px !important;
}

Loading…
Cancel
Save