-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathairtable.html
115 lines (108 loc) · 4.21 KB
/
airtable.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
<!--
Copyright 2018 Atsushi Kojo.
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/x-red" data-template-name="airtable">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-bookmark"></i> <span data-i18n="airtable.label.name"></span></label>
<input type="text" id="node-config-input-name" data-i18n="[placeholder]airtable.placeholder.name" />
</div>
<div class="form-row input-apiKey-row">
<label for="node-config-input-apiKey"><i class="fa fa-lock"></i> <span data-i18n="airtable.label.apiKey"></span></label>
<input type="password" id="node-config-input-apiKey">
</div>
<div class="form-row input-baseId-row">
<label for="node-config-input-baseId"><i class="fa fa-bookmark"></i> <span data-i18n="airtable.label.baseId"></span></label>
<input type="text" id="node-config-input-baseId" />
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('airtable', {
category: 'config',
color: "#48ace4",
defaults: {
name: { value: '', required: true }
},
credentials: {
apiKey: { type: 'password', required: true },
baseId: { type: 'text', required: true }
},
label: function() {
return this.name
}
});
</script>
<script type="text/x-red" data-template-name="airtable out">
<div class="form-row">
<label for="node-input-airtable"><i class="fa fa-user"></i> Set API Key</label>
<input type="text" id="node-input-airtable">
</div>
<div class="form-row">
<label for="node-input-table"><i class="fa fa-database"></i> <span data-i18n="airtable_out.label.table"></span></label>
<input type="text" id="node-input-table">
</div>
<div class="form-row">
<label for="node-input-operation"><i class="fa fa-wrench"></i> <span data-i18n="airtable_out.label.operation"></span></label>
<select type="text" id="node-input-operation">
<option value="select">select</option>
<option value="find">find</option>
<option value="create">create</option>
<option value="update">update</option>
<option value="replace">replace</option>
<option value="delete">delete</option>
</select>
</div>
<span class="select-Option">
<div class="form-row">
<label for="node-input-outputType"><i class="fa fa-wrench"></i> <span data-i18n="airtable_out.label.outputType"></span></label>
<select type="text" id="node-input-outputType">
<option value="multiple" data-i18n="airtable_out.outputType.multiple"></option>
<option value="array" data-i18n="airtable_out.outputType.array"></option>
</select>
</div>
</span>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="airtable_out.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]airtable_out.placeholder.name">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('airtable out', {
category: 'storage-output',
color: "#fff",
defaults: {
airtable: { type: 'airtable', required: true },
operation: { value: 'create' },
outputType: { value: 'multiple' },
table: { value: '' },
name: { value: '' }
},
inputs: 1,
outputs: 1,
icon: 'airtable.png',
label: function () {
var airtableNode = RED.nodes.node(this.airtable);
return this.name || 'airtable';
},
labelStyle: function () {
return this.name ? 'node_label_italic' : '';
},
oneditprepare: function() {
$("#node-input-operation").change(function() {
if ($(this).val() == "select") {
$(".select-Option").show();
} else {
$(".select-Option").hide();
}
});
},
});
</script>