UNPKG

node-red-contrib-trustpoint

Version:

Node-RED nodes for EST (Enrollment over Secure Transport) and certificate operations.

81 lines (72 loc) 2.79 kB
<script type="text/html" data-template-name="trustpoint-store-certificate"> <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> Certificate File Path</label> <input type="text" id="node-input-filePath" placeholder="/path/to/device-cert.pem" style="width:250px;"> <input type="hidden" id="node-input-filePath_fieldType"> </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-certificate', { category: 'Trustpoint', color: '#3e91f7', defaults: { name: { value: "" }, filePath: { value: "" }, filePath_fieldType: { value: "str" } }, inputs: 1, outputs: 1, icon: "font-awesome/fa-certificate", label: function () { return this.name || "store-certificate"; }, labelStyle: function () { return this.name ? "node_label_italic" : ""; }, oneditprepare: function () { $("#node-input-filePath").typedInput({ default: 'str', types: ['msg', 'str', 'flow', 'global'], typeField: $("#node-input-filePath_fieldType") }); 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); updatePathPreview(); } }); })(); </script>