UNPKG

cloud-red

Version:

Harnessing Serverless for your cloud integration needs

90 lines (85 loc) 2.85 kB
<script type="text/x-red" data-template-name="apigw-event-handler"> <!-- name --> <div class="form-row"> <label for="node-input-name"> <i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span> </label> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"> </div> <!-- method --> <div class="form-row"> <label for="node-input-method"><i class="fa fa-tasks"></i> Method</label> <select type="text" id="node-input-method" style="width:70%;"> <option value="get">GET</option> <option value="post">POST</option> <option value="put">PUT</option> <option value="delete">DELETE</option> <option value="patch">PATCH</option> </select> </div> <!-- url --> <div class="form-row"> <label for="node-input-url"><i class="fa fa-globe"></i> URL</label> <input id="node-input-url" type="text" placeholder="/*"> </div> <!-- Note --> <div class="form-tips" style="margin-top:20px">A proxy API will be created for the Lambda function on API Gateway, and forward all requests to this node</div> </div> </script> <script type="text/javascript"> RED.nodes.registerType('apigw-event-handler', { category: 'handlers', icon: 'aws.png', color: 'rgb(231, 231, 174)', defaults: { name: { value: '', required: false }, method: { value: false, required: true }, url: { value: '', required: true } }, inputs: 0, outputs: 1, label: function() { if (this.name) { return this.name; } else if (this.url) { var root = RED.settings.httpNodeRoot; if (root.slice(-1) != '/') { root = root + '/'; } if (this.url.charAt(0) == '/') { root += this.url.slice(1); } else { root += this.url; } return '[' + this.method + '] ' + root; } else { return 'http'; } }, labelStyle: function() { return this.name ? 'node_label_italic' : ''; } // oneditprepare: function() { // var node = this; // // Show or hide the trigger section // if ($('#node-input-triggerEnabled').checked) { // $('#triggerSection').show(); // } else { // $('#triggerSection').hide(); // } // // Handle changes in the trigger checkbox for trigger section // $('#node-input-triggerEnabled').change(function(data) { // if (this.checked) { // $('#triggerSection').show(); // } else { // $('#triggerSection').hide(); // $('#node-input-bucketName').val(''); // $('#node-input-prefix').val(''); // $('#node-input-suffix').val(''); // $('#node-input-event').val('s3:ObjectCreated:*'); // } // }); // } }); </script>