Commit d1fa280a authored by colemanw's avatar colemanw

System.check api - add severity_id to output

parent e5e4a5b2
......@@ -158,7 +158,8 @@ class CRM_Utils_Check_Message {
'name' => $this->name,
'message' => $this->message,
'title' => $this->title,
'severity' => $this->level,
'severity' => CRM_Utils_Check::severityMap($this->level, TRUE),
'severity_id' => $this->level,
'is_visible' => (int) $this->isVisible(),
'icon' => $this->icon,
);
......
(function(angular, $, _) {
angular.module('statuspage').controller('statuspageStatusPage',
function($scope, crmApi, crmStatus, statusData, statuspageSeverityList) {
function($scope, crmApi, crmStatus, statusData) {
function preprocessStatuses(apiData) {
_.each(apiData.values, function(status) {
status.severity_id = status.severity;
status.severity = statuspageSeverityList[status.severity];
if (status.hidden_until) {
var date = $.datepicker.parseDate('yy-mm-dd', status.hidden_until);
status.hidden_until = $.datepicker.formatDate(CRM.config.dateInputFormat, date);
......
......@@ -3,10 +3,6 @@
angular.module('statuspage')
.filter('trusted', function($sce){ return $sce.trustAsHtml; })
.service('statuspageSeverityList', function() {
return ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency'];
})
// Todo: abstract this into a generic crmUi directive?
.directive('statuspagePopupMenu', function($timeout) {
return {
......
......@@ -110,6 +110,12 @@ function _civicrm_api3_system_check_spec(&$spec) {
);
$spec['severity'] = array(
'title' => 'Severity',
'description' => 'Psr\Log\LogLevel string',
'type' => CRM_Utils_Type::T_STRING,
'options' => array_combine(CRM_Utils_Check::$severityMap, CRM_Utils_Check::$severityMap),
);
$spec['severity_id'] = array(
'title' => 'Severity ID',
'description' => 'Integer representation of Psr\Log\LogLevel',
'type' => CRM_Utils_Type::T_INT,
'options' => CRM_Utils_Check::$severityMap,
......
......@@ -63,7 +63,7 @@ class api_v3_SystemCheckTest extends CiviUnitTestCase {
break;
}
}
$this->assertEquals($testedCheck['severity'], '3', ' in line ' . __LINE__);
$this->assertEquals($testedCheck['severity_id'], '3', ' in line ' . __LINE__);
}
/**
......@@ -89,7 +89,7 @@ class api_v3_SystemCheckTest extends CiviUnitTestCase {
}
/**
* Items hushed through tomorrow shouldn't show up.
* Items hushed through tomorrow shouldn't show up.
*/
public function testSystemCheckHushFuture() {
$tomorrow = new DateTime('tomorrow');
......@@ -113,7 +113,7 @@ class api_v3_SystemCheckTest extends CiviUnitTestCase {
}
/**
* Items hushed through today should show up.
* Items hushed through today should show up.
*/
public function testSystemCheckHushToday() {
$today = new DateTime('today');
......@@ -137,7 +137,7 @@ class api_v3_SystemCheckTest extends CiviUnitTestCase {
}
/**
* Items hushed through yesterday should show up.
* Items hushed through yesterday should show up.
*/
public function testSystemCheckHushYesterday() {
$yesterday = new DateTime('yesterday');
......@@ -161,7 +161,7 @@ class api_v3_SystemCheckTest extends CiviUnitTestCase {
}
/**
* Items hushed above current severity should be hidden.
* Items hushed above current severity should be hidden.
*/
public function testSystemCheckHushAboveSeverity() {
$this->_params = array(
......@@ -183,7 +183,7 @@ class api_v3_SystemCheckTest extends CiviUnitTestCase {
}
/**
* Items hushed at current severity should be hidden.
* Items hushed at current severity should be hidden.
*/
public function testSystemCheckHushAtSeverity() {
$this->_params = array(
......@@ -205,7 +205,7 @@ class api_v3_SystemCheckTest extends CiviUnitTestCase {
}
/**
* Items hushed below current severity should be shown.
* Items hushed below current severity should be shown.
*/
public function testSystemCheckHushBelowSeverity() {
$this->_params = array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment