Переглянути джерело

YARN-7866. [UI2] Error to be displayed correctly while accessing kerberized cluster without kinit. Contributed by Sunil G.

Sunil G 7 роки тому
батько
коміт
72415c39cf

+ 3 - 0
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();
 }
 

+ 6 - 0
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 {

+ 1 - 0
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() {

+ 2 - 0
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');
       }

+ 20 - 0
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.
+--}}
+
+<h2 align = "center">401, Authorization required.</h2>
+<h4 align = "center">Please check your security settings.</h4>

+ 3 - 0
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;