fixed issue for when classification has . in name the termCount was n… (#12729)

* fixed issue for when classification has . in name the termCount was not getting

* fix url encoding issues

* changes as per comments and sonar fix

* changes as per comments

* fixed issue for when classification has . in name and testcase and pytest issue

* checkstyle

---------

Co-authored-by: Ashish Gupta <ashish@getcollate.io>
This commit is contained in:
07Himank 2023-08-04 11:37:17 +05:30 committed by GitHub
parent c5e7a63fbb
commit cda004e35e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 16 deletions

View File

@ -71,7 +71,7 @@ public class ClassificationRepository extends EntityRepository<Classification> {
} }
private int getTermCount(Classification category) { private int getTermCount(Classification category) {
ListFilter filter = new ListFilter(Include.NON_DELETED).addQueryParam("parent", category.getName()); ListFilter filter = new ListFilter(Include.NON_DELETED).addQueryParam("parent", category.getFullyQualifiedName());
return daoCollection.tagDAO().listCount(filter); return daoCollection.tagDAO().listCount(filter);
} }

View File

@ -25,6 +25,7 @@ import { reduceColorOpacity } from 'utils/CommonUtils';
import { getEncodedFqn } from 'utils/StringsUtils'; import { getEncodedFqn } from 'utils/StringsUtils';
import { ReactComponent as IconTerm } from '../../../assets/svg/book.svg'; import { ReactComponent as IconTerm } from '../../../assets/svg/book.svg';
import { ReactComponent as PlusIcon } from '../../../assets/svg/plus-primary.svg'; import { ReactComponent as PlusIcon } from '../../../assets/svg/plus-primary.svg';
import Fqn from '../../../utils/Fqn';
import { TagsV1Props } from './TagsV1.interface'; import { TagsV1Props } from './TagsV1.interface';
import './tagsV1.less'; import './tagsV1.less';
@ -81,7 +82,7 @@ const TagsV1 = ({
tag.source === TagSource.Glossary tag.source === TagSource.Glossary
? history.push(`${ROUTES.GLOSSARY}/${getEncodedFqn(tag.tagFQN)}`) ? history.push(`${ROUTES.GLOSSARY}/${getEncodedFqn(tag.tagFQN)}`)
: history.push( : history.push(
`${ROUTES.TAGS}/${getEncodedFqn(tag.tagFQN.split('.')[0])}` `${ROUTES.TAGS}/${getEncodedFqn(Fqn.split(tag.tagFQN)[0])}`
), ),
[tag.source, tag.tagFQN] [tag.source, tag.tagFQN]
); );

View File

