From c3d75251782ddc44ccd8131afc56edf9254e8a84 Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Wed, 26 Jun 2019 03:56:12 +0000 Subject: [PATCH] Fix issue with cert file read --- .../public/js/android-policy-edit.js | 12 ++++++------ .../public/templates/android-policy-edit.hbs | 8 ++++---- .../public/templates/android-policy-view.hbs | 8 ++++---- .../public/js/android-policy-operations.js | 9 ++++----- .../public/templates/android-policy-operations.hbs | 8 ++++---- 5 files changed, 22 insertions(+), 23 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.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 f8e7c65fa3..c346464678 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 @@ -174,14 +174,14 @@ var ovpnConfigUploaded = function () { }; var certConfigUploaded = function (val) { - var certFileInput = document.getElementById("cert-file-field"); - if ('files' in certFileInput) { - if (certFileInput.files.length === 1) { + var certFileInput = $(val); + if (certFileInput[0].files) { + if (certFileInput[0].files.length === 1) { var reader = new FileReader(); - reader.onload = function (progressEvent) { + reader.onload = function(progressEvent){ var txt = ""; var lines = this.result.split('\n'); - for (var line = 0; line < lines.length; line++) { + for(var line = 0; line < lines.length; line++){ console.log(lines[line]); if (lines[line].charAt(0) !== '#') { txt += lines[line] + '\n'; @@ -191,7 +191,7 @@ var certConfigUploaded = function (val) { //console.log(document.getElementById ("cert-config").value); $(val).next().val(txt); }; - reader.readAsText(certFileInput.files[0]); + reader.readAsText(certFileInput[0].files[0]); } } }; 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 28dac30632..62c5b887c9 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 @@ -78,9 +78,9 @@ - + - Secure Certificates + Certificates Install @@ -1431,7 +1431,7 @@ data-operation-code="INSTALL_CERT">
- + - Secure Certificate + Certificate Install @@ -2327,7 +2327,7 @@ data-operation-code="INSTALL_CERT">