@hypericon/node-red-hypertable
Version:
Node-RED plugin to interact with Hypertable
108 lines (92 loc) • 3.82 kB
HTML
<!-- 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('create-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 || "create record";
},
paletteLabel: "create 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="create-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-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="create-record">
<!-- The first p tag is used as a tooltip -->
<p>Creates a new 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 read</dd>
</dl>
<dl class="message-properties">
<dt class="optional">recordValues
<span class="property-type">object</span>
</dt>
<dd>Initial field values for the new record</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>record
<span class="property-type">object</span>
</dt>
<dd>The newly-created 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 initial field values of the record may be specified either in the node properties, in <code>msg.recordValues</code>, or remain unspecified.</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/Create%20a%20new%20Record">Hypertable API docs - create record endpoint</a></li>
</ul>
</script>