1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

changes as suggested by @knolleary

This commit is contained in:
mblackstock 2017-02-28 14:03:35 -08:00
parent 2bde07561f
commit 0979d565bb

View File

@ -22,9 +22,10 @@
<div class="form-row">
<label style="width: 120px;"><i class="fa fa-file-text-o"></i> <span data-i18n="tls.label.cert"></span></label>
<span class="tls-config-input-data">
<label class="btn ui-button" style="width: 85px; padding: 3px 0px;" for="node-config-input-certfile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
<label class="editor-button" for="node-config-input-certfile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
<input class="hide" type="file" id="node-config-input-certfile">
<span id="tls-config-certname" style="width: 180px; overflow: hidden; line-height:34px; height:34px; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle;"> </span>
<button class="editor-button editor-button-small" id="tls-config-button-cert-clear" style="margin-left: 10px"><i class="fa fa-times"></i></button>
</span>
<input type="hidden" id="node-config-input-certname">
<input type="hidden" id="node-config-input-certdata">
@ -33,9 +34,10 @@
<div class="form-row">
<label style="width: 120px;" for="node-config-input-key"><i class="fa fa-file-text-o"></i> <span data-i18n="tls.label.key"></span></label>
<span class="tls-config-input-data">
<label class="btn" style="width: 85px; padding: 3px 0px;" for="node-config-input-keyfile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
<label class="editor-button" for="node-config-input-keyfile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
<input class="hide" type="file" id="node-config-input-keyfile">
<span id="tls-config-keyname" style="width: 180px; overflow: hidden; line-height:34px; height:34px; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle;"> </span>
<button class="editor-button editor-button-small" id="tls-config-button-key-clear" style="margin-left: 10px"><i class="fa fa-times"></i></button>
</span>
<input type="hidden" id="node-config-input-keyname">
<input type="hidden" id="node-config-input-keydata">
@ -44,9 +46,10 @@
<div class="form-row">
<label style="width: 120px;" for="node-config-input-ca"><i class="fa fa-file-text-o"></i> <span data-i18n="tls.label.ca"></span></label>
<span class="tls-config-input-data">
<label class="btn" style="width: 85px; padding: 3px 0px;" for="node-config-input-cafile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
<label class="editor-button" for="node-config-input-cafile"><i class="fa fa-upload"></i> <span data-i18n="tls.label.upload"></span></label>
<input class="hide" type="file" title=" " id="node-config-input-cafile">
<span id="tls-config-caname" style="width: 180px; overflow: hidden; line-height:34px; height:34px; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle;"> </span>
<button class="editor-button editor-button-small" id="tls-config-button-ca-clear" style="margin-left: 10px"><i class="fa fa-times"></i></button>
</span>
<input type="hidden" id="node-config-input-caname">
<input type="hidden" id="node-config-input-cadata">
@ -89,7 +92,6 @@
certname: {value:""},
keyname: {value:""},
caname: {value:""},
uselocalfiles: {value:true},
verifyservercert: {value: true}
},
credentials: {
@ -116,6 +118,7 @@
$("#node-config-input-uselocalfiles").on("click",function() {
updateFileUpload();
});
function saveFile(property, file) {
var dataInputId = "#node-config-input-"+property+"data";
var filenameInputId = "#node-config-input-"+property+"name";
@ -137,6 +140,22 @@
$("#node-config-input-cafile" ).change(function() {
saveFile("ca", this.files[0]);
});
function clearNameData(prop) {
$("#tls-config-"+prop+"name").text("");
$("#node-config-input-"+prop+"data").val("");
$("#node-config-input-"+prop+"name").val("");
}
$("#tls-config-button-cert-clear").click(function() {
clearNameData("cert");
});
$("#tls-config-button-key-clear").click(function() {
clearNameData("key");
});
$("#tls-config-button-ca-clear").click(function() {
clearNameData("ca");
});
if (RED.settings.tlsDisableLocalFiles) {
$("#node-config-row-uselocalfiles").hide();
} else {
@ -144,7 +163,6 @@
}
// in case paths were set from old TLS config
if(this.cert || this.key || this.ca) {
this.uselocalfiles = true;
$("#node-config-input-uselocalfiles").prop('checked',true);
}
$("#tls-config-certname").text(this.certname);
@ -154,12 +172,9 @@
},
oneditsave: function() {
if ($("#node-config-input-uselocalfiles").is(':checked')) {
$("#node-config-input-cadata").val("");
$("#node-config-input-caname").val("");
$("#node-config-input-certdata").val("");
$("#node-config-input-certname").val("");
$("#node-config-input-keydata").val("");
$("#node-config-input-keyname").val("");
clearNameData("ca");
clearNameData("cert");
clearNameData("key");
} else {
$("#node-config-input-ca").val("");
$("#node-config-input-cert").val("");