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 2016/10/19 16:47:23 UTC

[12/50] [abbrv] ambari git commit: AMBARI-18573. Migration to Bootstrap3 framework (akovalenko)

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a77e39c/ambari-web/vendor/fonts/glyphicons-halflings-regular.woff
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/fonts/glyphicons-halflings-regular.woff b/ambari-web/vendor/fonts/glyphicons-halflings-regular.woff
new file mode 100644
index 0000000..9e61285
Binary files /dev/null and b/ambari-web/vendor/fonts/glyphicons-halflings-regular.woff differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a77e39c/ambari-web/vendor/fonts/glyphicons-halflings-regular.woff2
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/fonts/glyphicons-halflings-regular.woff2 b/ambari-web/vendor/fonts/glyphicons-halflings-regular.woff2
new file mode 100644
index 0000000..64539b5
Binary files /dev/null and b/ambari-web/vendor/fonts/glyphicons-halflings-regular.woff2 differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a77e39c/ambari-web/vendor/scripts/bootstrap-combobox.js
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/scripts/bootstrap-combobox.js b/ambari-web/vendor/scripts/bootstrap-combobox.js
index 09c2fba..ec3e7d3 100644
--- a/ambari-web/vendor/scripts/bootstrap-combobox.js
+++ b/ambari-web/vendor/scripts/bootstrap-combobox.js
@@ -1,5 +1,5 @@
 /* =============================================================
- * bootstrap-combobox.js v1.0.0
+ * bootstrap-combobox.js v1.1.7
  * =============================================================
  * Copyright 2012 Daniel Farrell
  *
@@ -16,235 +16,447 @@
  * limitations under the License.
  * ============================================================ */
 
