refactor(core): add addAbpRoutes method

pull/1867/head
mehmet-erim 6 years ago
parent a99496f2ef
commit 71d8779b63

@ -1,4 +1,4 @@
import { ABP_ROUTES, eLayoutType, RestService } from '@abp/ng.core';
import { eLayoutType, RestService, addAbpRoutes } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
@ -7,7 +7,7 @@ import { Router } from '@angular/router';
})
export class AccountConfigService {
constructor(private router: Router, private restService: RestService) {
ABP_ROUTES.push({
addAbpRoutes({
name: 'AbpAccount::Menu:Account',
path: 'account',
invisible: true,

@ -4,5 +4,5 @@
"lib": {
"entryFile": "src/public-api.ts"
},
"whitelistedNonPeerDependencies": ["@abp/ng.theme.shared"]
"whitelistedNonPeerDependencies": ["@abp/ng.theme.shared", "abp/ng.account.config"]
}

@ -2,7 +2,8 @@
"name": "@abp/ng.account",
"version": "0.9.0",
"dependencies": {
"@abp/ng.theme.shared": "^0.9.0"
"@abp/ng.theme.shared": "^0.9.0",
"abp/ng.account.config": "^0.0.1"
},
"publishConfig": {
"access": "public"

@ -8,7 +8,19 @@ import clone from 'just-clone';
export const NGXS_CONFIG_PLUGIN_OPTIONS = new InjectionToken('NGXS_CONFIG_PLUGIN_OPTIONS');
export let ABP_ROUTES = [] as ABP.FullRoute[];
let ABP_ROUTES = [] as ABP.FullRoute[];
export function addAbpRoutes(routes: ABP.FullRoute | ABP.FullRoute[]): void {
if (!Array.isArray(routes)) {
routes = [routes];
}
ABP_ROUTES.push(...routes);
}
export function getAbpRoutes(): ABP.FullRoute[] {
return [];
}
@Injectable()
export class ConfigPlugin implements NgxsPlugin {

@ -4,13 +4,13 @@ import { NGXS_PLUGINS, NgxsModule, InitState, Store } from '@ngxs/store';
import { environment } from '../../../../../apps/dev-app/src/environments/environment';
import { LAYOUTS } from '../../../../theme-basic/src/public-api';
import { ABP } from '../models';
import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS, ABP_ROUTES } from '../plugins';
import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS, addAbpRoutes } from '../plugins';
import { RouterOutletComponent } from '../components';
import { ConfigState } from '../states';
import { CoreModule } from '../core.module';
import { eLayoutType } from '../enums/common';
ABP_ROUTES.push(
addAbpRoutes([
{
name: 'AbpUiNavigation::Menu:Administration',
path: '',
@ -54,7 +54,7 @@ ABP_ROUTES.push(
},
],
},
);
]);
const expectedState = {
environment,

@ -1,4 +1,4 @@
import { ABP_ROUTES, eLayoutType, RestService } from '@abp/ng.core';
import { addAbpRoutes, eLayoutType, RestService } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
@ -8,7 +8,7 @@ import { Observable } from 'rxjs';
})
export class IdentityConfigService {
constructor(private router: Router, private restService: RestService) {
ABP_ROUTES.push(
addAbpRoutes([
{
name: 'AbpUiNavigation::Menu:Administration',
path: '',
@ -27,6 +27,6 @@ export class IdentityConfigService {
{ path: 'users', name: 'AbpIdentity::Users', order: 1, requiredPolicy: 'AbpIdentity.Users' },
],
},
);
]);
}
}

@ -1,12 +1,12 @@
import { Injectable } from '@angular/core';
import { ABP_ROUTES, eLayoutType } from '@abp/ng.core';
import { addAbpRoutes, eLayoutType } from '@abp/ng.core';
@Injectable({
providedIn: 'root',
})
export class SettingManagementConfigService {
constructor() {
ABP_ROUTES.push({
addAbpRoutes({
name: 'Settings',
path: 'setting-management',
parentName: 'AbpUiNavigation::Menu:Administration',

@ -1,12 +1,12 @@
import { Injectable } from '@angular/core';
import { ABP_ROUTES, eLayoutType } from '@abp/ng.core';
import { addAbpRoutes, eLayoutType } from '@abp/ng.core';
@Injectable({
providedIn: 'root',
})
export class TenantManagementConfigService {
constructor() {
ABP_ROUTES.push({
addAbpRoutes({
name: 'AbpTenantManagement::Menu:TenantManagement',
path: 'tenant-management',
parentName: 'AbpUiNavigation::Menu:Administration',

@ -0,0 +1,26 @@
{
"yarn": true,
"packages": [
{
"libraryFolderPath": "../../../npm/ng-packs/packages/core",
"linkFolderPath": "../../../npm/ng-packs/dist/core",
"buildCommand": "ng build core",
"buildCommandRunPath": "../../../npm/ng-packs/",
"exclude": ["node_modules", "dist"]
},
{
"libraryFolderPath": "../../../npm/ng-packs/packages/account",
"linkFolderPath": "../../../npm/ng-packs/dist/account",
"buildCommand": "ng build account",
"buildCommandRunPath": "../../../npm/ng-packs/",
"exclude": ["node_modules", "dist"]
},
{
"libraryFolderPath": "../../../npm/ng-packs/packages/account-config",
"linkFolderPath": "../../../npm/ng-packs/dist/account-config",
"buildCommand": "ng build account-config",
"buildCommandRunPath": "../../../npm/ng-packs/",
"exclude": ["node_modules", "dist"]
}
]
}
Loading…
Cancel
Save