mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
chore: add certified columns to top of list (#16910)
* initial commit * inital commit * add suggestions * remove changes * Update superset-frontend/src/explore/components/DatasourcePanel/index.tsx Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com> Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
This commit is contained in:
parent
420eff42b8
commit
3f6a24fe1a
@ -17,7 +17,11 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { ControlConfig, DatasourceMeta } from '@superset-ui/chart-controls';
|
import {
|
||||||
|
ControlConfig,
|
||||||
|
DatasourceMeta,
|
||||||
|
ColumnMeta,
|
||||||
|
} from '@superset-ui/chart-controls';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import { matchSorter, rankings } from 'match-sorter';
|
import { matchSorter, rankings } from 'match-sorter';
|
||||||
import { css, styled, t } from '@superset-ui/core';
|
import { css, styled, t } from '@superset-ui/core';
|
||||||
@ -253,6 +257,9 @@ export default function DataSourcePanel({
|
|||||||
setInputValue('');
|
setInputValue('');
|
||||||
}, [columns, datasource, metrics]);
|
}, [columns, datasource, metrics]);
|
||||||
|
|
||||||
|
const sortCertifiedFirst = (slice: ColumnMeta[]) =>
|
||||||
|
slice.sort((a, b) => b.is_certified - a.is_certified);
|
||||||
|
|
||||||
const metricSlice = useMemo(
|
const metricSlice = useMemo(
|
||||||
() =>
|
() =>
|
||||||
showAllMetrics
|
showAllMetrics
|
||||||
@ -263,8 +270,10 @@ export default function DataSourcePanel({
|
|||||||
const columnSlice = useMemo(
|
const columnSlice = useMemo(
|
||||||
() =>
|
() =>
|
||||||
showAllColumns
|
showAllColumns
|
||||||
? lists.columns
|
? sortCertifiedFirst(lists.columns)
|
||||||
: lists.columns.slice(0, DEFAULT_MAX_COLUMNS_LENGTH),
|
: sortCertifiedFirst(
|
||||||
|
lists.columns.slice(0, DEFAULT_MAX_COLUMNS_LENGTH),
|
||||||
|
),
|
||||||
[lists.columns, showAllColumns],
|
[lists.columns, showAllColumns],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user