mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Adding commit 'added change device status to device view page'
This commit is contained in:
parent
3f90b403c0
commit
9e5574dccc
@ -1994,10 +1994,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
int tenantId = this.getTenantId();
|
int tenantId = this.getTenantId();
|
||||||
switch (newStatus) {
|
switch (newStatus) {
|
||||||
case ACTIVE:
|
case ACTIVE:
|
||||||
updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
||||||
break;
|
break;
|
||||||
case INACTIVE:
|
case INACTIVE:
|
||||||
updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
isDeviceUpdated = updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
||||||
break;
|
break;
|
||||||
case REMOVED:
|
case REMOVED:
|
||||||
isDeviceUpdated = disenrollDevice(deviceIdentifier);
|
isDeviceUpdated = disenrollDevice(deviceIdentifier);
|
||||||
@ -2010,12 +2010,16 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
|
|
||||||
private boolean updateEnrollment(int deviceId, EnrolmentInfo enrolmentInfo, int tenantId)
|
private boolean updateEnrollment(int deviceId, EnrolmentInfo enrolmentInfo, int tenantId)
|
||||||
throws DeviceManagementException {
|
throws DeviceManagementException {
|
||||||
|
boolean isUpdatedEnrollment = false;
|
||||||
boolean isAutoCommit = true;
|
boolean isAutoCommit = true;
|
||||||
try {
|
try {
|
||||||
DeviceManagementDAOFactory.openConnection();
|
DeviceManagementDAOFactory.openConnection();
|
||||||
isAutoCommit = DeviceManagementDAOFactory.getConnection().getAutoCommit();
|
isAutoCommit = DeviceManagementDAOFactory.getConnection().getAutoCommit();
|
||||||
DeviceManagementDAOFactory.getConnection().setAutoCommit(true);
|
DeviceManagementDAOFactory.getConnection().setAutoCommit(true);
|
||||||
enrollmentDAO.updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
int updatedRows = enrollmentDAO.updateEnrollment(deviceId, enrolmentInfo, tenantId);
|
||||||
|
if (updatedRows > 0) {
|
||||||
|
isUpdatedEnrollment = true;
|
||||||
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
|
throw new DeviceManagementException("Error occurred while opening a connection to the data source", e);
|
||||||
} catch (DeviceManagementDAOException e) {
|
} catch (DeviceManagementDAOException e) {
|
||||||
@ -2029,7 +2033,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
}
|
}
|
||||||
DeviceManagementDAOFactory.closeConnection();
|
DeviceManagementDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
return true;
|
return isUpdatedEnrollment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
function onRequest(context) {
|
function onRequest(context) {
|
||||||
var log = new Log("detail.js");
|
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;
|
var device = context.unit.params.device;
|
||||||
return {"device": device, "permissions":permissions};
|
return {"device": device};
|
||||||
}
|
}
|
||||||
@ -53,25 +53,25 @@
|
|||||||
{{#if permissions.CHANGE_DEVICE_STATUS}}
|
{{#if permissions.CHANGE_DEVICE_STATUS}}
|
||||||
{{#equal device.status "ACTIVE"}}<span><i id="statusIcon"
|
{{#equal device.status "ACTIVE"}}<span><i id="statusIcon"
|
||||||
class="fw fw-success icon-success"></i>
|
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"
|
data-title="Select status"
|
||||||
selectedValue="Active"></a>
|
selectedValue="Active"></a>
|
||||||
</span>{{/equal}}
|
</span>{{/equal}}
|
||||||
{{#equal device.status "INACTIVE"}}<span><i id="statusIcon"
|
{{#equal device.status "INACTIVE"}}<span><i id="statusIcon"
|
||||||
class="fw fw-warning icon-warning"></i>
|
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"
|
data-title="Select status"
|
||||||
selectedValue="Inactive"></a>
|
selectedValue="Inactive"></a>
|
||||||
</span>{{/equal}}
|
</span>{{/equal}}
|
||||||
{{#equal device.status "BLOCKED"}}<span><i id="statusIcon"
|
{{#equal device.status "BLOCKED"}}<span><i id="statusIcon"
|
||||||
class="fw fw-remove icon-danger"></i>
|
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"
|
data-title="Select status"
|
||||||
selectedValue="Blocked"></a>
|
selectedValue="Blocked"></a>
|
||||||
</span>{{/equal}}
|
</span>{{/equal}}
|
||||||
{{#equal device.status "REMOVED"}}<span><i id="statusIcon"
|
{{#equal device.status "REMOVED"}}<span><i id="statusIcon"
|
||||||
class="fw fw-delete icon-danger"></i>
|
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"
|
data-title="Select status"
|
||||||
selectedValue="Removed"></a>
|
selectedValue="Removed"></a>
|
||||||
</span>{{/equal}}
|
</span>{{/equal}}
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
}}
|
}}
|
||||||
|
{{unit "cdmf.unit.lib.editable"}}
|
||||||
{{#zone "content"}}
|
{{#zone "content"}}
|
||||||
{{#if deviceFound}}
|
{{#if deviceFound}}
|
||||||
{{#if isAuthorized}}
|
{{#if isAuthorized}}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0"
|
"version": "1.0.0",
|
||||||
|
"index": 40
|
||||||
}
|
}
|
||||||
@ -6609,4 +6609,11 @@ header.header-default {
|
|||||||
|
|
||||||
.tooltip-overflow-fix{
|
.tooltip-overflow-fix{
|
||||||
overflow: visible !important;
|
overflow: visible !important;
|
||||||
|
|
||||||
|
.editable-input select{
|
||||||
|
height: 35px !important;
|
||||||
|
}
|
||||||
|
.editable-submit, .editable-cancel{
|
||||||
|
padding: 8px 15px !important;
|
||||||
|
line-height: 0px !important;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user