From commits-return-7412-archive-asf-public=cust-asf.ponee.io@trafficcontrol.apache.org Fri Jun 7 19:42:26 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 085EE18067E for ; Fri, 7 Jun 2019 21:42:25 +0200 (CEST) Received: (qmail 88582 invoked by uid 500); 7 Jun 2019 19:42:25 -0000 Mailing-List: contact commits-help@trafficcontrol.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@trafficcontrol.apache.org Delivered-To: mailing list commits@trafficcontrol.apache.org Received: (qmail 88571 invoked by uid 99); 7 Jun 2019 19:42:25 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jun 2019 19:42:25 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 2928E87A6C; Fri, 7 Jun 2019 19:42:25 +0000 (UTC) Date: Fri, 07 Jun 2019 19:42:25 +0000 To: "commits@trafficcontrol.apache.org" Subject: [trafficcontrol] branch master updated: Removed restangular from TrafficPortalService (#3634) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155993654494.31598.11916338266918345799@gitbox.apache.org> From: mitchell852@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: trafficcontrol X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: f04bd4b62880c7e6d1c292842758f8311097c3c5 X-Git-Newrev: d9ff3be61caa5ee70abf7451707a422ae148fde2 X-Git-Rev: d9ff3be61caa5ee70abf7451707a422ae148fde2 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. mitchell852 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 d9ff3be Removed restangular from TrafficPortalService (#3634) d9ff3be is described below commit d9ff3be61caa5ee70abf7451707a422ae148fde2 Author: ocket8888 AuthorDate: Fri Jun 7 13:42:19 2019 -0600 Removed restangular from TrafficPortalService (#3634) * Removed restangular from ./TrafficPortalService.js * Fixed some service methods not throwing in error handlers --- .../app/src/common/api/TrafficPortalService.js | 66 ++++++++++------------ 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/traffic_portal/app/src/common/api/TrafficPortalService.js b/traffic_portal/app/src/common/api/TrafficPortalService.js index 11b5cbc..cec27e6 100644 --- a/traffic_portal/app/src/common/api/TrafficPortalService.js +++ b/traffic_portal/app/src/common/api/TrafficPortalService.js @@ -17,33 +17,28 @@ * under the License. */ -var TrafficPortalService = function($http, $q, messageModel, ENV) { +var TrafficPortalService = function($http, messageModel, ENV) { this.getReleaseVersionInfo = function() { - var deferred = $q.defer(); - $http.get('traffic_portal_release.json') - .then( - function(result) { - deferred.resolve(result); - }, - function(fault) { - deferred.reject(fault); - } - ); - - return deferred.promise; + return $http.get('traffic_portal_release.json').then( + function(result) { + return result; + }, + function(err) { + throw err; + } + ); }; this.getProperties = function() { - var deferred = $q.defer(); - $http.get('traffic_portal_properties.json') - .then( - function(result) { - deferred.resolve(result.data.properties); - } - ); - - return deferred.promise; + return $http.get('traffic_portal_properties.json').then( + function(result) { + return result.data.properties; + }, + function (err) { + throw err; + } + ); }; this.dbDump = function() { @@ -51,22 +46,23 @@ var TrafficPortalService = function($http, $q, messageModel, ENV) { responseType=arraybuffer is important if you want to create a blob of your data See: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data */ - $http.get(ENV.api['root'] + 'dbdump', { responseType:'arraybuffer' } ) - .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); - } + return $http.get(ENV.api['root'] + 'dbdump', { responseType:'arraybuffer' } ).then( + function(result) { + download(result.data, moment().format() + '.pg_dump'); + return result; + }, + function(err) { + if (err && err.alerts && err.alerts.length > 0) { + messageModel.setMessages(err.alerts, false); + } else { + messageModel.setMessages([ { level: 'error', text: err.status.toString() + ': ' + err.statusText } ], false); } - ); + throw err; + } + ); }; }; -TrafficPortalService.$inject = ['$http', '$q', 'messageModel', 'ENV']; +TrafficPortalService.$inject = ['$http', 'messageModel', 'ENV']; module.exports = TrafficPortalService;