Merge branch 'rc'
This commit is contained in:
commit
1f6c44b997
@ -21,6 +21,9 @@ import { Observable } from 'rxjs';
|
|||||||
|
|
||||||
export function updateUserLang(translate: TranslateService, userLang: string, translations = env.supportedLangs): Observable<any> {
|
export function updateUserLang(translate: TranslateService, userLang: string, translations = env.supportedLangs): Observable<any> {
|
||||||
let targetLang = userLang;
|
let targetLang = userLang;
|
||||||
|
if (!translations) {
|
||||||
|
translations = env.supportedLangs;
|
||||||
|
}
|
||||||
if (!env.production) {
|
if (!env.production) {
|
||||||
console.log(`User lang: ${targetLang}`);
|
console.log(`User lang: ${targetLang}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import { merge, Observable } from 'rxjs';
|
|||||||
import { MenuSection } from '@core/services/menu.models';
|
import { MenuSection } from '@core/services/menu.models';
|
||||||
import { ActiveComponentService } from '@core/services/active-component.service';
|
import { ActiveComponentService } from '@core/services/active-component.service';
|
||||||
import { TbAnchorComponent } from '@shared/components/tb-anchor.component';
|
import { TbAnchorComponent } from '@shared/components/tb-anchor.component';
|
||||||
|
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-router-tabs',
|
selector: 'tb-router-tabs',
|
||||||
@ -115,9 +116,20 @@ export class RouterTabsComponent extends PageComponent implements OnInit {
|
|||||||
|
|
||||||
private buildTabsForRoutes(activatedRoute: ActivatedRoute): Array<MenuSection> {
|
private buildTabsForRoutes(activatedRoute: ActivatedRoute): Array<MenuSection> {
|
||||||
const sectionPath = this.getSectionPath(activatedRoute);
|
const sectionPath = this.getSectionPath(activatedRoute);
|
||||||
if (activatedRoute.routeConfig.children.length) {
|
const authority = getCurrentAuthUser(this.store).authority;
|
||||||
const activeRouterChildren = activatedRoute.routeConfig.children.filter(page => page.path !== '');
|
const children = activatedRoute.routeConfig.children.filter(page => {
|
||||||
return activeRouterChildren.map(tab => ({
|
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,
|
id: tab.component.name,
|
||||||
type: 'link',
|
type: 'link',
|
||||||
name: tab.data?.breadcrumb?.label ?? '',
|
name: tab.data?.breadcrumb?.label ?? '',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user