refactor(cli, ups-handler, daemon, migrations): remove thresholds handling and update migration order logic
This commit is contained in:
12
ts/cli.ts
12
ts/cli.ts
@@ -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:'),
|
||||
|
Reference in New Issue
Block a user