Skip to content

Commit

Permalink
Show expanded columns in gray in SQL Editor (#7627)
Browse files Browse the repository at this point in the history
* Show expanded columns in gray

* Remove payload mocking

* Remove empty line

* Safety fallback if expanded_columns is not in the payload

* Fix typo
  • Loading branch information
betodealmeida authored May 31, 2019
1 parent c1712e5 commit d408e30
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions superset/assets/src/SqlLab/components/ResultSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)()}
Expand All @@ -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>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const propTypes = {
overscanRowCount: PropTypes.number,
rowHeight: PropTypes.number,
striped: PropTypes.bool,
expandedColumns: PropTypes.array,
};

const defaultProps = {
Expand All @@ -52,6 +53,7 @@ const defaultProps = {
overscanRowCount: 10,
rowHeight: 32,
striped: true,
expandedColumns: [],
};

export default class FilterableTable extends PureComponent {
Expand Down Expand Up @@ -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} />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.header-style-disabled {
color: #aaa;
}

0 comments on commit d408e30

Please sign in to comment.