mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-01 13:13:10 +00:00
Increased the maximum width of the advanced search quick dropdown (#11117)
Brought common quick filters in the front for all the tabs
This commit is contained in:
parent
463f242d6b
commit
32f18449e9
@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-option-label {
|
.dropdown-option-label {
|
||||||
max-width: 200px;
|
max-width: 65vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.update-btn {
|
.update-btn {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
|
Col,
|
||||||
Divider,
|
Divider,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
Input,
|
Input,
|
||||||
@ -26,7 +27,14 @@ import {
|
|||||||
} from 'antd';
|
} from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { debounce, isEmpty, isUndefined } from 'lodash';
|
import { debounce, isEmpty, isUndefined } from 'lodash';
|
||||||
import React, { FC, useEffect, useMemo, useState } from 'react';
|
import React, {
|
||||||
|
FC,
|
||||||
|
ReactNode,
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { ReactComponent as DropDown } from '../../assets/svg/DropDown.svg';
|
import { ReactComponent as DropDown } from '../../assets/svg/DropDown.svg';
|
||||||
import {
|
import {
|
||||||
@ -141,78 +149,104 @@ const SearchDropdown: FC<SearchDropdownProps> = ({
|
|||||||
setSelectedOptions(selectedKeys);
|
setSelectedOptions(selectedKeys);
|
||||||
}, [isDropDownOpen, selectedKeys]);
|
}, [isDropDownOpen, selectedKeys]);
|
||||||
|
|
||||||
|
const getDropdownBody = useCallback(
|
||||||
|
(menuNode: ReactNode) => {
|
||||||
|
if (isSuggestionsLoading) {
|
||||||
|
return (
|
||||||
|
<Row align="middle" className="p-y-sm" justify="center">
|
||||||
|
<Col>
|
||||||
|
<Loader size="small" />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return options.length > 0 || selectedOptions.length > 0 ? (
|
||||||
|
menuNode
|
||||||
|
) : (
|
||||||
|
<Row align="middle" className="m-y-sm" justify="center">
|
||||||
|
<Col>
|
||||||
|
<Typography.Text>{t('message.no-data-available')}</Typography.Text>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[isSuggestionsLoading, options, selectedOptions]
|
||||||
|
);
|
||||||
|
|
||||||
|
const dropdownCardComponent = useCallback(
|
||||||
|
(menuNode: ReactNode) => (
|
||||||
|
<Card
|
||||||
|
bodyStyle={{ padding: 0 }}
|
||||||
|
className="custom-dropdown-render"
|
||||||
|
data-testid="drop-down-menu">
|
||||||
|
<Space direction="vertical" size={0}>
|
||||||
|
<div className="p-t-sm p-x-sm">
|
||||||
|
<Input
|
||||||
|
autoFocus
|
||||||
|
data-testid="search-input"
|
||||||
|
placeholder={`${t('label.search-entity', {
|
||||||
|
entity: label,
|
||||||
|
})}...`}
|
||||||
|
onChange={(e) => {
|
||||||
|
const { value } = e.target;
|
||||||
|
debouncedOnSearch(value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{showClearAllBtn && (
|
||||||
|
<>
|
||||||
|
<Divider className="m-t-xs m-b-0" />
|
||||||
|
<Button
|
||||||
|
className="p-0 m-l-sm"
|
||||||
|
data-testid="clear-button"
|
||||||
|
type="link"
|
||||||
|
onClick={handleClear}>
|
||||||
|
{t('label.clear-entity', {
|
||||||
|
entity: t('label.all'),
|
||||||
|
})}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<Divider
|
||||||
|
className={classNames(showClearAllBtn ? 'm-y-0' : 'm-t-xs m-b-0')}
|
||||||
|
/>
|
||||||
|
{getDropdownBody(menuNode)}
|
||||||
|
<Space className="p-sm p-t-xss">
|
||||||
|
<Button
|
||||||
|
className="update-btn"
|
||||||
|
data-testid="update-btn"
|
||||||
|
size="small"
|
||||||
|
onClick={handleUpdate}>
|
||||||
|
{t('label.update')}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
data-testid="close-btn"
|
||||||
|
size="small"
|
||||||
|
type="link"
|
||||||
|
onClick={handleDropdownClose}>
|
||||||
|
{t('label.close')}
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</Space>
|
||||||
|
</Card>
|
||||||
|
),
|
||||||
|
[
|
||||||
|
label,
|
||||||
|
debouncedOnSearch,
|
||||||
|
showClearAllBtn,
|
||||||
|
handleClear,
|
||||||
|
getDropdownBody,
|
||||||
|
handleUpdate,
|
||||||
|
handleDropdownClose,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dropdown
|
<Dropdown
|
||||||
destroyPopupOnHide
|
destroyPopupOnHide
|
||||||
data-testid={searchKey}
|
data-testid={searchKey}
|
||||||
dropdownRender={(menuNode) => (
|
dropdownRender={dropdownCardComponent}
|
||||||
<Card
|
|
||||||
bodyStyle={{ padding: 0 }}
|
|
||||||
className="custom-dropdown-render"
|
|
||||||
data-testid="drop-down-menu">
|
|
||||||
<Space direction="vertical" size={0}>
|
|
||||||
<div className="p-t-sm p-x-sm">
|
|
||||||
<Input
|
|
||||||
autoFocus
|
|
||||||
data-testid="search-input"
|
|
||||||
placeholder={`${t('label.search-entity', {
|
|
||||||
entity: label,
|
|
||||||
})}...`}
|
|
||||||
onChange={(e) => {
|
|
||||||
const { value } = e.target;
|
|
||||||
debouncedOnSearch(value);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{showClearAllBtn && (
|
|
||||||
<>
|
|
||||||
<Divider className="m-t-xs m-b-0" />
|
|
||||||
<Button
|
|
||||||
className="p-0 m-l-sm"
|
|
||||||
data-testid="clear-button"
|
|
||||||
type="link"
|
|
||||||
onClick={handleClear}>
|
|
||||||
{t('label.clear-entity', {
|
|
||||||
entity: t('label.all'),
|
|
||||||
})}
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Divider
|
|
||||||
className={classNames(showClearAllBtn ? 'm-y-0' : 'm-t-xs m-b-0')}
|
|
||||||
/>
|
|
||||||
{isSuggestionsLoading ? (
|
|
||||||
<Row align="middle" className="p-y-sm" justify="center">
|
|
||||||
<Loader size="small" />
|
|
||||||
</Row>
|
|
||||||
) : options.length > 0 || selectedOptions.length > 0 ? (
|
|
||||||
menuNode
|
|
||||||
) : (
|
|
||||||
<Row className="m-y-sm" justify="center">
|
|
||||||
<Typography.Text>
|
|
||||||
{t('message.no-data-available')}
|
|
||||||
</Typography.Text>
|
|
||||||
</Row>
|
|
||||||
)}
|
|
||||||
<Space className="p-sm p-t-xss">
|
|
||||||
<Button
|
|
||||||
className="update-btn"
|
|
||||||
data-testid="update-btn"
|
|
||||||
size="small"
|
|
||||||
onClick={handleUpdate}>
|
|
||||||
{t('label.update')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
data-testid="close-btn"
|
|
||||||
size="small"
|
|
||||||
type="link"
|
|
||||||
onClick={handleDropdownClose}>
|
|
||||||
{t('label.close')}
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
</Space>
|
|
||||||
</Card>
|
|
||||||
)}
|
|
||||||
key={searchKey}
|
key={searchKey}
|
||||||
menu={{ items: menuOptions, onClick: handleMenuItemClick }}
|
menu={{ items: menuOptions, onClick: handleMenuItemClick }}
|
||||||
open={isDropDownOpen}
|
open={isDropDownOpen}
|
||||||
|
@ -47,23 +47,23 @@ import SVGIcons, { Icons } from './SvgUtils';
|
|||||||
export const getDropDownItems = (index: string) => {
|
export const getDropDownItems = (index: string) => {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case SearchIndex.TABLE:
|
case SearchIndex.TABLE:
|
||||||
return [...TABLE_DROPDOWN_ITEMS, ...COMMON_DROPDOWN_ITEMS];
|
return [...COMMON_DROPDOWN_ITEMS, ...TABLE_DROPDOWN_ITEMS];
|
||||||
|
|
||||||
case SearchIndex.TOPIC:
|
case SearchIndex.TOPIC:
|
||||||
return [...TOPIC_DROPDOWN_ITEMS, ...COMMON_DROPDOWN_ITEMS];
|
return [...COMMON_DROPDOWN_ITEMS, ...TOPIC_DROPDOWN_ITEMS];
|
||||||
|
|
||||||
case SearchIndex.DASHBOARD:
|
case SearchIndex.DASHBOARD:
|
||||||
return [...DASHBOARD_DROPDOWN_ITEMS, ...COMMON_DROPDOWN_ITEMS];
|
return [...COMMON_DROPDOWN_ITEMS, ...DASHBOARD_DROPDOWN_ITEMS];
|
||||||
|
|
||||||
case SearchIndex.PIPELINE:
|
case SearchIndex.PIPELINE:
|
||||||
return [...PIPELINE_DROPDOWN_ITEMS, ...COMMON_DROPDOWN_ITEMS];
|
return [...COMMON_DROPDOWN_ITEMS, ...PIPELINE_DROPDOWN_ITEMS];
|
||||||
|
|
||||||
case SearchIndex.MLMODEL:
|
case SearchIndex.MLMODEL:
|
||||||
return [
|
return [
|
||||||
...COMMON_DROPDOWN_ITEMS.filter((item) => item.key !== 'service_type'),
|
...COMMON_DROPDOWN_ITEMS.filter((item) => item.key !== 'service_type'),
|
||||||
];
|
];
|
||||||
case SearchIndex.CONTAINER:
|
case SearchIndex.CONTAINER:
|
||||||
return [...CONTAINER_DROPDOWN_ITEMS, ...COMMON_DROPDOWN_ITEMS];
|
return [...COMMON_DROPDOWN_ITEMS, ...CONTAINER_DROPDOWN_ITEMS];
|
||||||
case SearchIndex.GLOSSARY:
|
case SearchIndex.GLOSSARY:
|
||||||
return [...GLOSSARY_DROPDOWN_ITEMS];
|
return [...GLOSSARY_DROPDOWN_ITEMS];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user