Pass title of action(s) to refresh(), to make errors more informative.
authorChris Burgess <chris@giantrobot.co.nz>
Fri, 19 May 2017 21:16:01 +0000 (09:16 +1200)
committerChris Burgess <chris@giantrobot.co.nz>
Fri, 19 May 2017 21:16:01 +0000 (09:16 +1200)
CRM-20602

ang/crmStatusPage/StatusPageCtrl.js

index c308d14e2e8343e4253f4bb874af3081849ad622..c718910ac8954402a988fb9280c8d917e943f13c 100644 (file)
@@ -8,7 +8,7 @@
       $scope.statuses = statusData.values;
 
       // Refresh the list. Optionally execute api calls first.
-      function refresh(apiCalls) {
+      function refresh(apiCalls, title) {
         apiCalls = (apiCalls || []).concat([['System', 'check', {sequential: 1}]]);
         $('#crm-status-list').block();
         crmApi(apiCalls, true)
             $scope.statuses = results[results.length - 1].values;
             results.forEach(function(result) {
               if (result.is_error) {
-                var error_message = ts('result.error_message');
+                var error_message = ts(result.error_message);
                 if (typeof(result.debug_information) !== 'undefined') {
                   error_message += '<div class="status-debug-information">' +
                       '<b>' + ts('Debug information') + ':</b><br>' +
                       result.debug_information + '</div>';
                 }
-                CRM.alert(error_message, ts('API error'), 'error');
+                CRM.alert(error_message, ts('Operation failed: ' + title), 'error');
                 }
               });
             $('#crm-status-list').unblock();
@@ -37,7 +37,7 @@
             ignore_severity: visible ? 0 : status.severity,
             hush_until: until
           }]
-        ]);
+        ], 'Set preference');
       };
       
       $scope.countVisible = function(visibility) {
@@ -54,7 +54,7 @@
               break;
 
             case 'api3':
-              refresh([action.params]);
+              refresh([action.params], action.title);
               break;
           }
         }