luci/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/plugins/apcups.js
Jo-Philipp Wich 8816c8fff7 luci-app-statistics: treat APC UPS "host" setting as single value option
Existing Lua code incorrectly stated that the "Host" option takes a space
sparated list of hostnames which is not the case since the collect plugin
does not handle multiple hosts.

This change reverts the configuration to a simple value as proposed by
the original PR and adjusts the config summary accordingly, while retaining
the translation string.

Ref: https://github.com/openwrt/luci/pull/5010#issuecomment-827285319
Fixes: dd5d96afd ("luci-app-statistics: fix APC UPS host configuration")
Fixes: e7d22dce5 ("luci-app-statistics: convert collectd configuration to client side views")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-04-27 10:17:05 +02:00

28 lines
742 B
JavaScript

'use strict';
'require baseclass';
'require form';
return baseclass.extend({
title: _('APCUPS Plugin Configuration'),
description: _('The APCUPS plugin collects statistics about the APC UPS.'),
addFormOptions: function(s) {
var o;
o = s.option(form.Flag, 'enable', _('Enable this plugin'));
o = s.option(form.Value, 'Host', _('Monitor host'));
o.default = 'localhost';
o.datatype = 'host';
o.depends('enable', '1');
o = s.option(form.Value, 'Port', _('Port for apcupsd communication'));
o.default = '3551';
o.datatype = 'port';
o.depends('enable', '1');
},
configSummary: function(section) {
return _('Monitoring APC UPS at host %s, port %d').format(section.Host || 'localhost', section.Port || 3551);
}
});