Skip to content

Commit

Permalink
[#107] Add notification formatting to check statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhilton committed Sep 13, 2023
1 parent b5c2ac1 commit c23d159
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion classes/admin_setting_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

use admin_setting;
use core\check\check;
use core\check\result;
use core\output\notification;

/**
* Admin setting for check api.
Expand Down Expand Up @@ -76,8 +78,18 @@ public function output_html($data, $query = '') {

$resulthtml = $OUTPUT->check_result($checkresult);
$resultinfo = $checkresult->get_summary();

$out = $resulthtml . ' ' . $resultinfo;

switch($checkresult->get_status()){
case result::CRITICAL:
case result::ERROR:
$out = $OUTPUT->notification($out, notification::NOTIFY_ERROR, false);
break;

case result::OK:
$out = $OUTPUT->notification($out, notification::NOTIFY_SUCCESS, false);
break;
}
return format_admin_setting($this, $this->visiblename, '', $out);
}
}

0 comments on commit c23d159

Please sign in to comment.