feat(cli,snmp): fix APC runtime unit defaults and add interactive action editing

This commit is contained in:
2026-04-16 09:44:30 +00:00
parent c7b52c48d5
commit c42ebb56d3
22 changed files with 2001 additions and 863 deletions
+10 -8
View File
@@ -1,5 +1,6 @@
import { BaseMigration } from './base-migration.ts';
import { logger } from '../logger.ts';
import { getDefaultRuntimeUnitForUpsModel } from '../snmp/runtime-units.ts';
/**
* Migration from v4.2 to v4.3
@@ -23,14 +24,15 @@ export class MigrationV4_2ToV4_3 extends BaseMigration {
const migratedDevices = devices.map((device) => {
const snmp = device.snmp as Record<string, unknown> | undefined;
if (snmp && !snmp.runtimeUnit) {
const model = snmp.upsModel as string | undefined;
if (model === 'cyberpower') {
snmp.runtimeUnit = 'ticks';
} else if (model === 'eaton') {
snmp.runtimeUnit = 'seconds';
} else {
snmp.runtimeUnit = 'minutes';
}
const model = snmp.upsModel as
| 'cyberpower'
| 'apc'
| 'eaton'
| 'tripplite'
| 'liebert'
| 'custom'
| undefined;
snmp.runtimeUnit = getDefaultRuntimeUnitForUpsModel(model);
logger.dim(`${device.name}: Set runtimeUnit to '${snmp.runtimeUnit}'`);
}
return device;