[ADF-4125] simplify extension load in extension module (#4214)

* add extension load in extension module

* add viewer extensions

* fix license header

* fix node passed in the viewer extension

* fix node passed in the viewer extension

* startup factory extension

* startup factory extension

* fix script

* fix beta tag build

* fix build

* fix build

* refactoring configuration files

* extension using map

* fix build

* fix config

* fix test

* fix test
This commit is contained in:
Eugenio Romano
2019-02-22 14:19:41 +00:00
committed by GitHub
parent bf4d1a2806
commit bda7e07b52
92 changed files with 1035 additions and 785 deletions

View File

@@ -34,6 +34,7 @@ export class ExtensionService {
rules: Array<RuleRef> = [];
routes: Array<RouteRef> = [];
actions: Array<ActionRef> = [];
features: Array<any> = [];
authGuards: { [key: string]: Type<{}> } = {};
evaluators: { [key: string]: RuleEvaluator } = {};
@@ -41,7 +42,8 @@ export class ExtensionService {
constructor(
private loader: ExtensionLoaderService,
private componentRegister: ComponentRegisterService
) {}
) {
}
/**
* Loads and registers an extension config file and plugins (specified by path properties).
@@ -75,6 +77,12 @@ export class ExtensionService {
this.rules = this.loader.getRules(config);
this.actions = this.loader.getActions(config);
this.routes = this.loader.getRoutes(config);
this.features = this.loader.getFeatures(config);
}
getFeature(key: string): any[] {
let properties: string[] = Array.isArray(key) ? [key] : key.split('.');
return properties.reduce((prev, curr) => prev && prev[curr], this.features) || [];
}
/**