mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-28 10:56:02 +00:00
fix(ui): tabs flickers on permission api response (#9957)
This commit is contained in:
parent
134a5b2c54
commit
72912d75a4
@ -16,7 +16,13 @@ import { AxiosError } from 'axios';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { isEqual, isNil, isUndefined } from 'lodash';
|
import { isEqual, isNil, isUndefined } from 'lodash';
|
||||||
import { EntityTags, ExtraInfo } from 'Models';
|
import { EntityTags, ExtraInfo } from 'Models';
|
||||||
import React, { RefObject, useCallback, useEffect, useState } from 'react';
|
import React, {
|
||||||
|
RefObject,
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { restoreTable } from 'rest/tableAPI';
|
import { restoreTable } from 'rest/tableAPI';
|
||||||
@ -137,6 +143,7 @@ const DatasetDetails: React.FC<DatasetDetailsProps> = ({
|
|||||||
const [isFollowing, setIsFollowing] = useState(false);
|
const [isFollowing, setIsFollowing] = useState(false);
|
||||||
const [usage, setUsage] = useState('');
|
const [usage, setUsage] = useState('');
|
||||||
const [weeklyUsageCount, setWeeklyUsageCount] = useState('');
|
const [weeklyUsageCount, setWeeklyUsageCount] = useState('');
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [tableJoinData, setTableJoinData] = useState<TableJoins>({
|
const [tableJoinData, setTableJoinData] = useState<TableJoins>({
|
||||||
startDate: new Date(),
|
startDate: new Date(),
|
||||||
dayCount: 0,
|
dayCount: 0,
|
||||||
@ -158,6 +165,7 @@ const DatasetDetails: React.FC<DatasetDetailsProps> = ({
|
|||||||
const { getEntityPermission } = usePermissionProvider();
|
const { getEntityPermission } = usePermissionProvider();
|
||||||
|
|
||||||
const fetchResourcePermission = useCallback(async () => {
|
const fetchResourcePermission = useCallback(async () => {
|
||||||
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const tablePermission = await getEntityPermission(
|
const tablePermission = await getEntityPermission(
|
||||||
ResourceEntity.TABLE,
|
ResourceEntity.TABLE,
|
||||||
@ -169,6 +177,8 @@ const DatasetDetails: React.FC<DatasetDetailsProps> = ({
|
|||||||
showErrorToast(
|
showErrorToast(
|
||||||
jsonData['api-error-messages']['fetch-entity-permissions-error']
|
jsonData['api-error-messages']['fetch-entity-permissions-error']
|
||||||
);
|
);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}, [tableDetails.id, getEntityPermission, setTablePermissions]);
|
}, [tableDetails.id, getEntityPermission, setTablePermissions]);
|
||||||
|
|
||||||
@ -201,7 +211,8 @@ const DatasetDetails: React.FC<DatasetDetailsProps> = ({
|
|||||||
);
|
);
|
||||||
setFollowersCount(followers?.length);
|
setFollowersCount(followers?.length);
|
||||||
};
|
};
|
||||||
const tabs = [
|
const tabs = useMemo(
|
||||||
|
() => [
|
||||||
{
|
{
|
||||||
name: t('label.schema'),
|
name: t('label.schema'),
|
||||||
icon: {
|
icon: {
|
||||||
@ -302,7 +313,9 @@ const DatasetDetails: React.FC<DatasetDetailsProps> = ({
|
|||||||
isProtected: false,
|
isProtected: false,
|
||||||
position: 9,
|
position: 9,
|
||||||
},
|
},
|
||||||
];
|
],
|
||||||
|
[tablePermissions, dataModel, feedCount]
|
||||||
|
);
|
||||||
|
|
||||||
const getFrequentlyJoinedWithTables = (): Array<
|
const getFrequentlyJoinedWithTables = (): Array<
|
||||||
JoinedWith & { name: string }
|
JoinedWith & { name: string }
|
||||||
@ -622,7 +635,9 @@ const DatasetDetails: React.FC<DatasetDetailsProps> = ({
|
|||||||
[paging]
|
[paging]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return isLoading ? (
|
||||||
|
<Loader />
|
||||||
|
) : (
|
||||||
<PageContainerV1>
|
<PageContainerV1>
|
||||||
<div className="entity-details-container">
|
<div className="entity-details-container">
|
||||||
<EntityPageInfo
|
<EntityPageInfo
|
||||||
|
@ -659,7 +659,7 @@
|
|||||||
"delete-team-message": "Any teams under \"{{teamName}}\" will be {{deleteType}} deleted as well.",
|
"delete-team-message": "Any teams under \"{{teamName}}\" will be {{deleteType}} deleted as well.",
|
||||||
"delete-webhook-permanently": "You want to delete webhook {{webhookName}} permanently? This action cannot be reverted.",
|
"delete-webhook-permanently": "You want to delete webhook {{webhookName}} permanently? This action cannot be reverted.",
|
||||||
"discover-your-data-and-unlock-the-value-of-data-assets": "Discover your data and unlock the value of data assets.",
|
"discover-your-data-and-unlock-the-value-of-data-assets": "Discover your data and unlock the value of data assets.",
|
||||||
"elastic-search-message": "Manage Elastisearch related works here. You can trigger re-create indexes or check the status of re-creating indexes",
|
"elastic-search-message": "Ensure that your Elasticsearch indexes are up-to-date by syncing, or recreating all indexes.",
|
||||||
"email-is-invalid": "Invalid Email.",
|
"email-is-invalid": "Invalid Email.",
|
||||||
"enable-column-profile": "Enable column profile",
|
"enable-column-profile": "Enable column profile",
|
||||||
"enable-debug-logging": "Enable debug logging",
|
"enable-debug-logging": "Enable debug logging",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user