mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
perf: Optimize performance of Results and Samples tables on Explore (#12257)
This commit is contained in:
committed by
GitHub
parent
76b06b215f
commit
fd15dff60e
@@ -44,6 +44,12 @@ export const CopyButton = styled(Button)`
|
||||
}
|
||||
`;
|
||||
|
||||
const CopyNode = (
|
||||
<CopyButton buttonSize="xs">
|
||||
<i className="fa fa-clipboard" />
|
||||
</CopyButton>
|
||||
);
|
||||
|
||||
export const CopyToClipboardButton = ({
|
||||
data,
|
||||
}: {
|
||||
@@ -52,11 +58,7 @@ export const CopyToClipboardButton = ({
|
||||
<CopyToClipboard
|
||||
text={data ? prepareCopyToClipboardTabularData(data) : ''}
|
||||
wrapped={false}
|
||||
copyNode={
|
||||
<CopyButton buttonSize="xs">
|
||||
<i className="fa fa-clipboard" />
|
||||
</CopyButton>
|
||||
}
|
||||
copyNode={CopyNode}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import Loading from 'src/components/Loading';
|
||||
import TableView, { EmptyWrapperType } from 'src/components/TableView';
|
||||
import { getChartDataRequest } from 'src/chart/chartAction';
|
||||
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
|
||||
import { getDataTablePageSize } from 'src/explore/exploreUtils';
|
||||
import {
|
||||
CopyToClipboardButton,
|
||||
FilterInput,
|
||||
@@ -43,6 +42,8 @@ const NULLISH_RESULTS_STATE = {
|
||||
[RESULT_TYPES.samples]: undefined,
|
||||
};
|
||||
|
||||
const DATA_TABLE_PAGE_SIZE = 50;
|
||||
|
||||
const TableControlsWrapper = styled.div`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -189,9 +190,6 @@ export const DataTablesPane = ({
|
||||
};
|
||||
|
||||
const renderDataTable = (type: string) => {
|
||||
// restrict cell count to 10000 or min 5 rows to avoid crashing browser
|
||||
const columnsLength = columns[type].length;
|
||||
const pageSize = getDataTablePageSize(columnsLength);
|
||||
if (isLoading[type]) {
|
||||
return <Loading />;
|
||||
}
|
||||
@@ -206,8 +204,7 @@ export const DataTablesPane = ({
|
||||
<TableView
|
||||
columns={columns[type]}
|
||||
data={filteredData[type]}
|
||||
withPagination
|
||||
pageSize={pageSize}
|
||||
pageSize={DATA_TABLE_PAGE_SIZE}
|
||||
noDataText={t('No data')}
|
||||
emptyWrapperType={EmptyWrapperType.Small}
|
||||
className="table-condensed"
|
||||
|
||||
Reference in New Issue
Block a user