Преглед на файлове

[frontend] Remove unsupported browser check

This removes some inline script that was checking for very old browser versions, instead of updating the check I decided to remove it completely. Officially we support the two latest versions of modern browsers but given the constant upgrades of browsers we likely support much older versions. With that in mind having a constraint in place adds no value, on the contrary it will probably worsen the experience by locking a user out even though Hue would work perfectly fine for them.
Johan Åhlén преди 2 години
родител
ревизия
5b8569d0ab

+ 0 - 1
.eslintrc.js

@@ -17,7 +17,6 @@ const hueGlobals = [
   'IS_K8S_ONLY',
   'IS_NEW_INDEXER_ENABLED',
   'IS_S3_ENABLED',
-  'isIE11',
   'KO_DATERANGEPICKER_LABELS',
   'LOGGED_USERGROUPS',
   'LOGGED_USERNAME',

+ 2 - 2
desktop/core/src/desktop/js/ext/ko.selectize.custom.js

@@ -39,10 +39,10 @@ var inject_binding = function (allBindings, key, value) {
 
 ko.bindingHandlers.browserAwareSelectize = {
   init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
-    (window.isIE11 ? ko.bindingHandlers.options : ko.bindingHandlers.selectize).init.apply(null, arguments);
+    ko.bindingHandlers.selectize.init.apply(null, arguments);
   },
   update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
-    (window.isIE11 ? ko.bindingHandlers.options : ko.bindingHandlers.selectize).update.apply(null, arguments);
+    ko.bindingHandlers.selectize.update.apply(null, arguments);
   }
 }
 

+ 1 - 3
desktop/core/src/desktop/js/jquery/plugins/jquery.delayedinput.js

