ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pallav...@apache.org
Subject ambari git commit: AMBARI-16424. Hive view : Upload Table-On unchecking Is first row header checkbox, the column name textfield should be replaced with some default (Nitiraj Rathore via pallavkul)
Date Mon, 16 May 2016 13:39:21 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 afd68d9c9 -> 8ed30dc58


AMBARI-16424. Hive view : Upload Table-On unchecking Is first row header checkbox, the column
name textfield should be replaced with some default (Nitiraj Rathore via pallavkul)


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

Branch: refs/heads/branch-2.4
Commit: 8ed30dc589f932f5bf61c113eb32429f9075035a
Parents: afd68d9
Author: Pallav Kulshreshtha <pallav.kul@gmail.com>
Authored: Mon May 16 19:07:54 2016 +0530
Committer: Pallav Kulshreshtha <pallav.kul@gmail.com>
Committed: Mon May 16 19:08:52 2016 +0530

----------------------------------------------------------------------
 .../ui/hive-web/app/controllers/upload-table.js  | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ed30dc5/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js
b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js
index 8b8415c..6e96cfb 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/upload-table.js
@@ -24,6 +24,7 @@ import constants from 'hive/utils/constants';
 export default Ember.Controller.extend({
   isLocalUpload : Ember.computed.equal("uploadSource","local"),
   uploadSource : "local",
+  COLUMN_NAME_PREFIX : "column",
   hdfsPath : "",
   jobService: Ember.inject.service(constants.namingConventions.job),
   notifyService: Ember.inject.service(constants.namingConventions.notify),
@@ -85,21 +86,22 @@ export default Ember.Controller.extend({
     "VARCHAR", // -- (Note: Available in Hive 0.12.0 and later)
     "CHAR" // -- (Note: Available in Hive 0.13.0 and later)
   ],
+  _setHeaderElements : function(header,valueArray){
+    header.forEach(function (item, index) {
+      Ember.set(item, 'name',  valueArray.objectAt(index));
+    }, this);
+  },
   isFirstRowHeaderDidChange: function () {
     console.log("inside onFirstRowHeader : isFirstRowHeader : " + this.get('isFirstRowHeader'));
     if (this.get('isFirstRowHeader') != null && typeof this.get('isFirstRowHeader')
!== 'undefined') {
       if (this.get('isFirstRowHeader') == false) {
         if (this.get('rows')) {
           this.get('rows').unshiftObject({row: this.get('firstRow')});
+          this._setHeaderElements(this.get('header'),this.get('defaultColumnNames'));
         }
       } else if( this.get('header') ) { // headers are available
         // take first row of
-        this.get('header').forEach(function (item, index) {
-          console.log("item : ", item);
-          console.log("this.get('firstRow').objectAt(index)  : ", this.get('firstRow').objectAt(index));
-          Ember.set(item, 'name', this.get('firstRow')[index]);
-        }, this);
-
+        this._setHeaderElements(this.get('header'),this.get('firstRow'));
         this.get('rows').removeAt(0);
       }
 
@@ -231,6 +233,11 @@ export default Ember.Controller.extend({
 
   previewTable: function (data) {
     console.log('inside previewTable');
+    var self = this;
+    var defaultColumnNames = data.header.map(function(item,index){
+      return self.COLUMN_NAME_PREFIX + index;
+    });
+    this.set("defaultColumnNames",defaultColumnNames);
     this.set("header", data.header);
     this.set("firstRow", data.rows[0].row);
     console.log("firstRow : ", this.get('firstRow'));


Mime
View raw message