ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbhowm...@apache.org
Subject [01/10] ambari git commit: AMBARI-15145. Revamped Filebrowser Design - UI. (dipayanb)
Date Wed, 24 Feb 2016 18:17:59 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk db999ae82 -> b988562aa


http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/test/unit/controllers/files_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/test/unit/controllers/files_test.js
b/contrib/views/files/src/main/resources/ui/test/unit/controllers/files_test.js
deleted file mode 100644
index 516e4df..0000000
--- a/contrib/views/files/src/main/resources/ui/test/unit/controllers/files_test.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.
- */
-
-
-moduleFor('controller:files', 'App.FilesController', {
-  needs:['controller:file']
-});
-
-test('Property "isRootDir" is true when in root directory', function () {
-
-  var cntr = this.subject();
-  Ember.run(function() {
-    equal(cntr.get('path')==='/', cntr.get('isRootDir') , 'isRootDir is set right');
-  });
-
-
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/testem.json
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/testem.json b/contrib/views/files/src/main/resources/ui/testem.json
new file mode 100644
index 0000000..0f35392
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/testem.json
@@ -0,0 +1,12 @@
+{
+  "framework": "qunit",
+  "test_page": "tests/index.html?hidepassed",
+  "disable_watching": true,
+  "launch_in_ci": [
+    "PhantomJS"
+  ],
+  "launch_in_dev": [
+    "PhantomJS",
+    "Chrome"
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/.jshintrc
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/.jshintrc b/contrib/views/files/src/main/resources/ui/tests/.jshintrc
new file mode 100644
index 0000000..6ec0b7c
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/tests/.jshintrc
@@ -0,0 +1,52 @@
+{
+  "predef": [
+    "document",
+    "window",
+    "location",
+    "setTimeout",
+    "$",
+    "-Promise",
+    "define",
+    "console",
+    "visit",
+    "exists",
+    "fillIn",
+    "click",
+    "keyEvent",
+    "triggerEvent",
+    "find",
+    "findWithAssert",
+    "wait",
+    "DS",
+    "andThen",
+    "currentURL",
+    "currentPath",
+    "currentRouteName"
+  ],
+  "node": false,
+  "browser": false,
+  "boss": true,
+  "curly": true,
+  "debug": false,
+  "devel": false,
+  "eqeqeq": true,
+  "evil": true,
+  "forin": false,
+  "immed": false,
+  "laxbreak": false,
+  "newcap": true,
+  "noarg": true,
+  "noempty": false,
+  "nonew": false,
+  "nomen": false,
+  "onevar": false,
+  "plusplus": false,
+  "regexp": false,
+  "undef": true,
+  "sub": true,
+  "strict": false,
+  "white": false,
+  "eqnull": true,
+  "esnext": true,
+  "unused": true
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/helpers/destroy-app.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/helpers/destroy-app.js b/contrib/views/files/src/main/resources/ui/tests/helpers/destroy-app.js
new file mode 100644
index 0000000..dfabf85
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/tests/helpers/destroy-app.js
@@ -0,0 +1,23 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+
+export default function destroyApp(application) {
+  Ember.run(application, 'destroy');
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/helpers/flash-message.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/helpers/flash-message.js b/contrib/views/files/src/main/resources/ui/tests/helpers/flash-message.js
new file mode 100644
index 0000000..6c1fb29
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/tests/helpers/flash-message.js
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import FlashObject from 'ember-cli-flash/flash/object';
+
+const { K } = Ember;
+
+FlashObject.reopen({ init: K });

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/helpers/module-for-acceptance.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/helpers/module-for-acceptance.js
b/contrib/views/files/src/main/resources/ui/tests/helpers/module-for-acceptance.js
new file mode 100644
index 0000000..05aa014
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/tests/helpers/module-for-acceptance.js
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+
+import { module } from 'qunit';
+import startApp from '../helpers/start-app';
+import destroyApp from '../helpers/destroy-app';
+
+export default function(name, options = {}) {
+  module(name, {
+    beforeEach() {
+      this.application = startApp();
+
+      if (options.beforeEach) {
+        options.beforeEach.apply(this, arguments);
+      }
+    },
+
+    afterEach() {
+      destroyApp(this.application);
+
+      if (options.afterEach) {
+        options.afterEach.apply(this, arguments);
+      }
+    }
+  });
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/helpers/resolver.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/helpers/resolver.js b/contrib/views/files/src/main/resources/ui/tests/helpers/resolver.js
new file mode 100644
index 0000000..b7193ba
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/tests/helpers/resolver.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+import Resolver from 'ember-resolver';
+import config from '../../config/environment';
+
+const resolver = Resolver.create();
+
+resolver.namespace = {
+  modulePrefix: config.modulePrefix,
+  podModulePrefix: config.podModulePrefix
+};
+
+export default resolver;

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/helpers/start-app.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/helpers/start-app.js b/contrib/views/files/src/main/resources/ui/tests/helpers/start-app.js
new file mode 100644
index 0000000..7b25773
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/tests/helpers/start-app.js
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+import Ember from 'ember';
+import Application from '../../app';
+import config from '../../config/environment';
+
+export default function startApp(attrs) {
+  let application;
+
+  let attributes = Ember.merge({}, config.APP);
+  attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
+
+  Ember.run(() => {
+    application = Application.create(attributes);
+    application.setupForTesting();
+    application.injectTestHelpers();
+  });
+
+  return application;
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/index.html
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/index.html b/contrib/views/files/src/main/resources/ui/tests/index.html
new file mode 100644
index 0000000..8faf5f9
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/tests/index.html
@@ -0,0 +1,52 @@
+<!--
+ * 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.
+-->
+
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <title>FilesView Tests</title>
+    <meta name="description" content="">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+
+    {{content-for "head"}}
+    {{content-for "test-head"}}
+
+    <link rel="stylesheet" href="assets/vendor.css">
+    <link rel="stylesheet" href="assets/files-view.css">
+    <link rel="stylesheet" href="assets/test-support.css">
+
+    {{content-for "head-footer"}}
+    {{content-for "test-head-footer"}}
+  </head>
+  <body>
+    {{content-for "body"}}
+    {{content-for "test-body"}}
+
+    <script src="testem.js" integrity=""></script>
+    <script src="assets/vendor.js"></script>
+    <script src="assets/test-support.js"></script>
+    <script src="assets/files-view.js"></script>
+    <script src="assets/tests.js"></script>
+    <script src="assets/test-loader.js"></script>
+
+    {{content-for "body-footer"}}
+    {{content-for "test-body-footer"}}
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/integration/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/integration/.gitkeep b/contrib/views/files/src/main/resources/ui/tests/integration/.gitkeep
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/test-helper.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/test-helper.js b/contrib/views/files/src/main/resources/ui/tests/test-helper.js
new file mode 100644
index 0000000..64814c1
--- /dev/null
+++ b/contrib/views/files/src/main/resources/ui/tests/test-helper.js
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+
+import resolver from './helpers/resolver';
+import './helpers/flash-message';
+
+import {
+  setResolver
+} from 'ember-qunit';
+
+setResolver(resolver);

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/tests/unit/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/tests/unit/.gitkeep b/contrib/views/files/src/main/resources/ui/tests/unit/.gitkeep
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/vendor/.gitkeep
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/vendor/.gitkeep b/contrib/views/files/src/main/resources/ui/vendor/.gitkeep
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/vendor/js/bsPopover.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/vendor/js/bsPopover.js b/contrib/views/files/src/main/resources/ui/vendor/js/bsPopover.js
deleted file mode 100644
index 90c1392..0000000
--- a/contrib/views/files/src/main/resources/ui/vendor/js/bsPopover.js
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * 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.
- */
-var template = '' +
-        '<div class="arrow"></div>' +
-        '{{#if title}}' +
-        '    <h3 class="popover-title">{{title}}</h3>' +
-        '{{/if}}' +
-        '<div class="popover-content">' +
-        '{{#if content}}' +
-        '        {{content}}' +
-        '{{else}}' +
-        '{{yield}}' +
-        '{{/if}}' +
-        '    </div>';
- 
-Ember.TEMPLATES["components/bs-popover"] = Ember.Handlebars.compile(template);
- 
-Ember.BsPopoverComponent = Ember.Component.extend({
-    classNames: 'popover',
-    classNameBindings:  ['fade', 'in', 'top', 'left', 'right', 'bottom'],
- 
-    top: function(){
-        return this.get('realPlacement')=='top';
-    }.property('realPlacement'),
-    left: function(){
-        return this.get('realPlacement')=='left';
-    }.property('realPlacement'),
-    right: function(){
-        return this.get('realPlacement')=='right';
-    }.property('realPlacement'),
-    bottom: function(){
-        return this.get('realPlacement')=='bottom';
-    }.property('realPlacement'),
- 
-    title: '',
-    content: '',
-    html: false,
-    delay: 0,
-    isVisible: false,
-    animation: true,
-    fade: function(){
-        return this.get('animation');
-    }.property('animation'),
-    in: function(){
-        return this.get('isVisible');
-    }.property('isVisible'),
-    triggers: 'hover focus',
-    placement: 'top',
-    onElement: null,
-    $element: null,
-    $tip: null,
-    inserted: false,
- 
-    styleUpdater: function(){
-        if( !this.$tip || !this.get('isVisible')){
-            return;
-        }
-        this.$tip.css('display','block');
-        var placement = this.get('realPlacement');
-        var pos = this.getPosition();
-        var actualWidth = this.$tip[0].offsetWidth;
-        var actualHeight = this.$tip[0].offsetHeight;
-        var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
- 
-        this.$tip.css('top',calculatedOffset.top);
-        this.$tip.css('left',calculatedOffset.left);
-        if(this.firstTime){
-            this.firstTime = false;
-            this.styleUpdater();
-            this.firstTime = true;
-        }
-    }.observes('content','realPlacement','inserted', 'isVisible'),
- 
- 
-    didInsertElement: function(){
- 
-        this.$tip = this.$();
-        if(this.get('onElement')){
-            this.$element=$('#'+this.get('onElement'));
-        }else if(this.$tip.prev(':not(script)').length){
-            this.$element = this.$tip.prev(':not(script)');
-        }else{
-            this.$element = this.$tip.parent(':not(script)');
-        }
- 
- 
-        var triggers = this.triggers.split(' ');
- 
-        for (var i = triggers.length; i--;) {
-            var trigger = triggers[i];
- 
-            if (trigger == 'click') {
-                this.$element.on('click',$.proxy(this.toggle, this));
-            } else if (trigger != 'manual') {
-                var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focus';
-                var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur';
- 
-                this.$element.on(eventIn, $.proxy(this.enter, this));
-                this.$element.on(eventOut, $.proxy(this.leave, this));
-            }
-        }
-        this.set('inserted',true);
-    },
- 
- 
-    toggle: function(){
-        this.toggleProperty('isVisible');
-    },
- 
-    enter: function(){
-        this.set('isVisible',true);
-    },
- 
-    leave: function(){
-        this.set('isVisible',false);
-    },
- 
-    afterRender: function(){
-        this.notifyPropertyChange('content');
-    },
- 
- 
-    realPlacement: function(){
- 
-        if(!this.$tip) return null;
-        var placement = this.get('placement') || '';
-        var autoToken = /\s?auto?\s?/i;
-        var autoPlace = autoToken.test(placement);
-        if (autoPlace)
-            placement = placement.replace(autoToken, '') || 'top';
- 
-        var pos = this.getPosition();
-        var actualWidth = this.$tip[0].offsetWidth;
-        var actualHeight = this.$tip[0].offsetHeight;
- 
-        if (autoPlace) {
-            var $parent = this.$element.parent();
- 
-            var orgPlacement = placement;
-            var docScroll = document.documentElement.scrollTop || document.body.scrollTop;
-            var parentWidth = $parent.outerWidth();
-            var parentHeight = $parent.outerHeight();
-            var parentLeft = $parent.offset().left;
- 
-            placement = placement == 'bottom' && pos.top + pos.height + actualHeight
- docScroll > parentHeight ? 'top' :
-                    placement == 'top' && pos.top - docScroll - actualHeight <
0 ? 'bottom' :
-                            placement == 'right' && pos.right + actualWidth >
parentWidth ? 'left' :
-                                    placement == 'left' && pos.left - actualWidth
< parentLeft ? 'right' :
-                                            placement;
-        }
-        return placement;
- 
-    }.property('placement','inserted'),
- 
- 
-    hasContent: function () {
-        return this.get('title');
-    },
- 
-    getPosition: function () {
-        var el = this.$element[0];
-        return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect()
: {
-            width: el.offsetWidth, height: el.offsetHeight
-        }, this.$element.offset());
-    },
- 
- 
-    getCalculatedOffset: function (placement, pos, actualWidth, actualHeight) {
-        return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width
/ 2 - actualWidth / 2  } :
-                placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width
/ 2 - actualWidth / 2  } :
-                        placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight
/ 2, left: pos.left - actualWidth } :
-                            /* placement == 'right' */ { top: pos.top + pos.height / 2 -
actualHeight / 2, left: pos.left + pos.width   }
-    }
- 
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/b988562a/contrib/views/files/src/main/resources/ui/vendor/js/ember-cloaking.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/vendor/js/ember-cloaking.js b/contrib/views/files/src/main/resources/ui/vendor/js/ember-cloaking.js
deleted file mode 100644
index 235d1f6..0000000
--- a/contrib/views/files/src/main/resources/ui/vendor/js/ember-cloaking.js
+++ /dev/null
@@ -1,436 +0,0 @@
-(function () {
-
-  /**
-    Display a list of cloaked items
-
-    @class CloakedCollectionView
-    @extends Ember.CollectionView
-    @namespace Ember
-  **/
-  Ember.CloakedCollectionView = Ember.CollectionView.extend({
-    topVisible: null,
-    bottomVisible: null,
-    offsetFixedTopElement: null,
-    offsetFixedBottomElement: null,
-//
-
-
-    init: function() {
-      var cloakView = this.get('cloakView'),
-          idProperty = this.get('idProperty'),
-          uncloakDefault = !!this.get('uncloakDefault');
-
-      // Set the slack ratio differently to allow for more or less slack in preloading
-      var slackRatio = parseFloat(this.get('slackRatio'));
-      if (!slackRatio) { this.set('slackRatio', 1.0); }
-
-      this.set('itemViewClass', Ember.CloakedView.extend({
-        classNames: [cloakView + '-cloak'],
-        cloaks: cloakView,
-        preservesContext: this.get('preservesContext') === "true",
-        cloaksController: this.get('itemController'),
-        defaultHeight: this.get('defaultHeight'),
-
-        init: function() {
-          this._super();
-
-          if (idProperty) {
-            this.set('elementId', cloakView + '-cloak-' + this.get('content.' + idProperty));
-          }
-          if (uncloakDefault) {
-            this.uncloak();
-          } else {
-            this.cloak();
-          }
-        }
-      }));
-
-      this._super();
-      Ember.run.next(this, 'scrolled');
-    },
-
-
-    /**
-      If the topmost visible view changed, we will notify the controller if it has an appropriate
hook.
-
-      @method _topVisibleChanged
-      @observes topVisible
-    **/
-    _topVisibleChanged: Ember.observer('topVisible', function() {
-      var controller = this.get('controller');
-      if (controller.topVisibleChanged) { controller.topVisibleChanged(this.get('topVisible'));
}
-    }),
-
-    /**
-      If the bottommost visible view changed, we will notify the controller if it has an
appropriate hook.
-
-      @method _bottomVisible
-      @observes bottomVisible
-    **/
-    _bottomVisible: Ember.observer('bottomVisible', function() {
-      var controller = this.get('controller');
-      if (controller.bottomVisibleChanged) { controller.bottomVisibleChanged(this.get('bottomVisible'));
}
-    }),
-
-    /**
-      Binary search for finding the topmost view on screen.
-
-      @method findTopView
-      @param {Array} childViews the childViews to search through
-      @param {Number} windowTop The top of the viewport to search against
-      @param {Number} min The minimum index to search through of the child views
-      @param {Number} max The max index to search through of the child views
-      @returns {Number} the index into childViews of the topmost view
-    **/
-    findTopView: function(childViews, viewportTop, min, max) {
-      if (max < min) { return min; }
-
-      var wrapperTop = this.get('wrapperTop')>>0;
-
-      while(max>min){
-        var mid = Math.floor((min + max) / 2),
-            // in case of not full-window scrolling
-            $view = childViews[mid].$(),
-            viewBottom = $view.position().top + wrapperTop + $view.height();
-
-        if (viewBottom > viewportTop) {
-          max = mid-1;
-        } else {
-          min = mid+1;
-        }
-      }
-
-      return min;
-    },
-
-
-    /**
-      Determine what views are onscreen and cloak/uncloak them as necessary.
-
-      @method scrolled
-    **/
-    scrolled: function() {
-      if (!this.get('scrollingEnabled')) { return; }
-
-      var childViews = this.get('childViews');
-      if ((!childViews) || (childViews.length === 0)) { return; }
-
-      var self = this,
-          toUncloak = [],
-          onscreen = [],
-          onscreenCloaks = [],
-          // calculating viewport edges
-          $w = Ember.$(window),
-          windowHeight = this.get('wrapperHeight') || ( window.innerHeight ? window.innerHeight
: $w.height() ),
-          windowTop = this.get('wrapperTop') || $w.scrollTop(),
-          slack = Math.round(windowHeight * this.get('slackRatio')),
-          viewportTop = windowTop - slack,
-          windowBottom = windowTop + windowHeight,
-          viewportBottom = windowBottom + slack,
-          topView = this.findTopView(childViews, viewportTop, 0, childViews.length-1),
-          bodyHeight = this.get('wrapperHeight') ? this.$().height() : Ember.$('body').height(),
-          bottomView = topView,
-          offsetFixedTopElement = this.get('offsetFixedTopElement'),
-          offsetFixedBottomElement = this.get('offsetFixedBottomElement');
-
-      if (windowBottom > bodyHeight) { windowBottom = bodyHeight; }
-      if (viewportBottom > bodyHeight) { viewportBottom = bodyHeight; }
-
-      if (offsetFixedTopElement) {
-        windowTop += (offsetFixedTopElement.outerHeight(true) || 0);
-      }
-
-      if (offsetFixedBottomElement) {
-        windowBottom -= (offsetFixedBottomElement.outerHeight(true) || 0);
-      }
-
-      // Find the bottom view and what's onscreen
-      while (bottomView < childViews.length) {
-        var view = childViews[bottomView],
-          $view = view.$(),
-          // in case of not full-window scrolling
-          scrollOffset = this.get('wrapperTop') || 0,
-          viewTop = $view.offset().top + scrollOffset,
-          viewBottom = viewTop + $view.height();
-
-        if (viewTop > viewportBottom) { break; }
-        toUncloak.push(view);
-
-        if (viewBottom > windowTop && viewTop <= windowBottom) {
-          onscreen.push(view.get('content'));
-          onscreenCloaks.push(view);
-        }
-
-        bottomView++;
-      }
-      if (bottomView >= childViews.length) { bottomView = childViews.length - 1; }
-
-      // If our controller has a `sawObjects` method, pass the on screen objects to it.
-      var controller = this.get('controller');
-      if (onscreen.length) {
-        this.setProperties({topVisible: onscreen[0], bottomVisible: onscreen[onscreen.length-1]});
-        if (controller && controller.sawObjects) {
-          Em.run.schedule('afterRender', function() {
-            controller.sawObjects(onscreen);
-          });
-        }
-      } else {
-        this.setProperties({topVisible: null, bottomVisible: null});
-      }
-
-      var toCloak = childViews.slice(0, topView).concat(childViews.slice(bottomView+1));
-
-      this._uncloak = toUncloak;
-      if(this._nextUncloak){
-        Em.run.cancel(this._nextUncloak);
-        this._nextUncloak = null;
-      }
-
-      Em.run.schedule('afterRender', this, function() {
-        onscreenCloaks.forEach(function (v) {
-          if(v && v.uncloak) {
-            v.uncloak();
-          }
-        });
-        toCloak.forEach(function (v) { v.cloak(); });
-        if (self._nextUncloak) { Em.run.cancel(self._nextUncloak); }
-        self._nextUncloak = Em.run.later(self, self.uncloakQueue,50);
-      });
-
-      for (var j=bottomView; j<childViews.length; j++) {
-        var checkView = childViews[j];
-        if (!checkView._containedView) {
-          if (!checkView.get('loading')) {
-            checkView.$().html(this.get('loadingHTML') || "Loading...");
-          }
-          return;
-        }
-      }
-
-    },
-
-    uncloakQueue: function(){
-      var maxPerRun = 3, delay = 50, processed = 0, self = this;
-
-      if(this._uncloak){
-        while(processed < maxPerRun && this._uncloak.length>0){
-          var view = this._uncloak.shift();
-          if(view && view.uncloak && !view._containedView){
-            Em.run.schedule('afterRender', view, view.uncloak);
-            processed++;
-          }
-        }
-        if(this._uncloak.length === 0){
-          this._uncloak = null;
-        } else {
-          Em.run.schedule('afterRender', self, function(){
-            if(self._nextUncloak){
-              Em.run.cancel(self._nextUncloak);
-            }
-            self._nextUncloak = Em.run.next(self, function(){
-              if(self._nextUncloak){
-                Em.run.cancel(self._nextUncloak);
-              }
-              self._nextUncloak = Em.run.later(self,self.uncloakQueue,delay);
-            });
-          });
-        }
-      }
-    },
-
-    scrollTriggered: function() {
-      Em.run.scheduleOnce('afterRender', this, 'scrolled');
-    },
-
-    _startEvents: Ember.on('didInsertElement', function() {
-      if (this.get('offsetFixed')) {
-        Em.warn("Cloaked-collection's `offsetFixed` is deprecated. Use `offsetFixedTop` instead.");
-      }
-
-      var self = this,
-          offsetFixedTop = this.get('offsetFixedTop') || this.get('offsetFixed'),
-          offsetFixedBottom = this.get('offsetFixedBottom'),
-          onScrollMethod = function() {
-            Ember.run.debounce(self, 'scrollTriggered', 10);
-          };
-
-      if (offsetFixedTop) {
-        this.set('offsetFixedTopElement', Ember.$(offsetFixedTop));
-      }
-
-      if (offsetFixedBottom) {
-        this.set('offsetFixedBottomElement', Ember.$(offsetFixedBottom));
-      }
-
-      Ember.$(document).bind('touchmove.ember-cloak', onScrollMethod);
-      Ember.$(window).bind('scroll.ember-cloak', onScrollMethod);
-      this.addObserver('wrapperTop', self, onScrollMethod);
-      this.addObserver('wrapperHeight', self, onScrollMethod);
-      this.addObserver('content.@each', self, onScrollMethod);
-      this.scrollTriggered();
-
-      this.set('scrollingEnabled', true);
-    }),
-
-    cleanUp: function() {
-      Ember.$(document).unbind('touchmove.ember-cloak');
-      Ember.$(window).unbind('scroll.ember-cloak');
-      this.set('scrollingEnabled', false);
-    },
-
-    _endEvents: Ember.on('willDestroyElement', function() {
-      this.cleanUp();
-    })
-  });
-
-
-  /**
-    A cloaked view is one that removes its content when scrolled off the screen
-
-    @class CloakedView
-    @extends Ember.View
-    @namespace Ember
-  **/
-  Ember.CloakedView = Ember.View.extend({
-    attributeBindings: ['style'],
-
-    /**
-      Triggers the set up for rendering a view that is cloaked.
-
-      @method uncloak
-    */
-    uncloak: function() {
-      var state = this._state || this.state;
-      if (state !== 'inDOM' && state !== 'preRender') { return; }
-
-      if (!this._containedView) {
-        var model = this.get('content'),
-            controller = null,
-            container = this.get('container');
-
-        // Wire up the itemController if necessary
-        var controllerName = this.get('cloaksController');
-        if (controllerName) {
-          var controllerFullName = 'controller:' + controllerName,
-              factory = container.lookupFactory(controllerFullName),
-              parentController = this.get('controller');
-
-          // let ember generate controller if needed
-          if (factory === undefined) {
-            factory = Ember.generateControllerFactory(container, controllerName, model);
-
-            // inform developer about typo
-            Ember.Logger.warn('ember-cloaking: can\'t lookup controller by name "' + controllerFullName
+ '".');
-            Ember.Logger.warn('ember-cloaking: using ' + factory.toString() + '.');
-          }
-
-          controller = factory.create({
-            model: model,
-            parentController: parentController,
-            target: parentController
-          });
-        }
-        var createArgs = {},
-            target = controller || model;
-
-        if (this.get('preservesContext')) {
-          createArgs.content = target;
-        } else {
-          createArgs.context = target;
-        }
-        if (controller) { createArgs.controller = controller; }
-        this.setProperties({
-          style: null,
-          loading: false
-        });
-
-        this._containedView = this.createChildView(this.get('cloaks'), createArgs);
-        this.rerender();
-      }
-    },
-
-    /**
-      Removes the view from the DOM and tears down all observers.
-
-      @method cloak
-    */
-    cloak: function() {
-      var self = this;
-
-      if (this._containedView && (this._state || this.state) === 'inDOM') {
-        var style = 'height: ' + this.$().height() + 'px;';
-        this.set('style', style);
-        this.$().prop('style', style);
-
-        // We need to remove the container after the height of the element has taken
-        // effect.
-        Ember.run.schedule('afterRender', function() {
-          if(self._containedView){
-            self._containedView.remove();
-            self._containedView = null;
-          }
-        });
-      }
-    },
-
-    _removeContainedView: Ember.on('willDestroyElement', function(){
-      if(this._containedView){
-        this._containedView.remove();
-        this._containedView = null;
-      }
-      this._super();
-    }),
-
-    _setHeights: Ember.on('didInsertElement', function(){
-      if (!this._containedView) {
-        // setting default height
-        // but do not touch if height already defined
-        if(!this.$().height()){
-          var defaultHeight = 100;
-          if(this.get('defaultHeight')) {
-            defaultHeight = this.get('defaultHeight');
-          }
-
-          this.$().css('height', defaultHeight);
-        }
-      }
-    }),
-
-    /**
-      Render the cloaked view if applicable.
-
-      @method render
-    */
-    render: function(buffer) {
-      var containedView = this._containedView, self = this;
-
-      if (containedView && (containedView._state || containedView.state) !== 'inDOM')
{
-        containedView.triggerRecursively('willInsertElement');
-        containedView.renderToBuffer(buffer);
-        containedView._transitionTo('inDOM');
-        Em.run.schedule('afterRender', function() {
-          if(self._containedView) {
-            self._containedView.triggerRecursively('didInsertElement');
-          }
-        });
-      }
-    }
-
-  });
-
-
-
-  Ember.Handlebars.registerHelper('cloaked-collection', function(options) {
-    var hash = options.hash,
-        types = options.hashTypes;
-
-    for (var prop in hash) {
-      if (types[prop] === 'ID') {
-        hash[prop + 'Binding'] = hash[prop];
-        delete hash[prop];
-      }
-    }
-    return Ember.Handlebars.helpers.view.call(this, Ember.CloakedCollectionView, options);
-  });
-
-})();


Mime
View raw message