From 94d82f416258b65c8ab7849a459af78abebdf7d0 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Fri, 5 Oct 2018 14:28:54 +0530 Subject: [PATCH] YARN-8797. [UI2] Improve error pages in new YARN UI. Contributed by Akhil PB. --- .../src/main/webapp/app/controllers/application.js | 7 +++++-- .../hadoop-yarn-ui/src/main/webapp/app/router.js | 7 ++++--- .../src/main/webapp/app/routes/application.js | 8 ++++++-- .../src/main/webapp/app/templates/error.hbs | 2 +- .../src/main/webapp/app/templates/notfound.hbs | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js index 3e8fcceedd5..50a290912ae 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js @@ -61,11 +61,14 @@ export default Ember.Controller.extend({ }.property('currentPath'), clusterInfo: function() { - return this.model.clusterInfo.get('firstObject'); + if (this.model && this.model.clusterInfo) { + return this.model.clusterInfo.get('firstObject'); + } + return null; }.property('model.clusterInfo'), userInfo: function() { - if (this.model.userInfo) { + if (this.model && this.model.userInfo) { return this.model.userInfo.get('firstObject'); } return null; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js index b80b1966320..cd12fd2a449 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/router.js @@ -70,9 +70,6 @@ Router.map(function() { this.route('info', {path: '/:component_name/instances/:instance_name/info'}); }); this.route('yarn-app-attempt', { path: '/yarn-app-attempt/:app_attempt_id'}); - this.route('error'); - this.route('notfound', { path: '*:' }); - this.route('notauth', { path: '*:' }); this.route('yarn-queues', { path: '/yarn-queues/:queue_name' }); this.route('yarn-queue-apps', { path: '/yarn-queue-apps/:queue_name' }); this.route('yarn-tools', function() { @@ -92,6 +89,10 @@ Router.map(function() { }); this.route('yarn-flowrun-metric', { path: '/yarn-flowrun-metric/:flowrun_uid/:metric_id'}); this.route('timeline-error', {path: 'timeline-error/:error_id'}); + + this.route('notauth'); + this.route('notfound'); + this.route('error', { path: '*:' }); }); export default Router; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js index 60d1efd6a79..adb57b19c49 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js @@ -22,7 +22,9 @@ import AbstractRoute from './abstract'; export default AbstractRoute.extend({ model() { return Ember.RSVP.hash({ - clusterInfo: this.store.findAll('ClusterInfo', {reload: true}), + clusterInfo: this.store.findAll('ClusterInfo', {reload: true}).catch(function() { + return null; + }), userInfo: this.store.findAll('cluster-user-info', {reload: true}).catch(function() { return null; }) @@ -37,7 +39,9 @@ export default AbstractRoute.extend({ * error handler page. */ error: function (error) { - Ember.Logger.log(error.stack); + if (error && error.stack) { + Ember.Logger.log(error.stack); + } if (error && error.errors[0] && parseInt(error.errors[0].status) === 404) { this.intermediateTransitionTo('/notfound'); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs index 2e2a6e5f5dc..aace3c747d7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/error.hbs @@ -16,4 +16,4 @@ limitations under the License. --}} -

Sorry, Error Occurred.

+

Sorry, error occurred.

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notfound.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notfound.hbs index 588ea447d5f..8f60a2bd5c6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notfound.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notfound.hbs @@ -17,4 +17,4 @@ --}}

404, Not Found

-

Please Check your URL

+

Please check your URL