You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/02/24 14:19:25 UTC

[18/50] ambari git commit: AMBARI-20112. Add polyfills for Array.includes and String.includes (onechiporenko)

AMBARI-20112. Add polyfills for Array.includes and String.includes (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/813841f8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/813841f8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/813841f8

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 813841f871525a5e78a4fd551ab77ddb8c67e5b2
Parents: f080bd6
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Feb 22 13:31:19 2017 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Feb 22 13:44:32 2017 +0200

----------------------------------------------------------------------
 .../app/styles/theme/bootstrap-ambari.css       | 17 ++++++++
 ambari-web/test/init_test.js                    | 42 ++++++++++++++++++++
 2 files changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/813841f8/ambari-web/app/styles/theme/bootstrap-ambari.css
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/theme/bootstrap-ambari.css b/ambari-web/app/styles/theme/bootstrap-ambari.css
index af78310..2c84f88 100644
--- a/ambari-web/app/styles/theme/bootstrap-ambari.css
+++ b/ambari-web/app/styles/theme/bootstrap-ambari.css
@@ -1,3 +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.
+ */
 @font-face {
   font-family: 'Roboto';
   font-weight: normal;

http://git-wip-us.apache.org/repos/asf/ambari/blob/813841f8/ambari-web/test/init_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/init_test.js b/ambari-web/test/init_test.js
index df64cbe..cc97174 100644
--- a/ambari-web/test/init_test.js
+++ b/ambari-web/test/init_test.js
@@ -49,6 +49,48 @@ if (!Function.prototype.bind) {
   };
 }
 
+if (!String.prototype.includes) {
+  String.prototype.includes = function (search, start) {
+    'use strict';
+    var _start = start;
+    if (typeof start !== 'number') {
+      _start = 0;
+    }
+
+    if (_start + search.length > this.length) {
+      return false;
+    }
+    return this.indexOf(search, _start) !== -1;
+  };
+}
+
+if (!Array.prototype.includes) {
+  Object.defineProperty(Array.prototype, 'includes', {
+    value: function (searchElement, fromIndex) {
+
+      if (!this) {
+        throw new TypeError('"this" is null or not defined');
+      }
+
+      var o = Object(this);
+      var len = o.length >>> 0;
+      if (len === 0) {
+        return false;
+      }
+      var n = fromIndex | 0;
+      var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
+
+      while (k < len) {
+        if (o[k] === searchElement) {
+          return true;
+        }
+        k++;
+      }
+      return false;
+    }
+  });
+}
+
 Number.isFinite = Number.isFinite || function(value) {
   return typeof value === 'number' && isFinite(value);
 };
\ No newline at end of file