diff options
author | Miguel Angel Mulero Martinez <migmul@gmail.com> | 2023-03-17 19:39:53 +0100 |
---|---|---|
committer | Paul Donald <itsascambutmailmeanyway@gmail.com> | 2024-03-08 02:28:50 +0100 |
commit | 8bf5646459e229c1d01736f7c45f3b1c9bf3058f (patch) | |
tree | 17eadd2b5b42335b0e557bf6b5c68a287587ab68 /applications/luci-app-statistics/htdocs | |
parent | c68ec2f910007c77874816fc0b829df78ca47aa0 (diff) |
luci-app-statistics: Add UI to configure Mqtt
This commit adds UI to configure the Mqtt plugin of the luci-app-statistics.
Signed-off-by: Miguel Angel Mulero Martinez <migmul@gmail.com>
Diffstat (limited to 'applications/luci-app-statistics/htdocs')
-rw-r--r-- | applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/mqtt.js | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/mqtt.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/mqtt.js new file mode 100644 index 0000000000..602a453c0b --- /dev/null +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/mqtt.js @@ -0,0 +1,88 @@ +'use strict'; +'require baseclass'; +'require form'; + +return baseclass.extend({ + title: _('Mqtt Plugin Configuration'), + + addFormOptions: function(s) { + let o, ss; + + o = s.option(form.Flag, 'enable', _('Sends or receives data via mqtt')); + + o = s.option(form.SectionValue, '__blocks', form.GridSection, 'collectd_mqtt_block'); + o.depends('enable', '1'); + + ss = o.subsection; + ss.anonymous = true; + ss.addremove = true; + + o = ss.option(form.ListValue, 'blocktype', _('Type')); + o.value('Publish', _('Publish')); + o.value('Subscribe', _('Subscribe')); + o.default = 'Publish'; + + o = ss.option(form.Value, 'name', _('Name')); + o.optional = false; + o.rmempty = false; + + o = ss.option(form.Value, 'Host', _('Host')); + o.datatype = 'host'; + o.optional = false; + o.rmempty = false; + + o = ss.option(form.Value, 'Port', _('Port')); + o.datatype = 'port'; + o.optional = true; + + o = ss.option(form.Value, 'User', _('User')); + o.optional = true; + + o = ss.option(form.Value, 'Password', _('Password')); + o.password = true; + o.optional = true; + o.modalonly = true; + + o = ss.option(form.ListValue, 'Qos', _('QoS')); + o.value('0', _('0 - At most once')); + o.value('1', _('1 - At least once')); + o.value('2', _('2 - Exactly once')); + o.modalonly = true; + o.optional = true; + + o = ss.option(form.Value, 'Prefix', _('Prefix')); + o.depends('blocktype', 'Publish'); + o.optional = true; + o.modalonly = true; + + o = ss.option(form.ListValue, 'Retain', _('Retain')); + o.depends('blocktype', 'Publish'); + o.value('true', _('True')); + o.value('false', _('False')); + o.optional = true; + o.modalonly = true; + + o = ss.option(form.ListValue, 'StoreRates', _('StoreRates')); + o.depends('blocktype', 'Publish'); + o.value('true', _('True')); + o.value('false', _('False')); + o.modalonly = true; + o.optional = true; + + o = ss.option(form.ListValue, 'CleanSession', _('CleanSession')); + o.depends('blocktype', 'Subscribe'); + o.value('true', _('True')); + o.value('false', _('False')); + o.optional = true; + o.modalonly = true; + + o = ss.option(form.Value, 'Topic', _('Topic')); + o.depends('blocktype', 'Subscribe'); + o.optional = true; + o.modalonly = true; + }, + + configSummary: function(section) { + return _('Mqtt plugin enabled'); + } +}); |