Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-app-speedtest: Add packages #6951

Closed
wants to merge 22 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
01d3791
luci-app-speedtest: Add packages
animegasan Mar 2, 2024
5ca3312
luci-mod-network: Add clarifying note to wireless join dialog
hnyman Mar 3, 2024
33c6c9e
luci-mod-status: fix sporadic logical interfaces resolve failures
jow- Mar 4, 2024
905a030
luci-app-ntpc: remove app
dannil Feb 28, 2024
258b0cf
luci-base: docs house-keeping
systemcrash Mar 6, 2024
7fd26e4
rpcd-mod-luci: use standard POSIX header for basename()
guidosarducci Mar 6, 2024
c4fae8b
Translated using Weblate (Lithuanian)
weblate Mar 4, 2024
ac648d8
irqbalance: Add option for new 'debug' setting
schuettecarsten Mar 7, 2024
e8f5ede
luci-base: use correct regex for time validation
dannil Mar 2, 2024
1838356
luci-app-statistics: Add UI to configure Mqtt
McGiverGim Mar 17, 2023
cef7d35
Translated using Weblate (Polish)
weblate Mar 8, 2024
00df19e
luci-app-upnp: remove obsolete translation
stokito Mar 9, 2024
0827230
luci-app-upnp: revise wording to include PCP
stokito Mar 9, 2024
a26f5b2
luci-app-p910nd: convert to JS
systemcrash Feb 12, 2024
f1c13b3
luci-theme-bootstrap: Realtime Graphs dark mode
JimMatthew Mar 12, 2024
4355c4a
Translated using Weblate (Italian)
weblate Mar 12, 2024
adf9b3a
luci-mod-network: drop trailing whitespace
dannil Mar 12, 2024
2a5c802
luci-app-statistics: add users plugin support
mrjoel Jul 31, 2020
0c9bf5f
luci-theme-bootstrap: Allways show scrollbar
thomasschroeder Feb 18, 2024
cf300d1
Merge branch 'openwrt:master' into luci-app-speedtest
animegasan Mar 14, 2024
afa63bd
Merge remote-tracking branch 'upstream/master' into luci-app-speedtest
animegasan Mar 14, 2024
6aac964
Merge branch 'luci-app-speedtest' of https://github.com/animegasan/lu…
animegasan Mar 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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>
McGiverGim authored and animegasan committed Mar 14, 2024
commit 18383564b3cdb1adc2454271b491d7bfcb4a19b7
Original file line number Diff line number Diff line change
@@ -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');
}
});
28 changes: 28 additions & 0 deletions applications/luci-app-statistics/root/usr/libexec/stat-genconfig
Original file line number Diff line number Diff line change
@@ -241,6 +241,33 @@ function config_network(c) {
;
}

function config_mqtt(c) {
let str = "";

for (let k, s in sections) {
if (s['.type'] === 'collectd_mqtt_block') {
const isPublish = s['blocktype'] === 'Publish';

str += isPublish ? `\t<Publish "${s.name}">\n` : `\t<Subscribe "${s.name}">\n`;

str += `\t\tHost "${s.Host}"\n`;
str += s['Port'] ? `\t\tPort ${s.Port}\n` : '';
str += s['User'] ? `\t\tUser "${s.User}"\n` : '';
str += s['Password'] ? `\t\tPassword "${s.Password}"\n` : '';
str += s['Qos'] ? `\t\tQos ${s.Qos}\n` : '';
str += s['Prefix'] ? `\t\tPrefix ${s.Prefix}\n` : '';
str += s['Retain'] ? `\t\tRetain ${s.Retain}\n` : '';
str += s['StoreRates'] ? `\t\tRetain ${s.StoreRates}\n` : '';
str += s['CleanSession'] ? `\t\tRetain ${s.CleanSession}\n` : '';
str += s['Topic'] ? `\t\tTopic "${s.Topic}"\n` : '';

str += isPublish ? `\t</Publish>\n` : `\t</Subscribe>\n`;
}
}

return str;
}

function section(plugin) {
let config = sections[`collectd_${plugin}`] ?? sections.collectd;

@@ -270,6 +297,7 @@ for (let filename in lsdir(plugin_dir)) {
case 'iptables': plugins[name] = config_iptables; break;
case 'curl': plugins[name] = config_curl; break;
case 'network': plugins[name] = config_network; break;
case 'mqtt': plugins[name] = config_mqtt; break;
default:
plugins[name] = json(open(`${plugin_dir}/${filename}`))?.legend;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "Mqtt",
"category": "output"
}