From 11276986e4c1398a4f43b2bd2e6bef98ff4e7c97 Mon Sep 17 00:00:00 2001
From: Aniket Katkar <51777795+aniketkatkar97@users.noreply.github.com>
Date: Mon, 1 Aug 2022 23:28:33 +0530
Subject: [PATCH] Fix(UI)#6445: Global Search no data placeholder removal
(#6482)
---
.../ui/src/assets/svg/empty-img-default.svg | 9 ---------
.../GlobalSearchProvider.tsx | 11 ++++++++++-
.../GlobalSearchSuggestions.interface.ts | 2 ++
.../GlobalSearchSuggestions.tsx | 16 +++++++++++-----
4 files changed, 23 insertions(+), 15 deletions(-)
delete mode 100644 openmetadata-ui/src/main/resources/ui/src/assets/svg/empty-img-default.svg
diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/empty-img-default.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/empty-img-default.svg
deleted file mode 100644
index 0eb2cee27c2..00000000000
--- a/openmetadata-ui/src/main/resources/ui/src/assets/svg/empty-img-default.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchProvider.tsx b/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchProvider.tsx
index 69a28cc944d..2135ea4c01c 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchProvider.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchProvider.tsx
@@ -41,6 +41,8 @@ const GlobalSearchProvider: FC = ({ children }: Props) => {
const [visible, setVisible] = useState(false);
const [searchValue, setSearchValue] = useState();
const [suggestionSearch, setSuggestionSearch] = useState('');
+ const [isSuggestionsLoading, setIsSuggestionsLoading] =
+ useState(false);
const handleCancel = () => {
setSearchValue('');
@@ -68,6 +70,10 @@ const GlobalSearchProvider: FC = ({ children }: Props) => {
debouncedOnChange,
]);
+ const handleIsSuggestionsLoading = (value: boolean) => {
+ setIsSuggestionsLoading(value);
+ };
+
const searchHandler = (value: string) => {
addToRecentSearched(value);
history.push({
@@ -107,7 +113,7 @@ const GlobalSearchProvider: FC = ({ children }: Props) => {
maskClosable
bodyStyle={{
padding: '20px',
- height: '314px',
+ height: searchValue ? '314px' : '85px',
}}
closeIcon={<>>}
footer={null}
@@ -116,6 +122,8 @@ const GlobalSearchProvider: FC = ({ children }: Props) => {
width={650}
onCancel={handleCancel}>
= ({ children }: Props) => {
onSearch={(newValue) => {
debounceOnSearch(newValue);
setSearchValue(newValue);
+ setIsSuggestionsLoading(true);
}}
/>
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchSuggestions/GlobalSearchSuggestions.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchSuggestions/GlobalSearchSuggestions.interface.ts
index f3eada69c11..c60f60f7cb2 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchSuggestions/GlobalSearchSuggestions.interface.ts
+++ b/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchSuggestions/GlobalSearchSuggestions.interface.ts
@@ -14,6 +14,8 @@
import { BaseSelectRef } from 'rc-select';
export interface GlobalSearchSuggestionsProp {
+ isSuggestionsLoading: boolean;
+ handleIsSuggestionsLoading: (value: boolean) => void;
value: string;
searchText: string;
onOptionSelection: () => void;
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchSuggestions/GlobalSearchSuggestions.tsx b/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchSuggestions/GlobalSearchSuggestions.tsx
index bc3d62e2fb9..b9acf90fffe 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchSuggestions/GlobalSearchSuggestions.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/GlobalSearchProvider/GlobalSearchSuggestions/GlobalSearchSuggestions.tsx
@@ -11,11 +11,11 @@
* limitations under the License.
*/
-import { Select, Typography } from 'antd';
+import { Empty, Select } from 'antd';
import { AxiosError, AxiosResponse } from 'axios';
+import { isEmpty } from 'lodash';
import React, { useEffect, useRef, useState } from 'react';
import { Link, useHistory } from 'react-router-dom';
-import { ReactComponent as NoDataFoundSVG } from '../../../assets/svg/empty-img-default.svg';
import { getSuggestions } from '../../../axiosAPIs/miscAPI';
import { FQN_SEPARATOR_CHAR } from '../../../constants/char.constants';
import { FqnPart } from '../../../enums/entity.enum';
@@ -27,6 +27,7 @@ import SVGIcons, { Icons } from '../../../utils/SvgUtils';
import { getEntityLink } from '../../../utils/TableUtils';
import { showErrorToast } from '../../../utils/ToastUtils';
import CmdKIcon from '../../common/CmdKIcon/CmdKIcon.component';
+import Loader from '../../Loader/Loader';
import {
DashboardSource,
GlobalSearchSuggestionsProp,
@@ -39,6 +40,8 @@ import {
import './GlobalSearchSuggestions.less';
const GlobalSearchSuggestions = ({
+ isSuggestionsLoading,
+ handleIsSuggestionsLoading,
searchText,
onOptionSelection,
value,
@@ -275,6 +278,9 @@ const GlobalSearchSuggestions = ({
err,
jsonData['api-error-messages']['fetch-suggestions-error']
);
+ })
+ .finally(() => {
+ handleIsSuggestionsLoading(false);
});
}
}, [searchText]);
@@ -293,7 +299,6 @@ const GlobalSearchSuggestions = ({
/>