Merge pull request #1810 from abpframework/feature/config-modules

Feature/config modules
pull/1814/head
Yasin Aydın 6 years ago committed by GitHub
commit 7e2bce00d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -288,6 +288,146 @@
}
}
}
},
"setting-management-config": {
"projectType": "library",
"root": "packages/setting-management-config",
"sourceRoot": "packages/setting-management-config/src",
"prefix": "abp",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "packages/setting-management-config/tsconfig.lib.json",
"project": "packages/setting-management-config/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "packages/setting-management-config/src/test.ts",
"tsConfig": "packages/setting-management-config/tsconfig.spec.json",
"karmaConfig": "packages/setting-management-config/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"packages/setting-management-config/tsconfig.lib.json",
"packages/setting-management-config/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"identity-config": {
"projectType": "library",
"root": "packages/identity-config",
"sourceRoot": "packages/identity-config/src",
"prefix": "abp",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "packages/identity-config/tsconfig.lib.json",
"project": "packages/identity-config/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "packages/identity-config/src/test.ts",
"tsConfig": "packages/identity-config/tsconfig.spec.json",
"karmaConfig": "packages/identity-config/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"packages/identity-config/tsconfig.lib.json",
"packages/identity-config/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"account-config": {
"projectType": "library",
"root": "packages/account-config",
"sourceRoot": "packages/account-config/src",
"prefix": "abp",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "packages/account-config/tsconfig.lib.json",
"project": "packages/account-config/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "packages/account-config/src/test.ts",
"tsConfig": "packages/account-config/tsconfig.spec.json",
"karmaConfig": "packages/account-config/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"packages/account-config/tsconfig.lib.json",
"packages/account-config/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"tenant-management-config": {
"projectType": "library",
"root": "packages/tenant-management-config",
"sourceRoot": "packages/tenant-management-config/src",
"prefix": "abp",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "packages/tenant-management-config/tsconfig.lib.json",
"project": "packages/tenant-management-config/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "packages/tenant-management-config/src/test.ts",
"tsConfig": "packages/tenant-management-config/tsconfig.spec.json",
"karmaConfig": "packages/tenant-management-config/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"packages/tenant-management-config/tsconfig.lib.json",
"packages/tenant-management-config/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "core"

@ -5,10 +5,10 @@
"abpng": "abpng"
},
"devDependencies": {
"@abp/ng.core": "^0.8.3",
"@abp/ng.feature-management": "^0.8.3",
"@abp/ng.permission-management": "^0.8.3",
"@abp/ng.theme.shared": "^0.8.3",
"@abp/ng.core": "^0.9.0",
"@abp/ng.feature-management": "^0.9.0",
"@abp/ng.permission-management": "^0.9.0",
"@abp/ng.theme.shared": "^0.9.0",
"@angular-devkit/build-angular": "~0.803.5",
"@angular-devkit/build-ng-packagr": "~0.803.5",
"@angular/animations": "~8.2.7",
@ -55,9 +55,11 @@
"symlink-manager": "^1.3.0",
"ts-node": "~7.0.0",
"tsickle": "^0.35.0",
"tslib": "^1.9.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3",
"zone.js": "~0.9.1"
},
"dependencies": {
"tslib": "^1.10.0"
}
}

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/account-config'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/account-config",
"lib": {
"entryFile": "src/public-api.ts"
}
}

@ -0,0 +1,7 @@
{
"name": "@abp/ng.account.config",
"version": "0.0.1",
"publishConfig": {
"access": "public"
}
}

