You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2019/05/31 17:17:25 UTC

[incubator-superset] branch master updated: Show expanded columns in gray in SQL Editor (#7627)

This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new d408e30  Show expanded columns in gray in SQL Editor (#7627)
d408e30 is described below

commit d408e30594327ef311e4b7470721edbc72bcc508
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Fri May 31 10:17:13 2019 -0700

    Show expanded columns in gray in SQL Editor (#7627)
    
    * Show expanded columns in gray
    
    * Remove payload mocking
    
    * Remove empty line
    
    * Safety fallback if expanded_columns is not in the payload
    
    * Fix typo
---
 superset/assets/src/SqlLab/components/ResultSet.jsx          |  4 ++++
 .../src/components/FilterableTable/FilterableTable.jsx       | 12 +++++++++++-
 .../src/components/FilterableTable/FilterableTableStyles.css |  5 ++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/superset/assets/src/SqlLab/components/ResultSet.jsx b/superset/assets/src/SqlLab/components/ResultSet.jsx
index 443eb16..7ac04b3 100644
--- a/superset/assets/src/SqlLab/components/ResultSet.jsx
+++ b/superset/assets/src/SqlLab/components/ResultSet.jsx
@@ -207,6 +207,9 @@ export default class ResultSet extends React.PureComponent {
         data = results.data;
       }
       if (data && data.length > 0) {
+        const expandedColumns = results.expanded_columns
+          ? results.expanded_columns.map(col => col.name)
+          : [];
         return (
           <React.Fragment>
             {this.renderControls.bind(this)()}
@@ -216,6 +219,7 @@ export default class ResultSet extends React.PureComponent {
               orderedColumnKeys={results.columns.map(col => col.name)}
               height={height}
               filterText={this.state.searchText}
+              expandedColumns={expandedColumns}
             />
           </React.Fragment>
         );
diff --git a/superset/assets/src/components/FilterableTable/FilterableTable.jsx b/superset/assets/src/components/FilterableTable/FilterableTable.jsx
index 702f2b9..e4f21a5 100644
--- a/superset/assets/src/components/FilterableTable/FilterableTable.jsx
+++ b/superset/assets/src/components/FilterableTable/FilterableTable.jsx
@@ -44,6 +44,7 @@ const propTypes = {
   overscanRowCount: PropTypes.number,
   rowHeight: PropTypes.number,
   striped: PropTypes.bool,
+  expandedColumns: PropTypes.array,
 };
 
 const defaultProps = {
@@ -52,6 +53,7 @@ const defaultProps = {
   overscanRowCount: 10,
   rowHeight: 32,
   striped: true,
+  expandedColumns: [],
 };
 
 export default class FilterableTable extends PureComponent {
@@ -141,7 +143,15 @@ export default class FilterableTable extends PureComponent {
     return (
       <TooltipWrapper label="header" tooltip={label}>
         <div className="header-style">
-          {label}
+          <span
+            className={
+              this.props.expandedColumns.indexOf(label) > -1
+                ? 'header-style-disabled'
+                : ''
+            }
+          >
+            {label}
+          </span>
           {sortBy === dataKey &&
             <SortIndicator sortDirection={sortDirection} />
           }
diff --git a/superset/assets/src/components/FilterableTable/FilterableTableStyles.css b/superset/assets/src/components/FilterableTable/FilterableTableStyles.css
index 7a0d3ba..f24df73 100644
--- a/superset/assets/src/components/FilterableTable/FilterableTableStyles.css
+++ b/superset/assets/src/components/FilterableTable/FilterableTableStyles.css
@@ -76,4 +76,7 @@
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
-}
\ No newline at end of file
+}
+.header-style-disabled {
+  color: #aaa;
+}