diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs new file mode 100644 index 0000000000..2e5c1b3e97 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs @@ -0,0 +1,123 @@ +{{! + 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. +}} +{{unit "cdmf.unit.ui.title" pageTitle="Device Management"}} + +{{unit "cdmf.unit.data-tables-extended"}} + +{{#zone "breadcrumbs"}} +
  • + + + +
  • +
  • + + Devices + +
  • +{{/zone}} + +{{#zone "navbarActions"}} + {{#if permissions.enroll}} +
  • + + + + + + Enroll Device + +
  • + {{/if}} +{{/zone}} + +{{#zone "content"}} + +
    + +     + Loading devices . . . +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    By Device NameBy OwnerBy StatusBy PlatformBy Ownership
    +
    + {{unit "mdm.unit.device.operation-bar"}} +
    +
    +

    Enabling Device Operations

    +

    To enable device operations, select the desired platform from above filter.

    +
    +
    +
    +
    + +{{/zone}} + +{{#zone "bottomJs"}} + + {{js "js/device-listing.js"}} +{{/zone}} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.js new file mode 100644 index 0000000000..f1339b9e43 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.js @@ -0,0 +1,40 @@ +/* + * 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 userModule = require("/app/modules/business-controllers/user.js").userModule; + var constants = require("/app/modules/constants.js"); + var viewModel = {}; + var permissions = []; + if(userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/devices/list")){ + permissions.push("LIST_DEVICES"); + if (userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/devices/view")) { + permissions.push("VIEW_DEVICES"); + } + }else if(userModule.isAuthorized("/permission/admin/device-mgt/user/devices/list")){ + permissions.push("LIST_OWN_DEVICES"); + if (userModule.isAuthorized("/permission/admin/device-mgt/user/devices/view")) { + permissions.push("VIEW_OWN_DEVICES"); + } + }else if(userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/policies/list")){ + permissions.push("LIST_POLICIES"); + } + var currentUser = session.get(constants.USER_SESSION_KEY); + viewModel.permissions = stringify(permissions); + viewModel.currentUser = currentUser; + return viewModel; +} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.json b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.json new file mode 100644 index 0000000000..4886bfc3c4 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.json @@ -0,0 +1,4 @@ +{ + "version": "1.0.0", + "extends": "cdmf.page.devices" +} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/TemperatureController.png b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/TemperatureController.png new file mode 100644 index 0000000000..e16b48d8ee Binary files /dev/null and b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/TemperatureController.png differ diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/android.png b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/android.png new file mode 100755 index 0000000000..7fee78a646 Binary files /dev/null and b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/android.png differ diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/ios.png b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/ios.png new file mode 100644 index 0000000000..4b09796f83 Binary files /dev/null and b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/images/ios.png differ diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/js/device-listing.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/js/device-listing.js new file mode 100644 index 0000000000..8952faac18 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/js/device-listing.js @@ -0,0 +1,520 @@ +/* + * 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. + */ + +/** + * Following function would execute + * when a user clicks on the list item + * initial mode and with out select mode. + */ +function InitiateViewOption(url) { + if ($(".select-enable-btn").text() == "Select") { + $(location).attr('href', url); + } +} + +(function () { + var cache = {}; + var permissionSet = {}; + var validateAndReturn = function (value) { + return (value == undefined || value == null) ? "Unspecified" : value; + }; + Handlebars.registerHelper("deviceMap", function (device) { + device.owner = validateAndReturn(device.owner); + device.ownership = validateAndReturn(device.ownership); + var arr = device.properties; + if (arr){ + device.properties = arr.reduce(function (total, current) { + total[current.name] = validateAndReturn(current.value); + return total; + }, {}); + } + }); + + //This method is used to setup permission for device listing + $.setPermission = function (permission) { + permissionSet[permission] = true; + }; + + $.hasPermission = function (permission) { + return permissionSet[permission]; + }; +})(); + +/* + * Setting-up global variables. + */ +var deviceCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']"; +var assetContainer = "#ast-container"; + +/* + * DOM ready functions. + */ +$(document).ready(function () { + /* Adding selected class for selected devices */ + $(deviceCheckbox).each(function () { + addDeviceSelectedClass(this); + }); + + var i; + var permissionList = $("#permission").data("permission"); + for (i = 0; i < permissionList.length; i++) { + $.setPermission(permissionList[i]); + } + + /* for device list sorting drop down */ + $(".ctrl-filter-type-switcher").popover({ + html : true, + content : function () { + return $("#content-filter-types").html(); + } + }); + + $(".ast-container").on("click", ".claim-btn", function(e){ + e.stopPropagation(); + var deviceId = $(this).data("deviceid"); + var deviceListing = $("#device-listing"); + var currentUser = deviceListing.data("current-user"); + var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser; + var deviceIdentifier = {id: deviceId, type: "TemperatureController"}; + invokerUtil.put(serviceURL, deviceIdentifier, function(message){ + console.log(message); + }, function(message){ + console.log(message.content); + }); + }); +}); + +/* + * On Select All Device button click function. + * + * @param button: Select All Device button + */ +function selectAllDevices(button) { + if(!$(button).data('select')){ + $(deviceCheckbox).each(function(index){ + $(this).prop('checked', true); + addDeviceSelectedClass(this); + }); + $(button).data('select', true); + $(button).html('Deselect All Devices'); + }else{ + $(deviceCheckbox).each(function(index){ + $(this).prop('checked', false); + addDeviceSelectedClass(this); + }); + $(button).data('select', false); + $(button).html('Select All Devices'); + } +} + +/* + * On listing layout toggle buttons click function. + * + * @param view: Selected view type + * @param selection: Selection button + */ +function changeDeviceView(view, selection) { + $(".view-toggle").each(function() { + $(this).removeClass("selected"); + }); + $(selection).addClass("selected"); + if (view == "list") { + $(assetContainer).addClass("list-view"); + } else { + $(assetContainer).removeClass("list-view"); + } +} + +/* + * Add selected style class to the parent element function. + * + * @param checkbox: Selected checkbox + */ +function addDeviceSelectedClass(checkbox) { + if ($(checkbox).is(":checked")) { + $(checkbox).closest(".ctrl-wr-asset").addClass("selected device-select"); + } else { + $(checkbox).closest(".ctrl-wr-asset").removeClass("selected device-select"); + } +} + +function toTitleCase(str) { + return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); +} + +function loadDevices(searchType, searchParam){ + var deviceListing = $("#device-listing"); + var currentUser = deviceListing.data("currentUser"); + + var serviceURL; + if ($.hasPermission("LIST_DEVICES")) { + //serviceURL = "/mdm-admin/devices"; + serviceURL = "/api/device-mgt/v1.0/devices"; + } else if ($.hasPermission("LIST_OWN_DEVICES")) { + //Get authenticated users devices + serviceURL = "/api/device-mgt/v1.0/devices?user="+currentUser; + //serviceURL = "/mdm-admin/users/devices?username="+currentUser; + } else { + $("#loading-content").remove(); + $('#device-table').addClass('hidden'); + $('#device-listing-status-msg').text('Permission denied.'); + $("#device-listing-status").removeClass(' hidden'); + return; + } + + function getPropertyValue(deviceProperties, propertyName) { + var property; + for (var i =0; i < deviceProperties.length; i++) { + property = deviceProperties[i]; + if (property.name == propertyName) { + return property.value; + } + } + return {}; + } + + var fnCreatedRow = function( nRow, aData, iDataIndex ) { + $(nRow).attr('data-type', 'selectable'); + $(nRow).attr('data-deviceid', aData.deviceIdentifier); + $(nRow).attr('data-devicetype', aData.deviceType); + } + + + var columns = [ + { + class : 'remove-padding icon-only content-fill viewEnabledIcon', + data : 'icon', + render: function (data, type, row, meta) { + var deviceType = row.deviceType; + var deviceIdentifier = row.deviceIdentifier; + var url = "#"; + if (status != 'REMOVED') { + url = "devices/view?type=" + deviceType + "&id=" + deviceIdentifier; + } + return '
    ' + } + },{ + class: 'fade-edge', + data: 'name', + render: function ( name, type, row, meta ) { + var model = row.model; + var vendor = row.vendor; + var html = '

    Device ' + name + '

    '; + if (model) { + html += '
    (' + vendor + '-' + model + ')
    '; + } + return html; + } + },{ + class: 'fade-edge remove-padding-top', + data: 'user', + render: function ( user, type, row, meta ) { + return '
    ' + user + '
    '; + } + },{ + class: 'fade-edge remove-padding-top', + data: 'status', + render: function ( status, type, row, meta ) { + var html; + switch (status) { + case 'ACTIVE' : + html = ' Active'; + break; + case 'INACTIVE' : + html = ' Inactive'; + break; + case 'BLOCKED' : + html = ' Blocked'; + break; + case 'REMOVED' : + html = ' Removed'; + break; + } + return '
    '+html+'
    '; + } + },{ + className: 'fade-edge remove-padding-top', + data: 'deviceType', + render: function ( deviceType, type, row, meta ) { + return '
    ' + deviceType + '
    '; + } + },{ + className: 'fade-edge remove-padding-top', + data: 'ownership', + render: function ( ownership, type, row, meta ) { + return '
    ' + ownership + '
    '; + } + } + ]; + + + var dataFilter = function(data){ + data = JSON.parse(data); + + var objects = []; + + $(data.devices).each(function( index ) { + objects.push( + { + model: getPropertyValue(data.devices[index].properties, 'DEVICE_MODEL'), + vendor: getPropertyValue(data.devices[index].properties, 'VENDOR'), + owner: data.devices[index].enrolmentInfo.owner, + status: data.devices[index].enrolmentInfo.status, + ownership: data.devices[index].enrolmentInfo.ownership, + deviceType: data.devices[index].type, + deviceIdentifier: data.devices[index].deviceIdentifier, + name : data.devices[index].name + } + ); + }); + + json = { + "recordsTotal": data.count, + "recordsFiltered": data.count, + "data": objects + }; + return JSON.stringify( json ); + }; + + + $('#device-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/devices', dataFilter, columns, fnCreatedRow, + function( oSettings ) { + $(".icon .text").res_text(0.2); + $('#device-grid').removeClass('hidden'); + $("#loading-content").remove(); + }, { + "placeholder": "Search By Device Name", + "searchKey" : "name" + }); + + // $('#device-grid').datatables_extended({ + // serverSide: true, + // processing: false, + // searching: true, + // ordering: false, + // filter: false, + // pageLength : 16, + // ajax: { url : '/emm/api/devices', data : {url : serviceURL}, + // dataSrc: function (json) { + // $('#device-grid').removeClass('hidden'); + // $("#loading-content").remove(); + // var $list = $("#device-table :input[type='search']"); + // $list.each(function(){ + // $(this).addClass("hidden"); + // }); + // return json.devices; + // } + // }, + // columnDefs: [ + // { targets: 0, data: 'name', className: 'remove-padding icon-only content-fill viewEnabledIcon' , render: function ( data, type, row, meta ) { + // var deviceType = row.type; + // var deviceIdentifier = row.deviceIdentifier; + // var url = "#"; + // if (status != 'REMOVED') { + // url = "devices/view?type=" + deviceType + "&id=" + deviceIdentifier; + // } + // return '
    '; + // }}, + // { targets: 1, data: 'name', className: 'fade-edge' , render: function ( name, type, row, meta ) { + // var model = getPropertyValue(row.properties, 'DEVICE_MODEL'); + // var vendor = getPropertyValue(row.properties, 'VENDOR'); + // var html = '

    Device ' + name + '

    '; + // if (model) { + // html += '
    (' + vendor + '-' + model + ')
    '; + // } + // return html; + // }}, + // { targets: 2, data: 'enrolmentInfo.owner', className: 'fade-edge remove-padding-top'}, + // { targets: 3, data: 'enrolmentInfo.status', className: 'fade-edge remove-padding-top' , + // render: function ( status, type, row, meta ) { + // var html; + // switch (status) { + // case 'ACTIVE' : + // html = ' Active'; + // break; + // case 'INACTIVE' : + // html = ' Inactive'; + // break; + // case 'BLOCKED' : + // html = ' Blocked'; + // break; + // case 'REMOVED' : + // html = ' Removed'; + // break; + // } + // return html; + // }}, + // { targets: 4, data: 'type' , className: 'fade-edge remove-padding-top' }, + // { targets: 5, data: 'enrolmentInfo.ownership' , className: 'fade-edge remove-padding-top' }, + // { targets: 6, data: 'enrolmentInfo.status' , className: 'text-right content-fill text-left-on-grid-view no-wrap' , + // render: function ( status, type, row, meta ) { + // var deviceType = row.type; + // var deviceIdentifier = row.deviceIdentifier; + // var html = ''; + // return html; + // }} + // ], + // "createdRow": function( row, data, dataIndex ) { + // $(row).attr('data-type', 'selectable'); + // $(row).attr('data-deviceid', data.deviceIdentifier); + // $(row).attr('data-devicetype', data.type); + // var model = getPropertyValue(data.properties, 'DEVICE_MODEL'); + // var vendor = getPropertyValue(data.properties, 'VENDOR'); + // var owner = data.enrolmentInfo.owner; + // var status = data.enrolmentInfo.status; + // var ownership = data.enrolmentInfo.ownership; + // var deviceType = data.type; + // $.each($('td', row), function (colIndex) { + // switch(colIndex) { + // case 1: + // $(this).attr('data-search', model + ',' + vendor); + // $(this).attr('data-display', model); + // break; + // case 2: + // $(this).attr('data-grid-label', "Owner"); + // $(this).attr('data-search', owner); + // $(this).attr('data-display', owner); + // break; + // case 3: + // $(this).attr('data-grid-label', "Status"); + // $(this).attr('data-search', status); + // $(this).attr('data-display', status); + // break; + // case 4: + // $(this).attr('data-grid-label', "Type"); + // $(this).attr('data-search', deviceType); + // $(this).attr('data-display', deviceType); + // break; + // case 5: + // $(this).attr('data-grid-label', "Ownership"); + // $(this).attr('data-search', ownership); + // $(this).attr('data-display', ownership); + // break; + // } + // }); + // }, + // "fnDrawCallback": function( oSettings ) { + // $(".icon .text").res_text(0.2); + // } + // }); + $(deviceCheckbox).click(function () { + addDeviceSelectedClass(this); + }); +} + +/* + * Setting-up global variables. + */ +var deviceCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']"; +var assetContainer = "#ast-container"; + +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'); + } + }); +} + +function initPage() { + var currentUser = $("#device-listing").data("currentUser"); + var serviceURL; + if ($.hasPermission("LIST_DEVICES")) { + serviceURL ="/api/device-mgt/v1.0/devices" + } else if ($.hasPermission("LIST_OWN_DEVICES")) { + //Get authenticated users devices + serviceURL = "/api/device-mgt/v1.0/devices?user=" + currentUser; + } + invokerUtil.get( + serviceURL, + function (data) { + if (data) { + data = JSON.parse(data); + if (data.devices.length > 0) { + loadDevices(); + } else { + $("#loading-content").remove(); + $("#device-listing-status-msg").text("No enrolled device is found."); + $("#device-listing-status").removeClass(' hidden'); + } + } + }, function (message) { + initPage(); + } + ); +} + +/* + * DOM ready functions. + */ +$(document).ready(function () { + initPage(); + + /* Adding selected class for selected devices */ + $(deviceCheckbox).each(function () { + addDeviceSelectedClass(this); + }); + + var i; + var permissionList = $("#permission").data("permission"); + for (i = 0; i < permissionList.length; i++) { + $.setPermission(permissionList[i]); + } + + /* for device list sorting drop down */ + $(".ctrl-filter-type-switcher").popover({ + html : true, + content : function () { + return $("#content-filter-types").html(); + } + }); + + $(".ast-container").on("click", ".claim-btn", function(e){ + e.stopPropagation(); + var deviceId = $(this).data("deviceid"); + var deviceListing = $("#device-listing"); + var currentUser = deviceListing.data("current-user"); + var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser; + var deviceIdentifier = {id: deviceId, type: "TemperatureController"}; + invokerUtil.put(serviceURL, deviceIdentifier, function(message){ + console.log(message); + }, function(message){ + console.log(message.content); + }); + }); + + /* for data tables*/ + $('[data-toggle="tooltip"]').tooltip(); + + $("[data-toggle=popover]").popover(); + + $(".ctrl-filter-type-switcher").popover({ + html : true, + content: function() { + return $('#content-filter-types').html(); + } + }); + + $('#nav').affix({ + offset: { + top: $('header').height() + } + }); + +}); diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/templates/device-listing.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/templates/device-listing.hbs new file mode 100644 index 0000000000..8e5f2d2f88 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/public/templates/device-listing.hbs @@ -0,0 +1,42 @@ + {{#each devices}} + {{deviceMap this}} + + +
    + +
    + + +

    Device {{name}}

    + {{#if properties.DEVICE_MODEL}} +
    ({{properties.VENDOR}} - {{properties.DEVICE_MODEL}})
    + {{/if}} + + {{enrolmentInfo.owner}} + + {{#equal enrolmentInfo.status "ACTIVE"}} Active{{/equal}} + {{#equal enrolmentInfo.status "INACTIVE"}} Inactive{{/equal}} + {{#equal enrolmentInfo.status "BLOCKED"}} Blocked{{/equal}} + {{#equal enrolmentInfo.status "REMOVED"}} Removed{{/equal}} + + {{type}} + {{enrolmentInfo.ownership}} + + + + + {{/each}} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.hbs index 468bae0c4f..e4a17d8f02 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.hbs @@ -15,10 +15,14 @@ specific language governing permissions and limitations under the License. }} -
    +{{#zone "content"}} +
    + {{unit "mdm.unit.device.operation-mod"}} +
    +{{/zone}} {{#zone "bottomJs"}} - {{js "js/operation-bar.js"}} + {{js "js/operation-bar.js"}} {{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js index fe6c85bd0c..1e65ffb33a 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/js/operation-bar.js @@ -1,5 +1,5 @@ /* - * 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 @@ -103,13 +103,15 @@ function loadOperationBar(deviceType) { var operationBar = $("#operations-bar"); var operationBarSrc = operationBar.attr("src"); var platformType = deviceType; + //var selectedDeviceID = deviceId; $.template("operations-bar", operationBarSrc, function (template) { - var serviceURL = "/devicemgt_admin/features/" + platformType; + //var serviceURL = "/mdm-admin/features/" + platformType; + var serviceURL = "/api/device-mgt/v1.0/devices/"+platformType+"/*/features"; var successCallback = function (data) { var viewModel = {}; data = JSON.parse(data).filter(function (current) { var iconName; - switch (deviceType) { + switch(deviceType) { case platformTypeConstants.ANDROID: iconName = operationModule.getAndroidIconForFeature(current.code); current.type = deviceType; @@ -140,6 +142,7 @@ function loadOperationBar(deviceType) { function runOperation(operationName) { var deviceIdList = getSelectedDeviceIds(); var list = getDevicesByTypes(deviceIdList); + console.log(list); var successCallback = function (data) { if (operationName == "NOTIFICATION") { @@ -157,7 +160,7 @@ function runOperation(operationName) { var payload, serviceEndPoint; if (list[platformTypeConstants.IOS]) { payload = operationModule. - generatePayload(platformTypeConstants.IOS, operationName, list[platformTypeConstants.IOS]); + generatePayload(platformTypeConstants.IOS, operationName, list[platformTypeConstants.IOS]); serviceEndPoint = operationModule.getIOSServiceEndpoint(operationName); } else if (list[platformTypeConstants.ANDROID]) { payload = operationModule @@ -165,14 +168,15 @@ function runOperation(operationName) { serviceEndPoint = operationModule.getAndroidServiceEndpoint(operationName); } else if (list[platformTypeConstants.WINDOWS]) { payload = operationModule. - generatePayload(platformTypeConstants.WINDOWS, operationName, list[platformTypeConstants.WINDOWS]); + generatePayload(platformTypeConstants.WINDOWS, operationName, list[platformTypeConstants.WINDOWS]); serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName); } if (operationName == "NOTIFICATION") { var errorMsgWrapper = "#notification-error-msg"; var errorMsg = "#notification-error-msg span"; - var message = $("#message").val(); - if (!message) { + var messageTitle = $("#messageTitle").val(); + var messageText = $("#messageText").val(); + if (!(messageTitle && messageText)) { $(errorMsg).text("Enter a message. It cannot be empty."); $(errorMsgWrapper).removeClass("hidden"); } else { @@ -181,6 +185,7 @@ function runOperation(operationName) { hidePopup(); } } else { + console.log(serviceEndPoint); invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); $(modalPopupContent).removeData(); hidePopup();