UNPKG

@hypericon/node-red-hypertable

Version:

Node-RED plugin to interact with Hypertable

116 lines (98 loc) 4.14 kB
<!-- Node HTML file docs: https://nodered.org/docs/creating-nodes/node-html --> <!-- the main node definition that is registered with the editor --> <script type="text/javascript"> RED.nodes.registerType('update-record', { category: 'storage', color: '#EDF2F7', defaults: { name: { value: "" }, connection: { value: "", type: "hypertable-connection" }, // baseUrl: { value: "https://hypertable.cloud", required: true }, // projectId: { value: "", required: true }, collectionId: { value: "" }, recordId: { value: "" }, recordValues: { value: "{}" }, }, inputs: 1, outputs: 1, icon: "hypertable-logo-h.png", label: function () { return this.name || "update record"; }, paletteLabel: "update record", oneditprepare: function () { $("#node-input-recordValues").typedInput({ type: "json", types: ["json"] }); }, }); </script> <!-- the node edit template --> <!-- Docs: https://nodered.org/docs/creating-nodes/edit-dialog --> <script type="text/html" data-template-name="update-record"> <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="Name"> </div> <div class="form-row"> <label for="node-input-connection"><i class="fa fa-database"></i> Connection</label> <input type="text" id="node-input-connection" placeholder="Hypertable Connection"> </div> <div class="form-row"> <label for="node-input-collectionId"><i class="fa fa-table"></i> Collection ID</label> <input type="text" id="node-input-collectionId" placeholder="Collection ID"> </div> <p>(or set <code>msg.collectionId</code> instead)</p> <div class="form-row"> <label for="node-input-recordId"><i class="fa fa-file-text-o"></i> Record ID</label> <input type="text" id="node-input-recordId" placeholder="Record ID"> </div> <p>(or set <code>msg.recordId</code> instead)</p> <div class="form-row"> <label for="node-input-recordValues"><i class="fa fa-file-text-o"></i> Record values</label> <input type="text" id="node-input-recordValues" placeholder="Record values"> </div> <p>(or set <code>msg.recordValues</code> instead)</p> </script> <!-- the help text --> <script type="text/html" data-help-name="update-record"> <!-- The first p tag is used as a tooltip --> <p>Updates the field values for a specified Hypertable record</p> <h3>Inputs</h3> <dl class="message-properties"> <dt class="optional">collectionId <span class="property-type">string</span> </dt> <dd>The ID of the collection containing the target record</dd> </dl> <dl class="message-properties"> <dt class="optional">recordId <span class="property-type">string</span> </dt> <dd>The ID of the record to update</dd> </dl> <dl class="message-properties"> <dt class="optional">recordValues <span class="property-type">object</span> </dt> <dd>Updated field values for the record</dd> </dl> <h3>Outputs</h3> <dl class="message-properties"> <dt>record <span class="property-type">object</span> </dt> <dd>The updated record</dd> </dl> <h3>Details</h3> <p>The ID of the Hypertable collection is specified either in the node properties, or in <code>msg.collectionId</code>.</p> <p>The ID of the Hypertable record is specified either in the node properties, or in <code>msg.recordId</code>.</p> <p>The updated field values of the record may be specified either in the node properties, in <code>msg.recordValues</code>.</p> <p>Any number of field values may be updated in the specified record.</p> <h3>References</h3> <ul> <li><a href="https://hypertable.co.uk/docs/hypertable/features/records">Hypertable docs - records</a></li> <li><a href="https://hypertable.co.uk/docs/developers/hypertable-api#operation/Patch%20a%20Record">Hypertable API docs - patch record endpoint</a></li> </ul> </script>