You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ra...@apache.org on 2019/01/07 17:06:39 UTC

[trafficcontrol] branch master updated: handles error scenario for dbdump in TP (#3170)

This is an automated email from the ASF dual-hosted git repository.

rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 9022960  handles error scenario for dbdump in TP (#3170)
9022960 is described below

commit 9022960f97350764aa6b9925ce4680a372d8e17d
Author: Jeremy Mitchell <mi...@users.noreply.github.com>
AuthorDate: Mon Jan 7 10:06:34 2019 -0700

    handles error scenario for dbdump in TP (#3170)
---
 traffic_portal/app/src/common/api/TrafficPortalService.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/traffic_portal/app/src/common/api/TrafficPortalService.js b/traffic_portal/app/src/common/api/TrafficPortalService.js
index aa91d5d..e32723b 100644
--- a/traffic_portal/app/src/common/api/TrafficPortalService.js
+++ b/traffic_portal/app/src/common/api/TrafficPortalService.js
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-var TrafficPortalService = function($http, $q, ENV) {
+var TrafficPortalService = function($http, $q, messageModel, ENV) {
 
     this.getReleaseVersionInfo = function() {
         var deferred = $q.defer();
@@ -55,11 +55,18 @@ var TrafficPortalService = function($http, $q, ENV) {
             .then(
                 function(result) {
                     download(result.data, moment().format() + '.pg_dump');
+                },
+                function(fault) {
+                    if (fault && fault.alerts && fault.alerts.length > 0) {
+                        messageModel.setMessages(fault.alerts, false);
+                    } else {
+                        messageModel.setMessages([ { level: 'error', text: fault.status.toString() + ': ' + fault.statusText } ], false);
+                    }
                 }
             );
     };
 
 };
 
-TrafficPortalService.$inject = ['$http', '$q', 'ENV'];
+TrafficPortalService.$inject = ['$http', '$q', 'messageModel', 'ENV'];
 module.exports = TrafficPortalService;