mirror of https://github.com/apache/superset.git
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.
|
||||
*/
|
||||
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 { matchSorter, rankings } from 'match-sorter';
|
||||
import { css, styled, t } from '@superset-ui/core';
|
||||
|
@ -253,6 +257,9 @@ export default function DataSourcePanel({
|
|||
setInputValue('');
|
||||
}, [columns, datasource, metrics]);
|
||||
|
||||
const sortCertifiedFirst = (slice: ColumnMeta[]) =>
|
||||
slice.sort((a, b) => b.is_certified - a.is_certified);
|
||||
|
||||
const metricSlice = useMemo(
|
||||
() =>
|
||||
showAllMetrics
|
||||
|
@ -263,8 +270,10 @@ export default function DataSourcePanel({
|
|||
const columnSlice = useMemo(
|
||||
() =>
|
||||
showAllColumns
|
||||
? lists.columns
|
||||
: lists.columns.slice(0, DEFAULT_MAX_COLUMNS_LENGTH),
|
||||
? sortCertifiedFirst(lists.columns)
|
||||
: sortCertifiedFirst(
|
||||
lists.columns.slice(0, DEFAULT_MAX_COLUMNS_LENGTH),
|
||||
),
|
||||
[lists.columns, showAllColumns],
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue