refactor(cli, ups-handler, daemon, migrations): remove thresholds handling and update migration order logic
Some checks failed
CI / Type Check & Lint (push) Failing after 4s
CI / Build Test (Current Platform) (push) Successful in 5s
Release / build-and-release (push) Successful in 41s
CI / Build All Platforms (push) Successful in 46s

This commit is contained in:
2025-10-20 12:03:14 +00:00
parent 2c8ea44d40
commit afd026d08c
8 changed files with 33 additions and 53 deletions

View File

@@ -335,7 +335,7 @@ export class NupstCli {
id: theme.dim(ups.id),
host: `${ups.snmp.host}:${ups.snmp.port}`,
model: ups.snmp.upsModel || 'cyberpower',
thresholds: `${ups.thresholds.battery}% / ${ups.thresholds.runtime}min`,
actions: `${(ups.actions || []).length} configured`,
groups: ups.groups.length > 0 ? ups.groups.join(', ') : theme.dim('None'),
}));
@@ -344,7 +344,7 @@ export class NupstCli {
{ header: 'ID', key: 'id', align: 'left' },
{ header: 'Host:Port', key: 'host', align: 'left', color: theme.info },
{ header: 'Model', key: 'model', align: 'left' },
{ header: 'Battery/Runtime', key: 'thresholds', align: 'left' },
{ header: 'Actions', key: 'actions', align: 'left' },
{ header: 'Groups', key: 'groups', align: 'left' },
];
@@ -389,9 +389,9 @@ export class NupstCli {
} else {
// === Legacy Single UPS Configuration ===
if (!config.snmp || !config.thresholds) {
if (!config.snmp) {
logger.logBox('Configuration Error', [
'Error: Legacy configuration missing SNMP or threshold settings',
'Error: Legacy configuration missing SNMP settings',
], 60, 'error');
return;
}
@@ -435,9 +435,7 @@ export class NupstCli {
: []
),
'',
theme.dim('Thresholds:'),
` Battery: ${theme.highlight(String(config.thresholds.battery))}%`,
` Runtime: ${theme.highlight(String(config.thresholds.runtime))} minutes`,
` Check Interval: ${config.checkInterval / 1000} seconds`,
'',
theme.dim('Configuration File:'),