From 587f847934e26cd37ce8738af73f0621b34fb2f8 Mon Sep 17 00:00:00 2001 From: kamidu Date: Tue, 14 Feb 2017 19:28:09 +0530 Subject: [PATCH] ui improvements to device cloud --- .../pages/cdmf.page.dashboard/dashboard.hbs | 38 ++-- .../pages/cdmf.page.dashboard/dashboard.js | 1 + .../cdmf.page.roles/public/js/role-listing.js | 25 ++- .../app/pages/cdmf.page.roles/roles.hbs | 7 + .../app/pages/cdmf.page.roles/roles.js | 1 + .../app/pages/cdmf.page.user.view/view.hbs | 185 +++++++++--------- .../app/pages/cdmf.page.user.view/view.js | 6 +- .../app/pages/cdmf.page.users/users.hbs | 22 ++- .../app/pages/cdmf.page.users/users.js | 1 + .../user-menu.hbs | 148 +++++++------- .../units/cdmf.unit.ui.header.logo/logo.hbs | 4 +- .../cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs | 11 ++ .../cdmf.unit.ui.navbar.nav-menu/nav-menu.js | 1 + 13 files changed, 254 insertions(+), 196 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs index 1ed9f22d3e..90ec4bf89c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs @@ -35,18 +35,18 @@
{{deviceCount}} - + - {{#if deviceCount}} - + {{#if deviceCount}} + View - {{/if}} - + {{/if}} + @@ -66,7 +66,7 @@
@@ -97,7 +99,7 @@
{{userCount}} - + {{#if userCount}} @@ -108,14 +110,16 @@ View {{/if}} - - + + {{#unless isCloud}} + Add + {{/unless}}
@@ -128,7 +132,7 @@
{{policyCount}} - + {{#if policyCount}} @@ -139,14 +143,16 @@ View {{/if}} - - + + {{#unless isCloud}} + Add + {{/unless}}
@@ -171,13 +177,15 @@ {{/if}} - + {{#unless isCloud}} + Add + {{/unless}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js index 35a4eb0c05..f52ce80319 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.js @@ -40,6 +40,7 @@ function onRequest() { viewModel.userCount = userModule.getUsersCount(); viewModel.policyCount = policyModule.getPoliciesCount(); viewModel.roleCount = userModule.getRolesCount(); + viewModel.isCloud = devicemgtProps.isCloud; return viewModel; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js index d673e72929..d2b7521ff7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js @@ -142,8 +142,14 @@ function loadRoles() { class: "text-right content-fill text-left-on-grid-view no-wrap", data: null, render: function (data, type, row, meta) { - return '' + - ' 0){ + isCloud = true; + } + + var innerhtml = ''; + + var editLink = '' + @@ -156,8 +162,9 @@ function loadRoles() { '' + '' + '' + - '' + - ''; + + var editPermissionLink = '' + @@ -170,8 +177,9 @@ function loadRoles() { '' + '' + '' + - '' + - ''; + + car removeLink = '' + '' + @@ -180,6 +188,11 @@ function loadRoles() { '' + '' + ''; + + if (!isCloud){ + innerhtml = editLink + editPermissionLink + removeLink; + } + return innerhtml; } } ]; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs index e92009887d..962a7f3cea 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs @@ -35,6 +35,7 @@ {{/zone}} {{#zone "navbarActions"}} + {{#unless isCloud}}
  • @@ -45,16 +46,22 @@ Add Role
  • + {{/unless}} {{/zone}} {{#zone "content"}}
    + {{#unless isCloud}} {{#if removePermitted}} {{/if}} {{#if editPermitted}} {{/if}} + {{/unless}} + {{#if isCloud}} + + {{/if}} Loading roles . . .
    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js index 957d29a5f8..10121aa72d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js @@ -32,6 +32,7 @@ function onRequest(context) { } context["adminRole"] = deviceMgtProps["adminRole"]; + context["isCloud"] = deviceMgtProps["isCloud"]; return context; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs index 01acd48ffa..6230be73b7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.hbs @@ -37,94 +37,99 @@ {{#zone "content"}} {{#if canView}} - {{#zone "contentTitle"}} -
    -
    - + {{#zone "contentTitle"}} +
    +
    + +
    -
    - {{/zone}} + {{/zone}} -
    -
    -
    -
    +
    +
    +
    +
    +
    +
    + + {{#unless isCloud}} + {{#if editPermitted}} + + {{/if}} + {{/unless}} +
    -
    - {{#if editPermitted}} - - {{/if}} +
    +
    Profile Overview +
    + {{#defineZone "user-detail-properties"}} + + + + + + + + + + + + + + + + + + + + + + + +
    Username{{user.username}}
    First Name{{user.firstname}}
    Last Name{{user.lastname}}
    Email{{user.emailAddress}}
    Roles + {{#each userRoles}} + + {{/each}} +
    + {{/defineZone}}
    -
    -
    Profile Overview
    - {{#defineZone "user-detail-properties"}} - - - - - - - - - - - - - - - - - - - - - - - -
    Username{{user.username}}
    First Name{{user.firstname}}
    Last Name{{user.lastname}}
    Email{{user.emailAddress}}
    Roles - {{#each userRoles}} - - {{/each}} -
    - {{/defineZone}} -
    -
    -
    -
    - -
    - {{#defineZone "user-enrolled-devices"}} -
    -
    -
    -
    Enrolled Devices by - {{#if user.firstname}} - {{user.firstname}} {{user.lastname}} - {{else}} - {{user.username}} - {{/if}} -
    -
    -
    -
    - {{#each devices}} -
    +
    +
    + +
    + {{#defineZone "user-enrolled-devices"}} +
    +
    +
    +
    Enrolled Devices by + {{#if user.firstname}} + {{user.firstname}} {{user.lastname}} + {{else}} + {{user.username}} + {{/if}} +
    +
    +
    +
    + {{#each devices}} +
    @@ -155,19 +160,19 @@
    -
    - {{/each}} +
    + {{/each}} +
    +
    -
    -
    - {{/defineZone}} + {{/defineZone}} +
    -
    - {{else}} + {{else}}

    Permission Denied

    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js index 3ad6887941..2d544949b0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.view/view.js @@ -20,6 +20,7 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var username = request.getParameter("username"); var user = userModule.getUser(username)["content"]; + var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var userName = request.getParameter("username"); @@ -45,5 +46,8 @@ function onRequest(context) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) { canView = true; } - return {"user": user, "userRoles": userRoles, "devices": devices, "canView": canView}; + + var isCloud = deviceMgtProps.isCloud; + + return {"user": user, "userRoles": userRoles, "devices": devices, "canView": canView, "isCloud" : isCloud}; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs index fad118d1a4..85f2241db3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs @@ -35,6 +35,7 @@ {{/zone}} {{#zone "navbarActions"}} + {{#unless isCloud}}
  • @@ -45,18 +46,21 @@ Add User
  • + {{/unless}} {{/zone}} {{#zone "content"}}
    - {{#if canManage}} - - - - - {{/if}} + {{#unless isCloud}} + {{#if canManage}} + + + + + {{/if}} + {{/unless}} {{#if canView}} {{/if}} @@ -108,14 +112,16 @@ Enter new password

    -

    Retype new password

    -

    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js index e777b314ac..4b7f9c01bc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.js @@ -33,6 +33,7 @@ function onRequest(context) { page["currentUser"] = userModule.getCarbonUser().username; page["adminUser"] = deviceMgtProps["adminUser"].split("@")[0]; + page["isCloud"] = deviceMgtProps["isCloud"]; if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) { page.canManage = true; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs index f1c9eb0fa0..2ed8c3af49 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs @@ -29,80 +29,80 @@ -
  • - - - - - - - - - - - - -
  • - -
  • - - - - - - - - - - -
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  • {{/if}} + + {{#unless isCloud}} {{#if permissions.VIEW_DASHBOARD}}
  • @@ -57,6 +59,9 @@
  • {{/if}} + {{/unless}} + + {{#if permissions.LIST_GROUPS}}
  • @@ -81,6 +86,8 @@ {{#if permissions.LIST_POLICIES}}
  • Policy Management
  • {{/if}} + + {{#unless isCloud}} {{#if permissions.TENANT_CONFIGURATION}}
  • Configuration Management
      @@ -92,6 +99,10 @@
  • {{/if}} + {{/unless}} + + + {{/zone}} {{#zone "navbarCollapsableRightItems"}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.js index 471a152402..69e306f590 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.js @@ -52,6 +52,7 @@ function onRequest(context) { context["isAuthorizedForNotifications"] = isAuthorizedForNotifications; context["currentUser"] = currentUser; context["appContext"] = mdmProps["appContext"]; + context["isCloud"] = mdmProps["isCloud"]; return context; } \ No newline at end of file