You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by pr...@apache.org on 2018/11/29 13:56:03 UTC

zeppelin git commit: [ZEPPELIN-3690] display all column with the same name in ui-grid

Repository: zeppelin
Updated Branches:
  refs/heads/master 2ea945f54 -> 6b9c29bdf


[ZEPPELIN-3690] display all column with the same name in ui-grid

This PR allows you to correctly display tables with the same column names.
Also removes a little unnecessary code.

PR type:   `Bug Fix`
Jira issue [`ZEPPELIN-3690`](https://issues.apache.org/jira/browse/ZEPPELIN-3690)
paragraph's text : [`paragraph-text.txt`](https://github.com/apache/zeppelin/files/2270553/paragraph-text.txt)

<p align="center">Before PR</p>

![before](https://user-images.githubusercontent.com/30798933/43842410-f7128bb2-9b2d-11e8-8fb3-62ae01ca649c.png)

<p align="center">After PR</p>

![after](https://user-images.githubusercontent.com/30798933/43842418-fbd5ac60-9b2d-11e8-92f8-bfeb9d6bdc97.png)

* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Savalek <de...@mail.ru>

Closes #3116 from Savalek/ZEPPELIN-3690 and squashes the following commits:

77388d91d [Savalek] [ZEPPELIN-3690] display all column with the same name in ui-grid

Change-Id: If726cfab61ca404acc1dc37f4e697e7945d9a8d1


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

Branch: refs/heads/master
Commit: 6b9c29bdf66f183ede3c60d6b026ad8878c51fed
Parents: 2ea945f
Author: Savalek <de...@mail.ru>
Authored: Wed Aug 8 17:01:54 2018 +0300
Committer: Prabhjyot Singh <pr...@gmail.com>
Committed: Thu Nov 29 19:25:55 2018 +0530

----------------------------------------------------------------------
 zeppelin-web/src/app/tabledata/tabledata.js                    | 4 ----
 .../src/app/visualization/builtins/visualization-table.js      | 6 +++---
 2 files changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6b9c29bd/zeppelin-web/src/app/tabledata/tabledata.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/tabledata/tabledata.js b/zeppelin-web/src/app/tabledata/tabledata.js
index 67c47be..ab96c33 100644
--- a/zeppelin-web/src/app/tabledata/tabledata.js
+++ b/zeppelin-web/src/app/tabledata/tabledata.js
@@ -32,7 +32,6 @@ export default class TableData extends Dataset {
 
     let columnNames = [];
     let rows = [];
-    let array = [];
     let textRows = paragraphResult.msg.split('\n');
     let comment = '';
     let commentRow = false;
@@ -54,7 +53,6 @@ export default class TableData extends Dataset {
       }
       let textCols = textRow.split('\t');
       let cols = [];
-      let cols2 = [];
       for (let j = 0; j < textCols.length; j++) {
         let col = textCols[j];
         if (i === 0) {
@@ -67,12 +65,10 @@ export default class TableData extends Dataset {
             }
           }
           cols.push(col);
-          cols2.push({key: (columnNames[i]) ? columnNames[i].name : undefined, value: col});
         }
       }
       if (i !== 0) {
         rows.push(cols);
-        array.push(cols2);
       }
     }
     this.comment = comment;

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6b9c29bd/zeppelin-web/src/app/visualization/builtins/visualization-table.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/visualization/builtins/visualization-table.js b/zeppelin-web/src/app/visualization/builtins/visualization-table.js
index c386f82..179fd9a 100644
--- a/zeppelin-web/src/app/visualization/builtins/visualization-table.js
+++ b/zeppelin-web/src/app/visualization/builtins/visualization-table.js
@@ -92,7 +92,7 @@ export default class TableVisualization extends Visualization {
 
     const gridData = rows.map((r) => {
       return columnNames.reduce((acc, colName, index) => {
-        acc[colName] = r[index];
+        acc[colName + index] = r[index];
         return acc;
       }, {});
     });
@@ -108,11 +108,11 @@ export default class TableVisualization extends Visualization {
       treeRowHeaderAlwaysVisible: false,
       exporterExcelFilename: 'myFile.xlsx',
 
-      columnDefs: columnNames.map((colName) => {
+      columnDefs: columnNames.map((colName, index) => {
         const self = this;
         return {
           displayName: colName,
-          name: colName,
+          name: colName + index,
           type: DefaultTableColumnType,
           cellTemplate: `
             <div ng-if="!grid.getCellValue(row, col).startsWith('%html')"