From 53baccd2e71911baffc55c00e5c7e8bddadb089d Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Wed, 3 Apr 2019 03:14:26 +0000 Subject: [PATCH] Kiosk Policy UI - Single Mode App --- .../public/js/operation-mod.js | 15 +++++++++++++ .../public/js/android-policy-edit.js | 18 +++++++++++++++- .../public/templates/android-policy-edit.hbs | 20 ++++++++++++++++++ .../public/templates/android-policy-view.hbs | 21 ++++++++++++++++++- .../public/js/android-policy-operations.js | 18 +++++++++++++++- .../templates/android-policy-operations.hbs | 20 ++++++++++++++++++ 6 files changed, 109 insertions(+), 3 deletions(-) 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.operation-mod/public/js/operation-mod.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.operation-mod/public/js/operation-mod.js index 775ddd756..e4bd32974 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.operation-mod/public/js/operation-mod.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.operation-mod/public/js/operation-mod.js @@ -210,6 +210,7 @@ var androidOperationModule = function () { payload["kioskBackgroundImage"] = deviceGlobalConfigurations["kioskBackgroundImage"]; payload["kioskLogoImage"] = deviceGlobalConfigurations["kioskLogoImage"]; payload["kioskAppName"] = deviceGlobalConfigurations["kioskAppName"]; + payload["isSingleModeApp"] = deviceGlobalConfigurations["isSingleModeApp"]; payload["isIdleGraphicsEnabled"] = deviceGlobalConfigurations["isIdleGraphicsEnabled"]; payload["idleTimeout"] = deviceGlobalConfigurations["idleTimeout"]; payload["isMultiUserDevice"] = deviceGlobalConfigurations["isMultiUserDevice"]; @@ -501,6 +502,20 @@ var androidOperationModule = function () { if (operationData["kioskAppName"]) { deviceGlobalConfigurations["kioskAppName"] = operationData["kioskAppName"]; } + deviceGlobalConfigurations["isSingleModeApp"] = operationData["isSingleModeApp"]; + if (deviceGlobalConfigurations["isSingleModeApp"] === true) { + var selectedSingleModeAppElement = "div#install-app-enrollment .child-input"; + if ($(selectedSingleModeAppElement + "[data-child-key='type']").val() === "Web Clip") { + var webClipApp = { + "identity": $(selectedSingleModeAppElement + "[data-child-key='packageName']").val(), + "title": $(selectedSingleModeAppElement + "[data-child-key='appName']").val() + }; + deviceGlobalConfigurations["singleModeApp"] = JSON.stringify(webClipApp); + } else { + deviceGlobalConfigurations["singleModeApp"] + = $(selectedSingleModeAppElement + "[data-child-key='packageName']").val(); + } + } deviceGlobalConfigurations["isIdleGraphicsEnabled"] = operationData["isIdleGraphicsEnabled"]; if (operationData["idleTimeout"]) { deviceGlobalConfigurations["idleTimeout"] = operationData["idleTimeout"]; 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-edit/public/js/android-policy-edit.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.policy-edit/public/js/android-policy-edit.js index bf162be35..f00f61f30 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-edit/public/js/android-policy-edit.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.policy-edit/public/js/android-policy-edit.js @@ -365,6 +365,22 @@ var validatePolicyProfile = function () { } } + if (continueToCheckNextInputs) { + var isSingleAppMode = $("input#cosu-global-config-is-single-application-mode").is(":checked"); + if (isSingleAppMode === true) { + var enrollmentAppInstallAppList = "div#install-app-enrollment .child-input"; + if ($(enrollmentAppInstallAppList).length === 0) { + validationStatus = { + "error": true, + "subErrorMsg": "No application has been selected in Enrollment Application Install " + + "config to run on Single Application Mode.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + } + if (continueToCheckNextInputs) { var isMultiUser = $("input#cosu-global-config-is-multi-user-device").is(":checked"); if (isMultiUser === true) { @@ -778,7 +794,7 @@ var validatePolicyProfile = function () { //If enrollment app install configured operation = androidOperationConstants["ENROLLMENT_APP_INSTALL"]; var enrollmentAppInstallAppList = "div#install-app-enrollment .child-input"; - if($(enrollmentAppInstallAppList).length == 0) { + if($(enrollmentAppInstallAppList).length === 0) { validationStatus = { "error": true, "subErrorMsg": "Applications are not selected to be installed during device enrollment.", 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-edit/public/templates/android-policy-edit.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-edit/public/templates/android-policy-edit.hbs index 4aa64554c..2d0318501 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-edit/public/templates/android-policy-edit.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-edit/public/templates/android-policy-edit.hbs @@ -1722,6 +1722,26 @@ class="form-control operationDataKeys" data-key="kioskAppName" maxlength="100" placeholder="Name to appear on the agent"/> +
+ +
+
+ +
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-view/public/templates/android-policy-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.policy-view/public/templates/android-policy-view.hbs index 055d5e2ec..d169203e5 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-view/public/templates/android-policy-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.policy-view/public/templates/android-policy-view.hbs @@ -1327,7 +1327,26 @@ class="form-control operationDataKeys" data-key="kioskAppName" maxlength="100" placeholder="Name to appear on the agent" disabled/>
- +
+
    + + Selected initial app in + Enrollment Application Install policy config + will be selected for single application mode +
+
+
+ +
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/js/android-policy-operations.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.policy-wizard/public/js/android-policy-operations.js index 636d264ed..5554413f2 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/js/android-policy-operations.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.policy-wizard/public/js/android-policy-operations.js @@ -308,6 +308,22 @@ var validatePolicyProfile = function () { } } + if (continueToCheckNextInputs) { + var isSingleAppMode = $("input#cosu-global-config-is-single-application-mode").is(":checked"); + if (isSingleAppMode === true) { + var enrollmentAppInstallAppList = "div#install-app-enrollment .child-input"; + if ($(enrollmentAppInstallAppList).length === 0) { + validationStatus = { + "error": true, + "subErrorMsg": "No application has been selected in Enrollment Application Install " + + "config to run on Single Application Mode.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + } + if (continueToCheckNextInputs) { var isMultiUser = $("input#cosu-global-config-is-multi-user-device").is(":checked"); if (isMultiUser === true) { @@ -713,7 +729,7 @@ var validatePolicyProfile = function () { //If enrollment app install configured operation = androidOperationConstants["ENROLLMENT_APP_INSTALL"]; var enrollmentAppInstallAppList = "div#install-app-enrollment .child-input"; - if($(enrollmentAppInstallAppList).length == 0) { + if($(enrollmentAppInstallAppList).length === 0) { validationStatus = { "error": true, "subErrorMsg": "Applications are not selected to be installed during device enrollment.", 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 c32e9099b..c6d8c6311 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 @@ -1453,6 +1453,26 @@ class="form-control operationDataKeys" data-key="kioskAppName" maxlength="100" placeholder="Name to appear on the agent"/>
+
+
    + + Selected initial app in + Enrollment Application Install policy config + will be selected for single application mode +
+
+
+ +