Add multi group
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('ui_multi_group', {
|
||||
category: 'dashboard',
|
||||
color: 'rgb(63, 173, 181)',
|
||||
defaults: {
|
||||
name: { value: '' },
|
||||
group: { type: 'ui_group', required: true },
|
||||
order: { value: 0 },
|
||||
width: {
|
||||
value: 0, validate: function (v) {
|
||||
var width = v || 0;
|
||||
var currentGroup = $('#node-input-group').val() || this.group;
|
||||
var groupNode = RED.nodes.node(currentGroup);
|
||||
var valid = !groupNode || +width <= +groupNode.width;
|
||||
$("#node-input-size").toggleClass("input-error", !valid);
|
||||
return valid;
|
||||
}
|
||||
},
|
||||
height: { value: 0 },
|
||||
},
|
||||
inputs: 1,
|
||||
outputs: 1,
|
||||
icon: 'font-awesome/fa-th',
|
||||
paletteLabel: 'multi group',
|
||||
label: function () {
|
||||
return this.name || 'Multi Group';
|
||||
},
|
||||
oneditprepare: function () {
|
||||
$("#node-input-size").elementSizer({
|
||||
width: "#node-input-width",
|
||||
height: "#node-input-height",
|
||||
group: "#node-input-group"
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="ui_multi_group">
|
||||
<div class='form-row' id='template-row-group'>
|
||||
<label for='node-input-group'><i class='fa fa-table'></i> Group</label>
|
||||
<input type='text' id='node-input-group'>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label><i class="fa fa-object-group"></i> Size</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-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="ui_multi_group">
|
||||
<p>A simple multi group node</p>
|
||||
<p>
|
||||
To add items, input an array with one of the following objects per item as msg.payload:
|
||||
```json
|
||||
[
|
||||
{
|
||||
"type": "gauge",
|
||||
"width": 2,
|
||||
"height": 2,
|
||||
"label": "Dashboard Button Name",
|
||||
"value": 123,
|
||||
"max" : 500,
|
||||
"smoothColors": [[0.0, "#a9d70b" ], [0.50, "#f9c802"], [1.0, "#ff0000"]],
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"width": 1,
|
||||
"height": 1,
|
||||
"label": "Dashboard Button Name",
|
||||
"payload": {/*The payload that is send when the button is clicked*/},
|
||||
"disabled": false, // Optional
|
||||
"color": "#123456" // Optional
|
||||
},
|
||||
{
|
||||
"type": "container",
|
||||
"width": 2,
|
||||
"height": 2,
|
||||
"items": [/* Array of Gauges, Buttons... */]
|
||||
}
|
||||
]
|
||||
```
|
||||
</p>
|
||||
</script>
|
||||
Reference in New Issue
Block a user