http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/app/templates/util/contextMenu.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/templates/util/contextMenu.hbs b/contrib/views/files/src/main/resources/ui/app/templates/util/contextMenu.hbs deleted file mode 100644 index e5c601c..0000000 --- a/contrib/views/files/src/main/resources/ui/app/templates/util/contextMenu.hbs +++ /dev/null @@ -1,56 +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. -}} - -<div id="context-menu"> - <ul class="dropdown-menu dropdown-context compressed-context" role="menu"> - {{#if view.target.content.isDirectory}} - <li><a tabindex="-1" href="#" {{action 'open'}}>Open folder</a></li> - {{else}} - <li><a tabindex="-1" href="#" {{action 'download'}}>Download</a></li> - {{/if}} - <li><a tabindex="-1" href="#" {{action 'moveFile' 'cut' view.target.content}}>Move</a></li> - <li class="disabled"><a data-disabled="disabled" tabindex="-1" href="#">Permissions</a></li> - <li><a tabindex="-1" href="#" {{action 'rename' 'edit'}} >Rename</a></li> - <li class="divider"></li> - <li class="dropdown-submenu"> - <a href="#" data-disabled="disabled"> - <span> Delete </span> - <i class="fa fa-chevron-right pull-right fa-right"></i> - </a> - <ul class="dropdown-menu"> - {{#if view.target.isRemoving}} - <li> - <a tabindex="-1" href="#" data-disabled="disabled"> - Delete forever - <div class="btn-group text-center dropdown-confirm"> - <button {{action 'removeFile' 'cancel'}} type="button" class="btn btn-xs btn-danger"> - <i class="fa fa-times"></i> - </button> - <button {{action 'removeFile' 'confirm'}} type="button" class="btn btn-xs btn-success"> - <i class="fa fa-check"></i> - </button> - </div> - </a> - </li> - {{else}} - <li><a class="confirm-action" data-action="removeFile" tabindex="-1" href="#">Delete forever</a></li> - {{/if}} - </ul> - </li> - </ul> -</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/app/templates/util/deleteBulk.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/templates/util/deleteBulk.hbs b/contrib/views/files/src/main/resources/ui/app/templates/util/deleteBulk.hbs deleted file mode 100644 index 0c7a13f..0000000 --- a/contrib/views/files/src/main/resources/ui/app/templates/util/deleteBulk.hbs +++ /dev/null @@ -1,38 +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. -}} - -{{#if isRemoving}} -<a tabindex="-1" href="#"> - <i class="fa fa-exclamation-triangle"></i> - Delete forever - <div class="btn-group text-center dropdown-confirm"> - <button {{action 'ask' target="view" }} type="button" class="btn btn-xs btn-danger"> - <span class="glyphicon glyphicon-remove"></span> - </button> - <button {{action 'deleteFile'}} type="button" class="btn btn-xs btn-success delete"> - <span class="glyphicon glyphicon-ok delete"></span> - </button> - </div> -</a> -{{else}} -<a {{action 'ask' target="view" }} tabindex="-1" href="#"> - <i class="fa fa-exclamation-triangle"></i> - Delete forever -</a> -{{/if}} - http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/app/templates/util/deletePopover.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/templates/util/deletePopover.hbs b/contrib/views/files/src/main/resources/ui/app/templates/util/deletePopover.hbs deleted file mode 100644 index 23a5085..0000000 --- a/contrib/views/files/src/main/resources/ui/app/templates/util/deletePopover.hbs +++ /dev/null @@ -1,38 +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. -}} - -<a {{action 'show' target="view"}} data-toggle="tooltip" data-placement="bottom" title="Delete"> <i class="fa fa-trash-o fa-lg"></i> </a> - -<div class='df-popover hide'> - <div class="input-group" > - <div class="btn-group "> - <button {{action 'close' target="view"}} type="button" class="btn btn-xs btn-danger"> - <i class="fa fa-times fa-fw"></i> - </button> - <button {{action 'deleteFile'}} type="button" class="btn btn-xs btn-success"> - <i class="fa fa-check fa-fw"></i> - </button> - </div> - <div class="checkbox delete-forever"> - <label> - <input type="checkbox"> Delete forever - </label> - </div> - </div> -</div> - http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/app/templates/util/fileRow.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/templates/util/fileRow.hbs b/contrib/views/files/src/main/resources/ui/app/templates/util/fileRow.hbs new file mode 100644 index 0000000..052a14e --- /dev/null +++ b/contrib/views/files/src/main/resources/ui/app/templates/util/fileRow.hbs @@ -0,0 +1,84 @@ +{{! + 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. +}} + +<tr {{bind-attr class=":file-row isMoving:isMoving"}}> + <td> + {{#if content.isDirectory}} + <i class="fa fa-folder"></i> + {{else}} + <i class="fa fa-file"></i> + {{/if}} + </td> + <td> + {{#rename-input fileBinding='content' confirm='rename' isRenaming=isRenaming}} + <div class="file-name allow-open"> + <span> + <a {{action 'open'}}> + <strong> + {{content.name}} + </strong> + </a> + </span> + <span class="help-block mod-time allow-open"> + <small class='allow-open'> + Updated {{showDate modificationTime 'YYYY-MM-DD HH:mm'}} + </small> + </span> + </div> + {{/rename-input}} + </td> + <td> + {{#unless content.isDirectory}}{{humanSize content.size}}{{else}}-{{/unless}} + </td> + <td >{{content.owner}}</td> + <td>{{content.group}}</td> + <td class="permission-cell"> + {{content.permission}} + {{#if isPermissionsDirty}} <span>*</span> {{/if}} + </td> + <td> + {{#unless isMoving}} + <ul class="list-inline file-actions text-right"> + <li> + {{#if content.isDirectory}} + <a href="#" {{action 'download' 'zip'}} data-toggle="tooltip" data-placement="bottom" title="Download zip"><i class="fa fa-archive fa-fw fa-lg"></i></a> + {{else}} + <a href="#" {{action 'download' 'browse'}} data-toggle="tooltip" data-placement="bottom" title="Download"><i class="fa fa-download fa-fw fa-lg"></i></a> + {{/if}} + </li> + <li> + <a href="#" {{action 'moveFile' 'cut' this.content}} data-toggle="tooltip" data-placement="bottom" title="Move"><i class="fa fa-level-down fa-rotate-270 fa-fw fa-lg"></i></span></a> + </li> + {{!-- <li> + <a {{action 'rename' 'edit'}} data-toggle="tooltip" data-placement="bottom" title="Rename"><i class="fa fa-edit fa-lg"></i></a> + </li> --}} + <li>{{popover-delete confirm="deleteFile"}}</li> + </ul> + {{/unless}} + </td> + <td> + {{#if isMoving}} + <a href="#" {{action 'moveFile' 'cancel' target="parentController" }} data-toggle="tooltip" data-placement="bottom" title="Cancel moving"> <i class="fa fa-times fa-lg"></i></a> + {{else}} + {{input type="checkbox" checkedBinding='content.selected'}} + {{/if}} + {{toggle-context}} + </td> +</tr> +{{chmod-input chVisible=chmodVisible file=content confirm="chmod"}} + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/app/templates/util/renameInput.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/templates/util/renameInput.hbs b/contrib/views/files/src/main/resources/ui/app/templates/util/renameInput.hbs deleted file mode 100644 index 57a7b7c..0000000 --- a/contrib/views/files/src/main/resources/ui/app/templates/util/renameInput.hbs +++ /dev/null @@ -1,38 +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. -}} -{{#if isRenaming}} - -<div class="input-group input-group-sm rename-area"> - {{view view.renameInputView class="form-control rename-input" valueBinding='tmpName'}} - <div class="input-group-btn"> - <button type="button" {{action 'rename' 'cancel'}} {{bind-attr class=":btn :btn-danger :btn-xs :btn-rename-cancel isRenaming:show"}} > - <i class="fa fa-times"></i> Cancel - </button> - </div> - <div class="input-group-btn"> - <button type="button" {{action 'rename' 'confirm'}} {{bind-attr class=":btn :btn-success :btn-xs :btn-rename isRenaming:show"}} > - <i class="fa fa-check"></i> Rename - </button> - </div> -</div> - -{{else}} - - {{yield}} - -{{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/app/templates/util/uploader.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/templates/util/uploader.hbs b/contrib/views/files/src/main/resources/ui/app/templates/util/uploader.hbs deleted file mode 100644 index cefc9f8..0000000 --- a/contrib/views/files/src/main/resources/ui/app/templates/util/uploader.hbs +++ /dev/null @@ -1,35 +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. -}} - -<div class="input-group input-group-sm"> - <span class="input-group-btn"> - <span class="btn btn-primary btn-file"> - Browse⦠{{view fileInput}} - </span> - <span {{bind-attr class=":btn :btn-danger isFiles:hide"}} {{action 'clear'}} > - Clear - </span> - </span> - <span {{bind-attr class=":input-group-btn :btn-upload isFiles:hide"}}> - {{#view uploadButton data-style="expand-right" data-size="xs"}} - <span class="ladda-label">Upload</span> - {{/view}} - </span> - {{view controlInput placeholder='Select files to upload.'}} -</div> - http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/app/views/file.js ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/views/file.js b/contrib/views/files/src/main/resources/ui/app/views/file.js index 05ca746..167f70f 100644 --- a/contrib/views/files/src/main/resources/ui/app/views/file.js +++ b/contrib/views/files/src/main/resources/ui/app/views/file.js @@ -18,116 +18,17 @@ var App = require('app'); -App.DeleteBulkView = Em.View.extend({ - actions:{ - ask:function (argument) { - this.get('controller').toggleProperty('isRemoving'); - return false; - } - } -}); - App.FilesView = Em.View.extend({ templateName: 'files', didInsertElement:function () { - $('.btn-sort').tooltip(); + this.scheduleRebind(); + }, + scheduleRebind:function () { + Em.run.scheduleOnce('render', this, this.get('reBindTooltips')); + }, + reBindTooltips:function () { + this.$().tooltip({selector:'[data-toggle=tooltip]'}); }, - deleteBulkView:App.DeleteBulkView.create({ - didInsertElement:function(){ - var self = this; - $('#bulkDropdown').on('hidden.bs.dropdown', function () { - self.get('controller').set('isRemoving',false); - }) - }, - templateName:'util/deleteBulk', - tagName:'li', - click:function (e) { - if (!$(e.target).hasClass('delete')) { - e.stopPropagation(); - }; - } - }), - deleteSingleView: Em.View.extend({ - popoverSelector:'.df-popover', - actions:{ - close:function () { - $(this.get('element')).popover('toggle'); - }, - show:function () { - $(this.get('element')).popover('toggle'); - } - }, - didInsertElement:function () { - var self = this, - element = $(this.get('element')); - $(element).popover({ - html:true, - trigger:'manual', - placement:'left', - content:function() { - var content = element.find('.df-popover'); - return content.html(); - } - }); - - $('body').on('click.popover', function (e) { - if (!element.is(e.target) - && element.has(e.target).length === 0 - && $('.popover').has(e.target).length === 0) { - element.popover('hide'); - } - }); - - element.on('hidden.bs.popover', function () { - element.parent().find('.popover').remove(); - }); - }, - willClearRender:function () { - $('body').off('click.popover'); - }, - templateName:'util/deletePopover', - }), - checkboxAll:Em.Checkbox.extend({ - changeBinding:'selectAll', - checkedBinding:'selectedAll', - selectedAll:false, - selectAll:function () { - var checked = this.get('checked'); - var items = this.get('content'); - return items.forEach(function (item) { - item.set('selected',checked); - }); - }, - selection:function () { - var selected = this.get('content').filterProperty('selected',true); - if (selected.length == this.get('content.length') && selected.length > 0) { - this.set('selectedAll',true); - } else { - this.set('selectedAll',false); - } - }.observes('[email protected]'), - }), - breadcrumbsView: Ember.CollectionView.extend({ - classNames: ['breadcrumb pull-left'], - tagName: 'ul', - content: function (argument) { - var crumbs = []; - var currentPath = this.get('controller.path').match(/((?!\/)\S)+/g)||[]; - currentPath.forEach(function (cur,i,array) { - return crumbs.push({name:cur,path:'/'+array.slice(0,i+1).join('/')}); - }); - crumbs.unshift({name:'/',path:'/'}); - crumbs.get('lastObject').last = 'true'; - return crumbs; - }.property('controller.path'), - itemViewClass: Ember.View.extend({ - classNameBindings: ['isActive:active'], - template: Ember.Handlebars.compile("{{#link-to 'files' (query-params path=view.content.path)}}{{view.content.name}}{{/link-to}}"), - isActive: function () { - return this.get('content.last'); - }.property('content') - }) - }), renameInputView: Em.TextField.extend({ controller:null, didInsertElement:function (argument) { @@ -144,72 +45,5 @@ App.FilesView = Em.View.extend({ return target.send('rename', 'cancel'); }; } - }), - togglecontext:Em.View.extend({ - didInsertElement:function () { - var self = this; - var fileRow = $(this.get('element')).parents('.file-row'); - fileRow.contextmenu({ - target:'#context-menu', - before: function(e) { - if (self.get('controller.isMoving')) { - return false; - }; - self.get('parentView.contextMenu').set('target',self.get('context')); - return true; - }, - onItem:function (t,e) { - if (e.target.className=='confirm-action') { - console.log('set waitConfirm onItem'); - self.get('parentView.contextMenu').set('waitConfirm',e.target.dataset.action); - return false; - } - - if (e.target.dataset.disabled) { - return false; - }; - } - }); - fileRow.find('[data-toggle=tooltip]').tooltip(); - fileRow.on('click',function(e){ - if($(e.target).is('td') || $(e.target).hasClass('allow-open')){ - self.get('controller').send('open'); - } - }); - }, - reBind:function(){ - var row = $(this.get('element')).parents('.file-row'); - Em.run.next(function(){ - row.find('[data-toggle=tooltip]').tooltip(); - }); - - }.observes('context.isMoving') - }), - contextMenu: App.ContextMenu.create(), - sortArrow:Em.View.extend({ - sortProperty:null, - asc:true, - cur:false, - sorting:function () { - if (this.get('controller.sortProperties.firstObject')==this.get('sortProperty')) { - this.set('asc',this.get('controller.sortAscending')); - this.set('cur',true); - } else{ - this.set('asc',true); - this.set('cur',false); - }; - }.observes('controller.sortProperties','controller.sortAscending').on('init'), - tagName:'span', - classNames:['pull-right'], - template:Ember.Handlebars.compile('<i {{bind-attr class=":fa view.asc:fa-chevron-down:fa-chevron-up view.cur::fa-gr view.cur::fa-rotate-270" }} ></i>') - }), - reBind:function(){ - Em.run.next(function(){ - $('.isMoving').find('[data-toggle=tooltip]').tooltip(); - }); - }.observes('controller.hideMoving') -}); - -App.FilesAlertView = Em.View.extend({ - templateName:'util/errorRow' + }) }); http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/app/views/filesAlert.js ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/views/filesAlert.js b/contrib/views/files/src/main/resources/ui/app/views/filesAlert.js new file mode 100644 index 0000000..68dc60a --- /dev/null +++ b/contrib/views/files/src/main/resources/ui/app/views/filesAlert.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. + */ + +var App = require('app'); + +App.FilesAlertView = Em.View.extend({ + templateName:'util/errorRow' +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/contrib/views/files/src/main/resources/ui/bower.json ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/bower.json b/contrib/views/files/src/main/resources/ui/bower.json index d837d4f..41a77c5 100644 --- a/contrib/views/files/src/main/resources/ui/bower.json +++ b/contrib/views/files/src/main/resources/ui/bower.json @@ -3,10 +3,10 @@ "version": "0.0.1", "main": "public/app.js", "dependencies": { - "ember": "1.6.0-beta.1", - "ember-data": "1.0.0-beta.7", + "ember": "1.7.0", + "ember-data": "1.0.0-beta.9", "jquery": "1.9.0", - "bootstrap": "3.0.x", + "bootstrap": "3.1.x", "ember-uploader": "~0.2.7", "ladda-bootstrap": "git://github.com/msurguy/ladda-bootstrap.git#~0.1.0", "moment": "~2.5.1", @@ -27,8 +27,8 @@ "ember-i18n": { "scripts": [] }, - "font-awesome":{ - "main":"css/font-awesome.css" + "font-awesome": { + "main": "css/font-awesome.css" } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/d5b9af74/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 new file mode 100644 index 0000000..90c1392 --- /dev/null +++ b/contrib/views/files/src/main/resources/ui/vendor/js/bsPopover.js @@ -0,0 +1,190 @@ +/** + * 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/d5b9af74/contrib/views/files/src/main/resources/view.xml ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/view.xml b/contrib/views/files/src/main/resources/view.xml index fdd39c7..69586d1 100644 --- a/contrib/views/files/src/main/resources/view.xml +++ b/contrib/views/files/src/main/resources/view.xml @@ -21,7 +21,7 @@ <parameter> <name>dataworker.defaultFs</name> - <description>FileSystem URI</description> + <description>The FileSystem URI (for example, hdfs://c6401.ambari.apache.org:8020)</description> <required>true</required> </parameter> <parameter>
