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 eb36242fe..d673b6d6a 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 @@ -55,6 +55,13 @@ var updateGroupedInputVisibility = function (domElement) { } }; +/** + * Populates policy configuration to the ui elements. + * + * This method will be invoked from the relevant cdmf unit when the edit page gets loaded. + * + * @param configuredOperations selected configurations. + */ var polulateProfileOperations = function (configuredOperations) { $(".wr-advance-operations li.grouped-input").each(function () { updateGroupedInputVisibility(this); @@ -80,6 +87,13 @@ var inputIsValidAgainstRange = function (numberInput, min, max) { return (numberInput == min || (numberInput > min && numberInput < max) || numberInput == max); }; +/** + * Validates policy profile operations for the windows platform. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {boolean} whether validation is successful. + */ var validatePolicyProfile = function () { var validationStatusArray = []; var validationStatus; @@ -528,6 +542,30 @@ var validatePolicyProfile = function () { return wizardIsToBeContinued; }; +/** + * Generates policy profile object which will be saved with the profile. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {Array} profile payloads + */ +var generatePolicyProfile = function () { + var profilePayloads = []; + // traverses key by key in policy["profile"] + var key; + for (key in policy["profile"]) { + if (policy["profile"].hasOwnProperty(key)) { + profilePayloads.push({ + "featureCode": key, + "deviceType": policy["platform"], + "content": policy["profile"][key] + }); + } + } + + return profilePayloads; +}; + // Start of HTML embedded invoke methods var showAdvanceOperation = function (operation, button) { $(button).addClass('selected'); 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 085379107..22bf73250 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 @@ -67,6 +67,13 @@ var inputIsValidAgainstRange = function (numberInput, min, max) { return (numberInput == min || (numberInput > min && numberInput < max) || numberInput == max); }; +/** + * Validates policy profile operations for the windows platform. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {boolean} whether validation is successful. + */ var validatePolicyProfile = function () { var validationStatusArray = []; var validationStatus; @@ -515,6 +522,30 @@ var validatePolicyProfile = function () { return wizardIsToBeContinued; }; +/** + * Generates policy profile object which will be saved with the profile. + * + * This function will be invoked from the relevant cdmf unit at the time of policy creation. + * + * @returns {Array} profile payloads + */ +var generatePolicyProfile = function () { + var profilePayloads = []; + // traverses key by key in policy["profile"] + var key; + for (key in policy["profile"]) { + if (policy["profile"].hasOwnProperty(key)) { + profilePayloads.push({ + "featureCode": key, + "deviceType": policy["platform"], + "content": policy["profile"][key] + }); + } + } + + return profilePayloads; +}; + // Start of HTML embedded invoke methods var showAdvanceOperation = function (operation, button) { $(button).addClass('selected');