-!function ($) {
-
-  "use strict"
-
-  var Combobox = function (element, options) {
-    this.options = $.extend({}, $.fn.combobox.defaults, options)
-    this.$container = this.setup(element)
-    this.$element = this.$container.find('input')
-    this.$button = this.$container.find('.dropdown-toggle')
-    this.$target = this.$container.find('select')
-    this.matcher = this.options.matcher || this.matcher
-    this.sorter = this.options.sorter || this.sorter
-    this.highlighter = this.options.highlighter || this.highlighter
-    this.$menu = $(this.options.menu).appendTo('body')
-    this.placeholder = this.options.placeholder || this.$target.attr('data-placeholder')
-    this.$element.attr('placeholder', this.placeholder)
-    this.shown = false
-    this.selected = false
-    this.refresh()
-    this.listen()
-  }
-
-  /* NOTE: COMBOBOX EXTENDS BOOTSTRAP-TYPEAHEAD.js
-   ========================================== */
-
-  Combobox.prototype = $.extend({}, $.fn.typeahead.Constructor.prototype, {
-
-    constructor:Combobox, setup:function (element) {
-      var select = $(element)
-        , combobox = $(this.options.template)
-      select.before(combobox)
-      select.detach()
-      combobox.append(select)
-      return combobox
-    },
-    parse:function () {
-      var map = {}
+!function( $ ) {
+
+  "use strict";
+
+  /* COMBOBOX PUBLIC CLASS DEFINITION
+   * ================================ */
+
+  var Combobox = function ( element, options ) {
+    this.options = $.extend({}, $.fn.combobox.defaults, options);
+    this.template = this.options.template || this.template
+    this.$source = $(element);
+    this.$container = this.setup();
+    this.$element = this.$container.find('input[type=text]');
+    this.$target = this.$container.find('input[type=hidden]');
+    this.$button = this.$container.find('.dropdown-toggle');
+    this.$menu = $(this.options.menu).appendTo('body');
+    this.matcher = this.options.matcher || this.matcher;
+    this.sorter = this.options.sorter || this.sorter;
+    this.highlighter = this.options.highlighter || this.highlighter;
+    this.shown = false;
+    this.selected = false;
+    this.refresh();
+    this.transferAttributes();
+    this.listen();
+  };
+
+  Combobox.prototype = {
+
+    constructor: Combobox
+
+    , setup: function () {
+      var combobox = $(this.template());
+      this.$source.before(combobox);
+      this.$source.hide();
+      return combobox;
+    }
+
+    , disable: function() {
+      this.$element.prop('disabled', true);
+      this.$button.attr('disabled', true);
+      this.disabled = true;
+      this.$container.addClass('combobox-disabled');
+    }
+
+    , enable: function() {
+      this.$element.prop('disabled', false);
+      this.$button.attr('disabled', false);
+      this.disabled = false;
+      this.$container.removeClass('combobox-disabled');
+    }
+    , parse: function () {
+      var that = this
+        , map = {}
         , source = []
         , selected = false
-      this.$target.find('option').each(function () {
-        var option = $(this)
-        map[option.text()] = option.val()
-        source.push(option.text())
-        if (option.attr('selected')) selected = option.html()
+        , selectedValue = '';
+      this.$source.find('option').each(function() {
+        var option = $(this);
+        if (option.val() === '') {
+          that.options.placeholder = option.text();
+          return;
+        }
+        map[option.text()] = option.val();
+        source.push(option.text());
+        if (option.prop('selected')) {
+          selected = option.text();
+          selectedValue = option.val();
+        }
       })
-      this.map = map
+      this.map = map;
       if (selected) {
-        this.$element.val(selected)
-        this.$container.addClass('combobox-selected')
-        this.selected = true
+        this.$element.val(selected);
+        this.$target.val(selectedValue);
+        this.$container.addClass('combobox-selected');
+        this.selected = true;
       }
-      return source
-    },
-    toggle:function () {
-      if (this.$container.hasClass('combobox-selected')) {
-        this.clearTarget()
-        this.$element.val('').focus()
-      } else {
-        if (this.shown) {
-          this.hide()
-        } else {
-          this.lookup()
-        }
+      return source;
+    }
+
+    , transferAttributes: function() {
+      this.options.placeholder = this.$source.attr('data-placeholder') || this.options.placeholder
+      if(this.options.appendId !== "undefined") {
+        this.$element.attr('id', this.$source.attr('id') + this.options.appendId);
       }
-    },
-    clearTarget:function () {
-      this.$target.val('')
-      this.$container.removeClass('combobox-selected')
-      this.selected = false
-      this.$target.trigger('change')
-    },
-    refresh:function () {
-      this.source = this.parse()
-      this.options.items = this.source.length
-    }
-
-    // modified typeahead function adding container and target handling
-    , select:function () {
-      var val = this.$menu.find('.active').attr('data-value')
-      this.$element.val(val)
-      this.$container.addClass('combobox-selected')
-      this.$target.val(this.map[val])
-      this.$target.trigger('change')
-      this.selected = true
-      return this.hide()
-    }
-
-    // modified typeahead function removing the blank handling
-    , lookup:function (event) {
-      var that = this
-        , items
-        , q
+      this.$element.attr('placeholder', this.options.placeholder)
+      this.$target.prop('name', this.$source.prop('name'))
+      this.$target.val(this.$source.val())
+      this.$source.removeAttr('name')  // Remove from source otherwise form will pass parameter twice.
+      this.$element.attr('required', this.$source.attr('required'))
+      this.$element.attr('rel', this.$source.attr('rel'))
+      this.$element.attr('title', this.$source.attr('title'))
+      this.$element.attr('class', this.$source.attr('class'))
+      this.$element.attr('tabindex', this.$source.attr('tabindex'))
+      this.$source.removeAttr('tabindex')
+      if (this.$source.attr('disabled')!==undefined)
+        this.disable();
+    }
+
+    , select: function () {
+      var val = this.$menu.find('.active').attr('data-value');
+      this.$element.val(this.updater(val)).trigger('change');
+      this.$target.val(this.map[val]).trigger('change');
+      this.$source.val(this.map[val]).trigger('change');
+      this.$container.addClass('combobox-selected');
+      this.selected = true;
+      return this.hide();
+    }
+
+    , updater: function (item) {
+      return item;
+    }
+
+    , show: function () {
+      var pos = $.extend({}, this.$element.position(), {
+        height: this.$element[0].offsetHeight
+      });
+
+      this.$menu
+        .insertAfter(this.$element)
+        .css({
+          top: pos.top + pos.height
+          , left: pos.left
+        })
+        .show();
+
+      $('.dropdown-menu').on('mousedown', $.proxy(this.scrollSafety, this));
+
+      this.shown = true;
+      return this;
+    }
+
+    , hide: function () {
+      this.$menu.hide();
+      $('.dropdown-menu').off('mousedown', $.proxy(this.scrollSafety, this));
+      this.$element.on('blur', $.proxy(this.blur, this));
+      this.shown = false;
+      return this;
+    }
+
+    , lookup: function (event) {
+      this.query = this.$element.val();
+      return this.process(this.source);
+    }
 
-      this.query = this.$element.val()
+    , process: function (items) {
+      var that = this;
 
-      items = $.grep(this.source, function (item) {
-        if (that.matcher(item)) return item
+      items = $.grep(items, function (item) {
+        return that.matcher(item);
       })
 
-      items = this.sorter(items)
+      items = this.sorter(items);
 
       if (!items.length) {
-        return this.shown ? this.hide() : this
+        return this.shown ? this.hide() : this;
       }
 
-      return this.render(items.slice(0, this.options.items)).show()
+      return this.render(items.slice(0, this.options.items)).show();
     }
 
-    // modified typeahead function adding button handling
-    , listen:function () {
-      this.$element
-        .on('blur', $.proxy(this.blur, this))
-        .on('keypress', $.proxy(this.keypress, this))
-        .on('keyup', $.proxy(this.keyup, this))
+    , template: function() {
+      if (this.options.bsVersion == '2') {
+        return '<div class="combobox-container"><input type="hidden" /> <div class="input-append"> <input type="text" autocomplete="false" /> <span class="add-on dropdown-toggle" data-dropdown="dropdown"> <span class="caret"/> <i class="icon-remove"/> </span> </div> </div>'
+      } else {
+        return '<div class="combobox-container"> <input type="hidden" /> <div class="input-group"> <input type="text" autocomplete="false" /> <span class="input-group-addon dropdown-toggle" data-dropdown="dropdown"> <span class="caret" /> <span class="glyphicon glyphicon-remove" /> </span> </div> </div>'
+      }
+    }
+
+    , matcher: function (item) {
+      return ~item.toLowerCase().indexOf(this.query.toLowerCase());
+    }
+
+    , sorter: function (items) {
+      var beginswith = []
+        , caseSensitive = []
+        , caseInsensitive = []
+        , item;
+
+      while (item = items.shift()) {
+        if (!item.toLowerCase().indexOf(this.query.toLowerCase())) {beginswith.push(item);}
+        else if (~item.indexOf(this.query)) {caseSensitive.push(item);}
+        else {caseInsensitive.push(item);}
+      }
+
+      return beginswith.concat(caseSensitive, caseInsensitive);
+    }
+
+    , highlighter: function (item) {
+      var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
+      return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
+        return '<strong>' + match + '</strong>';
+      })
+    }
+
+    , render: function (items) {
+      var that = this;
+
+      items = $(items).map(function (i, item) {
+        i = $(that.options.item).attr('data-value', item);
+        i.find('a').html(that.highlighter(item));
+        return i[0];
+      })
+
+      items.first().addClass('active');
+      this.$menu.html(items);
+      return this;
+    }
 
-      if ($.browser.webkit || $.browser.msie) {
-        this.$element.on('keydown', $.proxy(this.keypress, this))
+    , next: function (event) {
+      var active = this.$menu.find('.active').removeClass('active')
+        , next = active.next();
+
+      if (!next.length) {
+        next = $(this.$menu.find('li')[0]);
       }
 
-//      hide menu hack
-      this.$button.on('mouseenter', $.proxy(this.addClassOnMouseEnter, this.$button))
-        .on('mouseleave', $.proxy(this.addClassOnMouseLeave, this.$button));
+      next.addClass('active');
+    }
 
-      $(window).on('click', $.proxy(this.hideList, this));
-//      hide menu hack end
+    , prev: function (event) {
+      var active = this.$menu.find('.active').removeClass('active')
+        , prev = active.prev();
 
+      if (!prev.length) {
+        prev = this.$menu.find('li').last();
+      }
+
+      prev.addClass('active');
+    }
+
+    , toggle: function () {
+      if (!this.disabled) {
+        if (this.$container.hasClass('combobox-selected')) {
+          this.clearTarget();
+          this.triggerChange();
+          this.clearElement();
+        } else {
+          if (this.shown) {
+            this.hide();
+          } else {
+            this.clearElement();
+            this.lookup();
+          }
+        }
+      }
+    }
+
+    , scrollSafety: function(e) {
+      if (e.target.tagName == 'UL') {
+        this.$element.off('blur');
+      }
+    }
+    , clearElement: function () {
+      this.$element.val('').focus();
+    }
+
+    , clearTarget: function () {
+      this.$source.val('');
+      this.$target.val('');
+      this.$container.removeClass('combobox-selected');
+      this.selected = false;
+    }
+
+    , triggerChange: function () {
+      this.$source.trigger('change');
+    }
+
+    , refresh: function () {
+      this.source = this.parse();
+      this.options.items = this.source.length;
+    }
+
+    , listen: function () {
+      this.$element
+        .on('focus',    $.proxy(this.focus, this))
+        .on('blur',     $.proxy(this.blur, this))
+        .on('keypress', $.proxy(this.keypress, this))
+        .on('keyup',    $.proxy(this.keyup, this));
+
+      if (this.eventSupported('keydown')) {
+        this.$element.on('keydown', $.proxy(this.keydown, this));
+      }
 
       this.$menu
         .on('click', $.proxy(this.click, this))
         .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
+        .on('mouseleave', 'li', $.proxy(this.mouseleave, this));
 
       this.$button
-        .on('click', $.proxy(this.toggle, this))
+        .on('click', $.proxy(this.toggle, this));
+    }
+
+    , eventSupported: function(eventName) {
+      var isSupported = eventName in this.$element;
+      if (!isSupported) {
+        this.$element.setAttribute(eventName, 'return;');
+        isSupported = typeof this.$element[eventName] === 'function';
+      }
+      return isSupported;
     }
 
-    // modified typeahead function to clear on type and prevent on moving around
-    , keyup:function (e) {
-      switch (e.keyCode) {
+    , move: function (e) {
+      if (!this.shown) {return;}
+
+      switch(e.keyCode) {
+        case 9: // tab
+        case 13: // enter
+        case 27: // escape
+          e.preventDefault();
+          break;
+
+        case 38: // up arrow
+          e.preventDefault();
+          this.prev();
+          this.fixMenuScroll();
+          break;
+
         case 40: // down arrow
+          e.preventDefault();
+          this.next();
+          this.fixMenuScroll();
+          break;
+      }
+
+      e.stopPropagation();
+    }
+
+    , fixMenuScroll: function(){
+      var active = this.$menu.find('.active');
+      if(active.length){
+        var top = active.position().top;
+        var bottom = top + active.height();
+        var scrollTop = this.$menu.scrollTop();
+        var menuHeight = this.$menu.height();
+        if(bottom > menuHeight){
+          this.$menu.scrollTop(scrollTop + bottom - menuHeight);
+        } else if(top < 0){
+          this.$menu.scrollTop(scrollTop + top);
+        }
+      }
+    }
+
+    , keydown: function (e) {
+      this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27]);
+      this.move(e);
+    }
+
+    , keypress: function (e) {
+      if (this.suppressKeyPressRepeat) {return;}
+      this.move(e);
+    }
+
+    , keyup: function (e) {
+      switch(e.keyCode) {
+        case 40: // down arrow
+          if (!this.shown){
+            this.toggle();
+          }
+          break;
         case 39: // right arrow
         case 38: // up arrow
         case 37: // left arrow
         case 36: // home
         case 35: // end
         case 16: // shift
-          break
+        case 17: // ctrl
+        case 18: // alt
+          break;
 
         case 9: // tab
         case 13: // enter
-          if (!this.shown) return
-          this.select()
-          break
+          if (!this.shown) {return;}
+          this.select();
+          break;
 
         case 27: // escape
-          if (!this.shown) return
-          this.hide()
-          break
+          if (!this.shown) {return;}
+          this.hide();
+          break;
 
         default:
-          this.clearTarget()
-          this.lookup()
+          this.clearTarget();
+          this.lookup();
       }
 
-      e.stopPropagation()
-      e.preventDefault()
-    },
-
-    addClassOnMouseEnter:function (e) {
-      console.warn("Enter");
-      this.addClass('hover');
-    },
+      e.stopPropagation();
+      e.preventDefault();
+    }
 
-    addClassOnMouseLeave:function (e) {
-      console.warn("Leave");
-      this.removeClass('hover');
-    },
+    , focus: function (e) {
+      this.focused = true;
+    }
 
-    // modified typeahead function to only hide menu if it is visible
-    blur:function (e) {
-      var that = this
-      e.stopPropagation()
-      e.preventDefault()
-      var val = this.$element.val()
-      if (!this.selected && val != "") {
-        this.$element.val("")
-        this.$target.val("").trigger('change')
-      }
-      if (this.shown) {
-        setTimeout(function () {
-          that.hide()
-        }, 150)
-      }
-    },
-
-    /**
-     * hide list
-     * @param e
-     */
-    hideList:function (e) {
-      if (!this.$button.is(".hover")) {
-        var that = this;
-        if (this.shown) {
-          setTimeout(function () {
-            that.hide()
-          }, 150)
-        }
+    , blur: function (e) {
+      var that = this;
+      this.focused = false;
+      var val = this.$element.val();
+      if (!this.selected && val !== '' ) {
+        this.$element.val('');
+        this.$source.val('').trigger('change');
+        this.$target.val('').trigger('change');
       }
+      if (!this.mousedover && this.shown) {setTimeout(function () { that.hide(); }, 200);}
     }
-  })
+
+    , click: function (e) {
+      e.stopPropagation();
+      e.preventDefault();
+      this.select();
+      this.$element.focus();
+    }
+
+    , mouseenter: function (e) {
+      this.mousedover = true;
+      this.$menu.find('.active').removeClass('active');
+      $(e.currentTarget).addClass('active');
+    }
+
+    , mouseleave: function (e) {
+      this.mousedover = false;
+    }
+  };
 
   /* COMBOBOX PLUGIN DEFINITION
    * =========================== */
-
-  $.fn.combobox = function (option) {
+  $.fn.combobox = function ( option ) {
     return this.each(function () {
       var $this = $(this)
         , data = $this.data('combobox')
-        , options = typeof option == 'object' && option
-      if (!data) $this.data('combobox', (data = new Combobox(this, options)))
-      if (typeof option == 'string') data[option]()
-    })
-  }
+        , options = typeof option == 'object' && option;
+      if(!data) {$this.data('combobox', (data = new Combobox(this, options)));}
+      if (typeof option == 'string') {data[option]();}
+    });
+  };
 
   $.fn.combobox.defaults = {
-    template:'<div class="combobox-container"><input type="text" autocomplete="off" /><span class="add-on btn dropdown-toggle" data-dropdown="dropdown"><span class="caret"/><span class="combobox-clear"><i class="icon-remove"/></span></span></div>',
-    menu:'<ul class="typeahead typeahead-long dropdown-menu"></ul>',
-    item:'<li><a href="#"></a></li>', placeholder:null
-  }
+    bsVersion: '3'
+    , menu: '<ul class="typeahead typeahead-long dropdown-menu"></ul>'
+    , item: '<li><a href="#"></a></li>'
+  };
 
-  $.fn.combobox.Constructor = Combobox
+  $.fn.combobox.Constructor = Combobox;
 
-}(window.jQuery);
+}( window.jQuery );
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a77e39c/ambari-web/vendor/scripts/bootstrap-datepicker.js
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/scripts/bootstrap-datepicker.js b/ambari-web/vendor/scripts/bootstrap-datepicker.js
index 51686e1..9ed8e68 100644
--- a/ambari-web/vendor/scripts/bootstrap-datepicker.js
+++ b/ambari-web/vendor/scripts/bootstrap-datepicker.js
@@ -334,6 +334,12 @@
 			var zIndex = parseInt(this.element.parents().filter(function() {
 							return $(this).css('z-index') != 'auto';
 						}).first().css('z-index'))+10;
+			$('.modal').each(function(index, popup) {
+				var modalZIndex = $(popup).css('z-index');
+				if (modalZIndex > zIndex) {
+					zIndex = modalZIndex;
+				}
+			});
 			var offset = this.component ? this.component.parent().offset() : this.element.offset();
 			var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);
 			this.picker.css({