UNPKG

node-red-contrib-ui-metabase

Version:
125 lines (119 loc) 5.59 kB
<!-- Copyright JS Foundation and other contributors, http://js.foundation 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/html" data-template-name="ui_metabase"> <div class="form-row" id="template-row-group"> <label for="node-input-group"><i class="fa fa-table"></i> <span data-i18n="ui_metabase.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="ui_metabase.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-url"><i class="fa fa-external-link"></i> <span data-i18n="ui_metabase.label.url"></span></label> <input type="text" id="node-input-url" placeholder="http://localhost:3000"> </div> <div class="form-row"> <label for="node-input-resource"><i class="fa fa-question"></i> <span data-i18n="ui_metabase.label.resource"></span></label> <select id="node-input-resource"> <option value="question">question</option> <option value="dashboard">dashboard</option> </select> </div> <div class="form-row"> <label for="node-input-resourceNo"><i class="fa fa-window-maximize"></i> <span data-i18n="ui_metabase.label.resourceNo"></span></label> <input type="number" id="node-input-resourceNo" placeholder="1"> </div> <div class="form-row"> <label for="node-input-token"><i class="fa fa-key"></i> <span data-i18n="ui_metabase.label.token"></span></label> <input type="password" id="node-input-token" placeholder="xxxxxxxxxxxxxxxxxxxxxxx"> </div> <div class="form-row"> <label for="node-input-expire"><i class="fa fa-hourglass-end"></i> <span data-i18n="ui_metabase.label.expire"></span></label> <input type="number" id="node-input-expire" placeholder="100"> </div> <div class="form-row"> <label for="node-input-theme"><i class="fa fa-window-restore"></i> <span data-i18n="ui_metabase.label.theme"></span></label> <select id="node-input-theme"> <option value="">Light Mode</option> <option value="theme=night&">Dark Mode</option> </select> </div> <div class="form-row"> <label for="node-input-title"><i class="fa fa-font"></i> <span data-i18n="ui_metabase.label.title"></span></label> <input type="checkbox" id="node-input-title" style="display: inline-block; width: auto; vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-border"><i class="fa fa-square-o"></i> <span data-i18n="ui_metabase.label.border"></span></label> <input type="checkbox" id="node-input-border" style="display: inline-block; width: auto; vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="ui_metabase.label.name"></span></label> <input type="text" id="node-input-name"> </div> </script> <script type="text/javascript"> function mk_conf(NAME) { var ICON = "icon.png"; var conf = { category: 'dashboard', color: '#cee6ea', defaults: { group: {type: 'ui_group', required:true}, name: {value: ''}, 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}, url: {value: ""}, resource: {value: ""}, resourceNo: {value: ""}, token: {value:""}, expire: {value:""}, theme: {value:""}, title: {value:""}, border: {value:""} }, inputs:1, outputs:1, icon: ICON, align: "right", paletteLabel: NAME, label: function() { return this.name || NAME; }, oneditprepare: function() { $("#node-input-size").elementSizer({ width: "#node-input-width", height: "#node-input-height", group: "#node-input-group" }); }, oneditsave: function() { }, oneditresize: function(size) { } }; return conf; }; RED.nodes.registerType("ui_metabase", mk_conf("Metabase")); </script>