You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/04/29 20:58:55 UTC
[13/19] guacamole-client git commit: GUACAMOLE-526: Add convenience
callback for displaying modal notifications strictly for REST errors,
while logging all other promise rejections.
GUACAMOLE-526: Add convenience callback for displaying modal notifications strictly for REST errors, while logging all other promise rejections.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/f6d5e566
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/f6d5e566
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/f6d5e566
Branch: refs/heads/master
Commit: f6d5e5662b643e0521a3069c14639ca03a9a0714
Parents: 1e5e9b6
Author: Michael Jumper <mj...@apache.org>
Authored: Thu Apr 26 21:20:31 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Thu Apr 26 21:20:31 2018 -0700
----------------------------------------------------------------------
guacamole/src/main/webapp/app/rest/restModule.js | 5 ++++-
.../webapp/app/rest/services/requestService.js | 18 ++++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/f6d5e566/guacamole/src/main/webapp/app/rest/restModule.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/rest/restModule.js b/guacamole/src/main/webapp/app/rest/restModule.js
index 81b64b5..6672507 100644
--- a/guacamole/src/main/webapp/app/rest/restModule.js
+++ b/guacamole/src/main/webapp/app/rest/restModule.js
@@ -21,4 +21,7 @@
* The module for code relating to communication with the REST API of the
* Guacamole web application.
*/
-angular.module('rest', ['auth']);
+angular.module('rest', [
+ 'auth',
+ 'notification'
+]);
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/f6d5e566/guacamole/src/main/webapp/app/rest/services/requestService.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/rest/services/requestService.js b/guacamole/src/main/webapp/app/rest/services/requestService.js
index 9aef124..a27ccc3 100644
--- a/guacamole/src/main/webapp/app/rest/services/requestService.js
+++ b/guacamole/src/main/webapp/app/rest/services/requestService.js
@@ -25,8 +25,9 @@ angular.module('rest').factory('requestService', ['$injector',
function requestService($injector) {
// Required services
- var $http = $injector.get('$http');
- var $log = $injector.get('$log');
+ var $http = $injector.get('$http');
+ var $log = $injector.get('$log');
+ var guacNotification = $injector.get('guacNotification');
// Required types
var Error = $injector.get('Error');
@@ -115,6 +116,19 @@ angular.module('rest').factory('requestService', ['$injector',
$log.warn(error.type, error.message || error.translatableMessage);
});
+ /**
+ * Promise error callback which displays a modal notification for all
+ * rejections due to REST errors. The message displayed to the user within
+ * the notification is provided by the contents of the @link{Error} object
+ * within the REST response. All other rejections, such as those due to
+ * JavaScript errors, are logged to the browser console without displaying
+ * any notification.
+ *
+ * @constant
+ * @type Function
+ */
+ service.SHOW_NOTIFICATION = service.createErrorCallback(guacNotification.showRequestError);
+
return service;
}]);