fix(cli): remove obsolete gatherThresholdSettings method
- Remove call to gatherThresholdSettings in runAddProcess - Delete entire gatherThresholdSettings method - Thresholds are now configured per-action in gatherActionSettings Fixes: Cannot read properties of undefined (reading 'battery')
This commit is contained in:
@@ -123,9 +123,6 @@ export class UpsHandler {
|
|||||||
// Gather SNMP settings
|
// Gather SNMP settings
|
||||||
await this.gatherSnmpSettings(newUps.snmp, prompt);
|
await this.gatherSnmpSettings(newUps.snmp, prompt);
|
||||||
|
|
||||||
// Gather threshold settings
|
|
||||||
await this.gatherThresholdSettings(newUps.thresholds, prompt);
|
|
||||||
|
|
||||||
// Gather UPS model settings
|
// Gather UPS model settings
|
||||||
await this.gatherUpsModelSettings(newUps.snmp, prompt);
|
await this.gatherUpsModelSettings(newUps.snmp, prompt);
|
||||||
|
|
||||||
@@ -820,39 +817,6 @@ export class UpsHandler {
|
|||||||
snmpConfig.privKey = privKey.trim() || defaultPrivKey;
|
snmpConfig.privKey = privKey.trim() || defaultPrivKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gather threshold settings
|
|
||||||
* @param thresholds Thresholds configuration object to update
|
|
||||||
* @param prompt Function to prompt for user input
|
|
||||||
*/
|
|
||||||
private async gatherThresholdSettings(
|
|
||||||
thresholds: any,
|
|
||||||
prompt: (question: string) => Promise<string>,
|
|
||||||
): Promise<void> {
|
|
||||||
logger.log('');
|
|
||||||
logger.info('Shutdown Thresholds:');
|
|
||||||
|
|
||||||
// Battery threshold
|
|
||||||
const defaultBatteryThreshold = thresholds.battery || 60;
|
|
||||||
const batteryThresholdInput = await prompt(
|
|
||||||
`Battery percentage threshold [${defaultBatteryThreshold}%]: `,
|
|
||||||
);
|
|
||||||
const batteryThreshold = parseInt(batteryThresholdInput, 10);
|
|
||||||
thresholds.battery = batteryThresholdInput.trim() && !isNaN(batteryThreshold)
|
|
||||||
? batteryThreshold
|
|
||||||
: defaultBatteryThreshold;
|
|
||||||
|
|
||||||
// Runtime threshold
|
|
||||||
const defaultRuntimeThreshold = thresholds.runtime || 20;
|
|
||||||
const runtimeThresholdInput = await prompt(
|
|
||||||
`Runtime minutes threshold [${defaultRuntimeThreshold} minutes]: `,
|
|
||||||
);
|
|
||||||
const runtimeThreshold = parseInt(runtimeThresholdInput, 10);
|
|
||||||
thresholds.runtime = runtimeThresholdInput.trim() && !isNaN(runtimeThreshold)
|
|
||||||
? runtimeThreshold
|
|
||||||
: defaultRuntimeThreshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gather UPS model settings
|
* Gather UPS model settings
|
||||||
* @param snmpConfig SNMP configuration object to update
|
* @param snmpConfig SNMP configuration object to update
|
||||||
|
Reference in New Issue
Block a user