You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2019/12/24 19:28:27 UTC

[lucene-solr] branch branch_8x updated: SOLR-14120: Solr Admin UI breaks when using IE11

This is an automated email from the ASF dual-hosted git repository.

rmuir pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 359d823  SOLR-14120: Solr Admin UI breaks when using IE11
359d823 is described below

commit 359d82348e84348fa5fe4305b0f56c4ca387837e
Author: Robert Muir <rm...@apache.org>
AuthorDate: Tue Dec 24 11:27:44 2019 -0800

    SOLR-14120: Solr Admin UI breaks when using IE11
---
 solr/CHANGES.txt                  |  3 +++
 solr/webapp/web/js/angular/app.js | 30 ++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 36b626d..98f17aa 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -77,6 +77,9 @@ New Features
 
 Improvements
 ---------------------
+* SOLR-14120: Define JavaScript methods 'includes' and 'startsWith' to ensure AdminUI can be displayed when using 
+  Internet Explorer 11 (jafurrer).
+
 * SOLR-14042: Fix varargs precommit warnings (Andraas Salamon via Jason Gerlowski)
 
 * SOLR-14095: Replace Java serialization with Javabin in the Overseer queues (Tomás Fernández Löbbe)
diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js
index e2023ba..9db0aeb 100644
--- a/solr/webapp/web/js/angular/app.js
+++ b/solr/webapp/web/js/angular/app.js
@@ -15,6 +15,36 @@
  limitations under the License.
 */
 
+/* SOLR-14120: Providing a manual definition for the methods 'includes' and 'startsWith' to support Internet Explorer 11. */
+if (!String.prototype.includes) {
+  String.prototype.includes = function(search, start) { 'use strict';
+  if (search instanceof RegExp) {
+    throw TypeError('first argument must not be a RegExp');
+  } 
+  if (start === undefined) { start = 0; }
+    return this.indexOf(search, start) !== -1;
+  };
+}
+if (!Array.prototype.includes) {
+  Object.defineProperty(Array.prototype, "includes", {
+    enumerable: false,
+    value: function(obj) {
+    var newArr = this.filter(function(el) {
+      return el == obj;
+    });
+    return newArr.length > 0;
+    }
+  });
+}
+if (!String.prototype.startsWith) {
+  Object.defineProperty(String.prototype, 'startsWith', {
+    value: function(search, rawPos) {
+    var pos = rawPos > 0 ? rawPos|0 : 0;
+    return this.substring(pos, pos + search.length) === search;
+    }
+  });
+}
+
 var solrAdminApp = angular.module("solrAdminApp", [
   "ngResource",
   "ngRoute",