mirror of https://github.com/abpframework/abp.git
5 changed files with 75 additions and 74 deletions
@ -0,0 +1,72 @@ |
|||||
|
import { Routes } from '@angular/router'; |
||||
|
import { TenantManagementConfigOptions } from './models/config-options'; |
||||
|
import { |
||||
|
TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS, |
||||
|
TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS, |
||||
|
TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, |
||||
|
TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, |
||||
|
TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, |
||||
|
} from './tokens/extensions.token'; |
||||
|
|
||||
|
import { |
||||
|
authGuard, |
||||
|
permissionGuard, |
||||
|
ReplaceableComponents, |
||||
|
ReplaceableRouteContainerComponent, |
||||
|
RouterOutletComponent, |
||||
|
} from '@abp/ng.core'; |
||||
|
import { TenantsComponent } from './components'; |
||||
|
import { eTenantManagementComponents } from './enums'; |
||||
|
import { tenantManagementExtensionsResolver } from './resolvers'; |
||||
|
|
||||
|
export function provideTenantManagement(options: TenantManagementConfigOptions = {}) { |
||||
|
return [ |
||||
|
{ |
||||
|
provide: TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, |
||||
|
useValue: options.entityActionContributors, |
||||
|
}, |
||||
|
{ |
||||
|
provide: TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, |
||||
|
useValue: options.toolbarActionContributors, |
||||
|
}, |
||||
|
{ |
||||
|
provide: TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, |
||||
|
useValue: options.entityPropContributors, |
||||
|
}, |
||||
|
{ |
||||
|
provide: TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS, |
||||
|
useValue: options.createFormPropContributors, |
||||
|
}, |
||||
|
{ |
||||
|
provide: TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS, |
||||
|
useValue: options.editFormPropContributors, |
||||
|
}, |
||||
|
]; |
||||
|
} |
||||
|
|
||||
|
export const createTenantManagementRoutingConfiguration = ( |
||||
|
options: TenantManagementConfigOptions = {}, |
||||
|
): Routes => [ |
||||
|
{ |
||||
|
path: '', |
||||
|
component: RouterOutletComponent, |
||||
|
canActivate: [authGuard, permissionGuard], |
||||
|
resolve: [tenantManagementExtensionsResolver], |
||||
|
providers: [...provideTenantManagement(options)], |
||||
|
children: [ |
||||
|
{ path: '', redirectTo: 'tenants', pathMatch: 'full' }, |
||||
|
{ |
||||
|
path: 'tenants', |
||||
|
component: ReplaceableRouteContainerComponent, |
||||
|
data: { |
||||
|
requiredPolicy: 'AbpTenantManagement.Tenants', |
||||
|
replaceableComponent: { |
||||
|
key: eTenantManagementComponents.Tenants, |
||||
|
defaultComponent: TenantsComponent, |
||||
|
} as ReplaceableComponents.RouteData<TenantsComponent>, |
||||
|
}, |
||||
|
title: 'AbpTenantManagement::Tenants', |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
]; |
||||
@ -1,39 +0,0 @@ |
|||||
import { Routes } from '@angular/router'; |
|
||||
|
|
||||
import { |
|
||||
authGuard, |
|
||||
permissionGuard, |
|
||||
ReplaceableComponents, |
|
||||
ReplaceableRouteContainerComponent, |
|
||||
RouterOutletComponent, |
|
||||
} from '@abp/ng.core'; |
|
||||
|
|
||||
import { TenantsComponent } from './components/tenants/tenants.component'; |
|
||||
import { eTenantManagementComponents } from './enums/components'; |
|
||||
import { tenantManagementExtensionsResolver } from './resolvers'; |
|
||||
import { provideTenantManagement } from './tenant-management'; |
|
||||
|
|
||||
export const tenantManagementRoutes: Routes = [ |
|
||||
{ |
|
||||
path: '', |
|
||||
component: RouterOutletComponent, |
|
||||
canActivate: [authGuard, permissionGuard], |
|
||||
resolve: [tenantManagementExtensionsResolver], |
|
||||
providers: [...provideTenantManagement()], |
|
||||
children: [ |
|
||||
{ path: '', redirectTo: 'tenants', pathMatch: 'full' }, |
|
||||
{ |
|
||||
path: 'tenants', |
|
||||
component: ReplaceableRouteContainerComponent, |
|
||||
data: { |
|
||||
requiredPolicy: 'AbpTenantManagement.Tenants', |
|
||||
replaceableComponent: { |
|
||||
key: eTenantManagementComponents.Tenants, |
|
||||
defaultComponent: TenantsComponent, |
|
||||
} as ReplaceableComponents.RouteData<TenantsComponent>, |
|
||||
}, |
|
||||
title: 'AbpTenantManagement::Tenants', |
|
||||
}, |
|
||||
], |
|
||||
}, |
|
||||
]; |
|
||||
@ -1,33 +0,0 @@ |
|||||
import { TenantManagementConfigOptions } from './models/config-options'; |
|
||||
import { |
|
||||
TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS, |
|
||||
TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS, |
|
||||
TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, |
|
||||
TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, |
|
||||
TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, |
|
||||
} from './tokens/extensions.token'; |
|
||||
|
|
||||
export function provideTenantManagement(options: TenantManagementConfigOptions = {}) { |
|
||||
return [ |
|
||||
{ |
|
||||
provide: TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, |
|
||||
useValue: options.entityActionContributors, |
|
||||
}, |
|
||||
{ |
|
||||
provide: TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, |
|
||||
useValue: options.toolbarActionContributors, |
|
||||
}, |
|
||||
{ |
|
||||
provide: TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, |
|
||||
useValue: options.entityPropContributors, |
|
||||
}, |
|
||||
{ |
|
||||
provide: TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS, |
|
||||
useValue: options.createFormPropContributors, |
|
||||
}, |
|
||||
{ |
|
||||
provide: TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS, |
|
||||
useValue: options.editFormPropContributors, |
|
||||
}, |
|
||||
]; |
|
||||
} |
|
||||
Loading…
Reference in new issue