From 8148b5b06c239f707dc99654af360113040c3b7b Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Thu, 1 Sep 2016 16:10:53 +0530 Subject: [PATCH 01/13] Separating CDMF base app and uuf-template app --- .../org.wso2.carbon.device.mgt.ui/src/assembly/src.xml | 4 +++- .../src/main/resources/p2.inf | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/assembly/src.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/assembly/src.xml index c9805f8946..5aeaa05a35 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/assembly/src.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/assembly/src.xml @@ -28,13 +28,15 @@ ${basedir}/src + ${basedir}/src/main/resources/jaggeryapps/devicemgt /jaggeryapps/devicemgt-cdmf/ true + ${basedir}/src/main/resources/jaggeryapps/uuf-template-app - /jaggeryapps/devicemgt-cdmf/ + /jaggeryapps/uuf-template-app/ true diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf index 47e5f30872..89445081ba 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf +++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf @@ -1,4 +1,6 @@ instructions.configure = \ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt-cdmf);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggeryapps/devicemgt-cdmf,target:${installFolder}/../../deployment/server/jaggeryapps/devicemgt-cdmf,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/uuf-template-app);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggeryapps/uuf-template-app,target:${installFolder}/../../deployment/server/jaggeryapps/uuf-template-app,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggery-modules/utils/,target:${installFolder}/../../modules/utils,overwrite:true);\ \ No newline at end of file From 54807b99ee36080bea94a5503258f3dfa02906c0 Mon Sep 17 00:00:00 2001 From: dilanua Date: Thu, 1 Sep 2016 17:00:43 +0530 Subject: [PATCH 02/13] Updating role listing UI --- .../pages/cdmf.page.role.create/create.hbs | 4 +- .../pages/cdmf.page.role.create/create.json | 2 +- .../app/pages/cdmf.page.roles/roles.hbs | 6 +- .../public/js/role-listing.js | 167 ++++++++++-------- 4 files changed, 104 insertions(+), 75 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.hbs index 4271391f97..7ca07cf8a9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.hbs @@ -24,12 +24,14 @@
  • + Roles
  • - + + Add
  • diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.json index e54dc5f2af..adab2be0f6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/create.json @@ -1,5 +1,5 @@ { "version": "1.0.0", - "uri": "/roles/add-role", + "uri": "/role/add", "layout": "cdmf.layout.default" } \ 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/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 07f4c0a143..81007c5718 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 @@ -15,8 +15,8 @@ specific language governing permissions and limitations under the License. }} -{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} +{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} {{unit "cdmf.unit.data-tables-extended"}} {{#zone "breadcrumbs"}} @@ -26,6 +26,7 @@
  • + Roles @@ -34,7 +35,8 @@ {{#zone "navbarActions"}}
  • - + + 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/units/cdmf.unit.role.listing/public/js/role-listing.js index afeb0a393e..c47045e309 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/units/cdmf.unit.role.listing/public/js/role-listing.js @@ -1,20 +1,21 @@ /* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2015, 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 + * 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 + * "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. */ + var loadRoleBasedActionURL = function (action, rolename) { var href = $("#ast-container").data("app-context") + "role/" + action + "/" + rolename; $(location).attr('href', href); @@ -36,47 +37,47 @@ function InitiateViewOption() { * listed on Role Management page in WSO2 Devicemgt Console. */ -var loadPaginatedObjects = function (objectGridId, objectGridContainer, objectGridTemplateSrc, serviceURL, callback) { - var templateSrc = $(objectGridTemplateSrc).attr("src"); - $.template(objectGridId, templateSrc, function (template) { - invokerUtil.get(serviceURL, - function (data) { - data = callback(data); - if (data.length > 0 && data != null) { - $('#ast-container').removeClass('hidden'); - $('#role-listing-status').hide(); - for (var i = 0; i < data.viewModel.roles.length; i++) { - data.viewModel.roles[i].adminRole = $("#role-table").data("role"); - } - var content = template(data.viewModel); - $(objectGridContainer).html(content); - if (isInit) { - $('#role-grid').datatables_extended_serverside_paging(); - isInit = false; - } - $("#dt-select-all").addClass("hidden"); - $(".icon .text").res_text(0.2); - } else { - $('#ast-container').addClass('hidden'); - $('#role-listing-status-msg').text('No roles are available to be displayed.'); - $('#role-listing-status').show(); - } - - //$(objectGridId).datatables_extended(); - }, function (message) { - $('#ast-container').addClass('hidden'); - $('#role-listing-status-msg').text('Invalid search query. Try again with a valid search ' + - 'query'); - $('#role-listing-status').show(); - }); - }); -}; - -function loadRoles(searchQuery) { +//var loadPaginatedObjects = function (objectGridId, objectGridContainer, objectGridTemplateSrc, serviceURL, callback) { +// var templateSrc = $(objectGridTemplateSrc).attr("src"); +// $.template(objectGridId, templateSrc, function (template) { +// invokerUtil.get(serviceURL, +// function (data) { +// data = callback(data); +// if (data.length > 0 && data != null) { +// $('#ast-container').removeClass('hidden'); +// $('#role-listing-status').hide(); +// for (var i = 0; i < data.viewModel.roles.length; i++) { +// data.viewModel.roles[i].adminRole = $("#role-table").data("role"); +// } +// var content = template(data.viewModel); +// $(objectGridContainer).html(content); +// if (isInit) { +// $('#role-grid').datatables_extended_serverside_paging(); +// isInit = false; +// } +// $("#dt-select-all").addClass("hidden"); +// $(".icon .text").res_text(0.2); +// } else { +// $('#ast-container').addClass('hidden'); +// $('#role-listing-status-msg').text('No roles are available to be displayed.'); +// $('#role-listing-status').show(); +// } +// +// //$(objectGridId).datatables_extended(); +// }, function (message) { +// $('#ast-container').addClass('hidden'); +// $('#role-listing-status-msg').text('Invalid search query. Try again with a valid search ' + +// 'query'); +// $('#role-listing-status').show(); +// }); +// }); +//}; + +function loadRoles() { var loadingContent = $("#loading-content"); loadingContent.show(); - var dataFilter = function(data){ + var dataFilter = function (data) { data = JSON.parse(data); var objects = []; @@ -85,19 +86,21 @@ function loadRoles(searchQuery) { objects.push({name: data.roles[index], DT_RowId : "role-" + data.roles[index]}) }); - json = { + var json = { "recordsTotal": data.count, "recordsFiltered": data.count, "data": objects }; - return JSON.stringify( json ); - } + return JSON.stringify(json); + }; - var fnCreatedRow = function( nRow, aData, iDataIndex ) { + //noinspection JSUnusedLocalSymbols + var fnCreatedRow = function (nRow, aData, iDataIndex) { $(nRow).attr('data-type', 'selectable'); - } + }; + //noinspection JSUnusedLocalSymbols var columns = [ { class: "remove-padding icon-only content-fill", @@ -112,22 +115,44 @@ function loadRoles(searchQuery) { { class: "text-right content-fill text-left-on-grid-view no-wrap", data: null, - render: function ( data, type, row, meta ) { - return '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + - '' + render: function (data, type, row, meta) { + return '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''; } } ]; @@ -210,14 +235,14 @@ $("#role-grid").on("click", ".remove-role-link", function () { }); }); -$("#search-btn").click(function () { - var searchQuery = $("#search-by-name").val(); - if (searchQuery.trim() != "") { - loadRoles(searchQuery); - } else { - loadRoles(); - } -}); +//$("#search-btn").click(function () { +// var searchQuery = $("#search-by-name").val(); +// if (searchQuery.trim() != "") { +// loadRoles(searchQuery); +// } else { +// loadRoles(); +// } +//}); $(document).ready(function () { $('#role-listing-status').hide(); From 32fc58c917feab9865cf5e23a68903dcfb1582bf Mon Sep 17 00:00:00 2001 From: dilanua Date: Thu, 1 Sep 2016 17:49:16 +0530 Subject: [PATCH 03/13] Updating User Listing UI --- .../cdmf.page.users/public/js/listing.js | 105 ++++++++++-------- 1 file changed, 61 insertions(+), 44 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js index 7d8ec0622d..1241ba7fe6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js @@ -228,11 +228,11 @@ function resetPassword(uname) { * when a user type on the search field on User Listing page in * WSO2 MDM Console then click on the search button. */ -$("#search-btn").click(function () { - var searchQuery = $("#search-by-username").val(); - $("#ast-container").empty(); - loadUsers(searchQuery); -}); +//$("#search-btn").click(function () { +// var searchQuery = $("#search-by-username").val(); +// $("#ast-container").empty(); +// loadUsers(searchQuery); +//}); /** * Following function would execute @@ -248,94 +248,113 @@ function InitiateViewOption() { } } -function loadUsers(searchParam) { - - - $("#loading-content").show(); +function loadUsers() { + var loadingContentView = "#loading-content"; + $(loadingContentView).show(); - - var dataFilter = function(data){ + var dataFilter = function (data) { data = JSON.parse(data); var objects = []; - $(data.users).each(function( index ) { + $(data.users).each( function (index) { objects.push({ filter: data.users[index].username, - firstname: data.users[index].firstname ? data.users[index].firstname: '' , + firstname: data.users[index].firstname ? data.users[index].firstname : '' , lastname: data.users[index].lastname ? data.users[index].lastname : '', - emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress: '', - DT_RowId : "role-" + data.users[index].username}) + emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress : '', + DT_RowId : "user-" + data.users[index].username}) }); - json = { + var json = { "recordsTotal": data.count, "recordsFiltered": data.count, "data": objects }; - return JSON.stringify( json ); - } + return JSON.stringify(json); + }; - var fnCreatedRow = function( nRow, aData, iDataIndex ) { + //noinspection JSUnusedLocalSymbols + var fnCreatedRow = function (nRow, aData, iDataIndex) { $(nRow).attr('data-type', 'selectable'); $(nRow).attr('data-username', aData["filter"]); - } + }; + //noinspection JSUnusedLocalSymbols var columns = [ { class: "remove-padding icon-only content-fill", data: null, - defaultContent: '
    ' + defaultContent: '
    ' + + '' + + '
    ' }, { class: "fade-edge", data: null, - render: function ( data, type, row, meta ) { + render: function (data, type, row, meta) { return '

    ' + data.firstname + ' ' + data.lastname + '

    '; } }, { class: "fade-edge remove-padding-top", data: 'filter', - render: function ( filter, type, row, meta ) { + render: function (filter, type, row, meta) { return ' ' + filter; } }, { class: "fade-edge remove-padding-top", data: null, - render: function ( data, type, row, meta ) { + render: function (data, type, row, meta) { return ' ' + data.emailAddress + ' '; } }, { class: "text-right content-fill text-left-on-grid-view no-wrap", data: null, - render: function ( data, type, row, meta ) { - return ' ' + - ' ' + - ' ' + - - ' ' + + ' ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + - ' ' + - ' ' + - - ' ' + - ' <' + - '/i> ' + - ' ' + '' + + '' + + '' + + '' + + '' + + ''; } } ]; - var options = { "placeholder": "Search By Username", "searchKey" : "filter" @@ -347,7 +366,6 @@ function loadUsers(searchParam) { $("#loading-content").hide(); - // $("#loading-content").show(); // var userListing = $("#user-listing"); // var userListingSrc = userListing.attr("src"); @@ -410,7 +428,6 @@ function loadUsers(searchParam) { $(document).ready(function () { loadUsers(); - $(".viewEnabledIcon").click(function () { InitiateViewOption(); }); From 6f28bf1d94e974c6c028785c6345d0d35a3f195b Mon Sep 17 00:00:00 2001 From: dilanua Date: Thu, 1 Sep 2016 18:51:26 +0530 Subject: [PATCH 04/13] Updating User Listing UI --- .../cdmf.page.users/public/js/listing.js | 127 +++++------------- 1 file changed, 31 insertions(+), 96 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js index 1241ba7fe6..35bb3cc408 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js @@ -32,7 +32,7 @@ $(function () { var sortableElem = '.wr-sortable'; $(sortableElem).sortable({ beforeStop: function () { - var sortedIDs = $(this).sortable('toArray'); + $(this).sortable('toArray'); } }); $(sortableElem).disableSelection(); @@ -43,7 +43,6 @@ var modalPopup = ".wr-modalpopup"; var modalPopupContainer = modalPopup + " .modalpopup-container"; var modalPopupContent = modalPopup + " .modalpopup-content"; var body = "body"; -var isInit = true; $(".icon .text").res_text(0.2); /* @@ -137,17 +136,15 @@ function removeUser(uname) { $("a#remove-user-yes-link").click(function () { invokerUtil.delete( removeUserAPI, - function () { - $("#role-" + username).remove(); - // get new user-list-count - var newUserListCount = $(".user-list > span").length; - // update user-listing-status-msg with new user-count - $("#user-listing-status-msg").text("Total number of Users found : " + newUserListCount); - // update modal-content with success message - $(modalPopupContent).html($('#remove-user-success-content').html()); - $("a#remove-user-success-link").click(function () { - hidePopup(); - }); + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200) { + $("#user-" + username).remove(); + // update modal-content with success message + $(modalPopupContent).html($('#remove-user-success-content').html()); + $("a#remove-user-success-link").click(function () { + hidePopup(); + }); + } }, function () { $(modalPopupContent).html($('#remove-user-error-content').html()); @@ -202,14 +199,17 @@ function resetPassword(uname) { invokerUtil.post( resetPasswordServiceURL, resetPasswordFormData, - function (data, textStatus, jqXHR) { // The success callback + // The success callback + function (data, textStatus, jqXHR) { if (jqXHR.status == 200) { $(modalPopupContent).html($('#reset-password-success-content').html()); $("a#reset-password-success-link").click(function () { hidePopup(); }); } - }, function (jqXHR) { // The error callback + }, + // The error callback + function (jqXHR) { var payload = JSON.parse(jqXHR.responseText); $(errorMsg).text(payload.message); $(errorMsgWrapper).removeClass("hidden"); @@ -223,17 +223,6 @@ function resetPassword(uname) { }); } -/** - * Following on click function would execute - * when a user type on the search field on User Listing page in - * WSO2 MDM Console then click on the search button. - */ -//$("#search-btn").click(function () { -// var searchQuery = $("#search-by-username").val(); -// $("#ast-container").empty(); -// loadUsers(searchQuery); -//}); - /** * Following function would execute * when a user clicks on the list item @@ -260,9 +249,9 @@ function loadUsers() { $(data.users).each( function (index) { objects.push({ filter: data.users[index].username, - firstname: data.users[index].firstname ? data.users[index].firstname : '' , - lastname: data.users[index].lastname ? data.users[index].lastname : '', - emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress : '', + firstname: data.users[index].firstname ? data.users[index].firstname : "" , + lastname: data.users[index].lastname ? data.users[index].lastname : "", + emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress : "", DT_RowId : "user-" + data.users[index].username}) }); @@ -294,28 +283,36 @@ function loadUsers() { class: "fade-edge", data: null, render: function (data, type, row, meta) { - return '

    ' + data.firstname + ' ' + data.lastname + '

    '; + if (!data.firstname && !data.lastname) { + return ""; + } else if (data.firstname && data.lastname) { + return "

      " + data.firstname + " " + data.lastname + "

    "; + } } }, { class: "fade-edge remove-padding-top", data: 'filter', render: function (filter, type, row, meta) { - return ' ' + filter; + return '    ' + filter; } }, { class: "fade-edge remove-padding-top", data: null, render: function (data, type, row, meta) { - return ' ' + data.emailAddress + ' '; + if (!data.emailAddress) { + return ""; + } else { + return "    " + data.emailAddress + ""; + } } }, { class: "text-right content-fill text-left-on-grid-view no-wrap", data: null, render: function (data, type, row, meta) { - return ' ' + ' ' + @@ -360,70 +357,8 @@ function loadUsers() { "searchKey" : "filter" }; - $('#user-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options); - - $("#loading-content").hide(); - - - // $("#loading-content").show(); - // var userListing = $("#user-listing"); - // var userListingSrc = userListing.attr("src"); - // $.template("user-listing", userListingSrc, function (template) { - // var serviceURL = apiBasePath + "/users"; - // if (searchParam) { - // serviceURL = serviceURL + "?filter=" + searchParam; - // } - // var successCallback = function (data) { - // if (!data) { - // $('#ast-container').addClass('hidden'); - // $('#user-listing-status-msg').text('No users are available to be displayed.'); - // return; - // } - // var canRemove = $("#can-remove").val(); - // var canEdit = $("#can-edit").val(); - // var canResetPassword = $("#can-reset-password").val(); - // data = JSON.parse(data); - // var viewModel = {}; - // viewModel.users = data.users; - // for (var i = 0; i < viewModel.users.length; i++) { - // viewModel.users[i].userid = viewModel.users[i].username.replace(/[^\w\s]/gi, ''); - // if (canRemove) { - // viewModel.users[i].canRemove = true; - // } - // if (canEdit) { - // viewModel.users[i].canEdit = true; - // } - // if (canResetPassword) { - // viewModel.users[i].canResetPassword = true; - // } - // viewModel.users[i].adminUser = $("#user-table").data("user"); - // } - // if (data.count > 0) { - // $('#ast-container').removeClass('hidden'); - // $('#user-listing-status-msg').text(""); - // var content = template(viewModel); - // $("#ast-container").html(content); - // } else { - // $('#ast-container').addClass('hidden'); - // $('#user-listing-status-msg').text('No users are available to be displayed.'); - // } - // $("#loading-content").hide(); - // if (isInit) { - // $('#user-grid').datatables_extended(); - // isInit = false; - // } - // $(".icon .text").res_text(0.2); - // }; - // invokerUtil.get(serviceURL, - // successCallback, - // function (message) { - // $('#ast-container').addClass('hidden'); - // $('#user-listing-status-msg'). - // text('Invalid search query. Try again with a valid search query'); - // } - // ); - // }); + $(loadingContentView).hide(); } $(document).ready(function () { From eedb66ec4572af7396c5d9041c378e5b7cd594fc Mon Sep 17 00:00:00 2001 From: dilanua Date: Thu, 1 Sep 2016 19:08:20 +0530 Subject: [PATCH 05/13] Updating User Listing UI --- .../app/pages/cdmf.page.users/users.hbs | 100 ++++-------------- 1 file changed, 20 insertions(+), 80 deletions(-) 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 ae90987ece..5a3128a4e2 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 @@ -15,8 +15,8 @@ specific language governing permissions and limitations under the License. }} -{{unit "cdmf.unit.ui.title" pageTitle="User Management"}} +{{unit "cdmf.unit.ui.title" pageTitle="User Management"}} {{unit "cdmf.unit.data-tables-extended"}} {{#zone "breadcrumbs"}} @@ -26,6 +26,7 @@
  • + USERS @@ -34,6 +35,7 @@ {{#zone "navbarActions"}}
  • + @@ -64,69 +66,11 @@ {{/if}} - Loading users . . .
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -139,8 +83,7 @@ - - + Invite Selected @@ -150,12 +93,10 @@ - -
    -
    +
  • + Roles diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs index 249e35a6e3..281f5ea350 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs @@ -31,11 +31,8 @@
    - +
    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js index cf54af034e..ac21d0b696 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.js @@ -18,30 +18,38 @@ /** * Returns the dynamic state to be populated by add-user page. - * + * * @param context Object that gets updated with the dynamic state of this page to be presented * @returns {*} A context object that returns the dynamic state of this page to be presented */ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + var uri = request.getRequestURI(); var uriMatcher = new URIMatcher(String(uri)); - var isMatched = uriMatcher.match("/{context}/role/edit/{rolename}"); + var isMatched = uriMatcher.match("/{context}/role/edit/{roleName}"); if (isMatched) { var matchedElements = uriMatcher.elements(); - var roleName = matchedElements.rolename; + var roleName = matchedElements["roleName"]; var response = userModule.getRole(roleName); if (response["status"] == "success") { context["role"] = response["content"]; } - var userStores = userModule.getSecondaryUserStores(); - context["userStores"] = userStores; + var userStore; + if (roleName.indexOf("/") > -1) { + userStore = roleName.substring(0, roleName.indexOf("/")); + } else { + userStore = "PRIMARY"; + } + context["userStore"] = userStore; + context["roleNameJSRegEx"] = deviceMgtProps["roleValidationConfig"]["roleNameJSRegEx"]; + context["roleNameHelpText"] = deviceMgtProps["roleValidationConfig"]["roleNameHelpMsg"]; + context["roleNameRegExViolationErrorMsg"] = deviceMgtProps["roleValidationConfig"]["roleNameRegExViolationErrorMsg"]; + return context; + } else { + //TODO: handle error scenario + return context; } - //TODO: error scenario - context["roleNameJSRegEx"] = deviceMgtProps.roleValidationConfig.rolenameJSRegEx; - context["roleNameHelpText"] = deviceMgtProps.roleValidationConfig.rolenameHelpMsg; - context["roleNameRegExViolationErrorMsg"] = deviceMgtProps.roleValidationConfig.rolenameRegExViolationErrorMsg; - return context; } \ No newline at end of file