-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtdengine-operator.html
More file actions
139 lines (123 loc) · 5.79 KB
/
tdengine-operator.html
File metadata and controls
139 lines (123 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<script type="text/html" data-template-name="TDengineServer">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-config-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-row">
<label style="display: block; width: 200px; text-align: left;"><i class="fa fa-plug"></i> <span data-i18n="tdengine.label.conntype" ></span> </label>
</div>
<div class="form-row">
<label style="display: block; width: 200px; text-align: left;">
<input type="radio" name="connection-type" style="width: 30px; margin-bottom: 5px;" value="connection-string" checked>
<span data-i18n="tdengine.label.connstring"></span>
</label>
<span id="uri-section">
<div class="form-row">
<label for="node-config-input-uri" style="margin-left: 20px;"><i class="fa fa-link"></i> URI:</label>
<input type="text" id="node-config-input-uri">
</div>
</span>
<label style="display: block; width: 200px; text-align: left;">
<input type="radio" name="connection-type" style="width: 30px; margin-bottom: 5px;" value="host-port">
<span data-i18n="tdengine.label.hostport"></span>
</label>
<span id="host-port-section">
<div class="form-row">
<label for="node-config-input-host" style="margin-left: 20px;"><i class="fa fa-globe"></i> <span data-i18n="tdengine.label.host"></span></label>
<input type="text" id="node-config-input-host">
</div>
<div class="form-row">
<label for="node-config-input-port" style="margin-left: 20px;"><i class="fa fa-random"></i> <span data-i18n="tdengine.label.port"></span></label>
<input type="text" id="node-config-input-port">
</div>
<div class="form-row">
<label for="node-config-input-user" style="margin-left: 20px;"><i class="fa fa-user"></i> <span data-i18n="tdengine.label.user"></span></label>
<input type="text" id="node-config-input-user">
</div>
<div class="form-row">
<label for="node-config-input-pass" style="margin-left: 20px;"><i class="fa fa-lock"></i> <span data-i18n="tdengine.label.password"></label>
<input type="password" id="node-config-input-password">
</div>
<div class="form-row">
<label for="node-config-input-db" style="margin-left: 20px;"><i class="fa fa-database"></i> <span data-i18n="tdengine.label.database"></span></label>
<input type="text" id="node-config-input-db">
</div>
</span>
</div>
<div class="form-tips"><span data-i18n="[html]tdengine.tip"></span></div>
</script>
<script type="text/javascript">
RED.nodes.registerType('TDengineServer',{
category: 'config',
defaults: {
name: {value: "" },
uri: {value: "ws://root:taosdata@localhost:6041" },
connType: {value: "connection-string"},
host: {value: "127.0.0.1", required: true},
port: {value: "6041", required: true},
db: {value: "" }
},
credentials: {
user: {type: "text"},
password: {type: "password"}
},
label: function() {
return this.name || this.db;
},
oneditprepare: function() {
// init
const updateDisplay = () => {
const type = $("input[name='connection-type']:checked").val();
if (type === "host-port") {
$("#uri-section input").attr("disabled", "disabled");
$("#host-port-section").show();
} else {
$("#uri-section input").removeAttr("disabled");
$("#host-port-section").hide();
}
};
// set
$("input[name='connection-type'][value='" + this.connType + "']")
.prop("checked", true);
//$("#node-config-input-uri").val(this.uri);
updateDisplay();
// bind env
$("input[name='connection-type']").on("change", updateDisplay);
},
// save
oneditsave: function() {
this.connType = $("input[name='connection-type']:checked").val();
//this.uri = $("#node-config-input-uri").val();
}
});
</script>
<script type="text/html" data-template-name="tdengine-operator">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
</div>
<div class="form-row">
<label for="node-input-db"><i class="fa fa-database"></i> <span data-i18n="tdengine.label.database"></label>
<input type="text" id="node-input-db">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('tdengine-operator',{
category: 'storage-input',
color: '#a6bb00',
defaults: {
db: {type:"TDengineServer", required:true},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "tdengine.png",
label: function() {
var levelNode = RED.nodes.node(this.db);
return this.name||(levelNode ? levelNode.label(): "tdengine-operator");
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
</script>