Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget table scroll-x visible #4101

Merged
merged 4 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions client/app/assets/less/inc/misc.less
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,21 @@
.hide-in-percy, .pace {
visibility: hidden;
}

[data-percy="show-scrollbars"] {
overflow: scroll;

&::-webkit-scrollbar {
width: 10px;
height: 10px;
}

&::-webkit-scrollbar-track {
background: green;
}

&::-webkit-scrollbar-thumb {
background: red;
}
}
}
7 changes: 0 additions & 7 deletions client/app/assets/less/redash/query.less
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,6 @@ edit-in-place p.editable:hover {
}
}

.visualization-renderer {
.pagination,
.ant-pagination {
margin-top: 10px;
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no such classname

.embed__vis {
display: flex;
flex-flow: column;
Expand Down
15 changes: 7 additions & 8 deletions client/app/visualizations/VisualizationRenderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@ export function VisualizationRenderer(props) {
return (
<React.Fragment>
{showFilters && <Filters filters={filters} onChange={setFilters} />}
<div>
<Renderer
key={`visualization${visualization.id}`}
options={options}
data={filteredData}
visualizationName={visualization.name}
/>
</div>
<Renderer
key={`visualization${visualization.id}`}
options={options}
data={filteredData}
visualizationName={visualization.name}
context={props.context}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unused <div>

</React.Fragment>
);
}
Expand Down
1 change: 1 addition & 0 deletions client/app/visualizations/table/Renderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default function Renderer({ options, data }) {
return (
<div className="table-visualization-container">
<Table
data-percy="show-scrollbars"
data-test="TableVisualization"
columns={tableColumns}
dataSource={preparedRows}
Expand Down
21 changes: 20 additions & 1 deletion client/app/visualizations/table/renderer.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
margin-bottom: 0;
}

.ant-table-body {
.ant-table {
overflow-x: auto;
}

Expand Down Expand Up @@ -100,4 +100,23 @@
}
}
}

/* START table x scroll */
.dashboard-widget-wrapper:not(.widget-auto-height-enabled) & {
height: 100%;

& div {
height: inherit;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A must so .ant-spin-container gets the actual height: 100%.

}

.ant-spin-container {
display: flex;
flex-direction: column;

.ant-table {
flex-grow: 1;
}
}
}
/* END */
}
28 changes: 28 additions & 0 deletions client/cypress/integration/dashboard/widget_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,32 @@ describe('Widget', () => {
});
});
});

it('shows horizontal scrollbar for overflowing tabular content', function () {
const queryData = {
query: `select '${'loremipsum'.repeat(15)}' FROM generate_series(1,15)`,
};

const widgetOptions = { position: { col: 0, row: 0, sizeX: 3, sizeY: 10, autoHeight: false } };

createQueryAndAddWidget(this.dashboardId, queryData, widgetOptions).then(() => {
cy.visit(this.dashboardUrl);
cy.getByTestId('TableVisualization').should('exist');
cy.percySnapshot('Shows horizontal scrollbar for overflowing tabular content');
});
});

it('shows fixed pagination for overflowing tabular content ', function () {
const queryData = {
query: 'select \'lorem ipsum\' FROM generate_series(1,50)',
};

const widgetOptions = { position: { col: 0, row: 0, sizeX: 3, sizeY: 10, autoHeight: false } };

createQueryAndAddWidget(this.dashboardId, queryData, widgetOptions).then(() => {
cy.visit(this.dashboardUrl);
cy.getByTestId('TableVisualization').should('exist');
cy.percySnapshot('Shows fixed pagination for overflowing tabular content');
});
});
});