From f9a03133fac57f566ecbc9479752f729542c497e Mon Sep 17 00:00:00 2001 From: kamidu Date: Wed, 8 Mar 2017 12:49:52 +0530 Subject: [PATCH] device cloude related ui improvements --- .../devicemgt/app/conf/toplink-menu.json | 185 +++++++++++ .../app/modules/conf-reader/cloud.js | 62 ++++ .../pages/cdmf.page.device.search/search.hbs | 16 +- .../cdmf.page.devices/public/js/listing.js | 6 +- .../app/pages/cdmf.page.groups/groups.hbs | 1 + .../app/pages/cdmf.page.groups/groups.js | 2 + .../cdmf.page.groups/public/js/listing.js | 1 + .../user-menu.hbs | 292 +++++------------- .../user-menu.js | 66 +++- .../units/cdmf.unit.ui.header.logo/logo.hbs | 8 +- .../public/css/custom-desktop.css | 1 + 11 files changed, 403 insertions(+), 237 deletions(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/cloud.js diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json new file mode 100644 index 00000000000..8e0e36747f0 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/toplink-menu.json @@ -0,0 +1,185 @@ +{ + "Logo": { + "name": "Cloud", + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt", + "target": "_parent" + }, + "Main": { + "Domain": { + "url": "#", + "icon": "fw fw-organization", + "isAdminOnly": false, + "target": "_parent", + "dropDown": { + "Organization": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/organization.jag", + "icon": "fw fw-organization", + "dropDown": "false", + "target": "_self" + }, + "Members": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/user.jag", + "icon": "fa fa-users", + "dropDown": "false", + "target": "_self" + } + } + }, + "Account": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/account-summary.jag", + "icon": "fw fw-resource", + "isAdminOnly": true, + "target": "_blank", + "dropDown": { + "Upgrade Now": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/payment-plans.jag?cloud-type=api_cloud", + "icon": "fw fw-export", + "target": "_self" + }, + "Monetization": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/monetization-dashboard.jag", + "icon": "fa fa-money fa-lg", + "dropDown": "false", + "target": "_self" + }, + "Request Extension": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/contact-us.jag?cloud-type=api_cloud&request-extension=true", + "icon": "fw fw-mail", + "target": "_blank" + }, + "Usage data": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/tenant-usage.jag?cloud-type=api_cloud", + "icon": "fw fw-bar-chart", + "target": "_self" + } + } + }, + "Configure": { + "url": "none", + "icon": "fw fw-settings", + "isAdminOnly": true, + "dropDown": { + "Admin Dashboard": { + "id": "admin-dashboard", + "url": "https://api.cloudlocal.wso2.com:9445/admin-dashboard/", + "icon": "fw fw-user", + "target": "_self" + }, + "Custom URL": { + "id": "custom-url", + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/custom_url.jag", + "icon": "fw fw-uri", + "target": "_self" + }, + "API Store Access": { + "id": "custom-url", + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/selfSignup.jag", + "icon": "fw fw-store", + "target": "_self" + } + } + }, + "Support": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/contact-us.jag", + "icon": "fw fw-mail", + "isAdminOnly": false, + "target": "_self", + "dropDown": "false" + }, + "Documentation": { + "url": "#", + "icon": "fw fw-document", + "isAdminOnly": false, + "dropDown": { + "API Cloud": { + "id": "api_cloud", + "url": "https://docs.wso2.com/display/APICloud/WSO2+API+Cloud+Documentation", + "icon": "fw fw-api", + "target": "_blank" + }, + "Integration Cloud": { + "id": "integration_cloud", + "url": "https://docs.wso2.com/display/IntegrationCloud/WSO2+Integration+Cloud+Documentation", + "icon": "fw fw-application", + "target": "_blank" + }, + "API Cloud Walkthrough": { + "id": "api_cloud_walkthrough", + "url": "https://api.cloudlocal.wso2.com:9445/publisher?interactiveTutorial=true", + "icon": "fw fw-document", + "target": "_self" + } + } + } + }, + "User": { + "url": "#", + "icon": "fw fw-user", + "dropDown": { + "Profile": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/user-profile.jag", + "icon": "fw fw-user", + "dropDown": "true", + "target": "_self" + }, + "Change Password": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/change-password.jag", + "icon": "fw fw-lock", + "dropDown": "true", + "target": "_self" + }, + "Logout": { + "url": "https://api.cloudlocal.wso2.com:9445/publisher/site/pages/logout.jag", + "icon": "fw fw-sign-out", + "dropDown": "true", + "target": "_self" + } + } + }, + "Expand": { + "Clouds": { + "API Cloud": { + "id": "api_cloud", + "url": "https://api.cloudlocal.wso2.com:9445/publisher", + "icon": "fw fw-api fw-3x", + "dropDown": "true", + "target": "_self" + }, + "Integration Cloud": { + "id": "integration_cloud", + "url": "https://milestones.appfactory.wso2.com:9443/appmgt", + "icon": "fa fa-cubes fa-3x", + "dropDown": "true", + "target": "_self" + }, + "Identity Cloud": { + "id": "integration_cloud", + "url": "https://identity.cloudlocal.wso2.com:9443/admin", + "icon": "fw fw-security fa-3x", + "dropDown": "true", + "target": "_self" + }, + "Device Cloud": { + "id": "device_cloud", + "url": "https://device.cloudlocal.wso2.com:9443/devicemgt", + "icon": "fw fw-security fa-3x", + "dropDown": "true", + "target": "_self" + } + }, + "Actions": { + "Organization": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/organization.jag", + "icon": "fw fw-organization fw-3x", + "dropDown": "true", + "target": "_self" + }, + "Members": { + "url": "https://cloudmgt.cloudlocal.wso2.com:9444/cloudmgt/site/pages/user.jag", + "icon": "fa fa-users fa-3x", + "dropDown": "true", + "target": "_self" + } + } + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/cloud.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/cloud.js new file mode 100644 index 00000000000..526acff34e4 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/cloud.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2017, 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. + */ + +var conf = function () { + var cloudConf = application.get("CLOUD_CONF"); + if (!conf) { + cloudConf = require("/app/conf/toplink-menu.json"); + var pinch = require("/app/modules/conf-reader/pinch.min.js")["pinch"]; + var server = require("carbon")["server"]; + var process = require("process"); + pinch(conf, /^/, + function (path, key, value) { + if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) { + //noinspection JSUnresolvedFunction + return value.replace("%https.ip%", server.address("https")); + } else if ((typeof value === "string") && value.indexOf("%http.ip%") > -1) { + //noinspection JSUnresolvedFunction + return value.replace("%http.ip%", server.address("http")); + } else if ((typeof value === "string") && value.indexOf("%date-year%") > -1) { + var year = new Date().getFullYear(); + return value.replace("%date-year%", year); + } else if ((typeof value === "string") && value.indexOf("%server.ip%") > -1) { + var getProperty = require("process").getProperty; + return value.replace("%server.ip%", getProperty("carbon.local.ip")); + } else { + var paramPattern = new RegExp("%(.*?)%", "g"); + var out = value; + while ((matches = paramPattern.exec(value)) !== null) { + // This is necessary to avoid infinite loops with zero-width matches + if (matches.index === paramPattern.lastIndex) { + paramPattern.lastIndex++; + } + if (matches.length == 2) { + var property = process.getProperty(matches[1]); + if (property) { + out = out.replace(new RegExp("%" + matches[1] + "%", "g"), property); + } + } + } + return out; + } + } + ); + application.put("CLOUD_CONF", cloudConf); + } + return cloudConf; +}(); \ 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.device.search/search.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs index 036384d8438..dbe5d5a86b9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs @@ -72,14 +72,15 @@ Location
-
+

- +
-
+
@@ -90,9 +91,10 @@
-
-
-
+
+
+
+
@@ -149,10 +151,8 @@ - - {{/zone}} {{#zone "bottomJs"}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js index 36515c2c820..d594af0766b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js @@ -460,12 +460,12 @@ function loadDevices(searchType, searchParam) { $("#loading-content").remove(); attachDeviceEvents(); - // Temporary disable - /*if($('.advance-search').length < 1){ + + if($('.advance-search').length < 1){ $(this).closest('.dataTables_wrapper').find('div[id$=_filter] input') .after('Advance Search'); - }*/ + } }, { "placeholder": "Search By Device Name", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs index 71aa91766ad..74d866758ba 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs @@ -55,6 +55,7 @@
+ {{#if groupCount}}
+ {{#each Main}} +
  • + + + + + + {{#if this.dropDownVisible}} + + {{/if}} + + {{#if this.dropDownVisible}} + + + {{/if}} +
  • + {{/each}}
  • - - - - - - - -
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • - - - - - - - - - -
  • - -
  • - - - - - - - - - - -
  • - -
  • - + - + -
  • @@ -219,47 +108,34 @@
  • -
    Navigate to Cloud
    - - - -
    API Cloud
    -
    - - - -
    App Cloud
    -
    - - - -
    Device Cloud
    -
    - -
    + {{#each Expand.Clouds}} + {{#if this.dropDown}} + + +
    {{@key}}
    +
    + {{/if}} + {{/each}} +

    Manage your cloud

    - - - -
    Organization
    -
    - - - -
    Members
    -
    - + {{#each Expand.Actions}} + {{#if this.dropDown}} + + +
    {{@key}}
    +
    + {{/if}} + {{/each}}
    - {{#zone "bottomJs"}} {{js "/js/user-menu.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.ui.header.cloud.user-menu/user-menu.js 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.js index c5aa26981eb..9309dad584e 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.js +++ 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.js @@ -19,27 +19,65 @@ function onRequest(context) { var constants = require("/app/modules/constants.js"); var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; + var cloudProps = require("/app/modules/conf-reader/cloud.js")["conf"]; var user = context.user; var isSuperTenant = false; - if (user.tenantId == -1234){ + if (user.tenantId == -1234) { isSuperTenant = true; } var viewModal = {}; + viewModal.Main = cloudProps.Main; + viewModal.UserMenu = cloudProps.User; + viewModal.Expand = cloudProps.Expand; + viewModal.Main.Domain.isDomain = true; + viewModal.Main.Support.isSupport = true; + + for (var key in viewModal.Main) { + var tempDropDownCheck = false; + + for (var sub_key in viewModal.Main[key].dropDown) { + if (viewModal.Main[key].dropDown[sub_key].dropDown == null || + viewModal.Main[key].dropDown[sub_key].dropDown == true || + viewModal.Main[key].dropDown[sub_key].dropDown == "true") { + viewModal.Main[key].dropDown[sub_key].dropDown = true; + temp = true; + } else { + viewModal.Main[key].dropDown[sub_key].dropDown = false; + } + } + + viewModal.Main[key].dropDownVisible = tempDropDownCheck; + } + var tempDropDownCheck = false; + for (var key in viewModal.UserMenu.dropDown) { + + if (viewModal.UserMenu.dropDown[key].dropDown == null || + viewModal.UserMenu.dropDown[key].dropDown == true || + viewModal.UserMenu.dropDown[key].dropDown == "true") { + viewModal.UserMenu.dropDown[key].dropDown = true; + tempDropDownCheck = true; + } else { + viewModal.UserMenu.dropDown[key].dropDown = false; + + } + } + viewModal.UserMenu.dropDownVisible = tempDropDownCheck; + tempDropDownCheck = false; + for (var key in viewModal.Expand) { + for (var sub_key in viewModal.Expand[key]) { + if( viewModal.Expand[key][sub_key].dropDown == null || + viewModal.Expand[key][sub_key].dropDown == true || + viewModal.Expand[key][sub_key].dropDown == "true") { + viewModal.Expand[key][sub_key].dropDown = true; + tempDropDownCheck = true; + } else { + viewModal.Expand[key][sub_key].dropDown = false; + } + } + } + viewModal.isSuperTenant = isSuperTenant; viewModal.USER_SESSION_KEY = session.get(constants["USER_SESSION_KEY"]); viewModal.isCloud = mdmProps.isCloud; - viewModal.contactUsURL = mdmProps.cloudConfig.contactUsURL; - viewModal.apiCloudDocURL = mdmProps.cloudConfig.apiCloudDocURL; - viewModal.appCloudDocURL = mdmProps.cloudConfig.appCloudDocURL; - viewModal.deviceCloudDocURL = mdmProps.cloudConfig.deviceCloudDocURL; - viewModal.apiCloudWalkthroughURL = mdmProps.cloudConfig.apiCloudWalkthroughURL; - viewModal.profileURL = mdmProps.cloudConfig.profileURL; - viewModal.changePasswordURL = mdmProps.cloudConfig.changePasswordURL; - viewModal.logoutURL = mdmProps.cloudConfig.logoutURL; - viewModal.apiCloudURL = mdmProps.cloudConfig.apiCloudURL; - viewModal.appCloudURL = mdmProps.cloudConfig.appCloudURL; - viewModal.deviceCloudURL = mdmProps.cloudConfig.deviceCloudURL; - viewModal.oraganizationURL = mdmProps.cloudConfig.oraganizationURL; - viewModal.membersURL = mdmProps.cloudConfig.membersURL; return viewModal; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.logo/logo.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.logo/logo.hbs index 1cbff398d90..08776edaaa0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.logo/logo.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.logo/logo.hbs @@ -17,9 +17,9 @@ }} {{#if isCloud}} - {{#zone "productName"}}WSO2 Cloud{{/zone}} - {{#zone "productNameResponsive"}} Cloud{{/zone}} + {{#zone "productName"}}Cloud{{/zone}} + {{#zone "productNameResponsive"}}Cloud{{/zone}} {{else}} - {{#zone "productName"}}WSO2 IoT Server{{/zone}} - {{#zone "productNameResponsive"}} IoT Server{{/zone}} + {{#zone "productName"}}IoT Server{{/zone}} + {{#zone "productNameResponsive"}} IoTS{{/zone}} {{/if}} 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 fbdb93719cf..70fc4509e77 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 @@ -6360,6 +6360,7 @@ ul.tiles .icon { #device-location{ height:450px; + width: 100%; margin-bottom:0px; } #device-location .leaflet-popup-content-wrapper{