UNPKG

@thingweb/node-red-node-wot

Version:
138 lines (130 loc) 6.18 kB
<script type="text/javascript"> ;(() => { RED.nodes.registerType("wot-server-property", { category: "Web of Things", color: "#a2dea0", defaults: { name: { value: "" }, propertyName: { value: "", required: true }, propertyDescription: { value: "" }, propertyDataType: { value: "string", required: true }, propertyReadOnlyFlag: { value: false, required: true }, propertyObservableFlag: { value: true, required: true }, outParams2_writingValueType: { value: "msg", required: true, }, outParams2_writingValueConstValue: { value: "payload", required: true, }, woTServerConfig: { type: "wot-server-config", value: "", required: true, }, woTThingConfig: { type: "wot-thing-config", value: "", required: true, }, }, inputs: 1, outputs: 2, outputLabels: function (index) { return [this._("editor.outParams1.outputLabel"), this._("editor.outParams2.outputLabel")][index] }, icon: "arrow.png", label: function () { return this.name || this._("editor.paletteLabel") || "wot-server-property" }, labelStyle: function () { return this.name ? "node_label_italic" : "" }, paletteLabel: function () { return this._("editor.paletteLabel") || "node" }, onpaletteadd: function () {}, oneditprepare: function () { console.log("node oneditprepare") // Tab const tabs = RED.tabs.create({ id: "red-tabs", onchange(tab) { $("#tabs-content").children().hide() $("#" + tab.id).show() $("#red-tabs").resize() }, }) tabs.addTab({ id: "tab-outParams2-settings", label: this._("editor.outParams2.tabLabel"), }) $("#node-input-outParams2_writingValueConstValue").typedInput({ defaultType: "msg", defaultValue: "payload", types: ["msg"], typeField: "#node-input-outParams2_writingValueType", }) }, }) })() </script> <script type="text/html" data-template-name="wot-server-property"> <div class="form-row"> <label for="node-input-name"><span data-i18n="editor.nameLabel"></span></label> <input type="text" id="node-input-name" data-i18n="[placeholder]editor.nameLabel"> </div> <div class='form-row'> <label for='node-input-woTServerConfig' style='font-size: 95%;'><span data-i18n="editor.serverConfigLabel"></label> <input required type='url' id='node-input-woTServerConfig' placeholder='[placeholder]editor.serverConfigLabel'> </div> <div class='form-row'> <label for='node-input-woTThingConfig' style='font-size: 95%;'><span data-i18n="editor.thingConfigLabel"></label> <input required type='url' id='node-input-woTThingConfig' placeholder='[placeholder]editor.thingConfigLabel'> </div> <div class="form-row"> <label for="node-input-propertyName"><span data-i18n="editor.propertyNameLabel"></span></label> <input type="text" id="node-input-propertyName" data-i18n="[placeholder]editor.propertyNameLabel"> </div> <div class="form-row"> <label for="node-input-propertyDescription"><span data-i18n="editor.propertyDescriptionLabel"></span></label> <input type="text" id="node-input-propertyDescription" data-i18n="[placeholder]editor.propertyDescriptionLabel"> </div> <div class="form-row"> <label for="node-input-propertyDataType"><span data-i18n="editor.propertyDataTypeLabel"></span></label> <select id="node-input-propertyDataType" data-i18n="[placeholder]editor.propertyDataTypeLabel"> <option value="string">string</option> <option value="number">number</option> <option value="integer">integer</option> <option value="boolean">boolean</option> <option value="object">object</option> <option value="array">array</option> <option value="null">null</option> </select> </div> <div class="form-row"> <label for="node-input-propertyReadOnlyFlag"><span data-i18n="editor.propertyReadOnlyFlagLabel"></span></label> <input type="checkbox" id="node-input-propertyReadOnlyFlag" data-i18n="[placeholder]editor.propertyReadOnlyFlagLabel"> </div> <div class="form-row"> <label for="node-input-propertyObservableFlag"><span data-i18n="editor.propertyObservableFlagLabel"></span></label> <input type="checkbox" id="node-input-propertyObservableFlag" data-i18n="[placeholder]editor.propertyObservableFlagLabel"> </div> <!-- Tab --> <div class="form-row"> <ul style="min-width: 500px; margin-bottom: 20px;" id="red-tabs"> </ul> </div> <!-- Tab contents --> <div id="tabs-content" style="min-height:250px;"> <div id="tab-outParams2-settings"> <div class='form-row'> <label for='node-input-outParams2_writingValueConstValue'><span data-i18n="editor.outParams2.writingValue.label"></span></label> <input type='text' id='node-input-outParams2_writingValueConstValue' data-i18n="[placeholder]editor.outParams2.writingValue.placeholder"> <input type='hidden' id='node-input-outParams2_writingValueType'> </div> </div> </div> </script> <style></style>