sysutils/nut: scrub

This commit is contained in:
Franco Fichtner
2024-12-06 17:31:26 +01:00
parent 65cbc82053
commit f2a59dad2f
2 changed files with 4 additions and 9 deletions

View File

@@ -2,9 +2,7 @@
<nut>
<filename>Nut.js</filename>
<endpoints>
<endpoint>/api/nut/service/status</endpoint>
<endpoint>/api/nut/settings/get</endpoint>
<endpoint>/api/nut/diagnostics/upsstatus</endpoint>
<endpoint>/api/nut/*</endpoint>
</endpoints>
<translations>
<title>NUT</title>

View File

@@ -25,9 +25,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
import BaseTableWidget from 'widget-base-table';
export default class NutNetclient extends BaseTableWidget {
constructor() {
super();
@@ -54,7 +51,7 @@ export default class NutNetclient extends BaseTableWidget {
// Periodically called to update the widget's data and UI.
async onWidgetTick() {
// Fetch the NUT service status from the server.
const nut_service_status = await this.ajaxCall('/api/nut/service/status');
const nut_service_status = await this.ajaxCall(`/api/nut/${'service/status'}`);
// If the service is not running, display a message and stop further processing.
if (!nut_service_status || nut_service_status.status !== 'running') {
@@ -63,7 +60,7 @@ export default class NutNetclient extends BaseTableWidget {
}
// Fetch the NUT settings from the server.
const nut_settings = await this.ajaxCall('/api/nut/settings/get');
const nut_settings = await this.ajaxCall(`/api/nut/${'settings/get'}`);
// // If netclient is not enabled, display a message and stop further processing.
// if (nut_settings.nut?.netclient?.enable !== "1") {
@@ -72,7 +69,7 @@ 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');
const { response: nut_ups_status_response } = await this.ajaxCall(`/api/nut/${'diagnostics/upsstatus'}`);
// Parse the UPS status data into a key-value object.
const nut_ups_status = nut_ups_status_response.split('\n').reduce((acc, line) => {