@@ -45,9 +45,7 @@ Plugin.prototype.init = function () {
   const _this = this;
   let _timeout = -1;
   if (_this.options.fn != null) {
-    const event = isIE11 ? 'input' : 'keyup';
-
-    $(_this.element).on(event, e => {
+    $(_this.element).on('keyup', e => {
       if (!(_this.options.skipOnEnterAndKeys && [13, 37, 38, 39, 40].indexOf(e.keyCode) > -1)) {
         window.clearTimeout(_timeout);
         _timeout = window.setTimeout(_this.options.fn, _this.options.timeout);

+ 5 - 7
desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js

@@ -449,13 +449,11 @@ Plugin.prototype.navigateTo = function (path) {
             $searchInput.removeClass('x onX').val('');
           }
         });
-      if (!isIE11) {
-        $searchInput.on('blur', e => {
-          if ($searchInput.val() === '') {
-            slideOutInput();
-          }
-        });
-      }
+      $searchInput.on('blur', e => {
+        if ($searchInput.val() === '') {
+          slideOutInput();
+        }
+      });
 
       $search.find('.fa-search').on('click', () => {
         window.hueAnalytics.log('filechooser', 'show-search-btn-click');

+ 1 - 3
desktop/core/src/desktop/static/desktop/js/jquery.delayedinput.js

@@ -44,9 +44,7 @@
     var _this = this;
     var _timeout = -1;
     if (_this.options.fn != null) {
-      var event = isIE11 ? 'input' : 'keyup';
-
-      $(_this.element).on(event, function (e) {
+      $(_this.element).on('keyup', function (e) {
         if (!(_this.options.skipOnEnterAndKeys && [13, 37, 38, 39, 40].indexOf(e.keyCode) > -1)){
           window.clearTimeout(_timeout);
           _timeout = window.setTimeout(_this.options.fn, _this.options.timeout);

+ 0 - 2
desktop/core/src/desktop/templates/common_header.mako

@@ -138,8 +138,6 @@ if USE_NEW_EDITOR.get():
     % endif
   </style>
 
-  ${ commonHeaderFooterComponents.header_i18n_redirection() }
-
   % if user.is_authenticated:
   <%
     global_constants_url = '/desktop/globalJsConstants.js?v=' + hue_version()

+ 0 - 29
desktop/core/src/desktop/templates/common_header_footer_components.mako

@@ -32,35 +32,6 @@ else:
   from django.utils.translation import ugettext as _
 %>
 
-<%def name="header_i18n_redirection()">
-  <!--[if lt IE 9]>
-  <script type="text/javascript">
-    if (document.documentMode && document.documentMode < 9){
-      location.href = "${ url('desktop_views_unsupported') }";
-    }
-  </script>
-  <![endif]-->
-
-
-  <script type="text/javascript">
-    // check if it's a Firefox < 7
-    var _UA = navigator.userAgent.toLowerCase();
-    for (var i = 1; i < 7; i++) {
-      if (_UA.indexOf("firefox/" + i + ".") > -1) {
-        location.href = "${ url('desktop_views_unsupported') }";
-      }
-    }
-
-    // check for IE document modes
-    if (document.documentMode && document.documentMode < 9) {
-      location.href = "${ url('desktop_views_unsupported') }";
-    }
-
-    // sets a global variable to see if it's IE11 or not
-    var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
-  </script>
-</%def>
-
 <%def name="header_pollers(user, is_s3_enabled, apps)">
   <script type="text/javascript">
     Dropzone.autoDiscover = false;

+ 0 - 23
desktop/core/src/desktop/templates/common_header_m.mako

@@ -96,29 +96,6 @@ if USE_NEW_EDITOR.get():
     };
   </script>
 
-  <!--[if lt IE 9]>
-  <script type="text/javascript">
-    if (document.documentMode && document.documentMode < 9){
-      location.href = "${ url('desktop_views_unsupported') }";
-    }
-  </script>
-  <![endif]-->
-
-  <script type="text/javascript">
-    // check if it's a Firefox < 7
-    var _UA = navigator.userAgent.toLowerCase();
-    for (var i = 1; i < 7; i++) {
-      if (_UA.indexOf("firefox/" + i + ".") > -1) {
-        location.href = "${ url('desktop_views_unsupported') }";
-      }
-    }
-
-    // check for IE document modes
-    if (document.documentMode && document.documentMode < 9) {
-      location.href = "${ url('desktop_views_unsupported') }";
-    }
-  </script>
-
   % for bundle in get_hue_bundles('hue'):
     ${ render_bundle(bundle) | n,unicode }
   % endfor

+ 0 - 1
desktop/core/src/desktop/templates/hue.mako

@@ -89,7 +89,6 @@
   <link rel="stylesheet" href="${ static('desktop/css/nv.d3.css') }">
   <link rel="stylesheet" href="${ static('desktop/ext/css/bootstrap-fileupload.css') }" >
 
-  ${ commonHeaderFooterComponents.header_i18n_redirection() }
   <%
     global_constants_url = '/desktop/globalJsConstants.js?v=' + hue_version()
   %>

+ 0 - 102
desktop/core/src/desktop/templates/unsupported.mako

@@ -1,102 +0,0 @@
-## Licensed to Cloudera, Inc. under one
-## or more contributor license agreements.    See the NOTICE file
-## distributed with this work for additional information
-## regarding copyright ownership.  Cloudera, Inc. 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.
-<%!
-  import sys
-  if sys.version_info[0] > 2:
-    from django.utils.translation import gettext as _
-  else:
-    from django.utils.translation import ugettext as _
-%>
-<!DOCTYPE html>
-<html lang="en">
-<head>
-  <meta charset="utf-8">
-  <title>${_('Hue - Unsupported browser')}</title>
-
-  <meta name="viewport" content="width=device-width, initial-scale=1.0">
-  <meta name="description" content="">
-  <meta name="author" content="">
-
-  <style type="text/css">
-    body {
-      padding-top: 80px;
-      margin: 0;
-      font-family: Arial, Helvetica, sans-serif;
-      font-size: 13px;
-      line-height: 20px;
-      color: #444444;
-      text-align: center;
-    }
-
-    #logo {
-      display: block;
-      margin-left: auto;
-      margin-right: auto;
-      margin-bottom: 10px;
-      background: #FFF url("${ static('desktop/art/hue-login-logo-ellie.png') }") 50% 14px no-repeat;
-      width: 130px;
-      height: 130px;
-    }
-
-    .header {
-      background-color: #0B7FAD;
-      position: fixed;
-      top: 0;
-      width: 100%;
-      text-align: left;
-      padding: 4px;
-    }
-
-    .footer {
-      position: fixed;
-      bottom: 0;
-      background-color: #0B7FAD;
-      color: #FFF;
-      font-size: 10px;
-      width: 100%;
-      text-align: center;
-      height: 6px;
-    }
-
-    a {
-      color: #0B7FAD;
-      text-decoration: none;
-      font-weight: bold;
-    }
-
-    a:hover {
-      text-decoration: underline;
-    }
-  </style>
-</head>
-
-<body>
-<div class="header">
-  <img src="${ static('desktop/art/hue-logo-mini-white.png') }" alt="${ _('Hue logo') }"/>
-</div>
-
-<div class="footer"></div>
-
-<div id="logo"></div>
-
-<h3>${_('It looks like you are running an older browser. What about upgrading to the latest')}</h3>
-
-<a href="http://www.google.com/chrome/">Google Chrome</a> |
-<a href="http://www.mozilla.org/firefox/">Mozilla Firefox</a> |
-<a href="http://windows.microsoft.com/en-us/internet-explorer/browser-ie">Microsoft Internet Explorer</a>
-
-</body>
-</html>

+ 0 - 3
desktop/core/src/desktop/urls.py

@@ -138,9 +138,6 @@ dynamic_patterns += [
 
   re_path(r'^dynamic_bundle/(?P<config>\w+)/(?P<bundle_name>.+)', desktop_views.dynamic_bundle),
 
-  # Unsupported browsers
-  re_path(r'^boohoo$', desktop_views.unsupported, name='desktop_views_unsupported'),
-
   # Top level web page!
   re_path(r'^$', desktop_views.index, name="desktop_views.index"),
 ]

+ 0 - 4
desktop/core/src/desktop/views.py

@@ -488,10 +488,6 @@ def dynamic_bundle(request, config, bundle_name):
 def assist_m(request):
   return render('assist_m.mako', request, None)
 
-@login_notrequired
-def unsupported(request):
-  return render('unsupported.mako', request, None)
-
 def index(request):
   return redirect('desktop_views_hue')
 

+ 0 - 4
tools/knox/hue/1.0.0/rewrite.xml

@@ -58,13 +58,9 @@
   <rule dir="OUT" name="HUE/hue/outbound/huerooturl/css" pattern="/static/{*}/{**}?{**}">
     <rewrite template="{$frontend[path]}/hue/static/{*}/{**}?{**}"/>
   </rule>
-  <rule dir="OUT" name="HUE/hue/outbound/huerooturl/root" pattern="/boohoo">
-    <rewrite template="{$frontend[path]}/hue/boohoo"/>
-  </rule>
   <filter name="HUE/hue/outbound/huerooturl">
     <content type="*/html">
         <apply path="/desktop/globalJsConstants.*" rule="HUE/hue/outbound/huerooturl/desktop"/>
-        <apply path="/boohoo" rule="HUE/hue/outbound/huerooturl/root"/>
         <apply path="\/static\/.*\/.*\.(js|css|html|png)" rule="HUE/hue/outbound/huerooturl/static"/>
         <apply path="\/static\/desktop\/js\/ace" rule="HUE/hue/outbound/huerooturl/static"/>
     </content>