You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2016/02/26 11:19:48 UTC

[1/3] ambari git commit: AMBARI-15176. New Files view: When the folder name has special characters, download and preview of files throws error. (dipayanb)

Repository: ambari
Updated Branches:
  refs/heads/trunk 2fee278f6 -> 6e758b76a


AMBARI-15176. New Files view: When the folder name has special characters, download and preview of files throws error. (dipayanb)


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

Branch: refs/heads/trunk
Commit: 965c42fb69a6a3c593ada3c69a80b57b4cd76d5c
Parents: 2fee278
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Fri Feb 26 15:46:41 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Fri Feb 26 15:46:41 2016 +0530

----------------------------------------------------------------------
 .../files/src/main/resources/ui/app/services/file-preview.js | 8 ++++++--
 .../src/main/resources/ui/app/services/files-download.js     | 3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/965c42fb/contrib/views/files/src/main/resources/ui/app/services/file-preview.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/services/file-preview.js b/contrib/views/files/src/main/resources/ui/app/services/file-preview.js
index 2dc8558..7691e5e 100644
--- a/contrib/views/files/src/main/resources/ui/app/services/file-preview.js
+++ b/contrib/views/files/src/main/resources/ui/app/services/file-preview.js
@@ -66,9 +66,13 @@ export default Ember.Service.extend(FileOperationMixin, {
     var adapter = this.get('store').adapterFor('file');
     var baseURL = adapter.buildURL('file');
     var renameUrl = baseURL.substring(0, baseURL.lastIndexOf('/'));
-    var previewUrl = renameUrl.substring(0, renameUrl.lastIndexOf('/')) + "/preview/file?path=";
+    var previewUrl = renameUrl.substring(0, renameUrl.lastIndexOf('/')) + "/preview/file";
+    var queryParams = Ember.$.param({
+      path: this.get('selected.path'),
+      start: this.get('startIndex'),
+      end: this.get('endIndex')});
 
-    var currentFetchPath = previewUrl + this.get('selected.path') + '&start=' + this.get('startIndex') + '&end=' + this.get('endIndex');
+    var currentFetchPath = previewUrl + "?" + queryParams;
 
     this.set('isLoading', true);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/965c42fb/contrib/views/files/src/main/resources/ui/app/services/files-download.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/services/files-download.js b/contrib/views/files/src/main/resources/ui/app/services/files-download.js
index 5b54bc0..7624b53 100644
--- a/contrib/views/files/src/main/resources/ui/app/services/files-download.js
+++ b/contrib/views/files/src/main/resources/ui/app/services/files-download.js
@@ -137,7 +137,8 @@ export default Ember.Service.extend(FileOperationMixin, {
   },
 
   _getDownloadUrl: function(path) {
-    return this._getDownloadBrowseUrl() + "?path=" + path + "&download=true";
+    let params = Ember.$.param({path: path, download: true});
+    return this._getDownloadBrowseUrl() + "?" + params;
   },
 
   _getConcatGenLinkUrl: function() {


[3/3] ambari git commit: AMBARI-15178. New Files View : [UI Issue] No way to cancel/stop the upload file in File browser view. (dipayanb)

Posted by db...@apache.org.
AMBARI-15178. New Files View : [UI Issue] No way to cancel/stop the upload file in File browser view. (dipayanb)


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

Branch: refs/heads/trunk
Commit: 6e758b76a0d0802db89163467997433fa43f4a11
Parents: 4e253f6
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Fri Feb 26 15:49:29 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Fri Feb 26 15:49:29 2016 +0530

----------------------------------------------------------------------
 .../main/resources/ui/app/components/upload-file.js    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6e758b76/contrib/views/files/src/main/resources/ui/app/components/upload-file.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/components/upload-file.js b/contrib/views/files/src/main/resources/ui/app/components/upload-file.js
index 9da6854..e50dec8 100644
--- a/contrib/views/files/src/main/resources/ui/app/components/upload-file.js
+++ b/contrib/views/files/src/main/resources/ui/app/components/upload-file.js
@@ -62,11 +62,16 @@ export default Ember.Component.extend(OperationModal, {
       this.set('closeOnEscape', true);
     },
 
+    didCloseModal: function() {
+      this.set('uploader');
+    },
+
     fileLoaded: function(file) {
       var url = this.get('fileOperationService').getUploadUrl();
       var uploader = FileUploader.create({
         url: url
       });
+      this.set('uploader', uploader);
       if(!Ember.isEmpty(file)) {
         uploader.upload(file, {path: this.get('path')});
         this.setUploading(file.name);
@@ -85,6 +90,14 @@ export default Ember.Component.extend(OperationModal, {
         });
       }
 
+    },
+
+    close: function() {
+      if (!Ember.isNone(this.get('uploader'))) {
+        console.log('cancelling the upload');
+        this.get('uploader').abort();
+      }
+      this._super();
     }
 
   }


[2/3] ambari git commit: AMBARI-15177. [Better User Experience]Display of message when folder with length 255 is created. (dipayanb)

Posted by db...@apache.org.
AMBARI-15177. [Better User Experience]Display of message when folder with length 255 is created. (dipayanb)


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

Branch: refs/heads/trunk
Commit: 4e253f6765cb2e4a7269547e72027bb1711f4034
Parents: 965c42f
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Fri Feb 26 15:48:10 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Fri Feb 26 15:48:10 2016 +0530

----------------------------------------------------------------------
 .../ui/app/components/new-directory.js          | 26 +++++++++++++----
 .../resources/ui/app/components/rename-modal.js | 30 ++++++++++++++++----
 2 files changed, 44 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4e253f67/contrib/views/files/src/main/resources/ui/app/components/new-directory.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/components/new-directory.js b/contrib/views/files/src/main/resources/ui/app/components/new-directory.js
index c30cc8c..4494a4d 100644
--- a/contrib/views/files/src/main/resources/ui/app/components/new-directory.js
+++ b/contrib/views/files/src/main/resources/ui/app/components/new-directory.js
@@ -42,6 +42,25 @@ export default Ember.Component.extend(OperationModal, {
     this.set('hasError', true);
     this.set('errorMessage', message);
   },
+  validateFolderName: function(folderName) {
+    if(Ember.isBlank(folderName)) {
+      this.setError('Cannot be empty');
+      return false;
+    }
+
+    if(this.get('fileOperationService').isExistsInCurrentPath(folderName)) {
+      this.setError('Name already exists');
+      return false;
+    }
+
+    if(folderName.length > 255) {
+      this.setError(`Max limit for length of folder name is 255. Length: ${folderName.length}`);
+      return false;
+    }
+
+    return true;
+  },
+
   actions: {
     didOpenModal: function() {
       this.set('folderName');
@@ -50,13 +69,8 @@ export default Ember.Component.extend(OperationModal, {
       }, 500);
     },
     create: function() {
-      if(Ember.isBlank(this.get('folderName'))) {
-        this.setError('Cannot be empty');
-        return false;
-      }
 
-      if(this.get('fileOperationService').isExistsInCurrentPath(this.get('folderName'))) {
-        this.setError('Name already exists');
+      if(!this.validateFolderName(this.get('folderName'))) {
         return false;
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e253f67/contrib/views/files/src/main/resources/ui/app/components/rename-modal.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/components/rename-modal.js b/contrib/views/files/src/main/resources/ui/app/components/rename-modal.js
index 09ae061..c763c4a 100644
--- a/contrib/views/files/src/main/resources/ui/app/components/rename-modal.js
+++ b/contrib/views/files/src/main/resources/ui/app/components/rename-modal.js
@@ -37,6 +37,29 @@ export default Ember.Component.extend(OperationModal, {
     }
   }),
 
+  validateErrors: function() {
+    let suggestedName = this.get('selectionName');
+    if (Ember.isBlank(suggestedName)) {
+      this.set('hasError', true);
+      this.set('errorMessage', 'Name cannot be blank');
+      return false;
+    }
+
+    if (this.get('selected.name') === suggestedName) {
+      this.set('hasError', true);
+      this.set('errorMessage', 'Name should be different');
+      return false;
+    }
+
+    if (suggestedName.length > 255) {
+      this.set('hasError', true);
+      this.set('errorMessage', `Max limit for length of file name is 255. Length: ${suggestedName.length}`);
+      return false;
+    }
+
+    return true;
+  },
+
   actions: {
     didOpenModal: function() {
       this.set('selectionName', this.get('selected.name'));
@@ -48,15 +71,10 @@ export default Ember.Component.extend(OperationModal, {
     },
 
     rename: function() {
-      if(Ember.isBlank(this.get('selectionName'))) {
+      if(!this.validateErrors()) {
         return false;
       }
 
-      if(this.get('selected.name') === this.get('selectionName')) {
-        this.set('hasError', true);
-        this.set('errorMessage', 'Name should be different');
-        return false;
-      }
       this.set('isUpdating', true);
       this.get('renameService').rename(this.get('selected.path'), this.get('selectionName'))
       .then((response) => {