mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-11 09:59:04 +00:00
Issue 813: Unavailable entities will be removed from recent data instead of showing loader infinitely (#846)
This commit is contained in:
parent
09cc3b5dd2
commit
c655d197ac
@ -23,7 +23,10 @@ import { getTableDetailsByFQN } from '../../axiosAPIs/tableAPI';
|
||||
import { getTopicByFqn } from '../../axiosAPIs/topicsAPI';
|
||||
import { EntityType } from '../../enums/entity.enum';
|
||||
import { SearchIndex } from '../../enums/search.enum';
|
||||
import { getRecentlyViewedData } from '../../utils/CommonUtils';
|
||||
import {
|
||||
getRecentlyViewedData,
|
||||
setRecentlyViewedData,
|
||||
} from '../../utils/CommonUtils';
|
||||
import { getOwnerFromId, getTierFromTableTags } from '../../utils/TableUtils';
|
||||
import { getTableTags } from '../../utils/TagsUtils';
|
||||
import TableDataCard from '../common/table-data-card/TableDataCard';
|
||||
@ -38,10 +41,12 @@ const RecentlyViewed: FunctionComponent = () => {
|
||||
const fetchRecentlyViewedEntity = async () => {
|
||||
setIsloading(true);
|
||||
const arrData: Array<FormatedTableData> = [];
|
||||
let filteredRecentData = [...recentlyViewedData];
|
||||
|
||||
for (const oData of recentlyViewedData) {
|
||||
// for (let i = 0; i < recentlyViewedData.length; i++) {
|
||||
// const oData = recentlyViewedData[i];
|
||||
try {
|
||||
switch (oData.entityType) {
|
||||
case EntityType.DATASET: {
|
||||
const res = await getTableDetailsByFQN(
|
||||
@ -73,7 +78,8 @@ const RecentlyViewed: FunctionComponent = () => {
|
||||
...tableTags.map((tag) => tag.tagFQN),
|
||||
].filter((tag) => tag),
|
||||
tier: getTierFromTableTags(tags),
|
||||
weeklyPercentileRank: usageSummary?.weeklyStats.percentileRank || 0,
|
||||
weeklyPercentileRank:
|
||||
usageSummary?.weeklyStats.percentileRank || 0,
|
||||
});
|
||||
|
||||
break;
|
||||
@ -158,6 +164,16 @@ const RecentlyViewed: FunctionComponent = () => {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch {
|
||||
filteredRecentData = filteredRecentData.filter(
|
||||
(data) => data.fqn !== oData.fqn
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (filteredRecentData.length !== recentlyViewedData.length) {
|
||||
setRecentlyViewedData(filteredRecentData);
|
||||
}
|
||||
setIsloading(false);
|
||||
setData(arrData);
|
||||
|
@ -160,6 +160,14 @@ export const getRecentlyViewedData = (): Array<RecentlyViewedData> => {
|
||||
return [];
|
||||
};
|
||||
|
||||
export const setRecentlyViewedData = (
|
||||
recentData: Array<RecentlyViewedData>
|
||||
): void => {
|
||||
reactLocalStorage.setObject(LOCALSTORAGE_RECENTLY_VIEWED, {
|
||||
data: recentData,
|
||||
});
|
||||
};
|
||||
|
||||
export const getHtmlForNonAdminAction = (isClaimOwner: boolean) => {
|
||||
return (
|
||||
<>
|
||||
|
Loading…
x
Reference in New Issue
Block a user