@ -34,6 +34,7 @@ import { useHistory } from 'react-router-dom';
import { addTestCaseToLogicalTestSuite, createTestSuites } from 'rest/testAPI'; import { addTestCaseToLogicalTestSuite, createTestSuites } from 'rest/testAPI';
import { getCurrentUserId } from 'utils/CommonUtils'; import { getCurrentUserId } from 'utils/CommonUtils';
import { getTestSuitePath } from 'utils/RouterUtils'; import { getTestSuitePath } from 'utils/RouterUtils';
import { getEncodedFqn } from 'utils/StringsUtils';
import { showErrorToast } from 'utils/ToastUtils'; import { showErrorToast } from 'utils/ToastUtils';
import AddTestSuiteForm from '../AddTestSuiteForm/AddTestSuiteForm'; import AddTestSuiteForm from '../AddTestSuiteForm/AddTestSuiteForm';
@ -44,7 +45,11 @@ const TestSuiteStepper = () => {
const [testSuiteResponse, setTestSuiteResponse] = useState<TestSuite>(); const [testSuiteResponse, setTestSuiteResponse] = useState<TestSuite>();
const handleViewTestSuiteClick = () => { const handleViewTestSuiteClick = () => {
history.push(getTestSuitePath(testSuiteResponse?.fullyQualifiedName ?? '')); history.push(
getTestSuitePath(
getEncodedFqn(testSuiteResponse?.fullyQualifiedName ?? '')
)
);
}; };
const handleTestSuitNextClick = (data: TestSuite) => { const handleTestSuitNextClick = (data: TestSuite) => {

View File

@ -79,6 +79,7 @@ const PopoverContent: React.FC<{
break; break;
case EntityType.DASHBOARD: case EntityType.DASHBOARD:
case EntityType.CHART:
promise = getDashboardByFqn(entityFQN, fields); promise = getDashboardByFqn(entityFQN, fields);
break; break;
@ -103,7 +104,7 @@ const PopoverContent: React.FC<{
break; break;
case EntityType.GLOSSARY_TERM: case EntityType.GLOSSARY_TERM:
promise = getGlossaryTermByFQN(entityFQN, 'owner'); promise = getGlossaryTermByFQN(getDecodedFqn(entityFQN), 'owner');
break; break;
case EntityType.GLOSSARY: case EntityType.GLOSSARY:
@ -163,7 +164,7 @@ const PopoverContent: React.FC<{
displayName: getEntityName(entityData), displayName: getEntityName(entityData),
id: entityData.id ?? '', id: entityData.id ?? '',
description: entityData.description ?? '', description: entityData.description ?? '',
fullyQualifiedName: entityFQN, fullyQualifiedName: getDecodedFqn(entityFQN),
tags: (entityData as Table).tags, tags: (entityData as Table).tags,
entityType: entityType, entityType: entityType,
serviceType: (entityData as Table).serviceType, serviceType: (entityData as Table).serviceType,

View File

@ -46,6 +46,7 @@ export enum EntityType {
DASHBOARD_DATA_MODEL = 'dashboardDataModel', DASHBOARD_DATA_MODEL = 'dashboardDataModel',
SUBSCRIPTION = 'subscription', SUBSCRIPTION = 'subscription',
USER_NAME = 'username', USER_NAME = 'username',
CHART = 'chart',
} }
export enum AssetsType { export enum AssetsType {

View File

@ -654,24 +654,26 @@ const ContainerPage = () => {
if (hasViewPermission) { if (hasViewPermission) {
fetchContainerDetail(containerName); fetchContainerDetail(containerName);
} }
}, [containerName, containerPermissions]); }, [containerName, hasViewPermission]);
useEffect(() => { useEffect(() => {
fetchResourcePermission(containerName); fetchResourcePermission(containerName);
}, [containerName]); }, [containerName]);
useEffect(() => { useEffect(() => {
if (tab === EntityTabs.CHILDREN) { if (tab === EntityTabs.CHILDREN && hasViewPermission) {
fetchContainerChildren(containerName); fetchContainerChildren(containerName);
} }
}, [tab, containerName]); }, [tab, containerName, hasViewPermission]);
useEffect(() => { useEffect(() => {
getEntityFeedCount(); if (hasViewPermission) {
}, [containerName]); getEntityFeedCount();
}
}, [containerName, hasViewPermission]);
// Rendering // Rendering
if (isLoading || !containerData) { if (isLoading) {
return <Loader />; return <Loader />;
} }
@ -683,10 +685,14 @@ const ContainerPage = () => {
); );
} }
if (!hasViewPermission && !isLoading) { if (!hasViewPermission) {
return <ErrorPlaceHolder type={ERROR_PLACEHOLDER_TYPE.PERMISSION} />; return <ErrorPlaceHolder type={ERROR_PLACEHOLDER_TYPE.PERMISSION} />;
} }
if (!containerData) {
return <ErrorPlaceHolder />;
}
return ( return (
<PageLayoutV1 <PageLayoutV1
className="bg-white" className="bg-white"

View File

@ -1104,9 +1104,7 @@ const TagsPage = () => {
} }
entityFQN={currentClassification.fullyQualifiedName} entityFQN={currentClassification.fullyQualifiedName}
entityId={currentClassification.id} entityId={currentClassification.id}
entityName={ entityName={currentClassification.name}
currentClassification.fullyQualifiedName ?? ''
}
entityType={EntityType.CLASSIFICATION} entityType={EntityType.CLASSIFICATION}
extraDropdownContent={extraDropdownContent} extraDropdownContent={extraDropdownContent}
onEditDisplayName={handleUpdateDisplayName} onEditDisplayName={handleUpdateDisplayName}

View File

@ -38,6 +38,7 @@ import {
patchTeamDetail, patchTeamDetail,
} from 'rest/teamsAPI'; } from 'rest/teamsAPI';
import { getUsers, updateUserDetail } from 'rest/userAPI'; import { getUsers, updateUserDetail } from 'rest/userAPI';
import { getEncodedFqn } from 'utils/StringsUtils';
import AppState from '../../AppState'; import AppState from '../../AppState';
import { import {
INITIAL_PAGING_VALUE, INITIAL_PAGING_VALUE,
@ -611,7 +612,7 @@ const TeamsPage = () => {
useEffect(() => { useEffect(() => {
if (currentTab === TeamsPageTab.USERS) { if (currentTab === TeamsPageTab.USERS) {
getCurrentTeamUsers(selectedTeam.name, {}, false); getCurrentTeamUsers(getEncodedFqn(selectedTeam.name), {}, false);
} else { } else {
setUserPaging(pagingObject); setUserPaging(pagingObject);
} }