mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
sysutils/nut: do not crash on this edge case, all I can test
This commit is contained in:
parent
f2a59dad2f
commit
fc230cc927
2 changed files with 6 additions and 0 deletions
|
|
@ -31,6 +31,7 @@
|
|||
<status_boost>UPS is boosting voltage</status_boost>
|
||||
<status_fsd>Forced Shutdown</status_fsd>
|
||||
<unconfigured>Nut is not started. Click to configure Nut.</unconfigured>
|
||||
<misconfigured>Nut is not returning a status. Click to reconfigure Nut.</misconfigured>
|
||||
<netclient_unconfigured>This widget only works with the Netclient driver. Click to configure the Netclient driver.</netclient_unconfigured>
|
||||
<netclient_remote_server>Remote NUT Server</netclient_remote_server>
|
||||
<time_hours>h</time_hours>
|
||||
|
|
|
|||
|
|
@ -71,6 +71,11 @@ export default class NutNetclient extends BaseTableWidget {
|
|||
// Fetch the UPS status data from the server.
|
||||
const { response: nut_ups_status_response } = await this.ajaxCall(`/api/nut/${'diagnostics/upsstatus'}`);
|
||||
|
||||
if (!nut_ups_status_response) {
|
||||
$('#nut-table').html(`<a href="/ui/nut/index">${this.translations.misconfigured}</a>`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Parse the UPS status data into a key-value object.
|
||||
const nut_ups_status = nut_ups_status_response.split('\n').reduce((acc, line) => {
|
||||
const [key, value] = line.split(': ');
|
||||
|
|
|
|||
Loading…
Reference in a new issue