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