mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-27 18:05:00 +00:00
issue 390:- updated asstes count in my-data page (#409)
This commit is contained in:
parent
1fa033798a
commit
c02b384c27
@ -4,9 +4,10 @@ import NoDataFoundPlaceHolder from '../../../assets/img/no-data-placeholder.png'
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
type: 'error' | 'noData';
|
type: 'error' | 'noData';
|
||||||
|
errorMessage?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ErrorPlaceHolderES = ({ type }: Props) => {
|
const ErrorPlaceHolderES = ({ type, errorMessage }: Props) => {
|
||||||
const noRecordForES = () => {
|
const noRecordForES = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -36,6 +37,30 @@ const ErrorPlaceHolderES = ({ type }: Props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const elasticSearchError = () => {
|
||||||
|
const index = errorMessage?.split('[')[3]?.split(']')[0];
|
||||||
|
|
||||||
|
return errorMessage && index ? (
|
||||||
|
<p className="tw-max-w-sm tw-text-center">
|
||||||
|
OpenMetadata requires index
|
||||||
|
<span className="tw-text-primary tw-font-medium tw-mx-1">
|
||||||
|
{index}
|
||||||
|
</span>{' '}
|
||||||
|
to exist while running Elasticsearch. Please check your Elasticsearch
|
||||||
|
indexes
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<p className="tw-max-w-sm tw-text-center">
|
||||||
|
OpenMetadata requires Elasticsearch 7+ running and configured in
|
||||||
|
<span className="tw-text-primary tw-font-medium tw-mx-1">
|
||||||
|
openmetadata.yaml.
|
||||||
|
</span>
|
||||||
|
Please check the configuration and make sure the Elasticsearch is
|
||||||
|
running.
|
||||||
|
</p>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="tw-flex tw-flex-col tw-mt-24 tw-place-items-center">
|
<div className="tw-flex tw-flex-col tw-mt-24 tw-place-items-center">
|
||||||
@ -49,16 +74,7 @@ const ErrorPlaceHolderES = ({ type }: Props) => {
|
|||||||
}!`}
|
}!`}
|
||||||
</p>
|
</p>
|
||||||
{type === 'noData' && noRecordForES()}
|
{type === 'noData' && noRecordForES()}
|
||||||
{type === 'error' && (
|
{type === 'error' && elasticSearchError()}
|
||||||
<p className="tw-max-w-sm tw-text-center">
|
|
||||||
OpenMetadata requires Elasticsearch 7+ running and configured in
|
|
||||||
<span className="tw-text-primary tw-font-medium tw-mx-1">
|
|
||||||
openmetadata.yaml.
|
|
||||||
</span>
|
|
||||||
Please check the configuration and make sure the Elasticsearch is
|
|
||||||
running.
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -33,7 +33,6 @@ import FacetFilter from '../../components/common/facetfilter/FacetFilter';
|
|||||||
import DropDownList from '../../components/dropdown/DropDownList';
|
import DropDownList from '../../components/dropdown/DropDownList';
|
||||||
import SearchedData from '../../components/searched-data/SearchedData';
|
import SearchedData from '../../components/searched-data/SearchedData';
|
||||||
import {
|
import {
|
||||||
ERROR404,
|
|
||||||
ERROR500,
|
ERROR500,
|
||||||
PAGE_SIZE,
|
PAGE_SIZE,
|
||||||
tableSortingFields,
|
tableSortingFields,
|
||||||
@ -214,7 +213,7 @@ const ExplorePage: React.FC = (): React.ReactElement => {
|
|||||||
setDashboardCount(dashboard.data.hits.total.value);
|
setDashboardCount(dashboard.data.hits.total.value);
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
setError(ERROR404);
|
setError(err.response?.data?.responseMessage);
|
||||||
showToast({
|
showToast({
|
||||||
variant: 'error',
|
variant: 'error',
|
||||||
body: err.response?.data?.responseMessage ?? ERROR500,
|
body: err.response?.data?.responseMessage ?? ERROR500,
|
||||||
@ -297,7 +296,7 @@ const ExplorePage: React.FC = (): React.ReactElement => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
setError(ERROR404);
|
setError(err.response?.data?.responseMessage);
|
||||||
showToast({
|
showToast({
|
||||||
variant: 'error',
|
variant: 'error',
|
||||||
body: err.response?.data?.responseMessage ?? ERROR500,
|
body: err.response?.data?.responseMessage ?? ERROR500,
|
||||||
@ -478,7 +477,7 @@ const ExplorePage: React.FC = (): React.ReactElement => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{error ? (
|
{error ? (
|
||||||
<ErrorPlaceHolderES type="error" />
|
<ErrorPlaceHolderES errorMessage={error} type="error" />
|
||||||
) : (
|
) : (
|
||||||
<SearchedData
|
<SearchedData
|
||||||
showResultCount
|
showResultCount
|
||||||
|
@ -26,7 +26,7 @@ import ErrorPlaceHolderES from '../../components/common/error-with-placeholder/E
|
|||||||
import Loader from '../../components/Loader/Loader';
|
import Loader from '../../components/Loader/Loader';
|
||||||
import MyDataHeader from '../../components/my-data/MyDataHeader';
|
import MyDataHeader from '../../components/my-data/MyDataHeader';
|
||||||
import SearchedData from '../../components/searched-data/SearchedData';
|
import SearchedData from '../../components/searched-data/SearchedData';
|
||||||
import { ERROR404, ERROR500, PAGE_SIZE } from '../../constants/constants';
|
import { ERROR500, PAGE_SIZE } from '../../constants/constants';
|
||||||
import { Ownership } from '../../enums/mydata.enum';
|
import { Ownership } from '../../enums/mydata.enum';
|
||||||
import useToastContext from '../../hooks/useToastContext';
|
import useToastContext from '../../hooks/useToastContext';
|
||||||
import { formatDataResponse } from '../../utils/APIUtils';
|
import { formatDataResponse } from '../../utils/APIUtils';
|
||||||
@ -42,6 +42,9 @@ const MyDataPage: React.FC = (): React.ReactElement => {
|
|||||||
const [currentTab, setCurrentTab] = useState<number>(1);
|
const [currentTab, setCurrentTab] = useState<number>(1);
|
||||||
const [error, setError] = useState<string>('');
|
const [error, setError] = useState<string>('');
|
||||||
const [filter, setFilter] = useState<string>('');
|
const [filter, setFilter] = useState<string>('');
|
||||||
|
const [searchIndex] = useState<string>(
|
||||||
|
'dashboard_search_index,topic_search_index,table_search_index'
|
||||||
|
);
|
||||||
const [countServices, setCountServices] = useState<number>(0);
|
const [countServices, setCountServices] = useState<number>(0);
|
||||||
const [countAssets, setCountAssets] = useState<number>(0);
|
const [countAssets, setCountAssets] = useState<number>(0);
|
||||||
const isMounted = useRef<boolean>(false);
|
const isMounted = useRef<boolean>(false);
|
||||||
@ -65,7 +68,15 @@ const MyDataPage: React.FC = (): React.ReactElement => {
|
|||||||
|
|
||||||
const fetchTableData = (setAssetCount = false) => {
|
const fetchTableData = (setAssetCount = false) => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
searchData('', currentPage, PAGE_SIZE, filter ? getFilters() : '')
|
searchData(
|
||||||
|
'',
|
||||||
|
currentPage,
|
||||||
|
PAGE_SIZE,
|
||||||
|
filter ? getFilters() : '',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
searchIndex
|
||||||
|
)
|
||||||
.then((res: SearchResponse) => {
|
.then((res: SearchResponse) => {
|
||||||
const hits = res.data.hits.hits;
|
const hits = res.data.hits.hits;
|
||||||
const total = res.data.hits.total.value;
|
const total = res.data.hits.total.value;
|
||||||
@ -83,12 +94,11 @@ const MyDataPage: React.FC = (): React.ReactElement => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
setError(ERROR404);
|
setError(err.response?.data?.responseMessage);
|
||||||
showToast({
|
showToast({
|
||||||
variant: 'error',
|
variant: 'error',
|
||||||
body: err.response?.data?.responseMessage ?? ERROR500,
|
body: err.response?.data?.responseMessage ?? ERROR500,
|
||||||
});
|
});
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -151,7 +161,7 @@ const MyDataPage: React.FC = (): React.ReactElement => {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{error ? (
|
{error ? (
|
||||||
<ErrorPlaceHolderES type="error" />
|
<ErrorPlaceHolderES errorMessage={error} type="error" />
|
||||||
) : (
|
) : (
|
||||||
<SearchedData
|
<SearchedData
|
||||||
showOnboardingTemplate
|
showOnboardingTemplate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user