diff --git a/odd-platform-api/src/main/java/org/opendatadiscovery/oddplatform/controller/AppInfoController.java b/odd-platform-api/src/main/java/org/opendatadiscovery/oddplatform/controller/AppInfoController.java index 5d363e683..e64ecfe23 100644 --- a/odd-platform-api/src/main/java/org/opendatadiscovery/oddplatform/controller/AppInfoController.java +++ b/odd-platform-api/src/main/java/org/opendatadiscovery/oddplatform/controller/AppInfoController.java @@ -1,8 +1,8 @@ package org.opendatadiscovery.oddplatform.controller; -import lombok.RequiredArgsConstructor; import org.opendatadiscovery.oddplatform.api.contract.api.AppInfoApi; import org.opendatadiscovery.oddplatform.api.contract.model.AppInfo; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.info.BuildProperties; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestController; @@ -10,13 +10,21 @@ import reactor.core.publisher.Mono; @RestController -@RequiredArgsConstructor public class AppInfoController implements AppInfoApi { private final BuildProperties buildProperties; + private final String authType; + + public AppInfoController(final BuildProperties buildProperties, + @Value("${auth.type}") final String authType) { + this.buildProperties = buildProperties; + this.authType = authType; + } @Override public Mono> getAppInfo(final ServerWebExchange exchange) { - return Mono.just(new AppInfo().projectVersion(buildProperties.getVersion())) + return Mono.just(new AppInfo() + .projectVersion(buildProperties.getVersion()) + .authType(authType)) .map(ResponseEntity::ok); } } diff --git a/odd-platform-specification/components.yaml b/odd-platform-specification/components.yaml index 804c773e9..4a7d77927 100644 --- a/odd-platform-specification/components.yaml +++ b/odd-platform-specification/components.yaml @@ -2458,6 +2458,8 @@ components: properties: projectVersion: type: string + authType: + type: string LinkedTerm: type: object diff --git a/odd-platform-ui/src/components/Overview/Overview.tsx b/odd-platform-ui/src/components/Overview/Overview.tsx index 7862d9051..33b08b3b1 100644 --- a/odd-platform-ui/src/components/Overview/Overview.tsx +++ b/odd-platform-ui/src/components/Overview/Overview.tsx @@ -5,6 +5,7 @@ import { MainSearch, SkeletonWrapper } from 'components/shared/elements'; import { WithPermissionsProvider } from 'components/shared/contexts'; import { Permission } from 'generated-sources'; import { useAppSelector } from 'redux/lib/hooks'; +import { useAppInfo } from 'lib/hooks/api'; import Domains from 'components/Overview/Domains/Domains'; import { useGetPopularTags } from 'lib/hooks/api/tags'; import DataEntitiesUsageInfo from './DataEntitiesUsageInfo/DataEntitiesUsageInfo'; @@ -20,6 +21,10 @@ const Overview: React.FC = () => { page: 1, size: 30, }); + const { data: appInfo } = useAppInfo(); + const isShowOwnerAssociation = Boolean( + appInfo?.authType && appInfo.authType !== 'DISABLED' + ); const isLoading = React.useMemo( () => isIdentityFetching || isTagsFetching, @@ -41,17 +46,17 @@ const Overview: React.FC = () => { - - {tags ? : null} - + {tags && } - + {isShowOwnerAssociation && ( + + )} ); }; diff --git a/odd-platform-ui/src/components/shared/elements/AppToolbar/AppInfoMenu/AppInfoMenu.tsx b/odd-platform-ui/src/components/shared/elements/AppToolbar/AppInfoMenu/AppInfoMenu.tsx index de52caf53..6a3f91f83 100644 --- a/odd-platform-ui/src/components/shared/elements/AppToolbar/AppInfoMenu/AppInfoMenu.tsx +++ b/odd-platform-ui/src/components/shared/elements/AppToolbar/AppInfoMenu/AppInfoMenu.tsx @@ -14,7 +14,7 @@ import * as S from 'components/shared/elements/AppToolbar/AppInfoMenu/AppInfoMen import Button from 'components/shared/elements/Button/Button'; const AppInfoMenu: React.FC = () => { - const { data: version } = useAppInfo(); + const { data: appInfo } = useAppInfo(); const { data: links } = useAppLinks(); const gitbookLink = 'https://docs.opendatadiscovery.org/'; @@ -35,7 +35,7 @@ const AppInfoMenu: React.FC = () => { }; const projectVersion = React.useMemo(() => { - if (!version) return null; + if (!appInfo?.projectVersion) return null; return ( @@ -44,13 +44,13 @@ const AppInfoMenu: React.FC = () => { - {version} + {appInfo.projectVersion} ODD Platform version ); - }, [version]); + }, [appInfo?.projectVersion]); const projectLinks = React.useMemo(() => { if (!links || links.length === 0) return null; diff --git a/odd-platform-ui/src/lib/hooks/api/appInfo.ts b/odd-platform-ui/src/lib/hooks/api/appInfo.ts index e2570e16c..944621c21 100644 --- a/odd-platform-ui/src/lib/hooks/api/appInfo.ts +++ b/odd-platform-ui/src/lib/hooks/api/appInfo.ts @@ -5,7 +5,6 @@ export function useAppInfo() { return useQuery({ queryKey: ['appInfo'], queryFn: () => appInfoApi.getAppInfo(), - select: data => data.projectVersion, }); }