node-red-contrib-nem2
Version:
NEM blockchain nodes
55 lines (51 loc) • 2.24 kB
HTML
<!--
* Copyright 2018 NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<script type="text/javascript">
RED.nodes.registerType('serverConfig', {
category: 'config',
defaults: {
url: { value: "" },
customUrl: { value: "", validate: RED.validators.regex(/^((http|https):\/\/)[-a-zA-Z0-9@:%.\/_\+~#=]+$|^.{0}$/) },
network: { value: "", type: "networkConfig", required: true },
port: { value: "3000", required: true, validate: RED.validators.number() }
},
label: function () {
if (this.customUrl.trim()) {
this.url = this.customUrl;
}
return "server:" + this.url + ":" + this.port;
}
});
</script>
<script type="text/x-red" data-template-name="serverConfig">
<!-- list will be populated when data is public available -->
<div class="form-row">
<label for="node-config-input-url">url</label>
<select type="text" id="node-config-input-url" style="width:70%;">
<option value="http://localhost">http://localhost</option>
</select>
<label for="node-config-input-customUrl">custom url</label>
<input value="text" type="text" id="node-config-input-customUrl" placeholder="http(s)://your url or ip address">
</div>
<div class="form-row">
<label for="node-config-input-network"><i class="icon-globe"></i> network</label>
<input type="text" id="node-config-input-network">
</div>
<div class="form-row">
<label for="node-input-port">Port</label>
<input value="3000" type="text" id="node-config-input-port" style="width:65px" placeholder="3000" ></input>
</div>
</script>