+ {index === HEADER_LINE && (
+
setCollapse(!collapsed)}>
+
+ {isColumnSection ? t('Columns') : t('Metrics')}
+
+ {collapsed ? (
+
+ ) : (
+
+ )}
+
+ )}
+ {index === SUBTITLE_LINE && !collapsed && (
+
+ {isColumnSection
+ ? t(`Showing %s of %s`, columnSlice?.length, totalColumns)
+ : t(`Showing %s of %s`, metricSlice?.length, totalMetrics)}
+
+ )}
+ {index > SUBTITLE_LINE && index < BOTTOM_LINE && (
+
+
+
+ )}
+ {index === BOTTOM_LINE &&
+ !collapsed &&
+ (isColumnSection
+ ? totalColumns > DEFAULT_MAX_COLUMNS_LENGTH
+ : totalMetrics > DEFAULT_MAX_METRICS_LENGTH) && (
+
+
+
+ )}
+
+ );
+};
+
+export default DatasourcePanelItem;
diff --git a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
index 99f6b48b8..395b70061 100644
--- a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
+++ b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import React, { useEffect, useMemo, useRef, useState } from 'react';
+import React, { useEffect, useMemo, useState } from 'react';
import {
css,
DatasourceType,
@@ -27,10 +27,11 @@ import {
} from '@superset-ui/core';
import { ControlConfig } from '@superset-ui/chart-controls';
+import AutoSizer from 'react-virtualized-auto-sizer';
+import { FixedSizeList as List } from 'react-window';
import { debounce, isArray } from 'lodash';
import { matchSorter, rankings } from 'match-sorter';
-import Collapse from 'src/components/Collapse';
import Alert from 'src/components/Alert';
import { SaveDatasetModal } from 'src/SqlLab/components/SaveDatasetModal';
import { getDatasourceAsSaveableDataset } from 'src/utils/datasourceUtils';
@@ -38,23 +39,16 @@ import { Input } from 'src/components/Input';
import { FAST_DEBOUNCE } from 'src/constants';
import { ExploreActions } from 'src/explore/actions/exploreActions';
import Control from 'src/explore/components/Control';
-import DatasourcePanelDragOption from './DatasourcePanelDragOption';
-import { DndItemType } from '../DndItemType';
-import { DndItemValue } from './types';
+import DatasourcePanelItem, {
+ ITEM_HEIGHT,
+ DataSourcePanelColumn,
+ DEFAULT_MAX_COLUMNS_LENGTH,
+ DEFAULT_MAX_METRICS_LENGTH,
+} from './DatasourcePanelItem';
interface DatasourceControl extends ControlConfig {
datasource?: IDatasource;
}
-
-export interface DataSourcePanelColumn {
- is_dttm?: boolean | null;
- description?: string | null;
- expression?: string | null;
- is_certified?: number | null;
- column_name?: string | null;
- name?: string | null;
- type?: string;
-}
export interface IDatasource {
metrics: Metric[];
columns: DataSourcePanelColumn[];
@@ -76,22 +70,10 @@ export interface Props {
};
actions: Partial