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 498aa73d2d..b03a521af9 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
@@ -51,9 +51,9 @@ var InitiateViewOption = null;
$(".panel-body").append(defaultInnerHTML);
}
);
-
-
- invokerUtil.post(
+
+
+ invokerUtil.post(
serviceUrlLocal,
payload,
// success-callback
@@ -67,7 +67,7 @@ var InitiateViewOption = null;
$(".panel-body").append(defaultInnerHTML);
}
);
-
+
}
@@ -90,12 +90,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');
}
});
@@ -109,26 +109,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();
@@ -144,7 +144,7 @@ var InitiateViewOption = null;
loadApplicationsList();
});
});
-
+
function loadOperationsLog(update) {
var owner = $("#device-owner").data("owner");
var operationsLogTable = "#operations-log-table";
@@ -157,12 +157,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();
@@ -170,43 +170,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"]);
@@ -255,18 +255,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.
");
+ });
});
}
@@ -317,17 +315,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.
");
}
);
}
@@ -335,9 +331,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 af0d1e5d88..10464f22c6 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 ee082f7b4d..cc5660001c 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 @@