node-red-contrib-trustpoint
Version:
Node-RED nodes for EST (Enrollment over Secure Transport) and certificate operations.
82 lines (73 loc) • 2.78 kB
HTML
<script type="text/html" data-template-name="trustpoint-store-key">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Node name">
</div>
<div class="form-row">
<label for="node-input-filePath"><i class="fa fa-folder"></i> Key File Path</label>
<input type="text" id="node-input-filePath" style="width:250px;">
<input type="hidden" id="node-input-filePathType">
</div>
<div id="path-preview" class="validation-result">
<div class="validation-box" id="path-preview-box"></div>
</div>
</script>
<style>
.validation-box {
padding: 10px;
border-radius: 5px;
margin-top: 10px;
font-weight: normal;
}
.validation-info {
background-color: #4cafaf;
color: white;
}
.validation-error {
background-color: #f44336;
color: white;
}
</style>
<script type="text/javascript">
(function () {
RED.nodes.registerType('trustpoint-store-key', {
category: 'Trustpoint',
color: '#3e91f7',
defaults: {
name: { value: "" },
filePath: { value: "", required: false },
filePathType: { value: "str" }
},
inputs: 1,
outputs: 1,
icon: "font-awesome/fa-key",
label: function () {
return this.name || "store-key";
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function () {
$("#node-input-filePath").typedInput({
default: 'str',
types: ['msg', 'str', 'flow', 'global'],
typeField: "#node-input-filePathType"
});
function updatePathPreview() {
const path = $("#node-input-filePath").val();
const box = $("#path-preview-box");
if (path) {
box.text("Target file path: " + path);
box.removeClass("validation-error").addClass("validation-box validation-info");
} else {
box.text("No path defined – default directory will be used.");
box.removeClass("validation-error").addClass("validation-box validation-info");
}
}
$("#node-input-filePath").on("change", updatePathPreview);
$("#node-input-filePathType").on("change", updatePathPreview);
updatePathPreview();
}
});
})();
</script>