Skip to content

Commit

Permalink
fix: south pane scrolling issues (#12318)
Browse files Browse the repository at this point in the history
* remove extra scrollbars

* fix sql lab south pane bottom margin

* Update superset-frontend/src/SqlLab/components/SouthPane.jsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* Update superset-frontend/src/SqlLab/components/SouthPane.jsx

Co-authored-by: Evan Rusackas <evan@preset.io>

* move styles to component

Co-authored-by: Evan Rusackas <evan@preset.io>
  • Loading branch information
eschutho and rusackas authored Jan 8, 2021
1 parent d1767b9 commit 466a7c8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ describe('SqlLab datasource panel', () => {
cy.get('.sql-toolbar .Select').should('have.length', 3);

cy.get('.sql-toolbar .table-schema').should('not.exist');
cy.get('.SouthPane .tab-content .filterable-table-container').should(
'not.exist',
);
cy.get('[data-test="filterable-table-container"]').should('not.exist');

cy.get('.sql-toolbar .Select')
.eq(0) // database select
Expand Down
32 changes: 28 additions & 4 deletions superset-frontend/src/SqlLab/components/SouthPane.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import { Alert } from 'react-bootstrap';
import Tabs from 'src/common/components/Tabs';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { t } from '@superset-ui/core';
import { t, styled } from '@superset-ui/core';

import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';

import Label from 'src/components/Label';
Expand All @@ -36,7 +37,7 @@ import {
LOCALSTORAGE_MAX_QUERY_AGE_MS,
} from '../constants';

const TAB_HEIGHT = 44;
const TAB_HEIGHT = 64;

/*
editorQueries are queries executed by users passed from SqlEditor component
Expand All @@ -59,6 +60,29 @@ const defaultProps = {
offline: false,
};

const StyledPane = styled.div`
width: 100%;
.ant-tabs .ant-tabs-content-holder {
overflow: visible;
}
.SouthPaneTabs {
height: 100%;
display: flex;
flex-direction: column;
}
.tab-content {
.alert {
margin-top: ${({ theme }) => theme.gridUnit * 2}px;
}
button.fetch {
margin-top: ${({ theme }) => theme.gridUnit * 2}px;
}
}
`;

export class SouthPane extends React.PureComponent {
constructor(props) {
super(props);
Expand Down Expand Up @@ -158,7 +182,7 @@ export class SouthPane extends React.PureComponent {
));

return (
<div className="SouthPane" ref={this.southPaneRef}>
<StyledPane className="SouthPane" ref={this.southPaneRef}>
<Tabs
activeKey={this.props.activeSouthPaneTab}
className="SouthPaneTabs"
Expand All @@ -178,7 +202,7 @@ export class SouthPane extends React.PureComponent {
</Tabs.TabPane>
{dataPreviewTabs}
</Tabs>
</div>
</StyledPane>
);
}
}
Expand Down
32 changes: 1 addition & 31 deletions superset-frontend/src/SqlLab/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,6 @@ div.Workspace {
.ace_content {
height: 100%;
}

.SouthPane {
height: 100%;
}
}

.SqlEditorTabs li {
Expand Down Expand Up @@ -291,7 +287,7 @@ div.Workspace {
.queryPane {
flex: 1 1 auto;
padding-left: 10px;
overflow: auto;
overflow: visible;
}

.schemaPane-enter-done,
Expand Down Expand Up @@ -378,10 +374,6 @@ div.tablePopover {
padding-top: 16px;
}

.filterable-table-container {
margin-top: 48px;
}

.ace_editor.ace_editor {
//double class is better than !important
border: 1px solid @gray-light;
Expand Down Expand Up @@ -466,20 +458,6 @@ a.Link {
margin: 3px 5px;
}

.SouthPane {
width: 100%;

.SouthPaneTabs {
height: 100%;
display: flex;
flex-direction: column;
}

.ant-tabs-tabpane {
overflow-y: auto; // scroll the query history pane
}
}

.nav-tabs .ddbtn-tab {
padding: 0;
border: none;
Expand Down Expand Up @@ -510,14 +488,6 @@ a.Link {
}
}

.SouthPane .tab-content .alert {
margin-top: 10px;
}

.SouthPane .tab-content button.fetch {
margin-top: 10px;
}

.cost-estimate {
font-size: @font-size-s;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
SortIndicator,
Table,
} from 'react-virtualized';
import { getMultipleTextDimensions, t } from '@superset-ui/core';
import { getMultipleTextDimensions, t, styled } from '@superset-ui/core';

import Button from '../Button';
import CopyToClipboard from '../CopyToClipboard';
Expand Down Expand Up @@ -83,6 +83,11 @@ const JSON_TREE_THEME = {
base0F: '#cc6633',
};

const StyledFilterableTable = styled.div`
overflow-x: auto;
margin-top: ${({ theme }) => theme.gridUnit * 12}px;
`;

// when more than MAX_COLUMNS_FOR_TABLE are returned, switch from table to grid view
export const MAX_COLUMNS_FOR_TABLE = 50;

Expand Down Expand Up @@ -463,6 +468,7 @@ export default class FilterableTable extends PureComponent<
<div
style={{ height }}
className="filterable-table-container Table"
data-test="filterable-table-container"
ref={this.container}
>
<div className="LeftColumn">
Expand Down Expand Up @@ -551,7 +557,7 @@ export default class FilterableTable extends PureComponent<
const rowGetter = ({ index }: { index: number }) =>
this.getDatum(sortedAndFilteredList, index);
return (
<div
<StyledFilterableTable
style={{ height }}
className="filterable-table-container"
ref={this.container}
Expand Down Expand Up @@ -586,7 +592,7 @@ export default class FilterableTable extends PureComponent<
))}
</Table>
)}
</div>
</StyledFilterableTable>
);
}

Expand Down

0 comments on commit 466a7c8

Please sign in to comment.