|
1 | 1 | <script type="text/javascript"> |
2 | 2 | function validate(name) { |
3 | 3 | return function () { |
4 | | - |
5 | 4 | if (this[name] == null || this[name] == "") { |
6 | | - console.log(this.type, "false: value null"); |
| 5 | + console.log(this.type, name + " false: value null"); |
7 | 6 | if (name == "entities" && this.inputfield != null) { this[name] = this.inputfield; return true; } |
8 | 7 | return false; |
9 | 8 | } |
10 | | - if (this[name + "type"] == null || this[name + "type"] == "") { |
11 | | - console.log(this.type, "false: type null"); |
12 | | - return false; |
13 | | - } |
| 9 | + // if (this[name + "type"] == null || this[name + "type"] == "") { |
| 10 | + // console.log(this.type, name + " false: type null"); |
| 11 | + // return false; |
| 12 | + // } |
14 | 13 | return RED.validators.typedInput(name); |
15 | 14 | } |
16 | 15 | } |
|
142 | 141 | name: { value: "" }, |
143 | 142 | query: { value: "", validate: validate("querytype") }, |
144 | 143 | querytype: { value: "" }, |
145 | | - projection: { value: "", validate: RED.validators.typedInput("projectiontype") }, |
| 144 | + projection: { value: "", validate: validate("projectiontype") }, |
146 | 145 | projectiontype: { value: "" }, |
147 | 146 | top: { value: 500, validate: validate("toptype"), required: true }, |
148 | 147 | toptype: { value: "" }, |
|
162 | 161 | return this.name ? "node_label_italic" : ""; |
163 | 162 | }, |
164 | 163 | oneditprepare: function () { |
165 | | - if (this.skipquerytype === 'val') $("#node-input-querytype").val('str'); |
| 164 | + if (this.querytype === null) $("#node-input-querytype").val('str'); |
166 | 165 | $("#node-input-query").typedInput({ |
167 | 166 | default: 'str', |
168 | 167 | typeField: $("#node-input-querytype"), |
169 | 168 | types: ['msg', 'str', 'flow', 'global', 'json'] |
170 | 169 | }); |
171 | | - if (this.projectiontype === 'val') $("#node-input-projectiontype").val('str'); |
| 170 | + if (this.projectiontype === null) $("#node-input-projectiontype").val('str'); |
172 | 171 | $("#node-input-projection").typedInput({ |
173 | 172 | default: 'str', |
174 | 173 | typeField: $("#node-input-projectiontype"), |
175 | 174 | types: ['msg', 'str', 'flow', 'global', 'json'] |
176 | 175 | }); |
177 | | - if (this.orderbytype === 'val') $("#node-input-orderbytype").val('str'); |
| 176 | + if (this.orderbytype === null) $("#node-input-orderbytype").val('str'); |
178 | 177 | $("#node-input-orderby").typedInput({ |
179 | 178 | default: 'str', |
180 | 179 | typeField: $("#node-input-orderbytype"), |
181 | 180 | types: ['msg', 'str', 'flow', 'global', 'json'] |
182 | 181 | }); |
183 | | - if (this.collectiontype === 'val') $("#node-input-collectiontype").val('str'); |
| 182 | + if (this.collectiontype === null) $("#node-input-collectiontype").val('str'); |
184 | 183 | $("#node-input-collection").typedInput({ |
185 | 184 | default: 'str', |
186 | 185 | typeField: $("#node-input-collectiontype"), |
187 | 186 | types: ['msg', 'str', 'flow', 'global', 'json'] |
188 | 187 | }); |
189 | | - if (this.toptype === 'val') $("#node-input-toptype").val('str'); |
| 188 | + if (this.toptype === null) $("#node-input-toptype").val('num'); |
190 | 189 | $("#node-input-top").typedInput({ |
191 | 190 | default: 'num', |
192 | 191 | typeField: $("#node-input-toptype"), |
193 | 192 | types: ['msg', 'num', 'flow', 'global'] |
194 | 193 | }); |
195 | | - if (this.skiptype === 'val') $("#node-input-skiptype").val('str'); |
| 194 | + if (this.skiptype === null) $("#node-input-skiptype").val('num'); |
196 | 195 | $("#node-input-skip").typedInput({ |
197 | 196 | default: 'num', |
198 | 197 | typeField: $("#node-input-skiptype"), |
199 | 198 | types: ['msg', 'num', 'flow', 'global'] |
200 | 199 | }); |
201 | | - if (this.resultfieldtype === 'val') $("#node-input-resultfieldtype").val('str'); |
| 200 | + if (this.resultfieldtype === null) $("#node-input-resultfieldtype").val('msg'); |
202 | 201 | $("#node-input-resultfield").typedInput({ |
203 | 202 | default: 'msg', |
204 | 203 | typeField: $("#node-input-resultfieldtype"), |
|
266 | 265 | writeconcern: { value: "0", required: true }, |
267 | 266 | journal: { value: "false", required: true }, |
268 | 267 | collection: { value: "entities", validate: validate("collection") }, |
269 | | - // collection: { value: "entities", validate: RED.validators.typedInput("collection"), required: true }, |
270 | 268 | collectiontype: { value: "" }, |
271 | 269 | entitiestype: { value: "" }, |
272 | 270 | entities: { value: "payload", validate: validate("entities") }, |
273 | | - // entities: { value: "payload", validate: RED.validators.typedInput("entities"), required: true }, |
274 | 271 | entitiestype: { value: "" }, |
275 | 272 | entitytype: { value: "" }, |
276 | 273 | entitytypetype: { value: "" }, |
|
473 | 470 | entitiestype: { value: "" }, |
474 | 471 | writeconcern: { value: "0", required: true }, |
475 | 472 | journal: { value: "false", required: true }, |
| 473 | + |
| 474 | + inputfield: { value: "" }, |
| 475 | + resultfield: { value: "" } |
476 | 476 | }, |
477 | 477 | inputs: 1, |
478 | 478 | outputs: 1, |
|
579 | 579 | entitiestype: { value: "" }, |
580 | 580 | uniqeness: { value: "", validate: validate("uniqenesstype") }, |
581 | 581 | uniqenesstype: { value: "" }, |
| 582 | + |
| 583 | + resultfield: { value: "" }, |
| 584 | + inputfield: { value: "" }, |
582 | 585 | }, |
583 | 586 | inputs: 1, |
584 | 587 | outputs: 1, |
|
652 | 655 | icon: "font-awesome/fa-trash", |
653 | 656 | defaults: { |
654 | 657 | name: { value: "" }, |
655 | | - collection: { value: "entities", validate: RED.validators.typedInput("collection"), required: true }, |
| 658 | + collection: { value: "entities", validate: validate("collection"), required: true }, |
656 | 659 | collectiontype: { value: "" }, |
657 | | - entities: { value: "payload", validate: RED.validators.typedInput("entities"), required: true }, |
| 660 | + entities: { value: "payload", validate: validate("entities"), required: true }, |
658 | 661 | entitiestype: { value: "" }, |
| 662 | + |
| 663 | + resultfield: { value: "" }, |
| 664 | + inputfield: { value: "" }, |
659 | 665 | }, |
660 | 666 | inputs: 1, |
661 | 667 | outputs: 1, |
|
673 | 679 | types: ['msg', 'str', 'flow', 'global'] |
674 | 680 | }); |
675 | 681 |
|
676 | | - if (this.inputfieldtype === 'val') $("#node-input-inputfieldtype").val('str'); |
677 | | - $("#node-input-inputfield").typedInput({ |
| 682 | + if (this.entitiestype === 'val') $("#node-input-entitiestype").val('str'); |
| 683 | + $("#node-input-entities").typedInput({ |
678 | 684 | default: 'msg', |
679 | | - typeField: $("#node-input-inputfieldtype"), |
| 685 | + typeField: $("#node-input-entitiestype"), |
680 | 686 | types: ['msg'] |
681 | 687 | }); |
682 | 688 |
|
|
718 | 724 | icon: "font-awesome/fa-trash", |
719 | 725 | defaults: { |
720 | 726 | name: { value: "" }, |
721 | | - query: { value: "payload", validate: RED.validators.typedInput("querytype"), required: true }, |
| 727 | + query: { value: "payload", validate: validate("querytype"), required: true }, |
722 | 728 | querytype: { value: "" }, |
723 | | - collection: { value: "entities", validate: RED.validators.typedInput("collectiontype"), required: true }, |
| 729 | + collection: { value: "entities", validate: validate("collectiontype"), required: true }, |
724 | 730 | collectiontype: { value: "" }, |
725 | 731 | }, |
726 | 732 | inputs: 1, |
|
1315 | 1321 | writeconcern: { value: "0", required: true }, |
1316 | 1322 | journal: { value: "false", required: true }, |
1317 | 1323 | action: { value: "updateOne", required: true }, |
1318 | | - collection: { value: "entities", validate: RED.validators.typedInput("collectiontype"), required: true }, |
| 1324 | + collection: { value: "entities", validate: validate("collectiontype"), required: true }, |
1319 | 1325 | collectiontype: { value: "" }, |
1320 | | - query: { value: "", validate: RED.validators.typedInput("querytype"), required: true }, |
| 1326 | + query: { value: "", validate: validate("querytype"), required: true }, |
1321 | 1327 | querytype: { value: "" }, |
1322 | 1328 |
|
1323 | | - updatedocument: { value: "{ \"$inc\": { \"count\": 1}}", validate: RED.validators.typedInput("updatedocumenttype"), required: true }, |
| 1329 | + updatedocument: { value: "{ \"$inc\": { \"count\": 1}}", validate: validate("updatedocumenttype"), required: true }, |
1324 | 1330 | updatedocumenttype: { value: "" }, |
1325 | 1331 | }, |
1326 | 1332 | inputs: 1, |
|
1396 | 1402 | icon: "font-awesome/fa-bar-chart", |
1397 | 1403 | defaults: { |
1398 | 1404 | name: { value: "" }, |
1399 | | - aggregates: { value: "[ {\"$group\" : {\"_id\":\"$_type\", \"count\":{\"$sum\":1}} } ]", validate: RED.validators.typedInput("aggregatestype"), required: true }, |
| 1405 | + aggregates: { value: "[ {\"$group\" : {\"_id\":\"$_type\", \"count\":{\"$sum\":1}} } ]", validate: validate("aggregatestype"), required: true }, |
1400 | 1406 | aggregatestype: { value: "" }, |
1401 | 1407 |
|
1402 | | - collection: { value: "entities", validate: RED.validators.typedInput("collectiontype"), required: true }, |
| 1408 | + collection: { value: "entities", validate: validate("collectiontype"), required: true }, |
1403 | 1409 | collectiontype: { value: "" }, |
1404 | 1410 |
|
1405 | 1411 | }, |
|
1462 | 1468 | paletteLabel: 'download', |
1463 | 1469 | icon: "font-awesome/fa-download", |
1464 | 1470 | defaults: { |
1465 | | - fileid: { value: "", validate: RED.validators.typedInput("fileidtype") }, |
| 1471 | + fileid: { value: "", validate: validate("fileidtype") }, |
1466 | 1472 | fileidtype: { value: "" }, |
1467 | | - filename: { value: "", validate: RED.validators.typedInput("filenametype"), required: true }, |
| 1473 | + filename: { value: "", validate: validate("filenametype"), required: true }, |
1468 | 1474 | filenametype: { value: "" }, |
1469 | 1475 | name: { value: "" } |
1470 | 1476 | }, |
|
1528 | 1534 | paletteLabel: 'upload', |
1529 | 1535 | icon: "font-awesome/fa-upload", |
1530 | 1536 | defaults: { |
1531 | | - filename: { value: "", validate: RED.validators.typedInput("filenametype"), required: true }, |
| 1537 | + filename: { value: "", validate: validate("filenametype"), required: true }, |
1532 | 1538 | filenametype: { value: "" }, |
1533 | | - mimeType: { value: "", validate: RED.validators.typedInput("mimeTypetype"), required: true }, |
| 1539 | + mimeType: { value: "", validate: validate("mimeTypetype"), required: true }, |
1534 | 1540 | mimeTypetype: { value: "" }, |
1535 | 1541 | name: { value: "" } |
1536 | 1542 | }, |
|
1702 | 1708 | icon: "font-awesome/fa-list", |
1703 | 1709 | defaults: { |
1704 | 1710 | name: { value: "" }, |
1705 | | - results: { value: "payload", validate: RED.validators.typedInput("resultstype"), required: true }, |
| 1711 | + results: { value: "payload", validate: validate("resultstype"), required: true }, |
1706 | 1712 | resultstype: { value: "", required: true }, |
1707 | 1713 | }, |
1708 | 1714 | inputs: 1, |
|
0 commit comments