Server monitoring notification defaults to obey configuration

pull/1286/head
cm 2024-11-07 15:02:46 +00:00
parent fccc264107
commit 16c9fddc54
No known key found for this signature in database
GPG Key ID: ABA40BE6ED92A779
1 changed files with 13 additions and 0 deletions

View File

@ -140,6 +140,17 @@ class ServerController extends AbstractServerController
return $this->twig->render('module/server/server/list.tpl.html', $tpl_data);
}
/**
* Set default monitoring dropdown selections to configured values.
*/
private static function setDefaultMonitoringNotificationsToConfiguredValues( array &$tpl_data ): void {
$tpl_data['edit_email_selected'] = psm_get_conf('email_status') ? 'yes' : 'no';
$tpl_data['edit_sms_selected'] = psm_get_conf('sms_status') ? 'yes' : 'no';
$tpl_data['edit_pushover_selected'] = psm_get_conf('pushover_status') ? 'yes' : 'no';
$tpl_data['edit_telegram_selected'] = psm_get_conf('telegram_status') ? 'yes' : 'no';
$tpl_data['edit_jabber_selected'] = psm_get_conf('jabber_status') ? 'yes' : 'no';
}
/**
* Prepare the template to show the update screen for a single server
*/
@ -154,6 +165,8 @@ class ServerController extends AbstractServerController
$modal->setOKButtonLabel(psm_get_lang('system', 'delete'));
$tpl_data = $this->getLabels();
self::setDefaultMonitoringNotificationsToConfiguredValues( $tpl_data );
$tpl_data['edit_server_id'] = $this->server_id;
$tpl_data['url_save'] = psm_build_url(array(
'mod' => 'server',