Use ApiService to get error message

This commit is contained in:
Evan Cordell 2016-04-11 17:28:49 -04:00
parent b5db41920f
commit 7c361c07f9
5 changed files with 8 additions and 4 deletions

View file

@ -1,7 +1,7 @@
/**
* Service which provides helper methods for performing some simple UI operations.
*/
angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$location', function($timeout, $rootScope, $location) {
angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$location', 'ApiService', function($timeout, $rootScope, $location, ApiService) {
var CheckStateController = function(items, itemKey) {
this.items = items;
this.checked = [];
@ -12,6 +12,7 @@ angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$locatio
this.itemKey_ = itemKey;
this.listeners_ = [];
this.page_ = null;
this.ApiService = ApiService
};
CheckStateController.prototype.listen = function(callback) {
@ -138,7 +139,7 @@ angular.module('quay').factory('UIService', ['$timeout', '$rootScope', '$locatio
};
uiService.showFormError = function(elem, result, opt_placement) {
var message = result.data['message'] || result.data['error_description'] || result.data['detail'] || '';
var message = ApiService.getErrorMessage(result, 'error');
if (message) {
uiService.showPopover(elem, message, opt_placement || 'bottom');
} else {