Merge branch 'cert-ui' into 'master'

Fix issue with cert file read

See merge request entgra/carbon-device-mgt-plugins!47
revert-dabc3590
Charitha Goonetilleke 6 years ago
commit 6acc9e67ef

@ -174,14 +174,14 @@ var ovpnConfigUploaded = function () {
}; };
var certConfigUploaded = function (val) { var certConfigUploaded = function (val) {
var certFileInput = document.getElementById("cert-file-field"); var certFileInput = $(val);
if ('files' in certFileInput) { if (certFileInput[0].files) {
if (certFileInput.files.length === 1) { if (certFileInput[0].files.length === 1) {
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function (progressEvent) { reader.onload = function(progressEvent){
var txt = ""; var txt = "";
var lines = this.result.split('\n'); 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]); console.log(lines[line]);
if (lines[line].charAt(0) !== '#') { if (lines[line].charAt(0) !== '#') {
txt += lines[line] + '\n'; txt += lines[line] + '\n';
@ -191,7 +191,7 @@ var certConfigUploaded = function (val) {
//console.log(document.getElementById ("cert-config").value); //console.log(document.getElementById ("cert-config").value);
$(val).next().val(txt); $(val).next().val(txt);
}; };
reader.readAsText(certFileInput.files[0]); reader.readAsText(certFileInput[0].files[0]);
} }
} }
}; };

@ -78,9 +78,9 @@
</a> </a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)"> <a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)">
<span class="wr-hidden-operations-icon fw-stack"> <span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-security-policy fw-stack-2x"></i> <i class="fw fw-pages fw-stack-2x"></i>
</span> </span>
Secure Certificates Certificates Install
<span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span> <span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span> <span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span> <span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
@ -1431,7 +1431,7 @@
data-operation-code="INSTALL_CERT"> data-operation-code="INSTALL_CERT">
<div id="cert-heading" class="panel-heading" role="tab"> <div id="cert-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title"> <h2 class="sub-title panel-title">
Secure Certificate Settings Certificate Install Settings
<label class="wr-input-control switch" data-toggle="collapse" <label class="wr-input-control switch" data-toggle="collapse"
data-target="#cert-body"> data-target="#cert-body">
<input type="checkbox"/> <input type="checkbox"/>
@ -1440,7 +1440,7 @@
</label> </label>
</h2> </h2>
<div class="panel-title-description"> <div class="panel-title-description">
Configure the Secure Certificate settings on Android devices. Configure the certificate install settings on Android devices.
</div> </div>
</div> </div>
<div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel" <div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel"

@ -61,9 +61,9 @@
</a> </a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)"> <a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)">
<span class="wr-hidden-operations-icon fw-stack"> <span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-security-policy fw-stack-2x"></i> <i class="fw fw-pages fw-stack-2x"></i>
</span> </span>
Secure Certificate Certificate Install
<span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span> <span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span> <span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span> <span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
@ -2327,7 +2327,7 @@
data-operation-code="INSTALL_CERT"> data-operation-code="INSTALL_CERT">
<div id="cert-heading" class="panel-heading" role="tab"> <div id="cert-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title"> <h2 class="sub-title panel-title">
Secure Certificate Settings Certificate Install Settings
<label class="wr-input-control switch hidden" data-toggle="collapse" <label class="wr-input-control switch hidden" data-toggle="collapse"
data-target="#cert-body"> data-target="#cert-body">
<input type="checkbox"/> <input type="checkbox"/>
@ -2336,7 +2336,7 @@
</label> </label>
</h2> </h2>
<div class="panel-title-description"> <div class="panel-title-description">
Configure the Secure Certificate settings on Android devices. Configure the certificate install settings on Android devices.
</div> </div>
</div> </div>
<div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel" <div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel"

@ -115,11 +115,10 @@ var ovpnConfigUploaded = function () {
} }
}; };
var certConfigUploaded = function (val) { var certConfigUploaded = function (val) {
var certFileInput = document.getElementById("cert-file-field"); var certFileInput = $(val);
if ('files' in certFileInput) { if (certFileInput[0].files) {
if (certFileInput.files.length === 1) { if (certFileInput[0].files.length === 1) {
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function(progressEvent){ reader.onload = function(progressEvent){
var txt = ""; var txt = "";
@ -134,7 +133,7 @@ var certConfigUploaded = function (val) {
//console.log(document.getElementById ("cert-config").value); //console.log(document.getElementById ("cert-config").value);
$(val).next().val(txt); $(val).next().val(txt);
}; };
reader.readAsText(certFileInput.files[0]); reader.readAsText(certFileInput[0].files[0]);
} }
} }
}; };

@ -78,9 +78,9 @@
</a> </a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)"> <a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)">
<span class="wr-hidden-operations-icon fw-stack"> <span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-security-policy fw-stack-2x"></i> <i class="fw fw-pages fw-stack-2x"></i>
</span> </span>
Secure Certificate Certificate Install
<span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span> <span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span> <span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span> <span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
@ -2346,7 +2346,7 @@
data-operation-code="INSTALL_CERT"> data-operation-code="INSTALL_CERT">
<div id="cert-heading" class="panel-heading" role="tab"> <div id="cert-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title"> <h2 class="sub-title panel-title">
Secure Certificate Settings Certificate Install Settings
<label class="wr-input-control switch" data-toggle="collapse" <label class="wr-input-control switch" data-toggle="collapse"
data-target="#cert-body"> data-target="#cert-body">
<input type="checkbox"/> <input type="checkbox"/>
@ -2355,7 +2355,7 @@
</label> </label>
</h2> </h2>
<div class="panel-title-description"> <div class="panel-title-description">
Configure the Secure Certificate settings on Android devices. Configure the certificate install settings on Android devices.
</div> </div>
</div> </div>
<div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel" <div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel"

Loading…
Cancel
Save