From 6cf9dc1c67b4d32fb6ca03ffde00a9f78f3bc21c Mon Sep 17 00:00:00 2001 From: dilanua Date: Wed, 7 Sep 2016 14:15:43 +0530 Subject: [PATCH 1/4] Updating emm policy create UI --- .../app/units/mdm.unit.policy.create/create.hbs | 5 ++--- .../devicemgt/app/units/mdm.unit.policy.create/create.js | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) 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.policy.create/create.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.hbs index 8296cccbf..61c0a85ce 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.hbs @@ -265,8 +265,8 @@ data-next="policy-profile" data-platform="{{name}}" data-validate="false"> - -

+ + {{label}} @@ -295,4 +295,3 @@ type="text/x-handlebars-template"> {{js "/js/policy-create.js"}} {{/zone}} - 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.policy.create/create.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.js index 82ae71a83..5072ac956 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/create.js @@ -17,7 +17,7 @@ */ function onRequest() { - var log = new Log("/app/units/mdm.unit.policy.create"); + // var log = new Log("/app/units/mdm.unit.policy.create"); var CONF_DEVICE_TYPE_KEY = "deviceType"; var CONF_DEVICE_TYPE_LABEL_KEY = "label"; @@ -35,6 +35,11 @@ function onRequest() { var content = {}; var deviceType = deviceTypes[i]; content["name"] = deviceType; + if (deviceType == "ios") { + content["deviceTypeIcon"] = "apple"; + } else { + content["deviceTypeIcon"] = deviceType; + } var configs = utility.getDeviceTypeConfig(deviceType); var deviceTypeLabel = deviceType; if (configs && configs[CONF_DEVICE_TYPE_KEY][CONF_DEVICE_TYPE_LABEL_KEY]) { @@ -43,7 +48,7 @@ function onRequest() { var policyWizard = new File("/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-wizard")); if (policyWizard.isExists()) { - content["icon"] = utility.getDeviceThumb(deviceType); + // content["icon"] = utility.getDeviceThumb(deviceType); content["label"] = deviceTypeLabel; viewModelData["types"].push(content); } From 71d7baf04fe987787817d80fb606e669691cb274 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 7 Sep 2016 14:32:42 +0530 Subject: [PATCH 2/4] Fixing iOS enrollement check polling url --- .../emm-web-agent/app/conf/config.json | 2 +- .../modules/enrollments/ios/agent-check.jag | 37 ++++++++++--------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/conf/config.json b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/conf/config.json index b3f8ba718..2400b0730 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/conf/config.json +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/conf/config.json @@ -5,7 +5,7 @@ "httpURL" : "%http.ip%", "enrollmentDir": "/emm-web-agent/enrollment", "iOSConfigRoot" : "%https.ip%/ios-enrollment/", - "iOSAPIRoot" : "%https.ip%/ios/", + "iOSAPIRoot" : "%https.ip%/api/device-mgt/ios/v1.0/", "dynamicClientRegistrationEndPoint" : "%https.ip%/dynamic-client-web/register/", "adminService":"%https.ip%", "idPServer":"%https.ip%", diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/modules/enrollments/ios/agent-check.jag b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/modules/enrollments/ios/agent-check.jag index 2283505a0..797fc44b4 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/modules/enrollments/ios/agent-check.jag +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/modules/enrollments/ios/agent-check.jag @@ -22,6 +22,9 @@ var log = new Log("/modules/enrollments/ios/agent-check.jag"); var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; var UAParser = require("/app/modules/ua-parser.min.js")["UAParser"]; +var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; +var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; + var parser = new UAParser(); var userAgent = request.getHeader("User-Agent"); parser.setUA(userAgent); @@ -39,25 +42,25 @@ if (platform != "iOS") { response["status"] = 200; response["content"] = {"deviceID" : null}; } else { - var deviceCheckURL = mdmProps["iOSAPIRoot"] + "device/deviceid"; - - var xhr = new XMLHttpRequest(); - xhr.open("POST", deviceCheckURL); + var deviceCheckURL = mdmProps["iOSAPIRoot"] + "devices/udid"; var challengeToken = session.get("iOSChallengeToken"); - var inputs = {"challengeToken" : challengeToken}; - xhr.setRequestHeader("Content-Type", "application/json"); - xhr.setRequestHeader("Accept", "application/json"); - xhr.send(stringify(inputs)); + var payload = {"challengeToken" : challengeToken}; - if (xhr.status == 200) { - var responseObject = parse(xhr["responseText"]); - response["status"] = 200; - response["content"] = responseObject; - } else { - // server only returns 400 in case of bad request - response["status"] = 200; - response["content"] = {"deviceID" : null}; - } + serviceInvokers.XMLHttp.post( + deviceCheckURL, + stringify(payload), + function (restAPIResponse) { + var status = restAPIResponse["status"]; + if (status == 200) { + var responseContent = parse(restAPIResponse.responseText); + response["status"] = 200; + response["content"] = responseContent; + } else { + response["status"] = 200; + response["content"] = {"deviceID" : null}; + } + } + ); } } %> \ No newline at end of file From 435759f9614e73e0ef411e7b595abe7d90ea2cf2 Mon Sep 17 00:00:00 2001 From: dilanua Date: Wed, 7 Sep 2016 14:57:32 +0530 Subject: [PATCH 3/4] Updating policy listing - UI --- .../devicemgt/app/pages/mdm.page.policies/policies.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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.policies/policies.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/policies.hbs index 54c837ab7..d71b65cf6 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/policies.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/policies.hbs @@ -174,8 +174,8 @@ -
- +
+
Date: Wed, 7 Sep 2016 16:24:17 +0530 Subject: [PATCH 4/4] Updating policy UIs with API method updates --- .../app/pages/mdm.page.policies/public/js/policy-list.js | 4 ++-- .../app/units/mdm.unit.policy.edit/public/js/edit.js | 4 ++-- .../app/units/mdm.unit.policy.view/public/js/view.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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.policies/public/js/policy-list.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/public/js/policy-list.js index 978d6f0bd..763d70245 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/public/js/policy-list.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.policies/public/js/policy-list.js @@ -215,7 +215,7 @@ $(document).ready(function () { // on-click function for policy un-publishing "yes" button $("a#unpublish-policy-yes-link").click(function () { - invokerUtil.put( + invokerUtil.post( serviceURL, policyList, // on success @@ -268,7 +268,7 @@ $(document).ready(function () { // on-click function for policy removing "yes" button $("a#publish-policy-yes-link").click(function () { - invokerUtil.put( + invokerUtil.post( serviceURL, policyList, // on success 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.policy.edit/public/js/edit.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js index 89252aaf1..d347446a3 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js @@ -2038,7 +2038,7 @@ var updatePolicy = function (policy, state) { policyList.push(getParameterByName("id")); if (state == "save") { serviceURL = "/api/device-mgt/v1.0/policies/deactivate-policy"; - invokerUtil.put( + invokerUtil.post( serviceURL, policyList, // on success @@ -2055,7 +2055,7 @@ var updatePolicy = function (policy, state) { ); } else if (state == "publish") { serviceURL = "/api/device-mgt/v1.0/policies/activate-policy"; - invokerUtil.put( + invokerUtil.post( serviceURL, policyList, // on success 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.policy.view/public/js/view.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.view/public/js/view.js index cbb4d7a58..703b523ea 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.view/public/js/view.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.view/public/js/view.js @@ -1824,7 +1824,7 @@ var updatePolicy = function (policy, state) { var policyList = []; policyList.push(getParameterByName("id")); serviceURL = base_api_url + "/policies/deactivate-policy"; - invokerUtil.put( + invokerUtil.post( serviceURL, policyList, // on success @@ -1841,7 +1841,7 @@ var updatePolicy = function (policy, state) { var policyList = []; policyList.push(getParameterByName("id")); serviceURL = base_api_url + "/policies/activate-policy"; - invokerUtil.put( + invokerUtil.post( serviceURL, policyList, // on success