Merge pull request #1286 from fioru-software/cm-server-monitoring-notifications-ui

Server monitoring notification dropdowns to default to configured values
pull/1292/head
Tim Zandbergen 2025-01-05 02:32:49 +01:00 committed by GitHub
commit 43fa882a5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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',