diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs index d9c0f4342..f0998989c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs @@ -119,7 +119,7 @@
{{unit "cdmf.unit.device.type.android.operation-bar" device=device - backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}} + backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}}
{{/if}} {{/zone}} @@ -328,7 +328,14 @@ - +
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js index 58be0a061..cf1ba1171 100755 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js @@ -35,6 +35,37 @@ var InitiateViewOption = null; serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info"; serviceUrlLocal = "/api/device-mgt/android/v1.0/admin/devices/location"; } + if (serviceUrl) { + invokerUtil.post( + serviceUrl, + payload, + // success-callback + function () { + $(".panel-body").show(); + }, + // error-callback + function () { + var defaultInnerHTML = + "

Device data may not have been updated. Please refresh to try again.

"; + $(".panel-body").append(defaultInnerHTML); + } + ); + invokerUtil.post( + serviceUrlLocal, + payload, + // success-callback + function () { + $(".panel-body").show(); + }, + // error-callback + function () { + var defaultInnerHTML = + "

Device data may not have been updated. Please refresh to try again.

"; + $(".panel-body").append(defaultInnerHTML); + } + ); + + } $(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) { var activeTabPane = $(e.target).attr("href"); @@ -55,12 +86,12 @@ var InitiateViewOption = null; }); - $('.media.tab-responsive a[data-toggle="collapse"]').on('click',function(){ + $('.media.tab-responsive a[data-toggle="collapse"]').on('click', function () { var clickedPanel = $(this).attr('href'); - if($(clickedPanel).hasClass('in')){ + if ($(clickedPanel).hasClass('in')) { $(clickedPanel).collapse('hide'); - }else{ + } else { $(clickedPanel).collapse('show'); } }); @@ -74,26 +105,26 @@ var InitiateViewOption = null; var parentHeight = $(arrow).parent().innerHeight(); - if($(selectedTab).prev().length){ - $(selectedTab).prevAll().each(function() { + if ($(selectedTab).prev().length) { + $(selectedTab).prevAll().each(function () { totalHeight += $(this).innerHeight(); }); arrowPosition = totalHeight + (selectedTabHeight / 2); - }else{ + } else { arrowPosition = selectedTabHeight / 2; } - if(arrowPosition >= parentHeight){ + if (arrowPosition >= parentHeight) { parentHeight = arrowPosition + 50; $(arrow).siblings(".panel.active").height(parentHeight); - }else{ + } else { $(arrow).parent().removeAttr("style"); } $(arrow).css("top", arrowPosition - 10); } - $(document).ready(function() { + $(document).ready(function () { $(".device-detail-body").removeClass("hidden"); $("#loading-content").remove(); loadApplicationsList(); @@ -109,7 +140,7 @@ var InitiateViewOption = null; loadApplicationsList(); }); }); - + function loadOperationsLog(update) { var owner = $("#device-owner").data("owner"); var operationsLogTable = "#operations-log-table"; @@ -122,12 +153,12 @@ var InitiateViewOption = null; serverSide: true, processing: false, searching: false, - ordering: false, - pageLength : 10, + ordering: false, + pageLength: 10, order: [], ajax: { url: "/devicemgt/api/operation/paginate", - data: {deviceId : deviceIdentifier, deviceType: deviceType, owner:owner}, + data: {deviceId: deviceIdentifier, deviceType: deviceType, owner: owner}, dataSrc: function (json) { $("#operations-spinner").addClass("hidden"); $("#operations-log-container").empty(); @@ -135,43 +166,43 @@ var InitiateViewOption = null; } }, columnDefs: [ - {targets: 0, data: "code" }, - {targets: 1, data: "status", render: - function (status) { - var html; - switch (status) { - case "COMPLETED" : - html = " Completed"; - break; - case "PENDING" : - html = " Pending"; - break; - case "ERROR" : - html = " Error"; - break; - case "IN_PROGRESS" : - html = " In Progress"; - break; - case "REPEATED" : - html = " Repeated"; - break; - } - return html; + {targets: 0, data: "code"}, + { + targets: 1, data: "status", render: function (status) { + var html; + switch (status) { + case "COMPLETED" : + html = " Completed"; + break; + case "PENDING" : + html = " Pending"; + break; + case "ERROR" : + html = " Error"; + break; + case "IN_PROGRESS" : + html = " In Progress"; + break; + case "REPEATED" : + html = " Repeated"; + break; } + return html; + } }, - {targets: 2, data: "createdTimeStamp", render: - function (date) { - var value = String(date); - return value.slice(0, 16); - } + { + targets: 2, data: "createdTimeStamp", render: function (date) { + var value = String(date); + return value.slice(0, 16); + } } ], - "createdRow": function(row, data) { + "createdRow": function (row, data) { $(row).attr("data-type", "selectable"); $(row).attr("data-id", data["id"]); $.each($("td", row), - function(colIndex) { - switch(colIndex) { + function (colIndex) { + switch (colIndex) { case 1: $(this).attr("data-grid-label", "Code"); $(this).attr("data-display", data["code"]); @@ -220,18 +251,16 @@ var InitiateViewOption = null; var content = template(viewModel); $("#applications-list-container").html(content); } else { - $("#applications-list-container"). - html("

No applications found.

" + - "

