From 5ba324ab957820bc13b1ef3f7fcadfe2b82a8b31 Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Fri, 19 May 2017 17:09:04 +1200 Subject: [PATCH] Surface errors from API calls to user on status page. CRM-20602 --- ang/crmStatusPage.css | 4 ++++ ang/crmStatusPage/StatusPageCtrl.js | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ang/crmStatusPage.css b/ang/crmStatusPage.css index 3166641368..7bac7aac30 100644 --- a/ang/crmStatusPage.css +++ b/ang/crmStatusPage.css @@ -75,3 +75,7 @@ z-index: 99999; font-weight: normal; } + +.status-debug-information { + font-size: smaller; +} \ No newline at end of file diff --git a/ang/crmStatusPage/StatusPageCtrl.js b/ang/crmStatusPage/StatusPageCtrl.js index ff1e73527b..ba279adc9c 100644 --- a/ang/crmStatusPage/StatusPageCtrl.js +++ b/ang/crmStatusPage/StatusPageCtrl.js @@ -12,8 +12,19 @@ apiCalls = (apiCalls || []).concat([['System', 'check', {sequential: 1}]]); $('#crm-status-list').block(); crmApi(apiCalls, true) - .then(function(result) { - $scope.statuses = result[result.length - 1].values; + .then(function(results) { + $scope.statuses = results[results.length - 1].values; + results.forEach(function(result) { + if (result.is_error) { + var error_message = result.error_message; + if (typeof(result.debug_information) !== 'undefined') { + error_message += '
' + + 'Debug information:
' + + result.debug_information + '
'; + } + CRM.alert(error_message, 'API error', 'error'); + } + }); $('#crm-status-list').unblock(); }); } -- 2.25.1