From 9e5574dccc834b4ab2f79d50c7757fd63f35b1b5 Mon Sep 17 00:00:00 2001 From: lakshani Date: Mon, 6 Feb 2017 22:23:55 +0530 Subject: [PATCH] Adding commit 'added change device status to device view page' --- .../service/DeviceManagementProviderServiceImpl.java | 12 ++++++++---- .../jaggeryapps/devicemgt/app/conf/config.json | 2 +- .../app/units/cdmf.unit.device.details/details.js | 4 +--- .../overview-section.hbs | 8 ++++---- .../app/units/cdmf.unit.device.view/view.hbs | 1 + .../app/units/cdmf.unit.lib.editable/editable.json | 3 ++- .../cdmf.unit.ui.theme/public/css/custom-desktop.css | 7 +++++++ 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index ad21486735..70ec598a59 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -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; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 4a75088a26..c8c58fe396 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -202,4 +202,4 @@ "backendRestEndpoints": { "deviceMgt": "/api/device-mgt/v1.0" } -} \ No newline at end of file +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.details/details.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.details/details.js index 045f9ffecb..cd1602cd5b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.details/details.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.details/details.js @@ -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}; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.overview-section/overview-section.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.overview-section/overview-section.hbs index f1c54965ea..c6cea1c6c1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.overview-section/overview-section.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.overview-section/overview-section.hbs @@ -53,25 +53,25 @@ {{#if permissions.CHANGE_DEVICE_STATUS}} {{#equal device.status "ACTIVE"}} - {{/equal}} {{#equal device.status "INACTIVE"}} - {{/equal}} {{#equal device.status "BLOCKED"}} - {{/equal}} {{#equal device.status "REMOVED"}} - {{/equal}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs index 252d7679ff..903224be54 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs @@ -15,6 +15,7 @@ specific language governing permissions and limitations under the License. }} +{{unit "cdmf.unit.lib.editable"}} {{#zone "content"}} {{#if deviceFound}} {{#if isAuthorized}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/editable.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/editable.json index 877ad82b4e..3fb741b843 100755 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/editable.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.lib.editable/editable.json @@ -1,3 +1,4 @@ { - "version": "1.0.0" + "version": "1.0.0", + "index": 40 } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css index fbdb93719c..d76b3d0858 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css @@ -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; }