feat(daemon): Add UPSD (NUT) protocol support, Proxmox VM shutdown action, pause/resume monitoring, and network-loss/unreachable handling; bump config version to 4.2
This commit is contained in:
@@ -346,17 +346,30 @@ export class ActionHandler {
|
||||
{ header: 'Battery', key: 'battery', align: 'right' },
|
||||
{ header: 'Runtime', key: 'runtime', align: 'right' },
|
||||
{ header: 'Trigger Mode', key: 'triggerMode', align: 'left' },
|
||||
{ header: 'Delay', key: 'delay', align: 'right' },
|
||||
{ header: 'Details', key: 'details', align: 'left' },
|
||||
];
|
||||
|
||||
const rows = target.actions.map((action, index) => ({
|
||||
index: theme.dim(index.toString()),
|
||||
type: theme.highlight(action.type),
|
||||
battery: action.thresholds ? `${action.thresholds.battery}%` : theme.dim('N/A'),
|
||||
runtime: action.thresholds ? `${action.thresholds.runtime}min` : theme.dim('N/A'),
|
||||
triggerMode: theme.dim(action.triggerMode || 'onlyThresholds'),
|
||||
delay: `${action.shutdownDelay || 5}s`,
|
||||
}));
|
||||
const rows = target.actions.map((action, index) => {
|
||||
let details = `${action.shutdownDelay || 5}s delay`;
|
||||
if (action.type === 'proxmox') {
|
||||
const host = action.proxmoxHost || 'localhost';
|
||||
const port = action.proxmoxPort || 8006;
|
||||
details = `${host}:${port}`;
|
||||
} else if (action.type === 'webhook') {
|
||||
details = action.webhookUrl || theme.dim('N/A');
|
||||
} else if (action.type === 'script') {
|
||||
details = action.scriptPath || theme.dim('N/A');
|
||||
}
|
||||
|
||||
return {
|
||||
index: theme.dim(index.toString()),
|
||||
type: theme.highlight(action.type),
|
||||
battery: action.thresholds ? `${action.thresholds.battery}%` : theme.dim('N/A'),
|
||||
runtime: action.thresholds ? `${action.thresholds.runtime}min` : theme.dim('N/A'),
|
||||
triggerMode: theme.dim(action.triggerMode || 'onlyThresholds'),
|
||||
details,
|
||||
};
|
||||
});
|
||||
|
||||
logger.logTable(columns, rows);
|
||||
logger.log('');
|
||||
|
||||
Reference in New Issue
Block a user