From 1ed8a939faecfb3a48731f8fd9219e5bd4b94ad9 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Sat, 3 Feb 2018 15:18:58 +0530 Subject: [PATCH] YARN-7866 --- .../src/main/webapp/app/helpers/lower.js | 3 +++ .../src/main/webapp/app/initializers/loader.js | 6 ++++++ .../hadoop-yarn-ui/src/main/webapp/app/router.js | 1 + .../src/main/webapp/app/routes/application.js | 2 ++ .../src/main/webapp/app/templates/notauth.hbs | 20 ++++++++++++++++++++ .../src/main/webapp/app/utils/error-utils.js | 3 +++ 6 files changed, 35 insertions(+) create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notauth.hbs diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/lower.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/lower.js index e51990545d3..34c936f9df6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/lower.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/lower.js @@ -21,6 +21,9 @@ import Ember from 'ember'; export function lower(params) { const string = params[0]; + if(!string) { + return ""; + } return string.toLowerCase(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js index 58c6354f95c..47fe33e63a0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js @@ -73,6 +73,9 @@ function updateConfigs(application) { Ember.Logger.log("Timeline Updated Address: " + updatedAddress); } application.advanceReadiness(); + }, + error: function() { + application.advanceReadiness(); } }); } else { @@ -103,6 +106,9 @@ function updateConfigs(application) { Ember.Logger.log("Timeline V1 Updated Address: " + updatedAddress); } application.advanceReadiness(); + }, + error: function() { + application.advanceReadiness(); } }); } else { 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 3322a8795a2..b80b1966320 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 @@ -72,6 +72,7 @@ Router.map(function() { 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() { 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 33a741a443c..596b3030a4e 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 @@ -36,6 +36,8 @@ export default AbstractRoute.extend({ if (error && error.errors[0] && parseInt(error.errors[0].status) === 404) { this.intermediateTransitionTo('/notfound'); + } else if (error && error.errors[0] && parseInt(error.errors[0].status) === 401) { + this.intermediateTransitionTo('/notauth'); } else { this.intermediateTransitionTo('/error'); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notauth.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notauth.hbs new file mode 100644 index 00000000000..cdf93100d1c --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/notauth.hbs @@ -0,0 +1,20 @@ +{{!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--}} + +

401, Authorization required.

+

Please check your security settings.

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/error-utils.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/error-utils.js index 463f61f1fd8..7945be9c1b0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/error-utils.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/utils/error-utils.js @@ -39,6 +39,9 @@ export default { case "404": errorType = "Not Found"; break; + case "401": + errorType = "Authorization required"; + break; default: errorType = ""; break; -- 2.14.3 (Apple Git-98)