@ -0,0 +1,37 @@
import { CoreModule, noop } from '@abp/ng.core';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { APP_INITIALIZER, InjectionToken, ModuleWithProviders, NgModule } from '@angular/core';
import { AccountConfigService } from './services/account-config.service';
export interface AccountConfigOptions {
redirectUrl?: string;
}
export function accountOptionsFactory(options: AccountConfigOptions) {
return {
redirectUrl: '/',
...options,
};
}
export const ACCOUNT_OPTIONS = new InjectionToken('ACCOUNT_OPTIONS');
@NgModule({
imports: [CoreModule, ThemeSharedModule],
providers: [{ provide: APP_INITIALIZER, multi: true, deps: [AccountConfigService], useFactory: noop }],
})
export class AccountConfigModule {
static forRoot(options = {} as AccountConfigOptions): ModuleWithProviders {
return {
ngModule: AccountConfigModule,
providers: [
{ provide: ACCOUNT_OPTIONS, useValue: options },
{
provide: 'ACCOUNT_OPTIONS',
useFactory: accountOptionsFactory,
deps: [ACCOUNT_OPTIONS],
},
],
};
}
}

@ -0,0 +1,21 @@
import { ABP_ROUTES, eLayoutType, RestService } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
@Injectable({
providedIn: 'root',
})
export class AccountConfigService {
constructor(private router: Router, private restService: RestService) {
ABP_ROUTES.push({
name: 'AbpAccount::Menu:Account',
path: 'account',
invisible: true,
layout: eLayoutType.application,
children: [
{ path: 'login', name: 'AbpAccount::Login', order: 1 },
{ path: 'register', name: 'AbpAccount::Register', order: 2 },
],
});
}
}

@ -0,0 +1,2 @@
export * from './lib/services/account-config.service';
export * from './lib/account-config.module';

@ -0,0 +1,21 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

@ -0,0 +1,26 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"abp",
"camelCase"
],
"component-selector": [
true,
"element",
"abp",
"kebab-case"
]
}
}

