From 746a4d4372201b83ed6973171cf293a6b1bf383b Mon Sep 17 00:00:00 2001 From: dilanua Date: Fri, 2 Sep 2016 10:27:52 +0530 Subject: [PATCH] Refactoring roles listing UI - merging srcs in units to page --- .../public/js/role-listing.js | 4 +- .../public/templates/role-listing.hbs | 0 .../app/pages/cdmf.page.roles/roles.hbs | 110 ++++++++++++++++- .../cdmf.page.roles/roles.js} | 11 +- .../units/cdmf.unit.role.listing/listing.hbs | 115 ------------------ .../units/cdmf.unit.role.listing/listing.json | 3 - 6 files changed, 117 insertions(+), 126 deletions(-) rename components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/{units/cdmf.unit.role.listing => pages/cdmf.page.roles}/public/js/role-listing.js (97%) rename components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/{units/cdmf.unit.role.listing => pages/cdmf.page.roles}/public/templates/role-listing.hbs (100%) rename components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/{units/cdmf.unit.role.listing/listing.js => pages/cdmf.page.roles/roles.js} (88%) delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/listing.hbs delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/listing.json diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/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 similarity index 97% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/public/js/role-listing.js rename to 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 1915c07184f..15ce9a1b483 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/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 @@ -110,8 +110,8 @@ function loadRoles() { class: "remove-padding icon-only content-fill", data: null, defaultContent: "
" + - "" + - "
" + "" + + "" }, { class: "fade-edge", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/public/templates/role-listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/templates/role-listing.hbs similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/public/templates/role-listing.hbs rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/templates/role-listing.hbs 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 81007c57188..e22b85db058 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 @@ -47,5 +47,113 @@ {{/zone}} {{#zone "content"}} - {{unit "cdmf.unit.role.listing"}} +{{! +Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + +WSO2 Inc. licenses this file to you under the Apache License, +Version 2.0 (the "License"); you may not use this file except +in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +}} + +
+ {{#if removePermitted}} + + {{/if}} + {{#if editPermitted}} + + {{/if}} + + Loading roles . . . +
+
+ +
+ + + + + + + + + + +
By Role Name
+
+ + + + +
+
+
+
+

Do you really want to remove this role ?

+ + +
+
+
+
+ +
+
+
+
+

Done. Role was successfully removed.

+ + +
+
+
+
+ +
+
+
+
+

An unexpected error occurred. Please try again later.

+ + +
+
+
+
+{{/zone}} + +{{#zone "bottomJs"}} + + + {{js "js/role-listing.js"}} {{/zone}} \ 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.role.listing/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js similarity index 88% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/listing.js rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js index d908da5d2d3..341720e9a8e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.js @@ -18,8 +18,8 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var response = userModule.getUsers(); - var users = {}; + var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + context["permissions"] = userModule.getUIPermissions(); if (userModule.isAuthorized("/permission/admin/device-mgt/roles/delete")) { context["removePermitted"] = true; @@ -30,8 +30,9 @@ function onRequest(context) { if (userModule.isAuthorized("/permission/admin/device-mgt/roles/remove")) { context["removePermitted"] = true; } - var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - context["appContext"] = deviceMgtProps.appContext; - context["adminRole"] = deviceMgtProps.adminRole; + + context["appContext"] = deviceMgtProps["appContext"]; + context["adminRole"] = deviceMgtProps["adminRole"]; + 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/units/cdmf.unit.role.listing/listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/listing.hbs deleted file mode 100644 index a368502c91a..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/listing.hbs +++ /dev/null @@ -1,115 +0,0 @@ -{{! - Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - - WSO2 Inc. licenses this file to you under the Apache License, - Version 2.0 (the "License"); you may not use this file except - in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -}} - -
- {{#if removePermitted}} - - {{/if}} - {{#if editPermitted}} - - {{/if}} - - Loading roles . . . -
-
- -
- - - - - - - - - - -
By Role Name
-
- - - - -
-
-
-
-

Do you really want to remove this role ?

- - -
-
-
-
- -
-
-
-
-

Done. Role was successfully removed.

- - -
-
-
-
- -
-
-
-
-

An unexpected error occurred. Please try again later.

- - -
-
-
-
-{{#zone "common-navigation"}} - -{{/zone}} - -{{#zone "bottomJs"}} - - - {{js "js/role-listing.js"}} - -{{/zone}} \ 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.role.listing/listing.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/listing.json deleted file mode 100644 index b88788f78bc..00000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.listing/listing.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version" : "1.0.0" -} \ No newline at end of file