You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/04/16 19:39:42 UTC

[1/2] ambari git commit: AMBARI-10527. Pig View: Can`t delete script from table (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk cb9fd8e3c -> d835f4485


AMBARI-10527. Pig View: Can`t delete script from table (alexantonenko)


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

Branch: refs/heads/trunk
Commit: d835f4485006c1684e247f3a1baca8f2c10ab035
Parents: 035af84
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 16 18:17:10 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Apr 16 20:39:25 2015 +0300

----------------------------------------------------------------------
 .../ui/pig-web/app/components/scriptListRow.js          | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d835f448/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
----------------------------------------------------------------------
diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
index 3dc67ca..445fc91 100644
--- a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
+++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
@@ -38,5 +38,15 @@ App.ScriptListRowComponent = Em.Component.extend({
       return job.get('id') == jobId;
     });
     return scriptJob.get('firstObject');
-  }.property('currentJobId','scriptJobs')
+  }.property('currentJobId','scriptJobs'),
+  copyAction:'copyScript',
+  deleteAction:'deletescript',
+  actions:{
+    copyScript: function(script){
+      this.sendAction('copyAction',script);
+    },
+    deletescript: function(script){
+      this.sendAction('deleteAction',script);
+    }
+  }
 });


[2/2] ambari git commit: AMBARI-10526. Provide Visual Que for Permission Denied operations (alexantonenko)

