emiloberg/node-red-contrib-mopidy

View on GitHub
src/mopidy-in.html

Summary

Maintainability
Test Coverage
<script type="text/x-red" data-template-name="mopidy-in">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-server"><i class="fa fa-globe"></i> <span data-i18n="mopidy-in.editor.server"></span></label>
        <input type="text" id="node-input-server">
    </div>
    <div class="form-row">
    <label for="node-input-messagetype"><i class="fa fa-list"></i> <span data-i18n="mopidy-in.editor.listen-to"></span></label>
        <select type="text" id="node-input-messagetype">
            <option value="event" data-i18n="mopidy-in.editor.event-type.event"></option>
            <option value="websocket" data-i18n="mopidy-in.editor.event-type.websocket"></option>
            <option value="state" data-i18n="mopidy-in.editor.event-type.state"></option>
            <option value="reconnect" data-i18n="mopidy-in.editor.event-type.reconnect"></option>
            <option value="all" data-i18n="mopidy-in.editor.event-type.all"></option>
        </select>
    </div>
    <div class="form-tips">
        <ul>
            <li><b><span data-i18n="mopidy-in.editor.event-type.event"></span></b>: <span data-i18n="mopidy-in.editor.tip.event"></span></li>
            <li><b><span data-i18n="mopidy-in.editor.event-type.websocket"></span></b>: <span data-i18n="mopidy-in.editor.tip.websocket"></span></li>
            <li><b><span data-i18n="mopidy-in.editor.event-type.state"></span></b>: <span data-i18n="mopidy-in.editor.tip.state"></span></li>
            <li><b><span data-i18n="mopidy-in.editor.event-type.reconnect"></span></b>: <span data-i18n="mopidy-in.editor.tip.reconnect"></span></li>
            <li><b><span data-i18n="mopidy-in.editor.event-type.all"></span></b>: <span data-i18n="mopidy-in.editor.tip.all"></span></li>
        </ul>
    </div>
</script>

<script type="text/javascript">
    RED.nodes.registerType('mopidy-in',{
        category: 'advanced-input',
        color:'#C6E8C0',
        defaults: {
            name: {value:''},
            messagetype: {value:'event'},
            server: {
                value: '',
                type: 'mopidy-config',
                required: true
            }
        },
        inputs:0,
        outputs:1,
        icon: 'mopidy-icon.png',
        label: function() { return this.name || 'mopidy events'; },
        labelStyle: function() { return this.name?'node_label_italic':''; }
    });
</script>