From e93b37e8e8e924e2ef690fe81db9e9e7fab77345 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 22 Oct 2024 10:14:59 +0300 Subject: [PATCH 1/2] Minor fix for settings utils. --- ui-ngx/src/app/core/settings/settings.utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui-ngx/src/app/core/settings/settings.utils.ts b/ui-ngx/src/app/core/settings/settings.utils.ts index 3730878237..e5ec4e7182 100644 --- a/ui-ngx/src/app/core/settings/settings.utils.ts +++ b/ui-ngx/src/app/core/settings/settings.utils.ts @@ -21,6 +21,9 @@ import { Observable } from 'rxjs'; export function updateUserLang(translate: TranslateService, userLang: string, translations = env.supportedLangs): Observable { let targetLang = userLang; + if (!translations) { + translations = env.supportedLangs; + } if (!env.production) { console.log(`User lang: ${targetLang}`); } From 28a15296f78001beb041401bf21740c16279e84c Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 22 Oct 2024 12:14:14 +0300 Subject: [PATCH 2/2] UI: Improve router tabs component. --- .../home/components/router-tabs.component.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/router-tabs.component.ts b/ui-ngx/src/app/modules/home/components/router-tabs.component.ts index 681558deb0..3a416073c5 100644 --- a/ui-ngx/src/app/modules/home/components/router-tabs.component.ts +++ b/ui-ngx/src/app/modules/home/components/router-tabs.component.ts @@ -25,6 +25,7 @@ import { merge, Observable } from 'rxjs'; import { MenuSection } from '@core/services/menu.models'; import { ActiveComponentService } from '@core/services/active-component.service'; import { TbAnchorComponent } from '@shared/components/tb-anchor.component'; +import { getCurrentAuthUser } from '@core/auth/auth.selectors'; @Component({ selector: 'tb-router-tabs', @@ -115,9 +116,20 @@ export class RouterTabsComponent extends PageComponent implements OnInit { private buildTabsForRoutes(activatedRoute: ActivatedRoute): Array { const sectionPath = this.getSectionPath(activatedRoute); - if (activatedRoute.routeConfig.children.length) { - const activeRouterChildren = activatedRoute.routeConfig.children.filter(page => page.path !== ''); - return activeRouterChildren.map(tab => ({ + const authority = getCurrentAuthUser(this.store).authority; + const children = activatedRoute.routeConfig.children.filter(page => { + if (page.path !== '') { + if (page.data?.auth) { + return page.data?.auth.includes(authority); + } else { + return true; + } + } else { + return false; + } + }); + if (children.length) { + return children.map(tab => ({ id: tab.component.name, type: 'link', name: tab.data?.breadcrumb?.label ?? '',