Merge branch 'application-mgt-new' into 'application-mgt-new'

Modify enrollment app install policy to support new app manager

See merge request entgra/carbon-device-mgt!224
feature/appm-store/pbac
Inosh Perara 5 years ago
commit 2eeec362b7

@ -166,6 +166,6 @@
"isOAuthEnabled": true, "isOAuthEnabled": true,
"backendRestEndpoints": { "backendRestEndpoints": {
"deviceMgt": "/api/device-mgt/v1.0", "deviceMgt": "/api/device-mgt/v1.0",
"appMgt": "/api/appm/store/v1.1" "appMgt": "/api/application-mgt-store/v1.0"
} }
} }

@ -67,7 +67,6 @@ policyModule = function () {
} else { } else {
policyObjectToView["deviceTypeIcon"] = policyObjectToView["platform"]; policyObjectToView["deviceTypeIcon"] = policyObjectToView["platform"];
} }
//policyObjectToView["icon"] = utility.getDeviceThumb(policyObjectToView["platform"]);
var ownershipType = "None"; var ownershipType = "None";
var deviceGroups = policyObjectFromRestEndpoint["deviceGroups"]; var deviceGroups = policyObjectFromRestEndpoint["deviceGroups"];
if (deviceGroups) { if (deviceGroups) {
@ -210,12 +209,15 @@ policyModule = function () {
} }
try { try {
var url = devicemgtProps["managerHTTPSURL"] + devicemgtProps["backendRestEndpoints"]["appMgt"] + var url = devicemgtProps["managerHTTPSURL"] + devicemgtProps["backendRestEndpoints"]["appMgt"] +
"/apps/mobileapp?field-filter=all"; "/applications";
return serviceInvokers.XMLHttp.get(url, var data = {
limit: -1
};
return serviceInvokers.XMLHttp.post(url, data,
function (backendResponse) { function (backendResponse) {
var response = {}; var response = {};
if (backendResponse.status === 200 && backendResponse.responseText) { if (backendResponse.status === 200 && backendResponse.responseText) {
var appListFromRestEndpoint = parse(backendResponse.responseText)["appList"]; var appListFromRestEndpoint = parse(backendResponse.responseText)["applications"];
var storeApps = []; var storeApps = [];
var i, appObjectFromRestEndpoint, appObjectToView; var i, appObjectFromRestEndpoint, appObjectToView;
for (i=0; i<appListFromRestEndpoint.length; i++) { for (i=0; i<appListFromRestEndpoint.length; i++) {
@ -223,16 +225,14 @@ policyModule = function () {
appObjectToView = {}; appObjectToView = {};
appObjectToView["appName"] = appObjectFromRestEndpoint["name"]; appObjectToView["appName"] = appObjectFromRestEndpoint["name"];
appObjectToView["appId"] = appObjectFromRestEndpoint["id"]; appObjectToView["appId"] = appObjectFromRestEndpoint["id"];
appObjectToView["webUrl"] = appObjectFromRestEndpoint["appmeta"]["weburl"]; if ("WEB_CLIP" === appObjectFromRestEndpoint["type"]) {
if ("webapp" === appObjectFromRestEndpoint["platform"]) {
appObjectToView["packageName"] = appObjectFromRestEndpoint["appmeta"]["weburl"];
appObjectToView["type"] = "Web Clip" appObjectToView["type"] = "Web Clip"
} else { } else {
appObjectToView["packageName"] = appObjectFromRestEndpoint["appmeta"]["package"];
appObjectToView["type"] = "Mobile App" appObjectToView["type"] = "Mobile App"
} }
appObjectToView["version"] = appObjectFromRestEndpoint["version"]; appObjectToView["uuid"] = appObjectFromRestEndpoint["applicationReleases"][0]["uuid"];
appObjectToView["platform"] = appObjectFromRestEndpoint["platform"]; appObjectToView["version"] = appObjectFromRestEndpoint["applicationReleases"][0]["version"];
appObjectToView["platform"] = appObjectFromRestEndpoint["deviceType"];
storeApps.push(appObjectToView); storeApps.push(appObjectToView);
} }
response.status = "success"; response.status = "success";

@ -202,7 +202,7 @@ function getStoreApps(storeApps, deviceType) {
var selectedApps = []; var selectedApps = [];
var i; var i;
for (i=0; i<storeApps.length; i++) { for (i=0; i<storeApps.length; i++) {
if (deviceType === storeApps[i].platform || "webapp" === storeApps[i].platform) { if (deviceType === storeApps[i].platform || "ANY" === storeApps[i].platform) {
selectedApps.push(storeApps[i]); selectedApps.push(storeApps[i]);
} }
} }

@ -259,7 +259,7 @@ function getStoreApps(storeApps, deviceType) {
var selectedApps = []; var selectedApps = [];
var i; var i;
for (i=0; i<storeApps.length; i++) { for (i=0; i<storeApps.length; i++) {
if (storeApps[i].platform === deviceType || "webapp" === storeApps[i].platform) { if (deviceType === storeApps[i].platform || "ANY" === storeApps[i].platform) {
selectedApps.push(storeApps[i]); selectedApps.push(storeApps[i]);
} }
} }

Loading…
Cancel
Save