mirror of https://github.com/abpframework/abp
parent
5c49e008c8
commit
21e3d9aac5
@ -0,0 +1 @@
|
||||
export * from './route.provider';
|
@ -0,0 +1,42 @@
|
||||
import { eLayoutType, RoutesService, SettingTabsService } from '@abp/ng.core';
|
||||
import { eThemeSharedRouteNames } from '@abp/ng.theme.shared';
|
||||
import { APP_INITIALIZER } from '@angular/core';
|
||||
import { debounceTime, map } from 'rxjs/operators';
|
||||
import { eSettingManagementRouteNames } from '../enums/route-names';
|
||||
|
||||
export const SETTING_MANAGEMENT_ROUTE_PROVIDERS = [
|
||||
{ provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true },
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: hideRoutes,
|
||||
deps: [RoutesService, SettingTabsService],
|
||||
multi: true,
|
||||
},
|
||||
];
|
||||
|
||||
export function configureRoutes(routes: RoutesService) {
|
||||
return () => {
|
||||
routes.add([
|
||||
{
|
||||
name: eSettingManagementRouteNames.Settings,
|
||||
path: '/setting-management',
|
||||
parentName: eThemeSharedRouteNames.Administration,
|
||||
requiredPolicy: 'AbpAccount.SettingManagement',
|
||||
layout: eLayoutType.application,
|
||||
order: 6,
|
||||
iconClass: 'fa fa-cog',
|
||||
},
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
export function hideRoutes(routes: RoutesService, tabs: SettingTabsService) {
|
||||
return () => {
|
||||
tabs.visible$
|
||||
.pipe(
|
||||
debounceTime(0),
|
||||
map(nodes => !nodes.length),
|
||||
)
|
||||
.subscribe(invisible => routes.patch('AbpSettingManagement::Settings', { invisible }));
|
||||
};
|
||||
}
|
Loading…
Reference in new issue