UNPKG

@skylord123/node-red-contrib-backrest

Version:

Node-RED nodes for interacting with Backrest, a restic-powered backup management tool.

148 lines (134 loc) 5.69 kB
<script type="text/javascript"> RED.nodes.registerType('backrest-get-logs', { category: 'backrest', color: "#00e4d3", defaults: { name: { value: "" }, config: { type: "backrest-config", required: true }, triggerValue: { value: "true", required: false }, triggerType: { value: "bool", required: false }, logRefValue: { value: "logRef", required: false }, logRefType: { value: "msg", required: false } }, inputs: 1, outputs: 1, icon: "node-red-contrib-backrest-logo.png", paletteLabel: "Get Logs", label: function() { return this.name || "Get Logs"; }, oneditprepare: function() { // Listen typed input $("#node-input-triggerValue").typedInput({ types: ["msg","flow","global","str","jsonata","bool","num"], typeField: "#node-input-triggerType" }); // Log ref typed input $("#node-input-logRefValue").typedInput({ types: ["msg","flow","global","str","jsonata","bool","num"], typeField: "#node-input-logRefType" }); }, oneditsave: function() { this.triggerValue = $("#node-input-triggerValue").typedInput("value"); this.triggerType = $("#node-input-triggerValue").typedInput("type"); this.logRefValue = $("#node-input-logRefValue").typedInput("value"); this.logRefType = $("#node-input-logRefValue").typedInput("type"); } }); </script> <script type="text/html" data-template-name="backrest-get-logs"> <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="Give this node a name" /> </div> <div class="form-row"> <label for="node-input-config"> <i class="fa fa-server"></i> Backrest Server </label> <input type="text" id="node-input-config" /> </div> <div class="form-row"> <label for="node-input-triggerValue"> <i class="fa fa-play"></i> Trigger </label> <input type="text" id="node-input-triggerValue" style="width:60%;" /> <input type="hidden" id="node-input-triggerType" /> <div style="margin-left:5px;"> <small> Evaluates to <strong>true</strong> to start the GetLogs stream and <strong>false</strong> to stop it. If fetching logs for completed tasks or if stopping the stream isn't necessary, leave this set to <strong>true</strong>. </small> </div> </div> <div class="form-row"> <label for="node-input-logRefValue"> <i class="fa fa-file-text-o"></i> Log Reference </label> <input type="text" id="node-input-logRefValue" style="width:60%;" /> <input type="hidden" id="node-input-logRefType" /> <div style="margin-left:5px;"> <small>The "ref" for which logs should be streamed.</small> </div> </div> </script> <script type="text/html" data-help-name="backrest-get-logs"> <p>Streams logs from a Backrest operation. This node allows you to monitor the progress and output of backup, restore, and other operations in real-time.</p> <h3>Inputs</h3> <dl class="message-properties"> <dt> msg.logRef <span class="property-type">string</span> </dt> <dd>The reference ID of the operation to stream logs from.</dd> <dt class="optional"> msg.listen <span class="property-type">boolean</span> </dt> <dd>Set to true to start streaming logs, false to stop.</dd> </dl> <h3>Properties</h3> <dl class="message-properties"> <dt>Backrest Config <span class="property-type">config</span> </dt> <dd>Configuration for connecting to the Backrest server.</dd> <dt>Start Listening? <span class="property-type">msg | flow | global | bool</span> </dt> <dd>Property that determines when to start/stop streaming logs.</dd> <dt>Log Reference <span class="property-type">msg | flow | global | string</span> </dt> <dd>Property containing the operation reference ID to stream logs from.</dd> </dl> <h3>Outputs</h3> <dl class="message-properties"> <dt> msg.payload <span class="property-type">object | string</span> </dt> <dd>Log data from the operation. If the data is valid JSON, it will be parsed into an object. Otherwise, it will be output as a string.</dd> </dl> <h3>Details</h3> <p>The Get Logs node provides real-time access to operation logs from your Backrest server. Common uses include:</p> <ul> <li>Monitoring backup progress</li> <li>Debugging failed operations</li> <li>Capturing operation output for auditing</li> <li>Real-time status updates</li> </ul> <h3>Usage</h3> <p>To use this node:</p> <ol> <li>Configure the node with your Backrest server details</li> <li>Set the Log Reference to the operation ID you want to monitor</li> <li>Set Start Listening to true to begin receiving logs</li> <li>The node will emit messages containing log data until either: <ul> <li>The operation completes</li> <li>Start Listening is set to false</li> <li>An error occurs</li> </ul> </li> </ol> </script>