fix url malformed issue in entity popover and data insight detail page (#15402)

This commit is contained in:
Ashish Gupta 2024-03-01 00:02:25 +05:30 committed by GitHub
parent ce8a58c126
commit bf9269fb7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 16 deletions

View File

@ -47,7 +47,6 @@ import { getTagByFqn } from '../../../rest/tagAPI';
import { getTestCaseByFqn } from '../../../rest/testAPI'; import { getTestCaseByFqn } from '../../../rest/testAPI';
import { getTopicByFqn } from '../../../rest/topicsAPI'; import { getTopicByFqn } from '../../../rest/topicsAPI';
import { getEntityName } from '../../../utils/EntityUtils'; import { getEntityName } from '../../../utils/EntityUtils';
import { getDecodedFqn } from '../../../utils/StringsUtils';
import { EntityUnion } from '../../Explore/ExplorePage.interface'; import { EntityUnion } from '../../Explore/ExplorePage.interface';
import ExploreSearchCard from '../../ExploreV1/ExploreSearchCard/ExploreSearchCard'; import ExploreSearchCard from '../../ExploreV1/ExploreSearchCard/ExploreSearchCard';
import { SearchedDataProps } from '../../SearchedData/SearchedData.interface'; import { SearchedDataProps } from '../../SearchedData/SearchedData.interface';
@ -65,7 +64,6 @@ export const PopoverContent: React.FC<{
entityType: string; entityType: string;
extraInfo?: React.ReactNode; extraInfo?: React.ReactNode;
}> = ({ entityFQN, entityType, extraInfo }) => { }> = ({ entityFQN, entityType, extraInfo }) => {
const decodedFqn = getDecodedFqn(entityFQN);
const { t } = useTranslation(); const { t } = useTranslation();
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const { cachedEntityData, updateCachedEntityData } = const { cachedEntityData, updateCachedEntityData } =
@ -82,7 +80,7 @@ export const PopoverContent: React.FC<{
displayName: getEntityName(data), displayName: getEntityName(data),
id: data.id ?? '', id: data.id ?? '',
description: data.description ?? '', description: data.description ?? '',
fullyQualifiedName: decodedFqn, fullyQualifiedName: entityFQN,
tags: (data as Table)?.tags, tags: (data as Table)?.tags,
entityType: entityType, entityType: entityType,
serviceType: (data as Table)?.serviceType, serviceType: (data as Table)?.serviceType,
@ -101,7 +99,7 @@ export const PopoverContent: React.FC<{
break; break;
case EntityType.TEST_CASE: case EntityType.TEST_CASE:
promise = getTestCaseByFqn(decodedFqn, { promise = getTestCaseByFqn(entityFQN, {
fields: ['owner'], fields: ['owner'],
}); });

View File

@ -45,7 +45,6 @@ import { getTestCaseByFqn, updateTestCaseById } from '../../../rest/testAPI';
import { getFeedCounts } from '../../../utils/CommonUtils'; import { getFeedCounts } from '../../../utils/CommonUtils';
import { checkPermission } from '../../../utils/PermissionsUtils'; import { checkPermission } from '../../../utils/PermissionsUtils';
import { getIncidentManagerDetailPagePath } from '../../../utils/RouterUtils'; import { getIncidentManagerDetailPagePath } from '../../../utils/RouterUtils';
import { getDecodedFqn } from '../../../utils/StringsUtils';
import { showErrorToast } from '../../../utils/ToastUtils'; import { showErrorToast } from '../../../utils/ToastUtils';
import { IncidentManagerTabs } from '../IncidentManager.interface'; import { IncidentManagerTabs } from '../IncidentManager.interface';
import { TestCaseData } from './IncidentManagerDetailPage.interface'; import { TestCaseData } from './IncidentManagerDetailPage.interface';
@ -61,11 +60,6 @@ const IncidentManagerDetailPage = () => {
const { fqn: testCaseFQN } = useFqn(); const { fqn: testCaseFQN } = useFqn();
const decodedTestCaseFQN = useMemo(
() => getDecodedFqn(testCaseFQN),
[testCaseFQN]
);
const [testCaseData, setTestCaseData] = useState<TestCaseData>({ const [testCaseData, setTestCaseData] = useState<TestCaseData>({
data: undefined, data: undefined,
isLoading: true, isLoading: true,
@ -132,7 +126,7 @@ const IncidentManagerDetailPage = () => {
const fetchTestCaseData = async () => { const fetchTestCaseData = async () => {
setTestCaseData((prev) => ({ ...prev, isLoading: true })); setTestCaseData((prev) => ({ ...prev, isLoading: true }));
try { try {
const response = await getTestCaseByFqn(decodedTestCaseFQN, { const response = await getTestCaseByFqn(testCaseFQN, {
fields: [ fields: [
'testSuite', 'testSuite',
'testCaseResult', 'testCaseResult',
@ -177,7 +171,7 @@ const IncidentManagerDetailPage = () => {
if (activeKey !== activeTab) { if (activeKey !== activeTab) {
history.push( history.push(
getIncidentManagerDetailPagePath( getIncidentManagerDetailPagePath(
decodedTestCaseFQN, testCaseFQN,
activeKey as IncidentManagerTabs activeKey as IncidentManagerTabs
) )
); );
@ -230,17 +224,17 @@ const IncidentManagerDetailPage = () => {
}, []); }, []);
const getEntityFeedCount = useCallback(() => { const getEntityFeedCount = useCallback(() => {
getFeedCounts(EntityType.TEST_CASE, decodedTestCaseFQN, handleFeedCount); getFeedCounts(EntityType.TEST_CASE, testCaseFQN, handleFeedCount);
}, [decodedTestCaseFQN]); }, [testCaseFQN]);
useEffect(() => { useEffect(() => {
if (hasViewPermission && decodedTestCaseFQN) { if (hasViewPermission && testCaseFQN) {
fetchTestCaseData(); fetchTestCaseData();
getEntityFeedCount(); getEntityFeedCount();
} else { } else {
setTestCaseData((prev) => ({ ...prev, isLoading: false })); setTestCaseData((prev) => ({ ...prev, isLoading: false }));
} }
}, [decodedTestCaseFQN, hasViewPermission]); }, [testCaseFQN, hasViewPermission]);
if (testCaseData.isLoading) { if (testCaseData.isLoading) {
return <Loader />; return <Loader />;