Please try refreshing the list in a while.

"); + $("#applications-list-container").html("

No applications found.

" + + "

Please try refreshing the list in a while.

"); } } }, // error-callback function () { - $("#applications-list-container"). - html("

 Loading application list " + - "was not successful. please try refreshing the list in a while.

"); - }); + $("#applications-list-container").html("

 Loading application list " + + "was not successful. please try refreshing the list in a while.

"); + }); }); } @@ -282,17 +311,15 @@ var InitiateViewOption = null; $("#policy-compliance-table").addClass("hidden"); } } else { - $("#policy-list-container"). - html("

This device " + - "has no policy applied.

"); + $("#policy-list-container").html("

This device " + + "has no policy applied.

"); } } }, // error-callback function () { - $("#policy-list-container"). - html("

Loading policy compliance related data " + - "was not successful. please try refreshing data in a while.

"); + $("#policy-list-container").html("

Loading policy compliance related data " + + "was not successful. please try refreshing data in a while.

"); } ); } @@ -300,9 +327,8 @@ var InitiateViewOption = null; }, // error-callback function () { - $("#policy-list-container"). - html("

Loading policy compliance related data " + - "was not successful. please try refreshing data in a while.

"); + $("#policy-list-container").html("

Loading policy compliance related data " + + "was not successful. please try refreshing data in a while.

"); } ); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js index af0d1e5d8..10464f22c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js @@ -17,8 +17,10 @@ */ var map; +var isAnalitics = false; +var marker; -function loadLeafletMap() { +function loadLeafletMap(refresh) { var deviceLocationID = "#device-location", locations = $(deviceLocationID).data("locations"), @@ -28,8 +30,42 @@ function loadLeafletMap() { zoomLevel = 13, tileSet = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", attribution = "© OpenStreetMap contributors"; - if (locations && locations.locations.length > 0) { + if (refresh && !isAnalitics) { + var applicationsList = $("#applications-list"); + var deviceId = applicationsList.data("device-id"); + var deviceType = applicationsList.data("device-type"); + invokerUtil.get( + "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/location", + // success-callback + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + data = JSON.parse(data); + if (data.latitude && data.longitude) { + map.removeLayer(marker); + marker = L.marker([6.912853, 79.855635], {"opacity": opacVal}).addTo(map).bindPopup("Your device is here"); + // marker = L.marker([data.latitude, data.longitude], {"opacity": opacVal}).addTo(map).bindPopup("Your device is here"); + marker.on('mouseover', function (e) { + this.openPopup(); + }); + marker.on('mouseout', function (e) { + this.closePopup(); + }); + } + } else { + + $("#device-location").hide(); + $("#map-error").show(); + } + }, + // error-callback + function () { + $("#device-location").hide(); + $("#map-error").show(); + }); + + } else if (locations && locations.locations.length > 0) { + isAnalitics = true; var locationSets = locations.locations; map = L.map(container).setView([locationSets[0].lat, locationSets[0].lng], zoomLevel); L.tileLayer(tileSet, {attribution: attribution}).addTo(map); @@ -48,23 +84,26 @@ function loadLeafletMap() { } $("#map-error").hide(); $("#device-location").show(); - setTimeout(function(){ map.invalidateSize()}, 400); + setTimeout(function () { + map.invalidateSize() + }, 400); } else if (location_long && location_lat) { - map = L.map(container).setView([location_lat, location_long], zoomLevel); L.tileLayer(tileSet, {attribution: attribution}).addTo(map); - var m = L.marker([location_lat, location_long], {"opacity": opacVal}).addTo(map).bindPopup("Your device is here"); - m.on('mouseover', function (e) { + marker = L.marker([location_lat, location_long], {"opacity": opacVal}).addTo(map).bindPopup("Your device is here"); + marker.on('mouseover', function (e) { this.openPopup(); }); - m.on('mouseout', function (e) { + marker.on('mouseout', function (e) { this.closePopup(); }); $("#map-error").hide(); $("#device-location").show(); - setTimeout(function(){ map.invalidateSize()}, 400); + setTimeout(function () { + map.invalidateSize() + }, 400); } else { $("#device-location").hide(); $("#map-error").show(); @@ -73,6 +112,10 @@ function loadLeafletMap() { $(document).ready(function () { $(".location_tab").on("click", function () { - loadLeafletMap(); + loadLeafletMap(false); + }); + + $("#refresh-location").on("click", function () { + loadLeafletMap(true); }); }); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs index ee082f7b4..cc5660001 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs @@ -65,48 +65,56 @@ - + {{#unless iscloud}} + - Work-Profile Configurations - - - - - + Work-Profile Configurations + + + + + - Application Restrictions - - - - - + Application Restrictions + + + + + - System Update Policy (COSU) - - - - - + System Update Policy (COSU) + + + + + - Whitelist Apps (COSU) - - - - + Whitelist Apps (COSU) + + + + + {{/unless}}
@@ -302,400 +310,411 @@
-
- -
-
- +
+
-
- +
+
+ {{/unless}}
@@ -1375,9 +1394,7 @@
- This configuration can be used to set a passcode policy to an Android Device. - Once this configuration profile is installed on a device, corresponding users will not be able - to modify these settings on their devices. + this configurations can be used to set when system update take place in the COSU devices.