@ -18,6 +18,10 @@ import { ACCOUNT_OPTIONS, optionsFactory } from './tokens/options.token';
})
export class AccountModule {}
/**
*
* @deprecated since version 0.9
*/
export function AccountProviders(options = {} as Options): Provider[] {
return [
{ provide: ACCOUNT_OPTIONS, useValue: options },

@ -1,5 +1,9 @@
import { ABP, eLayoutType } from '@abp/ng.core';
/**
*
* @deprecated since version 0.9
*/
export const ACCOUNT_ROUTES = {
routes: [
{

@ -2,5 +2,8 @@ export const enum eLayoutType {
account = 'account',
application = 'application',
empty = 'empty',
/**
* @deprecated since version 0.9.0
*/
setting = 'setting',
}

@ -43,4 +43,8 @@ export namespace ABP {
id: string;
name: string;
}
export interface Dictionary<T = any> {
[key: string]: T;
}
}

@ -8,6 +8,8 @@ import clone from 'just-clone';
export const NGXS_CONFIG_PLUGIN_OPTIONS = new InjectionToken('NGXS_CONFIG_PLUGIN_OPTIONS');
export let ABP_ROUTES = [] as ABP.FullRoute[];
@Injectable()
export class ConfigPlugin implements NgxsPlugin {
private initialized: boolean = false;
@ -38,27 +40,31 @@ export class ConfigPlugin implements NgxsPlugin {
}
function transformRoutes(routes: Routes = [], wrappers: ABP.FullRoute[] = []): any {
/**
*
* @deprecated since version 0.9.0
*/
const abpRoutes: ABP.FullRoute[] = routes
.filter(route => {
return snq(() => route.data.routes.routes.find(r => r.path === route.path), false);
})
.reduce((acc, val) => [...acc, ...val.data.routes.routes], []);
ABP_ROUTES = [...ABP_ROUTES, ...abpRoutes];
wrappers = abpRoutes.filter(ar => ar.wrapper);
wrappers = ABP_ROUTES.filter(ar => ar.wrapper);
const transformed = [] as ABP.FullRoute[];
routes
.filter(route => (route.data || {}).routes && (route.component || route.loadChildren))
.filter(route => route.component || route.loadChildren)
.forEach(route => {
const abpPackage = abpRoutes.find(
abp => abp.path.toLowerCase() === route.path.toLowerCase() && snq(() => route.data.routes.routes.length, false),
);
const abpPackage = ABP_ROUTES.find(abp => abp.path.toLowerCase() === route.path.toLowerCase() && !abp.wrapper);
const { length } = transformed;
if (abpPackage) {
transformed.push(abpPackage);
}
if (transformed.length === length) {
if (transformed.length === length && (route.data || {}).routes) {
transformed.push({
...route.data.routes,
path: route.path,

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/identity-config'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/identity-config",
"lib": {
"entryFile": "src/public-api.ts"
}
}

@ -0,0 +1,7 @@
{
"name": "@abp/ng.identity.config",
"version": "0.0.1",
"publishConfig": {
"access": "public"
}
}

@ -0,0 +1,8 @@
import { noop } from '@abp/ng.core';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { IdentityConfigService } from './services/identity-config.service';
@NgModule({
providers: [{ provide: APP_INITIALIZER, deps: [IdentityConfigService], useFactory: noop, multi: true }],
})
export class IdentityConfigModule {}

@ -0,0 +1,32 @@
import { ABP_ROUTES, eLayoutType, RestService } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class IdentityConfigService {
constructor(private router: Router, private restService: RestService) {
ABP_ROUTES.push(
{
name: 'AbpUiNavigation::Menu:Administration',
path: '',
order: 1,
wrapper: true,
},
{
name: 'AbpIdentity::Menu:IdentityManagement',
path: 'identity',
order: 1,
parentName: 'AbpUiNavigation::Menu:Administration',
layout: eLayoutType.application,
iconClass: 'fa fa-id-card-o',
children: [
{ path: 'roles', name: 'AbpIdentity::Roles', order: 2, requiredPolicy: 'AbpIdentity.Roles' },
{ path: 'users', name: 'AbpIdentity::Users', order: 1, requiredPolicy: 'AbpIdentity.Users' },
],
},
);
}
}

@ -0,0 +1,2 @@
export * from './lib/services/identity-config.service';
export * from './lib/identity-config.module';

@ -0,0 +1,21 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

@ -0,0 +1,26 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"abp",
"camelCase"
],
"component-selector": [
true,
"element",
"abp",
"kebab-case"
]
}
}

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

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

@ -1,5 +1,9 @@
import { eLayoutType, ABP } from '@abp/ng.core';
/**
*
* @deprecated
*/
export const IDENTITY_ROUTES = {
routes: [
{

@ -9,21 +9,20 @@ import { UserResolver } from './resolvers/users.resolver';
const routes: Routes = [
{ path: '', redirectTo: 'roles', pathMatch: 'full' },
{
path: 'roles',
path: '',
component: DynamicLayoutComponent,
canActivate: [AuthGuard, PermissionGuard],
data: { requiredPolicy: 'AbpIdentity.Roles' },
children: [{ path: '', component: RolesComponent, resolve: [RoleResolver] }],
},
{
path: 'users',
component: DynamicLayoutComponent,
canActivate: [AuthGuard, PermissionGuard],
data: { requiredPolicy: 'AbpIdentity.Users' },
children: [
{
path: '',
path: 'roles',
component: RolesComponent,
resolve: [RoleResolver],
data: { requiredPolicy: 'AbpIdentity.Roles' },
},
{
path: 'users',
component: UsersComponent,
data: { requiredPolicy: 'AbpIdentity.Users' },
resolve: [RoleResolver, UserResolver],
},
],

@ -27,6 +27,10 @@ import { NgxValidateCoreModule } from '@ngx-validate/core';
})
export class IdentityModule {}
/**
*
* @deprecated
*/
export function IdentityProviders(): Provider[] {
return [];
}

@ -0,0 +1,24 @@
# SettingManagementConfig
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.7.
## Code scaffolding
Run `ng generate component component-name --project setting-management-config` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project setting-management-config`.
> Note: Don't forget to add `--project setting-management-config` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build setting-management-config` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build setting-management-config`, go to the dist folder `cd dist/setting-management-config` and run `npm publish`.
## Running unit tests
Run `ng test setting-management-config` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/setting-management-config'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/setting-management-config",
"lib": {
"entryFile": "src/public-api.ts"
}
}

@ -0,0 +1,7 @@
{
"name": "@abp/ng.setting-management.config",
"version": "0.0.1",
"publishConfig": {
"access": "public"
}
}

@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import { ABP_ROUTES, eLayoutType } from '@abp/ng.core';
@Injectable({
providedIn: 'root',
})
export class SettingManagementConfigService {
constructor() {
ABP_ROUTES.push({
name: 'Settings',
path: 'setting-management',
parentName: 'AbpUiNavigation::Menu:Administration',
layout: eLayoutType.application,
order: 6,
iconClass: 'fa fa-cog',
});
}
}

@ -0,0 +1,8 @@
import { NgModule, APP_INITIALIZER } from '@angular/core';
import { SettingManagementConfigService } from './services/setting-management-config.service';
import { noop } from '@abp/ng.core';
@NgModule({
providers: [{ provide: APP_INITIALIZER, deps: [SettingManagementConfigService], useFactory: noop, multi: true }],
})
export class SettingManagementConfigModule {}

@ -0,0 +1 @@
export * from './lib/setting-management-config.module';

@ -0,0 +1,21 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

@ -0,0 +1,26 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"abp",
"camelCase"
],
"component-selector": [
true,
"element",
"abp",
"kebab-case"
]
}
}

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

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

@ -1,29 +0,0 @@
import { eLayoutType } from '@abp/ng.core';
import { SettingTab } from '@abp/ng.theme.shared';
import { Component, TrackByFunction } from '@angular/core';
import { Router } from '@angular/router';
import { timer } from 'rxjs';
import { SettingManagementService } from '../services/setting-management.service';
@Component({
selector: 'abp-setting-layout',
templateUrl: './setting-layout.component.html',
})
export class SettingLayoutComponent {
// required for dynamic component
static type = eLayoutType.setting;
trackByFn: TrackByFunction<SettingTab> = (_, item) => item.name;
constructor(public settingManagementService: SettingManagementService, private router: Router) {
if (
settingManagementService.selected &&
this.router.url !== settingManagementService.selected.url &&
settingManagementService.settings.length
) {
settingManagementService.setSelected(settingManagementService.settings[0]);
}
}
ngOnDestroy() {}
}

@ -13,20 +13,15 @@
<div id="SettingManagementWrapper">
<div class="card">
<div class="card-body">
<div *ngIf="!settingManagementService.settings.length" class="text-center">
<div *ngIf="!settings.length" class="text-center">
<i class="fa fa-spinner fa-spin"></i>
</div>
<div class="row">
<div class="col-3">
<ul class="nav flex-column nav-pills" id="nav-tab" role="tablist">
<li
*abpFor="
let setting of settingManagementService.settings;
trackBy: trackByFn;
orderBy: 'order';
orderDir: 'ASC'
"
(click)="settingManagementService.setSelected(setting)"
*abpFor="let setting of settings; trackBy: trackByFn"
(click)="selected = setting"
class="nav-item"
[abpPermission]="setting.requiredPolicy"
>
@ -34,20 +29,16 @@
class="nav-link"
[id]="setting.name + '-tab'"
role="tab"
[class.active]="setting.name === settingManagementService.selected.name"
[class.active]="setting.name === selected.name"
>{{ setting.name | abpLocalization }}</a
>
</li>
</ul>
</div>
<div class="col-9">
<div *ngIf="settingManagementService.settings.length" class="tab-content">
<div
class="tab-pane fade show active"
[id]="settingManagementService.selected.name + '-tab'"
role="tabpanel"
>
<router-outlet></router-outlet>
<div *ngIf="settings.length" class="tab-content">
<div class="tab-pane fade show active" [id]="selected.name + '-tab'" role="tabpanel">
<ng-container *ngComponentOutlet="selected.component"></ng-container>
</div>
</div>
</div>

@ -0,0 +1,28 @@
import { Component, TrackByFunction, OnInit } from '@angular/core';
import { SettingTab, SETTING_TABS } from '@abp/ng.theme.shared';
import { Router } from '@angular/router';
import { Store } from '@ngxs/store';
import { ConfigState } from '@abp/ng.core';
@Component({
selector: 'abp-setting-management',
templateUrl: './setting-management.component.html',
})
export class SettingManagementComponent implements OnInit {
settings: SettingTab[] = [];
selected = {} as SettingTab;
trackByFn: TrackByFunction<SettingTab> = (_, item) => item.name;
constructor(private router: Router, private store: Store) {}
ngOnInit() {
if (this.settings.length) {
this.settings = SETTING_TABS.filter(setting =>
this.store.selectSnapshot(ConfigState.getGrantedPolicy(setting.requiredPolicy)),
).sort((a, b) => a.order - b.order);
this.selected = this.settings[0];
}
}
}

@ -1,14 +0,0 @@
import { ABP, eLayoutType } from '@abp/ng.core';
export const SETTING_MANAGEMENT_ROUTES = {
routes: [
{
name: 'Settings',
path: 'setting-management',
parentName: 'AbpUiNavigation::Menu:Administration',
layout: eLayoutType.application,
order: 6,
iconClass: 'fa fa-cog',
},
] as ABP.FullRoute[],
};

@ -1,61 +0,0 @@
import { SettingTab } from '@abp/ng.theme.shared';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Navigate } from '@ngxs/router-plugin';
import { Store, Actions, ofActionSuccessful } from '@ngxs/store';
import { Subject } from 'rxjs';
import { ConfigState, GetAppConfiguration } from '@abp/ng.core';
import { OAuthService } from 'angular-oauth2-oidc';
import { takeUntil } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class SettingManagementService {
settings: SettingTab[] = [];
selected = {} as SettingTab;
private destroy$ = new Subject();
constructor(
private actions: Actions,
private router: Router,
private store: Store,
private oAuthService: OAuthService,
) {
setTimeout(() => this.setSettings(), 0);
this.actions
.pipe(ofActionSuccessful(GetAppConfiguration))
.pipe(takeUntil(this.destroy$))
.subscribe(() => {
if (this.oAuthService.hasValidAccessToken()) {
this.setSettings();
}
});
}
ngOnDestroy() {
this.destroy$.next();
}
setSettings() {
const route = this.router.config.find(r => r.path === 'setting-management');
this.settings = (route.data.settings as SettingTab[])
.filter(setting => this.store.selectSnapshot(ConfigState.getGrantedPolicy(setting.requiredPolicy)))
.sort((a, b) => a.order - b.order);
this.checkSelected();
}
checkSelected() {
this.selected = this.settings.find(setting => setting.url === this.router.url) || ({} as SettingTab);
if (!this.selected.name && this.settings.length) {
this.setSelected(this.settings[0]);
}
}
setSelected(selected: SettingTab) {
this.selected = selected;
this.store.dispatch(new Navigate([selected.url]));
}
}

@ -1,15 +1,13 @@
import { DynamicLayoutComponent } from '@abp/ng.core';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { SETTING_MANAGEMENT_ROUTES } from './constants/routes';
import { SettingLayoutComponent } from './components/setting-layout.component';
import { SettingManagementComponent } from './components/setting-management.component';
import { DynamicLayoutComponent } from '@abp/ng.core';
const routes: Routes = [
{
path: 'setting-management',
path: '',
component: DynamicLayoutComponent,
children: [{ path: '', component: SettingLayoutComponent }],
data: { routes: SETTING_MANAGEMENT_ROUTES, settings: [] },
children: [{ path: '', component: SettingManagementComponent }],
},
];

@ -1,14 +1,11 @@
import { CoreModule } from '@abp/ng.core';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { NgModule } from '@angular/core';
import { SettingLayoutComponent } from './components/setting-layout.component';
import { SettingManagementRoutingModule } from './setting-management-routing.module';
export const SETTING_LAYOUT = SettingLayoutComponent;
import { SettingManagementComponent } from './components/setting-management.component';
@NgModule({
declarations: [SETTING_LAYOUT],
declarations: [SettingManagementComponent],
imports: [SettingManagementRoutingModule, CoreModule, ThemeSharedModule],
entryComponents: [SETTING_LAYOUT],
})
export class SettingManagementModule {}

@ -1,3 +1,2 @@
export * from './lib/setting-management.module';
export * from './lib/constants';
export * from './lib/components/setting-layout.component';
export * from './lib/components/setting-management.component';

@ -0,0 +1 @@
# @abp/ng.tenant-management.config

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/tenant-management-config'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/tenant-management-config",
"lib": {
"entryFile": "src/public-api.ts"
}
}

@ -0,0 +1,7 @@
{
"name": "@abp/ng.tenant-management.config",
"version": "0.0.1",
"publishConfig": {
"access": "public"
}
}

@ -0,0 +1,25 @@
import { Injectable } from '@angular/core';
import { ABP_ROUTES, eLayoutType } from '@abp/ng.core';
@Injectable({
providedIn: 'root',
})
export class TenantManagementConfigService {
constructor() {
ABP_ROUTES.push({
name: 'AbpTenantManagement::Menu:TenantManagement',
path: 'tenant-management',
parentName: 'AbpUiNavigation::Menu:Administration',
layout: eLayoutType.application,
iconClass: 'fa fa-users',
children: [
{
path: 'tenants',
name: 'AbpTenantManagement::Tenants',
order: 1,
requiredPolicy: 'AbpTenantManagement.Tenants',
},
],
});
}
}

@ -0,0 +1,8 @@
import { NgModule, APP_INITIALIZER } from '@angular/core';
import { TenantManagementConfigService } from './services/tenant-management-config.service';
import { noop } from '@abp/ng.core';
@NgModule({
providers: [{ provide: APP_INITIALIZER, deps: [TenantManagementConfigService], useFactory: noop, multi: true }],
})
export class TenantManagementConfigModule {}

@ -0,0 +1,2 @@
export * from './lib/services/tenant-management-config.service';
export * from './lib/tenant-management-config.module';

@ -0,0 +1,21 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

@ -0,0 +1,26 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"abp",
"camelCase"
],
"component-selector": [
true,
"element",
"abp",
"kebab-case"
]
}
}

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

@ -3,7 +3,8 @@
"version": "0.9.0",
"dependencies": {
"@abp/ng.theme.shared": "^0.9.0",
"@abp/ng.feature-management": "^0.9.0"
"@abp/ng.feature-management": "^0.9.0",
"@abp/ng.tenant-management.config": "^0.0.1"
},
"publishConfig": {
"access": "public"

@ -1,5 +1,9 @@
import { ABP, eLayoutType } from '@abp/ng.core';
/**
*
* @deprecated since version 0.9.0
*/
export const TENANT_MANAGEMENT_ROUTES = {
routes: [
{

@ -25,6 +25,10 @@ import { NgxValidateCoreModule } from '@ngx-validate/core';
})
export class TenantManagementModule {}
/**
*
* @deprecated since version 0.9.0
*/
export function TenantManagementProviders(): Provider[] {
return [];
}

@ -176,7 +176,7 @@ export default `
}
to {
transform: translateY(5px);
transform: translateY(0px);
opacity: 1;
}
}

@ -1,6 +1,10 @@
import { Type } from '@angular/core';
export interface SettingTab {
component: Type<any>;
name: string;
order: number;
requiredPolicy?: string;
url?: string;
}
export const SETTING_TABS = [] as SettingTab[];

@ -23,7 +23,10 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": ["src/favicon.ico", "src/assets"],
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
@ -97,7 +100,10 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": ["src/favicon.ico", "src/assets"],
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
@ -112,8 +118,14 @@
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
"exclude": ["**/node_modules/**"]
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
@ -131,5 +143,8 @@
}
}
},
"defaultProject": "myProjectName"
}
"defaultProject": "myProjectName",
"cli": {
"analytics": "07ef29be-2b85-4919-9f78-44994f63b8b7"
}
}

@ -17,14 +17,14 @@
"@abp/ng.identity": "^0.9.0",
"@abp/ng.tenant-management": "^0.9.0",
"@abp/ng.theme.basic": "^0.9.0",
"@angular/animations": "~8.2.2",
"@angular/common": "~8.2.2",
"@angular/compiler": "~8.2.2",
"@angular/core": "~8.2.2",
"@angular/forms": "~8.2.2",
"@angular/platform-browser": "~8.2.2",
"@angular/platform-browser-dynamic": "~8.2.2",
"@angular/router": "~8.2.2",
"@angular/animations": "~8.2.8",
"@angular/common": "~8.2.8",
"@angular/compiler": "~8.2.8",
"@angular/core": "~8.2.8",
"@angular/forms": "~8.2.8",
"@angular/platform-browser": "~8.2.8",
"@angular/platform-browser-dynamic": "~8.2.8",
"@angular/router": "~8.2.8",
"@angularclass/hmr": "^2.1.3",
"@ngxs/devtools-plugin": "^3.5.0",
"@ngxs/hmr-plugin": "^3.5.0",
@ -33,10 +33,10 @@
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.802.2",
"@angular/cli": "~8.2.2",
"@angular/compiler-cli": "~8.2.2",
"@angular/language-service": "~8.2.2",
"@angular-devkit/build-angular": "~0.803.6",
"@angular/cli": "~8.3.6",
"@angular/compiler-cli": "~8.2.8",
"@angular/language-service": "~8.2.8",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",

@ -1,9 +1,6 @@
import { IDENTITY_ROUTES } from '@abp/ng.identity';
import { ACCOUNT_ROUTES } from '@abp/ng.account';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ABP } from '@abp/ng.core';
import { TENANT_MANAGEMENT_ROUTES } from '@abp/ng.tenant-management';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
@ -18,18 +15,15 @@ const routes: Routes = [
{
path: 'account',
loadChildren: () => import('./lazy-libs/account-wrapper.module').then(m => m.AccountWrapperModule),
data: { routes: ACCOUNT_ROUTES },
},
{
path: 'identity',
loadChildren: () => import('./lazy-libs/identity-wrapper.module').then(m => m.IdentityWrapperModule),
data: { routes: IDENTITY_ROUTES },
},
{
path: 'tenant-management',
loadChildren: () =>
import('./lazy-libs/tenant-management-wrapper.module').then(m => m.TenantManagementWrapperModule),
data: { routes: TENANT_MANAGEMENT_ROUTES },
},
];

@ -11,9 +11,9 @@ import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { SharedModule } from './shared/shared.module';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { AccountProviders } from '@abp/ng.account';
import { IdentityProviders } from '@abp/ng.identity';
import { TenantManagementProviders } from '@abp/ng.tenant-management';
import { AccountConfigModule } from '@abp/ng.account.config';
import { IdentityConfigModule } from '@abp/ng.identity.config';
import { TenantManagementConfigModule } from '@abp/ng.tenant-management.config';
@NgModule({
declarations: [AppComponent],
@ -27,13 +27,16 @@ import { TenantManagementProviders } from '@abp/ng.tenant-management';
}),
OAuthModule.forRoot(),
NgxsModule.forRoot([]),
AccountConfigModule.forRoot({ redirectUrl: '/' }),
IdentityConfigModule,
TenantManagementConfigModule,
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
SharedModule,
NgxsReduxDevtoolsPluginModule.forRoot({ disabled: environment.production }),
],
providers: [...AccountProviders({ redirectUrl: '/' }), ...IdentityProviders(), ...TenantManagementProviders()],
bootstrap: [AppComponent],
})
export class AppModule {}

Loading…
Cancel
Save