diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml index 8adefb2207..e79f988710 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/test/resources/sample.xml @@ -134,4 +134,12 @@ + + + DEVICE_INFO + APPLICATION_LIST + DEVICE_LOCATION + + + \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/utility.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/utility.js index 7b6add5fa8..159b61d999 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/utility.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/utility.js @@ -63,6 +63,9 @@ utility = function () { publicMethods.getDeviceTypeConfig = function (deviceType) { var unitName = publicMethods.getTenantedDeviceUnitName(deviceType, "type-view"); + if (!unitName) { + return null; + } if (deviceType in deviceTypeConfigMap) { return deviceTypeConfigMap[deviceType]; @@ -99,6 +102,9 @@ utility = function () { publicMethods.getDeviceThumb = function (deviceType) { var unitName = publicMethods.getTenantedDeviceUnitName(deviceType, "type-view"); + if (!unitName) { + unitName = "cdmf.unit.default.device.type.type-view"; + } var iconPath = "/app/units/" + unitName + "/public/images/thumb.png"; var icon = new File(iconPath); if (icon.isExists()) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.js index 693769dd11..6810da2496 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.type.view/view.js @@ -32,15 +32,18 @@ function onRequest(context) { var utility = require("/app/modules/utility.js").utility; var deviceType = context.uriParams.deviceType; - var configs = utility.getDeviceTypeConfig(deviceType); - if(!configs["deviceType"]){ - throw new Error("Invalid Device Type Configurations Found!",""); - } - + var label = deviceType; + if (configs) { + label = configs["deviceType"]["label"]; + } + var unitName = utility.getTenantedDeviceUnitName(deviceType, "type-view"); + if (!unitName) { + unitName = "cdmf.unit.default.device.type.type-view"; + } return { - "deviceTypeViewUnitName": utility.getTenantedDeviceUnitName(deviceType, "type-view"), + "deviceTypeViewUnitName": unitName, "deviceType": deviceType, - "label" : configs["deviceType"]["label"] + "label" : label }; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.js index 21ce993020..754cef4fa8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.view/view.js @@ -29,5 +29,9 @@ function onRequest(context){ }); var deviceType = context.uriParams.deviceType; - return {"deviceViewUnitName": utility.getTenantedDeviceUnitName(deviceType, "device-view")}; + var unitName = utility.getTenantedDeviceUnitName(deviceType, "device-view"); + if (!unitName) { + unitName = "cdmf.unit.default.device.type.device-view"; + } + return {"deviceViewUnitName": unitName}; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js index 0f3f8066fd..05e041bc24 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js @@ -60,17 +60,25 @@ function onRequest(context) { if (data) { for (var i = 0; i < data.length; i++) { var config = utility.getDeviceTypeConfig(data[i]); - if (!config) { - continue; + var category = "iot"; + var label = data[i]; + var analyticsEnabled = "true"; + var groupingEnabled = "true"; + if (config) { + var deviceType = config.deviceType; + category = deviceType.category; + label = deviceType.label; + analyticsEnabled = deviceType.analyticsEnabled; + groupingEnabled = deviceType.groupingEnabled; } - var deviceType = config.deviceType; + deviceTypes.push({ "type": data[i], - "category": deviceType.category, - "label": deviceType.label, + "category": category, + "label": label, "thumb": utility.getDeviceThumb(data[i]), - "analyticsEnabled": deviceType.analyticsEnabled, - "groupingEnabled": deviceType.groupingEnabled + "analyticsEnabled": analyticsEnabled, + "groupingEnabled": groupingEnabled }); } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.hbs new file mode 100644 index 0000000000..b79c02383e --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.hbs @@ -0,0 +1,77 @@ +{{! + 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. +}} +{{#zone "topCss"}} + +{{/zone}} + +{{#zone "device-thumbnail"}} + +{{/zone}} + +{{#zone "device-opetations"}} +
+ Operations +
+
+ operation comes here +
+{{/zone}} + +{{#zone "device-view-tabs"}} +
  • Device + Statistics +
  • +
  • Operations Log
  • +{{/zone}} + +{{#zone "device-view-tab-contents"}} +
    +
    Device Statistics
    + unit "cdmf.unit.device.type.senseme.realtime.analytics-view" device=device +
    +
    +
    Operations Log
    +
    + +
    +
    + Not available yet +
    +
    +
    +
    +
    +{{/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.default.device.type.device-view/device-view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.js new file mode 100644 index 0000000000..834d8f5d53 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +function onRequest(context) { + var log = new Log("device-view.js"); + var deviceType = context.uriParams.deviceType; + var deviceId = request.getParameter("id"); + var autoCompleteParams = [ + {"name" : "deviceId", "value" : deviceId} + ]; + + if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { + var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; + var device = deviceModule.viewDevice(deviceType, deviceId); + if (device && device.status != "error") { + return {"device": device.content, "autoCompleteParams" : autoCompleteParams, "encodedFeaturePayloads": ""}; + } else { + response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); + exit(); + } + } +} \ 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.default.device.type.device-view/device-view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.json new file mode 100644 index 0000000000..9eecd8f5bf --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/device-view.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.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.default.device.type.device-view/public/images/deviceType.png b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/public/images/deviceType.png new file mode 100644 index 0000000000..ad3f3a5d01 Binary files /dev/null and b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.device-view/public/images/deviceType.png differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/private/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/private/config.json new file mode 100644 index 0000000000..f5d01d0d77 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/private/config.json @@ -0,0 +1,49 @@ +{ + "deviceType": { + "label": "Windows", + "category": "mobile", + "scopes" : [ + "perm:windows:enroll", + "perm:windows:lock-devices", + "perm:windows:ring", + "perm:windows:wipe", + "perm:windows:lock-reset", + "perm:windows:reboot", + "perm:windows:location", + "perm:windows:disenroll" + ], + "analyticsEnabled": "false", + "groupingEnabled": "false", + "features": { + "DEVICE_RING": { + "icon": "fw-dial-up", + "permission": "/device-mgt/devices/owning-device/operations/android/ring" + }, + "DEVICE_LOCK": { + "icon": "fw-lock", + "permission": "/device-mgt/devices/owning-device/operations/windows/lock" + }, + "DEVICE_LOCATION": { + "icon": "fw-map-location", + "permission": "/device-mgt/devices/owning-device/operations/windows/location" + }, + "DEVICE_REBOOT": { + "icon": "fw-refresh", + "permission": "/device-mgt/devices/owning-device/operations/windows/reboot" + }, + "LOCK_RESET": { + "icon": "fw-security", + "permission": "/device-mgt/devices/owning-device/operations/windows/lock-reset" + + }, + "DISENROLL": { + "icon": "fw-block", + "permission": "/device-mgt/devices/owning-device/operations/windows/disenroll" + }, + "WIPE_DATA": { + "icon": "fw-delete", + "permission": "/device-mgt/devices/owning-device/operations/windows/wipe" + } + } + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/css/styles.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/css/styles.css new file mode 100644 index 0000000000..04e2a26115 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/css/styles.css @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed 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. + */ +.circle { + background: none repeat scroll 0 0 #191919; + border-radius: 50px; + height: 50px; + padding: 10px; + width: 50px; + color: #fff; +} +.padding-top-double { + padding-top: 20px; +} +.padding-double { + padding: 20px; +} +.grey { + color: #333; +} +hr { + display: block; + height: 1px; + border: 0; + border-top: 1px solid #7f7f7f; + margin: 1em 0; + padding: 0; + opacity: 0.2; +} +.light-grey { + color: #7c7c7c; +} +.uppercase { + text-transform: uppercase; +} +.grey-bg { + background-color: #f6f4f4; +} + +.doc-link { + background: #11375B; + padding: 20px; + color: white; + margin-top: 0; +} + +.doc-link a { + color: white; +} \ 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.default.device.type.type-view/public/images/deviceType.png b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/deviceType.png new file mode 100644 index 0000000000..ad3f3a5d01 Binary files /dev/null and b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/deviceType.png differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/schematicsGuide.png b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/schematicsGuide.png new file mode 100644 index 0000000000..db4d0adbb7 Binary files /dev/null and b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/schematicsGuide.png differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/thumb.png b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/thumb.png new file mode 100644 index 0000000000..ad3f3a5d01 Binary files /dev/null and b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/images/thumb.png differ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/js/type-view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/js/type-view.js new file mode 100644 index 0000000000..9d6bcd2666 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/public/js/type-view.js @@ -0,0 +1,388 @@ +/* + * 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 + * + * 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 modalPopup = ".modal", + modalPopupContainer = modalPopup + " .modal-content", + modalPopupContent = modalPopup + " .modal-content"; + +var emmAdminBasePath = "/api/device-mgt/v1.0"; + +//function openCollapsedNav() { +// $(".wr-hidden-nav-toggle-btn").addClass("active"); +// $("#hiddenNav").slideToggle("slideDown", function () { +// if ($(this).css("display") == "none") { +// $(".wr-hidden-nav-toggle-btn").removeClass("active"); +// } +// }); +//} + +/* + * set popup maximum height function. + */ +function setPopupMaxHeight() { + var maxHeight = "max-height"; + var marginTop = "margin-top"; + var body = "body"; + $(modalPopupContent).css(maxHeight, ($(body).height() - ($(body).height() / 100 * 30))); + $(modalPopupContainer).css(marginTop, (-($(modalPopupContainer).height() / 2))); +} + +/* + * show popup function. + */ +function showPopup() { + $(modalPopup).modal('show'); +} + +/* + * hide popup function. + */ +function hidePopup() { + $(modalPopupContent).html(""); + $(modalPopupContent).removeClass("operation-data"); + $(modalPopup).modal('hide'); + $('body').removeClass('modal-open').css('padding-right','0px'); + $('.modal-backdrop').remove(); +} + +/* + * QR-code generation function. + */ +function generateQRCode(qrCodeClass) { + var enrollmentURL = $("#qr-code-modal").data("enrollment-url"); + $(qrCodeClass).qrcode({ + text: enrollmentURL, + width: 200, + height: 200 + }); +} + +function toggleEnrollment() { + $(".modal-content").html($("#qr-code-modal").html()); + generateQRCode(".modal-content .qr-code"); + modalDialog.show(); +} + +var updateNotificationCountOnSuccess = function (data, textStatus, jqXHR) { + var notificationBubble = "#notification-bubble"; + if (jqXHR.status == 200 && data) { + var responsePayload = JSON.parse(data); + var newNotificationsCount = responsePayload["count"]; + if (newNotificationsCount > 0) { + $(notificationBubble).html(newNotificationsCount); + $(notificationBubble).show(); + } else { + $(notificationBubble).hide(); + } + } +}; + +function updateNotificationCountOnError() { + var notificationBubble = "#notification-bubble"; + $(notificationBubble).html("Error"); + $(notificationBubble).show(); +} + +function loadNewNotificationsOnSideViewPanel() { + if ($("#right-sidebar").attr("is-authorized") == "false") { + $("#notification-bubble-wrapper").remove(); + } else { + var serviceURL = emmAdminBasePath + "/notifications?status=NEW"; + invokerUtil.get(serviceURL, updateNotificationCountOnSuccess, updateNotificationCountOnError); + loadNewNotifications(); + } +} + +function loadNewNotifications() { + var messageSideBar = ".sidebar-messages"; + if ($("#right-sidebar").attr("is-authorized") == "false") { + $(messageSideBar).html("

    You are not authorized to view notifications.

    "); + } else { + var notifications = $("#notifications"); + var currentUser = notifications.data("currentUser"); + + $.template("notification-listing", notifications.attr("src"), function (template) { + var serviceURL = emmAdminBasePath + "/notifications?offset=0&limit=5&status=NEW"; + invokerUtil.get( + serviceURL, + // on success + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + var viewModel = {}; + var responsePayload = JSON.parse(data); + if (responsePayload["notifications"]) { + if (responsePayload.count > 0) { + viewModel["notifications"] = responsePayload["notifications"]; + viewModel["appContext"] = context; + $(messageSideBar).html(template(viewModel)); + } else { + $(messageSideBar).html("

    No New Notifications

    " + + "
    " + + "Check this section for error notifications
    related to device operations" + + "
    "); + } + } else { + $(messageSideBar).html("

    Unexpected error " + + "occurred while loading new notifications.

    "); + } + } + }, + // on error + function (jqXHR) { + if (jqXHR.status = 500) { + $(messageSideBar).html("

    Unexpected error occurred while trying " + + "to retrieve any new notifications.

    "); + } + } + ); + }); + } +} + +/** + * Toggle function for + * notification listing sidebar. + * @return {Null} + */ +$.sidebar_toggle = function (action, target, container) { + var elem = '[data-toggle=sidebar]', + button, + containerOffsetLeft, + containerOffsetRight, + targetOffsetLeft, + targetOffsetRight, + targetWidth, + targetSide, + relationship, + pushType, + buttonParent; + + var sidebar_window = { + update: function (target, container, button) { + containerOffsetLeft = $(container).data('offset-left') ? $(container).data('offset-left') : 0; + containerOffsetRight = $(container).data('offset-right') ? $(container).data('offset-right') : 0; + targetOffsetLeft = $(target).data('offset-left') ? $(target).data('offset-left') : 0; + targetOffsetRight = $(target).data('offset-right') ? $(target).data('offset-right') : 0; + targetWidth = $(target).data('width'); + targetSide = $(target).data("side"); + pushType = $(container).parent().is('body') == true ? 'padding' : 'margin'; + + if (button !== undefined) { + relationship = button.attr('rel') ? button.attr('rel') : ''; + buttonParent = $(button).parent(); + } + }, + + show: function () { + if ($(target).data('sidebar-fixed') == true) { + $(target).height($(window).height() - $(target).data('fixed-offset')); + } + $(target).trigger('show.sidebar'); + if (targetWidth !== undefined) { + $(target).css('width', targetWidth); + } + $(target).addClass('toggled'); + if (button !== undefined) { + if (relationship !== '') { + // Removing active class from all relative buttons + $(elem + '[rel=' + relationship + ']:not([data-handle=close])').removeClass("active"); + $(elem + '[rel=' + relationship + ']:not([data-handle=close])').attr('aria-expanded', 'false'); + } + // Adding active class to button + if (button.attr('data-handle') !== 'close') { + button.addClass("active"); + button.attr('aria-expanded', 'true'); + } + if (buttonParent.is('li')) { + if (relationship !== '') { + $(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().removeClass("active"); + $(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().attr('aria-expanded', 'false'); + } + buttonParent.addClass("active"); + buttonParent.attr('aria-expanded', 'true'); + } + } + // Sidebar open function + if (targetSide == 'left') { + if ((button !== undefined) && (button.attr('data-container-divide'))) { + $(container).css(pushType + '-' + targetSide, targetWidth + targetOffsetLeft); + } + $(target).css(targetSide, targetOffsetLeft); + } else if (targetSide == 'right') { + if ((button !== undefined) && (button.attr('data-container-divide'))) { + $(container).css(pushType + '-' + targetSide, targetWidth + targetOffsetRight); + } + $(target).css(targetSide, targetOffsetRight); + } + $(target).trigger('shown.sidebar'); + }, + + hide: function () { + $(target).trigger('hide.sidebar'); + $(target).removeClass('toggled'); + if (button !== undefined) { + if (relationship !== '') { + // Removing active class from all relative buttons + $(elem + '[rel=' + relationship + ']:not([data-handle=close])').removeClass("active"); + $(elem + '[rel=' + relationship + ']:not([data-handle=close])').attr('aria-expanded', 'false'); + } + // Removing active class from button + if (button.attr('data-handle') !== 'close') { + button.removeClass("active"); + button.attr('aria-expanded', 'false'); + } + if ($(button).parent().is('li')) { + if (relationship !== '') { + $(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().removeClass("active"); + $(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().attr('aria-expanded', 'false'); + } + } + } + // Sidebar close function + if (targetSide == 'left') { + if ((button !== undefined) && (button.attr('data-container-divide'))) { + $(container).css(pushType + '-' + targetSide, targetOffsetLeft); + } + $(target).css(targetSide, -Math.abs(targetWidth + targetOffsetLeft)); + } else if (targetSide == 'right') { + if ((button !== undefined) && (button.attr('data-container-divide'))) { + $(container).css(pushType + '-' + targetSide, targetOffsetRight); + } + $(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight)); + } + $(target).trigger('hidden.sidebar'); + } + }; + if (action === 'show') { + sidebar_window.update(target, container); + sidebar_window.show(); + } + if (action === 'hide') { + sidebar_window.update(target, container); + sidebar_window.hide(); + } + // binding click function + var body = 'body'; + $(body).off('click', elem); + $(body).on('click', elem, function (e) { + e.preventDefault(); + button = $(this); + container = button.data('container'); + target = button.data('target'); + sidebar_window.update(target, container, button); + /** + * Sidebar function on data container divide + * @return {Null} + */ + if (button.attr('aria-expanded') == 'false') { + sidebar_window.show(); + } else if (button.attr('aria-expanded') == 'true') { + sidebar_window.hide(); + } + }); +}; + +$.fn.collapse_nav_sub = function () { + var navSelector = 'ul.nav'; + + if (!$(navSelector).hasClass('collapse-nav-sub')) { + $(navSelector + ' > li', this).each(function () { + var position = $(this).offset().left - $(this).parent().scrollLeft(); + $(this).attr('data-absolute-position', (position + 5)); + }); + + $(navSelector + ' li', this).each(function () { + if ($('ul', this).length !== 0) { + $(this).addClass('has-sub'); + } + }); + + $(navSelector + ' > li', this).each(function () { + $(this).css({ + 'left': $(this).data('absolute-position'), + 'position': 'absolute' + }); + }); + + $(navSelector + ' li.has-sub', this).on('click', function () { + var elem = $(this); + if (elem.attr('aria-expanded') !== 'true') { + elem.siblings().fadeOut(100, function () { + elem.animate({'left': '15'}, 200, function () { + $(elem).first().children('ul').fadeIn(200); + }); + }); + elem.siblings().attr('aria-expanded', 'false'); + elem.attr('aria-expanded', 'true'); + } else { + $(elem).first().children('ul').fadeOut(100, function () { + elem.animate({'left': $(elem).data('absolute-position')}, 200, function () { + elem.siblings().fadeIn(100); + }); + }); + elem.siblings().attr('aria-expanded', 'false'); + elem.attr('aria-expanded', 'false'); + } + }); + + $(navSelector + ' > li.has-sub ul', this).on('click', function (e) { + e.stopPropagation(); + }); + $(navSelector).addClass('collapse-nav-sub'); + } +}; + +$(".download-link").click(function(){ + toggleEnrollment(); +}); + +$(document).ready(function () { + $.sidebar_toggle(); + if (typeof $.fn.collapse == 'function') { + $('.navbar-collapse.tiles').on('shown.bs.collapse', function () { + $(this).collapse_nav_sub(); + }); + } + + loadNewNotificationsOnSideViewPanel(); + $("#right-sidebar").on("click", ".new-notification", function () { + var notificationId = $(this).data("id"); + var redirectUrl = $(this).data("url"); + var markAsReadNotificationsEpr = emmAdminBasePath + "/notifications/" + notificationId + "/mark-checked"; + var messageSideBar = ".sidebar-messages"; + + invokerUtil.put( + markAsReadNotificationsEpr, + null, + // on success + function (data) { + data = JSON.parse(data); + if (data.statusCode == responseCodes["ACCEPTED"]) { + location.href = redirectUrl; + } + }, + // on error + function () { + var content = "
  • Warning

    " + + "

    Unexpected error occurred while loading notification. Please refresh the page and" + + " try again

  • "; + $(messageSideBar).html(content); + } + ); + }); +}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs new file mode 100644 index 0000000000..aa089d40eb --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.hbs @@ -0,0 +1,142 @@ +
    +

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

    Description

    +
    +

    Need to get the description from the device

    +
    +
    +
    + View API + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +

    +
    +
    +

    How To Enroll a Device

    +
    + +
    +
    +
    + +{{#zone "topCss"}} + {{css "css/styles.css"}} +{{/zone}} + +{{#zone "bottomJs"}} +{{/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.default.device.type.type-view/type-view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.js new file mode 100644 index 0000000000..cac85f1346 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.js @@ -0,0 +1,24 @@ +/* + * 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. + */ + +function onRequest(context) { + var deviceType = context.uriParams.deviceType; + return { + "deviceType": deviceType + }; +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.json new file mode 100644 index 0000000000..9eecd8f5bf --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.type-view/type-view.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file