UNPKG

node-red-contrib-mnubo

Version:

Mnubo

127 lines (123 loc) 5.01 kB
<script type="text/javascript"> RED.nodes.registerType('mnubo analytics', { category: 'SmartObjects', color: '#00a1e0', defaults: { name: { value: '' }, mnuboconfig: { value: '', type: 'mnubo config', required: true }, searchtype: { value: 'SearchQuery', required: true }, inputquery: { value: '', type: 'text' }, }, inputs: 1, outputs: 1, icon: 'Analytics.png', align: 'left', label: function() { return this.name || 'analytics: ' + this.searchtype; }, labelStyle: function() { return this.name ? 'node_label_italic' : ''; }, button: { onclick: function() { var label = this.name || 'button'; var node = this; $.ajax({ url: 'analytics/' + this.id + '/button', type: 'POST', success: function(resp, textStatus, xhr) { RED.notify(node._('local injection', { label: label }), 'success'); }, error: function(resp, textStatus, xhr) { RED.notify(node._('local injection', { label: label }), 'error'); }, }); }, }, oneditprepare: function() { $('#node-input-searchtype').change(function() { var id = $('#node-input-searchtype option:selected').val(); if (id === 'SearchQuery') { $('#node-input-inputquery-row').show(); } else { $('#node-input-inputquery-row').hide(); } }); $('#node-input-searchtype').val(this.searchtype); $('#node-input-searchtype').change(); }, }); </script> <script type="text/x-red" data-template-name="mnubo analytics"> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"></input> </div> <div class="form-row"> <label for="node-input-mnuboconfig"><i class="fa fa-database"></i> mnubo config</label> <input type="text" id="node-input-mnuboconfig"></input> </div> <div class="form-row"> <label for="node-input-searchtype"><i class="fa fa-search"></i> Search Type</label> <select type="text" id="node-input-searchtype" style="width:70%;"> <option value="getDatasets">Get Datasets</option> <option value="getDatamodel">Get Data Model</option> <option value="SearchQuery"> Search Query</option> </select> </div> <div class="form-row" id="node-input-inputquery-row"> <label for="node-input-inputquery" style="vertical-align: top;"><i class="fa fa-pencil"></i> Query</label> <textarea id="node-input-inputquery" rows="10" placeholder="optional input string" style="width: 70%;"></textarea> </div> </script> <script type="text/x-red" data-help-name="mnubo analytics"> <p>This node will perform a search.</p> <h3>Details</h3> <p>There are 3 types of SmartObjects search:</p> <ul> <li> <b>Get Datasets:</b> Get the datasets from mnubo SmartObjects. Note that the dataset list describes what can be queried <u>(no input is required)</u>. </li> <li> <b>Get Data Model:</b> Get the datasets from mnubo SmartObjects, and convert the output to a data model <u>(no input is required)</u>. </li> <li> <b>Search Query:</b> Execute a MQL query. <p>Search Query have 2 possible input:</p> <ul> <li>you can press the button to request restitution using this node optional input.</li> <li>you can inject the input in the "msg.payload".</li> </ul> <p><u>Example:</u></p> <pre style="font-size: 12px;line-height: normal;padding-top: 4px;padding-bottom: 4px;overflow: scroll;height: 22em;">msg.payload = { "from": "event", "limit": 5000, "select": [ { "count": "*" } ], "groupBy": [ { "time": "x_timestamp", "interval": "month", "timeZone": "America/New_York" } ] }</pre> </li> </ul> <h3>Requirements</h3> <ol> <li> <b>Mnubo configuration:</b> A valid Environment, ClientID and Client Secret. </li> </ol> <p>To use SmartObjects nodes, you will need to have a valid mnubo account, with access granted on a namespace. To obtain your unique namespace in the SmartObjects platform, contact sales@mnubo.com . Please use the subject title <b>node-red-contrinb-mnubo</b> and include in the body of the email the name of your company, contact name and phone number.</p> <h3>References</h3> <ul> <li><a href="https://smartobjects.mnubo.com/documentation/api_search.html" target="_blank">SmartObjects online documentation </a> - (under the API section) for details about this interface usage. </li> <li><a href="https://github.com/mnubo/node-red-contrib-mnubo" target="_blank">GitHub</a> - the nodes github repository</li> </ul> </script>