eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject incubator-eagle git commit: EAGLE-194 UI show exception alert if service error When backend error occurred, we wish to see the exception.
Date Thu, 10 Mar 2016 07:28:15 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 625f7c19a -> 124de31aa


EAGLE-194 UI show exception alert if service error
When backend error occurred, we wish to see the exception.

https://issues.apache.org/jira/browse/EAGLE-194

Author: @zombiej
Reviewer: @qingwen220

Closes #120


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/124de31a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/124de31a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/124de31a

Branch: refs/heads/master
Commit: 124de31aabcb33154d4e3546bac36fb42917cd21
Parents: 625f7c1
Author: jiljiang <jiljiang@ebay.com>
Authored: Thu Mar 10 15:28:05 2016 +0800
Committer: jiljiang <jiljiang@ebay.com>
Committed: Thu Mar 10 15:28:05 2016 +0800

----------------------------------------------------------------------
 eagle-webservice/src/main/webapp/app/index.html | 35 +++++++++++++
 .../src/main/webapp/app/public/css/main.css     |  8 +++
 .../src/main/webapp/app/public/js/app.js        |  3 +-
 .../src/main/webapp/app/public/js/srv/main.js   | 55 +++++++++++++++++++-
 4 files changed, 99 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/124de31a/eagle-webservice/src/main/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/index.html b/eagle-webservice/src/main/webapp/app/index.html
index 3311d8c..c5e9e34 100644
--- a/eagle-webservice/src/main/webapp/app/index.html
+++ b/eagle-webservice/src/main/webapp/app/index.html
@@ -59,6 +59,28 @@
 
 					<div class="navbar-custom-menu">
 						<ul class="nav navbar-nav">
+							<!-- Admin error list -->
+							<li class="dropdown" ng-show="ServiceError.list.length">
+								<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">
+									<i class="fa fa-exclamation-triangle" ng-class="{blink: ServiceError.hasUnread}"></i>
+								</a>
+								<ul class="dropdown-menu">
+									<li ng-repeat="error in ServiceError.list">
+										<a ng-click="ServiceError.showError(error);">
+											<span class="fa" ng-class="{'fa-envelope': !error._read, 'fa-check': error._read}"></span>
+											{{error.title}}
+										</a>
+									</li>
+									<li role="separator" class="divider"></li>
+									<li>
+										<a ng-click="ServiceError.clearAll();">
+											<span class="fa fa-trash"></span>
+											Clear All
+										</a>
+									</li>
+								</ul>
+							</li>
+
 							<!-- Site -->
 							<li class="dropdown" ng-show="!PageConfig.hideSite && !PageConfig.lockSite">
 								<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">
@@ -189,6 +211,19 @@
 					</div>
 				</section><!-- /.content -->
 			</div><!-- /.content-wrapper -->
+
+			<footer class="main-footer">
+				<div class="pull-right hidden-xs">
+					<b>License</b>
+					<a href="http://www.apache.org/licenses/LICENSE-2.0" class="text-muted">Apache-2.0</a>
+				</div>
+				<strong>
+					Apache Eagle
+					<a target="_blank" href="https://eagle.incubator.apache.org/">Home</a> /
+					<a target="_blank" href="https://eagle.incubator.apache.org/docs/community.html">Community</a>
/
+					<a target="_blank" href="https://cwiki.apache.org/confluence/display/EAG/FAQ">FAQ</a>
+				</strong>
+			</footer>
 		</div><!-- ./wrapper -->
 
 		<!-- ref:js public/js/doc.js -->

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/124de31a/eagle-webservice/src/main/webapp/app/public/css/main.css
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/css/main.css b/eagle-webservice/src/main/webapp/app/public/css/main.css
index b6e848e..1af0c8b 100644
--- a/eagle-webservice/src/main/webapp/app/public/css/main.css
+++ b/eagle-webservice/src/main/webapp/app/public/css/main.css
@@ -727,3 +727,11 @@ td.text-ellipsis {
 	-webkit-touch-callout: none;
 	-webkit-user-select: none;
 }
+
+.blink {
+	animation: blinker 1s linear infinite;
+}
+
+@keyframes blinker {
+	50% {opacity: 0.0;}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/124de31a/eagle-webservice/src/main/webapp/app/public/js/app.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/app.js b/eagle-webservice/src/main/webapp/app/public/js/app.js
index 80b6aa0..0ef5d93 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/app.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/app.js
@@ -393,7 +393,8 @@ var app = {};
 	// ======================================================================================
 	// =                                   Main Controller                                 
=
 	// ======================================================================================
-	eagleApp.controller('MainCtrl', function ($scope, $wrapState, $http, $injector, PageConfig,
FeaturePageConfig, Site, Authorization, Entities, nvd3, Application, Feature, UI) {
+	eagleApp.controller('MainCtrl', function ($scope, $wrapState, $http, $injector, ServiceError,
PageConfig, FeaturePageConfig, Site, Authorization, Entities, nvd3, Application, Feature,
UI) {
+		window.serviceError = $scope.ServiceError = ServiceError;
 		window.site = $scope.Site = Site;
 		window.auth = $scope.Auth = Authorization;
 		window.entities = $scope.Entities = Entities;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/124de31a/eagle-webservice/src/main/webapp/app/public/js/srv/main.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/js/srv/main.js b/eagle-webservice/src/main/webapp/app/public/js/srv/main.js
index 82765b8..4f5a72a 100644
--- a/eagle-webservice/src/main/webapp/app/public/js/srv/main.js
+++ b/eagle-webservice/src/main/webapp/app/public/js/srv/main.js
@@ -16,4 +16,57 @@
  * limitations under the License.
  */
 
-angular.module('eagle.service', []);
\ No newline at end of file
+(function() {
+	'use strict';
+
+	var eagleSrv = angular.module('eagle.service', []);
+
+	eagleSrv.provider('ServiceError', function() {
+		var errorContainer = {
+			list: [],
+			newError: function(err) {
+				err._read = false;
+				errorContainer.list.unshift(err);
+			},
+			showError: function(err) {
+				err._read = true;
+				$.dialog({
+					size: "large",
+					title: err.title,
+					content: $("<pre>").html(err.description)
+				});
+			},
+			clearAll: function() {
+				errorContainer.list = [];
+			}
+		};
+
+		Object.defineProperty(errorContainer, 'hasUnread', {
+			get: function() {
+				return !!common.array.find(false, errorContainer.list, "_read");
+			}
+		});
+
+		this.$get = function() {
+			return errorContainer;
+		};
+	});
+
+	eagleSrv.config(function ($httpProvider, ServiceErrorProvider) {
+		$httpProvider.interceptors.push(function ($q, $timeout) {
+			return {
+				response: function (response) {
+					var data = response.data;
+					if(data.exception) {
+						console.log(response);
+						ServiceErrorProvider.$get().newError({
+							title: "Http Request Error",
+							description: "URL:\n" + response.config.url + "\n\nParams:\n" + JSON.stringify(response.config.params,
null, "\t") + "\n\nException:\n" + data.exception
+						});
+					}
+					return response;
+				}
+			};
+		});
+	});
+})();


Mime
View raw message