-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui_table.html
236 lines (217 loc) · 10.8 KB
/
ui_table.html
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<script type="text/javascript">
function mk_conf(NAME) {
var conf = {
category: 'iaCloud Visuals',
color: 'rgb(119, 198, 204)',
defaults: {
confsel: {value:"inchartSet"},
group: {type: 'ui_group', required:false},
name: {value: ''},
label: {value: NAME},
order: {value: 0},
width: {value: 0,
validate: function(v) {
var valid = true
var width = v||0;
var currentGroup = $('#node-input-group').val()|| this.group;
var groupNode = RED.nodes.node(currentGroup);
valid = !groupNode || +width <= +groupNode.width;
$("#node-input-size").toggleClass("input-error",!valid);
return valid;
}},
height: {value: 0},
contype1: {value: "Alarm&Event"},
contype2: {value: "iaCloudData"},
statuslist: {value: ""},
"statuscheck-set": {value: ""},
"statuscheck-reset": {value: ""},
"statuscheck-on": {value: ""},
"statuscheck-off": {value: ""},
item: {value: ""},
storeOutMessages: {value: true},
fwdInMessages: {value: true},
templateScope: {value: 'local'}
},
inputs:1,
outputs:0,
align: "right",
icon: "ia-cloud.png",
paletteLabel: NAME,
label: function() {
return this.name||this._("table.paletteLabel");
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
paletteLabel: function() {
return this._("table.paletteLabel") || "ui_table";
},
oneditprepare: function() {
var that = this;
$("#node-input-size").elementSizer({
width: "#node-input-width",
height: "#node-input-height",
group: "#node-input-group"
});
// 入力値設定
$('input[name="configSel"]:radio').change(function() {
if ($("#node-input-configSel1").is(":checked")) {
$("#node-row-item").hide();
$("#node-row-contype1").show();
$("#node-row-contype2").hide();
$("#node-row-statuscheck").show();
$('#node-input-confsel').val("dynamodbSet");
} else if ($("#node-input-configSel2").is(":checked")) {
$("#node-row-item").hide();
$("#node-row-contype1").hide();
$("#node-row-contype2").show();
$("#node-row-statuscheck").hide();
$('#node-input-confsel').val("inchartSet");
} else {
$("#node-row-item").show();
$("#node-row-contype1").hide();
$("#node-row-contype2").hide();
$("#node-row-statuscheck").hide();
$('#node-input-confsel').val("formatSet");
}
});
if($("#node-input-confsel").val() == "dynamodbSet"){
$('#node-input-configSel1').prop('checked', true);
} else if ($("#node-input-confsel").val() == "inchartSet") {
$('#node-input-configSel2').prop('checked', true);
} else {
$('#node-input-configSel3').prop('checked', true);
}
$('input[name="configSel"]:radio').change();
// 表示ステータス設定
$("#node-input-statuscheck-set").change(function() {
if ($(this).is(":checked")) {
$("#node-input-statuscheck-set").prop("checked", true);
} else {
$("#node-input-statuscheck-set").prop("checked", false);
}
});
$("#node-input-statuscheck-setre").change(function() {
if ($(this).is(":checked")) {
$("#node-input-statuscheck-setre").prop("checked", true);
} else {
$("#node-input-statuscheck-setre").prop("checked", false);
}
});
$("#node-input-statuscheck-on").change(function() {
if ($(this).is(":checked")) {
$("#node-input-statuscheck-on").prop("checked", true);
} else {
$("#node-input-statuscheck-on").prop("checked", false);
}
});
$("#node-input-statuscheck-off").change(function() {
if ($(this).is(":checked")) {
$("#node-input-statuscheck-off").prop("checked", true);
} else {
$("#node-input-statuscheck-off").prop("checked", false);
}
});
},
oneditsave: function() {
// 表示ステータス設定
var statuslist = [];
if ($("#node-input-statuscheck-set").is(":checked")) {
statuslist.push("set");
}
if ($("#node-input-statuscheck-reset").is(":checked")) {
statuslist.push("reset");
}
if ($("#node-input-statuscheck-off").is(":checked")) {
statuslist.push("off");
}
if ($("#node-input-statuscheck-on").is(":checked")) {
statuslist.push("on");
}
$("#node-input-statuslist").val(statuslist.join(','));
}
};
return conf;
}
RED.nodes.registerType('ui_table', mk_conf('table'));
</script>
<script type="text/html" data-template-name="ui_table">
<!-- グループ -->
<div class="form-row" id="template-row-group">
<label for="node-input-group"><i class="fa fa-table"></i> <span data-i18n="table.label.group"></span></label>
<input type="text" id="node-input-group">
</div>
<!-- 表示サイズ -->
<div class="form-row" id="template-row-size">
<label><i class="fa fa-object-group"></i> <span data-i18n="table.label.size"></span></label>
<input type="hidden" id="node-input-width">
<input type="hidden" id="node-input-height">
<button class="editor-button" id="node-input-size"></button>
</div>
<!-- ラベル -->
<div class="form-row">
<label for="node-input-label"><i class="fa fa-i-cursor"></i> <span data-i18n="table.label.label"></span></label>
<input type="text" id="node-input-label">
</div>
<!-- 入力値設定 -->
<div class="form-row">
<label for="node-input-setMode"><i class="fa fa-list"></i> <span data-i18n="table.label.input"></span></label>
<input type="text" style="display: none;" id="node-input-confsel" valie="inchartSet">
<input type="radio" style="display: inline-block; width: auto; vertical-align: top;"
name="configSel" id="node-input-configSel1" value="dynamodbSet" checked="checked">
<label style="width: 30%;" for="node-input-configSel1"> <span data-i18n="table.input.dynamodb"></span></label>
<input type="radio" style="display: inline-block; width: auto; vertical-align: top;"
name="configSel" id="node-input-configSel2" value="inchartSet" checked="checked">
<label style="width: 30%;" for="node-input-configSel2"> <span data-i18n="table.input.getchartdata"></span></label>
</div>
<div class="form-row" style="margin-left: 105px">
<input type="radio" style="display: inline-block; width: auto; vertical-align: top;"
name="configSel" id="node-input-configSel3" value="formatSet">
<label style="width: 40%;" for="node-input-configSel3"> <span data-i18n="table.input.formatdata"></span></label>
</div>
<!-- contentType(dynamoDB) -->
<div class="form-group hide" id="node-row-contype1">
<div class="form-row">
<label for="node-input-contype1"><i class="fa fa-list"></i> <span data-i18n="table.label.contype"></span></label>
<select type="text" style="width:200px;" id="node-input-contype1">
<option value="Alarm&Event" data-i18n="table.contype.ane"></option>
</select>
</div>
</div>
<!-- contentType(getchartdata) -->
<div class="form-group hide" id="node-row-contype2">
<div class="form-row">
<label for="node-input-contype2"><i class="fa fa-list"></i> <span data-i18n="table.label.contype"></span></label>
<select type="text" style="width:200px;" id="node-input-contype2">
<option value="iaCloudData" data-i18n="table.contype.iacd"></option>
</select>
</div>
</div>
<!-- アラーム&イベント 表示対象ステータス設定 -->
<div class="form-group hide" id="node-row-statuscheck">
<div class="form-row">
<label for="node-input-statuscheck"><i class="fa fa-check"></i> <span data-i18n="table.label.statuscheck"></label>
<input id="node-input-statuscheck-set" type="checkbox" style="display: inline-block; width: auto; vertical-align: top;" name="set" value="set">
<label for="node-input-statuscheck-set" style="display: inline-block; width: 50px; vertical-align: top;"> <span data-i18n="table.ane.set"></span></label>
<input id="node-input-statuscheck-reset"type="checkbox" style="display: inline-block; width: auto; vertical-align: top;" name="reset" value="reset">
<label for="node-input-statuscheck-reset" style="display: inline-block; width: 50px; vertical-align: top;"> <span data-i18n="table.ane.reset"></span></label>
<input id="node-input-statuscheck-on" type="checkbox" style="display: inline-block; width: auto; vertical-align: top;" name="on" value="on">
<label for="node-input-statuscheck-on" style="display: inline-block; width: 50px; vertical-align: top;"> <span data-i18n="table.ane.on"></span></label>
<input id="node-input-statuscheck-off" type="checkbox" style="display: inline-block; width: auto; vertical-align: top;" name="off" value="off">
<label for="node-input-statuscheck-off" style="display: inline-block; width: 50px; vertical-align: top;"> <span data-i18n="table.ane.off"></span></label>
</div>
</div>
<input type="hidden" id="node-input-statuslist">
<!-- 項目名(inchartSet) -->
<div class="form-group hide" id="node-row-item">
<div class="form-row">
<label for="node-input-item"><i class="fa fa-list"></i> <span data-i18n="table.input.item"></label>
<input type="text" id="node-input-item">
</div>
</div>
<!-- ノード名 -->
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="table.label.name"></label>
<input type="text" id="node-input-name">
</div>
</script>