diff --git a/authority-portal-frontend/.env.local-dev b/authority-portal-frontend/.env.local-dev index 054d23e2e..fe9fc3596 100644 --- a/authority-portal-frontend/.env.local-dev +++ b/authority-portal-frontend/.env.local-dev @@ -12,3 +12,4 @@ AUTHORITY_PORTAL_FRONTEND_SUPPORT_URL=https://support-url AUTHORITY_PORTAL_FRONTEND_ACTIVE_PROFILE=sovity-open-source AUTHORITY_PORTAL_FRONTEND_DATASPACE_SHORT_NAME=sovity Dataspace AUTHORITY_PORTAL_FRONTEND_PORTAL_DISPLAY_NAME=Authority Portal +AUTHORITY_PORTAL_FRONTEND_ENABLE_DASHBOARD=true diff --git a/authority-portal-frontend/.env.local-e2e-dev b/authority-portal-frontend/.env.local-e2e-dev index 62d9d13a0..08ab77bbd 100644 --- a/authority-portal-frontend/.env.local-e2e-dev +++ b/authority-portal-frontend/.env.local-e2e-dev @@ -12,3 +12,4 @@ AUTHORITY_PORTAL_FRONTEND_SUPPORT_URL=https://support.mobility-dataspace.eu AUTHORITY_PORTAL_FRONTEND_ACTIVE_PROFILE=sovity-open-source AUTHORITY_PORTAL_FRONTEND_BRAND_SHORT_NAME=sovity AUTHORITY_PORTAL_FRONTEND_PORTAL_DISPLAY_NAME=Authority Portal +AUTHORITY_PORTAL_FRONTEND_ENABLE_DASHBOARD=true diff --git a/authority-portal-frontend/src/app/app-routing.module.ts b/authority-portal-frontend/src/app/app-routing.module.ts index 6bf29ec55..896c6a79d 100644 --- a/authority-portal-frontend/src/app/app-routing.module.ts +++ b/authority-portal-frontend/src/app/app-routing.module.ts @@ -110,6 +110,17 @@ export const HOME_REDIRECTS: Routes = REDIRECT_TO_HOME.map((path) => ({ pathMatch: 'full', })); +export const FEATURE_DASHBOARD_ROUTE: Routes = [ + { + path: 'dashboard', + component: DashboardPageComponent, + data: { + requiresRole: ['USER'] satisfies UserRoleDto[], + }, + canActivate: [requiresRole], + }, +]; + export const AUTHORITY_PORTAL_ROUTES: Routes = [ // participant own connector registration { @@ -149,14 +160,6 @@ export const AUTHORITY_PORTAL_ROUTES: Routes = [ path: '', component: PortalLayoutComponent, children: [ - { - path: 'dashboard', - component: DashboardPageComponent, - data: { - requiresRole: ['USER'] satisfies UserRoleDto[], - }, - canActivate: [requiresRole], - }, { path: 'catalog', component: CatalogPageComponent, diff --git a/authority-portal-frontend/src/app/core/global-state/routes/route-config-service.ts b/authority-portal-frontend/src/app/core/global-state/routes/route-config-service.ts index 6103dfa77..db8ca91b7 100644 --- a/authority-portal-frontend/src/app/core/global-state/routes/route-config-service.ts +++ b/authority-portal-frontend/src/app/core/global-state/routes/route-config-service.ts @@ -17,6 +17,7 @@ import {Fetched} from 'src/app/core/utils/fetched'; import { AUTHORITY_PORTAL_ROUTES, CATALOG_REDIRECTS, + FEATURE_DASHBOARD_ROUTE, FEATURE_HOME_ROUTE, HOME_REDIRECTS, LOADING_ROUTES, @@ -86,11 +87,18 @@ export class RouteConfigService { if (nextPageSet === 'AUTHORITY_PORTAL') { const apRouteChildren = routes.find((r) => r.path === '')?.children; + + // Add home route depending on feature set if (this.activeFeatureSet.isHomePageEnabled()) { apRouteChildren?.push(...HOME_REDIRECTS, ...FEATURE_HOME_ROUTE); } else { apRouteChildren?.push(...CATALOG_REDIRECTS); } + + // Add additional routes depending on feature set & configuration + if (this.activeFeatureSet.isDashboardEnabled()) { + apRouteChildren?.push(...FEATURE_DASHBOARD_ROUTE); + } } this.router.resetConfig(routes); diff --git a/authority-portal-frontend/src/app/core/services/config/active-feature-set.ts b/authority-portal-frontend/src/app/core/services/config/active-feature-set.ts index fca263c36..9538175c5 100644 --- a/authority-portal-frontend/src/app/core/services/config/active-feature-set.ts +++ b/authority-portal-frontend/src/app/core/services/config/active-feature-set.ts @@ -30,6 +30,11 @@ export class ActiveFeatureSet { return this.has('enable-home'); } + // This is configurable via environment variable, not via theme + isDashboardEnabled(): boolean { + return this.config.enableDashboard; + } + has(feature: UiFeature): boolean { return this.config.features.has(feature); } diff --git a/authority-portal-frontend/src/app/core/services/config/app-config.ts b/authority-portal-frontend/src/app/core/services/config/app-config.ts index 6367f71f6..792feeda3 100644 --- a/authority-portal-frontend/src/app/core/services/config/app-config.ts +++ b/authority-portal-frontend/src/app/core/services/config/app-config.ts @@ -18,6 +18,7 @@ import {UiLogo} from './profiles/ui-logo'; import {UiProfile} from './profiles/ui-profile'; export const APP_CONFIG = new InjectionToken('APP_CONFIG'); + /** * App Config * @@ -57,6 +58,7 @@ export interface AppConfig { useLocalBackend: boolean; brandDataspaceName: string; portalName: string; + enableDashboard: boolean; } /** @@ -78,6 +80,7 @@ export interface AppConfigEnv { AUTHORITY_PORTAL_FRONTEND_ACTIVE_PROFILE: string; AUTHORITY_PORTAL_FRONTEND_DATASPACE_SHORT_NAME: string; AUTHORITY_PORTAL_FRONTEND_PORTAL_DISPLAY_NAME: string; + AUTHORITY_PORTAL_FRONTEND_ENABLE_DASHBOARD: string; } /** @@ -109,5 +112,7 @@ export function buildAppConfig(envVars: AppConfigEnv): AppConfig { supportUrl: envVars.AUTHORITY_PORTAL_FRONTEND_SUPPORT_URL, brandDataspaceName: envVars.AUTHORITY_PORTAL_FRONTEND_DATASPACE_SHORT_NAME, portalName: envVars.AUTHORITY_PORTAL_FRONTEND_PORTAL_DISPLAY_NAME, + enableDashboard: + envVars.AUTHORITY_PORTAL_FRONTEND_ENABLE_DASHBOARD === 'true', }; } diff --git a/authority-portal-frontend/src/app/shared/common/portal-layout/sidebar/sidebar.component.ts b/authority-portal-frontend/src/app/shared/common/portal-layout/sidebar/sidebar.component.ts index 8a3377558..7b7cf6de5 100644 --- a/authority-portal-frontend/src/app/shared/common/portal-layout/sidebar/sidebar.component.ts +++ b/authority-portal-frontend/src/app/shared/common/portal-layout/sidebar/sidebar.component.ts @@ -96,6 +96,7 @@ export class SidebarComponent implements OnInit, OnDestroy { title: 'Dashboard', icon: 'dashboard', rLink: '/dashboard', + isDisabled: !this.activeFeatureSet.isDashboardEnabled(), }, ], },