Posted by al...@apache.org.
AMBARI-10526. Provide Visual Que for Permission Denied operations (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 035af842c48548f1107a1bbee27e87d6f95f1cfd
Parents: cb9fd8e
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 16 17:50:24 2015 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Thu Apr 16 20:39:25 2015 +0300

----------------------------------------------------------------------
 .../files/src/main/resources/ui/app/adapter.js  |  6 +--
 .../ui/app/components/toggleContext.js          | 27 ++++++++++-
 .../resources/ui/app/components/uploader.js     | 50 ++++++++++++--------
 .../main/resources/ui/app/controllers/files.js  |  8 ++--
 .../ui/app/templates/components/mkdirInput.hbs  |  2 +-
 .../main/resources/ui/app/templates/files.hbs   |  6 +--
 .../resources/ui/app/templates/util/fileRow.hbs |  4 +-
 7 files changed, 67 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/adapter.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/adapter.js b/contrib/views/files/src/main/resources/ui/app/adapter.js
index b181854..1c13b3d 100644
--- a/contrib/views/files/src/main/resources/ui/app/adapter.js
+++ b/contrib/views/files/src/main/resources/ui/app/adapter.js
@@ -56,7 +56,7 @@ function _listdir(adapter, store, type, query, recordArray) {
       label = "";
 
   return Ember.RSVP.Promise.cast(promise, label).then(function(adapterPayload) {
-    var payload = serializer.extractArray(store, type, adapterPayload);
+    var payload = serializer.extract(store, type, adapterPayload, null, 'findAll');
 
     Ember.assert("The response from a findQuery must be an Array, not " + Ember.inspect(payload), Ember.typeOf(payload) === 'array');
 
@@ -284,10 +284,6 @@ App.ApplicationStore = DS.Store.extend({
 
 App.FileSerializer = DS.RESTSerializer.extend({
   primaryKey:'path',
-  extractArray: function(store, type, payload, id, requestType) {
-    payload = {'files': payload};
-    return this._super(store, type, payload, id, requestType);
-  },
   extractSingle: function(store, type, payload, id, requestType) {
     payload = {'files': payload};
     return this._super(store, type, payload, id, requestType);

http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js b/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js
index 65735ba..31f1e27 100644
--- a/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js
+++ b/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js
@@ -18,6 +18,15 @@
 
 var App = require('app');
 
+function _shake (element) {
+  var l = 5;
+  for ( var i = 0; i < 4; i++ ) {
+    element.animate( (l>0) ? {'margin-left':(l=-l)+'px','padding-left':0}:{'padding-left':+(l=-l)+'px','margin-left':0}, 50, function (el) {
+      element.css({'padding-left':0,'margin-left':0});
+    });
+  }
+}
+
 App.ToggleContextComponent = Em.Component.extend({
   didInsertElement:function () {
     var fileRow = this.$().parents('tr'),
@@ -46,7 +55,11 @@ App.ToggleContextComponent = Em.Component.extend({
   },
   openOnClick:function (e) {
     if($(e.target).is('td') || $(e.target).hasClass('allow-open')){
-      this.get('targetObject').send('open');
+      if (this.get('targetObject.content.readAccess')) {
+        this.get('targetObject').send('open');
+      } else {
+        _shake(this.$().parents('.file-row').find('.file-name span').first());
+      }
     }
   },
   willClearRender:function () {
@@ -55,3 +68,15 @@ App.ToggleContextComponent = Em.Component.extend({
     fileRow.data('context').destroy();
   }
 });
+
+App.FileShakerComponent = Em.Component.extend({
+  action:'',
+  isValid:false,
+  click:function () {
+    if (this.get('isValid')) {
+      this.sendAction('action');
+    } else {
+      _shake(this.$());
+    }
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/components/uploader.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/components/uploader.js b/contrib/views/files/src/main/resources/ui/app/components/uploader.js
index 919e4dd..9e413e0 100644
--- a/contrib/views/files/src/main/resources/ui/app/components/uploader.js
+++ b/contrib/views/files/src/main/resources/ui/app/components/uploader.js
@@ -47,23 +47,14 @@ App.FileUploaderComponent = Ember.Component.extend({
     });
   },
   actions:{
-    upload:function (files) {
-      var uploader = this.get('uploader');
-      var uploadBtn = Ladda.create(this.uploadButton.get('element'));
-      var reset = function () {
-        uploadBtn.stop();
-        this.send('clear');
-      };
-      if (!uploader.get('isUploading')) {
-        var path = this.get('path');
-        if (!Ember.isEmpty(this.get('files'))) {
-          var file = this.get('files')[0];
-          uploadBtn.start();
-          uploader.on('progress',function (e) {
-            uploadBtn.setProgress(e.percent/100);
-          });
-          uploader.upload(file,{path:path}).finally(Em.run.bind(this,reset));
-        }
+    upload:function () {
+      if (this.get('dirStatus.writeAccess')) {
+        this.uploadFile();
+      } else {
+        this.set('isError',true);
+        Em.run.later(this,function () {
+          this.set('isError',false);
+        },500);
       }
     },
     clear:function () {
@@ -78,11 +69,30 @@ App.FileUploaderComponent = Ember.Component.extend({
   isFiles:function () {
     return !this.get('files.length');
   }.property('files'),
+  uploadFile:function () {
+    var path = this.get('path');
+    var uploader = this.get('uploader');
+    var uploadBtn = Ladda.create(this.uploadButton.get('element'));
+    var reset = function () {
+      uploadBtn.stop();
+      this.send('clear');
+    };
+    if (!uploader.get('isUploading')) {
+      if (!Ember.isEmpty(this.get('files'))) {
+        var file = this.get('files')[0];
+        uploadBtn.start();
+        uploader.on('progress',function (e) {
+          uploadBtn.setProgress(e.percent/100);
+        });
+        uploader.upload(file,{path:path}).finally(Em.run.bind(this,reset));
+      }
+    }
+  },
   uploadButton: Em.View.createWithMixins(Ember.TargetActionSupport, {
     tagName:'button',
     target: Ember.computed.alias('controller'),
-    classNames:['btn btn-success ladda-button'],
-    classNameBindings:['isFiles:hide'],
+    classNames:['btn','ladda-button'],
+    classNameBindings:['isFiles:hide','target.isError:btn-danger:btn-success'],
     attributeBindings: ["data-style","data-size"],
     action:'upload',
     click: function() {
@@ -105,4 +115,4 @@ App.FileUploaderComponent = Ember.Component.extend({
     readonly:true,
     classNames:['form-control']
   })
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/controllers/files.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/controllers/files.js b/contrib/views/files/src/main/resources/ui/app/controllers/files.js
index 9c46de1..f6432d1 100644
--- a/contrib/views/files/src/main/resources/ui/app/controllers/files.js
+++ b/contrib/views/files/src/main/resources/ui/app/controllers/files.js
@@ -126,9 +126,8 @@ App.FilesController = Ember.ArrayController.extend({
     var adapter = controller.store.adapterFor('file');
     var url = adapter.buildURL('upload');
     this.uploader.set('url',url);
-    this.uploader.on('didUpload', function(e) {
-
-      controller.store.pushPayload('file',{file:e});
+    this.uploader.on('didUpload', function (payload) {
+      controller.store.pushPayload('file', {'file': payload });
     });
     this._super();
   },
@@ -148,8 +147,7 @@ App.FilesController = Ember.ArrayController.extend({
     return (this.movingFile)?[this.path,this.movingFile.name].join('/').replace('//','/')===this.movingFile.path:false;
   }.property('movingFile','path'),
   currentDir:function () {
-    var splitpath = this.get('path').split('/');
-    return splitpath.get(splitpath.length-1) || '/';
+    return this.get('path').split('/').get('lastObject') || '/';
   }.property('path'),
   selectedOne:Ember.computed.equal('selectedFiles.length', 1),
   isSelected:Ember.computed.gt('selectedFiles.length', 0),

http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/templates/components/mkdirInput.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/templates/components/mkdirInput.hbs b/contrib/views/files/src/main/resources/ui/app/templates/components/mkdirInput.hbs
index 4fd7c98..171b445 100644
--- a/contrib/views/files/src/main/resources/ui/app/templates/components/mkdirInput.hbs
+++ b/contrib/views/files/src/main/resources/ui/app/templates/components/mkdirInput.hbs
@@ -17,7 +17,7 @@
 }}
 
 {{#unless isMkdir}}
-  <button type="button" {{action 'edit'}} {{bind-attr class=":btn :btn-default :btn-sm :pull-right :mkdirwrap"}}>
+  <button type="button" {{action 'edit'}} {{bind-attr class=":btn :btn-default :btn-sm :pull-right :mkdirwrap canCreate::disabled"}}>
     <i class="fa fa-plus"></i> New directory
   </button>
 {{else}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/templates/files.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/templates/files.hbs b/contrib/views/files/src/main/resources/ui/app/templates/files.hbs
index 70e5625..26ee096 100644
--- a/contrib/views/files/src/main/resources/ui/app/templates/files.hbs
+++ b/contrib/views/files/src/main/resources/ui/app/templates/files.hbs
@@ -25,17 +25,17 @@
     {{!-- UPLOADER --}}
     <div {{bind-attr class="isUploading::hide :pull-right" }}>
       <button {{action 'upload' 'close'}} type="button" class="close" aria-hidden="true">&times;</button>
-      {{file-uploader path=path uploader=uploader class=" upload-area pull-right" alert='showAlert'}}
+      {{file-uploader path=path uploader=uploader store=controller.store dirStatus=content.meta class="upload-area pull-right" alert='showAlert'}}
     </div>
 
     <div {{bind-attr class="isUploading:hide: :pull-right :uploadwrap" }}>
-      <button type="button" {{action 'upload' 'open'}} {{bind-attr class=":btn :btn-default :btn-sm :pull-right"}}>
+      <button type="button" {{action 'upload' 'open'}} {{bind-attr class=":btn :btn-default :btn-sm :pull-right content.meta.writeAccess::disabled"}}>
         <i class="fa fa-upload"></i> Upload
       </button>
     </div>
 
     {{!-- MKDIR --}}
-    {{mkdir-input create="mkdir" path=path}}
+    {{mkdir-input create="mkdir" path=path canCreate=content.meta.writeAccess}}
 
     </div>
   </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/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
index 197b3d6..6ca3369 100644
--- 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
@@ -26,13 +26,15 @@
   <td>
     {{#rename-input fileBinding='content' confirm='rename' isRenaming=isRenaming}}
       <div class="file-name allow-open">
+      {{#file-shaker action="open" isValid=content.readAccess}}
         <span>
-          <a {{action 'open'}}>
+          <a>
             <strong>
               {{content.name}}
             </strong>
           </a>
         </span>
+      {{/file-shaker}}
         <span class="help-block mod-time allow-open">
           <small class='allow-open'>
             Updated {{showDate modificationTime 'YYYY-MM-DD HH:mm'}}