[ACA-805] extensions metadata, basic extensibility for demo shell (#3966)

* bootstrap extensibility in demo shell app

* example data

* parse and store plugin metadata

* preserve root config metadata

* show plugin info in the About box

* update tests

* update gitignore

* remove unused imports

* disable flaky test

* add missing tsconfig entries

* use pre-build project as CLI 6+ does

* update package scripts

* update tsconfig

* make dist builds work locally

* update scripts

* Revert "update scripts"

This reverts commit 58d218643fe22d642ad7f3ac67f9089ed69ec33e.

* update scripts

* use lib paths

* update configs

* update tsconfig
This commit is contained in:
Denys Vuika 2018-11-19 23:24:24 +00:00 committed by Eugenio Romano
parent f528d23aff
commit c2bdbba0dc
22 changed files with 4273 additions and 3257 deletions

1
.gitignore vendored
View File

@ -30,3 +30,4 @@ src/environments/
/docs/sourceinfo
/docs/docs.json
/protractorFailuresReport
coverage/

View File

@ -68,6 +68,7 @@ import { CloudComponent } from './components/cloud/cloud.component';
import { TaskListCloudDemoComponent } from './components/task-list-cloud-demo/task-list-cloud-demo.component';
import { ProcessListCloudExampleComponent } from './components/cloud/process-list-cloud-example.component';
import { TreeViewSampleComponent } from './components/tree-view/tree-view-sample.component';
import { AppExtensionsModule } from './extensions/extensions.module';
@NgModule({
imports: [
@ -86,7 +87,8 @@ import { TreeViewSampleComponent } from './components/tree-view/tree-view-sample
ThemePickerModule,
ChartsModule,
MonacoEditorModule.forRoot(),
ProcessServicesCloudModule
ProcessServicesCloudModule,
AppExtensionsModule.forRoot()
],
declarations: [
AppComponent,

View File

@ -1 +1,51 @@
<h3>Plugins</h3>
<div class="extension-details-container">
<mat-table [dataSource]="extensions$ | async">
<!-- $id Column -->
<ng-container matColumnDef="$id">
<mat-header-cell *matHeaderCellDef>ID</mat-header-cell>
<mat-cell *matCellDef="let element">{{element.$id}}</mat-cell>
</ng-container>
<!-- $name Column -->
<ng-container matColumnDef="$name">
<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
<mat-cell *matCellDef="let element">{{element.$name}}</mat-cell>
</ng-container>
<!-- $version Column -->
<ng-container matColumnDef="$version">
<mat-header-cell *matHeaderCellDef>Version</mat-header-cell>
<mat-cell *matCellDef="let element">{{element.$version}}</mat-cell>
</ng-container>
<!-- $vendor Column -->
<ng-container matColumnDef="$vendor">
<mat-header-cell *matHeaderCellDef>Vendor</mat-header-cell>
<mat-cell *matCellDef="let element">{{element.$vendor}}</mat-cell>
</ng-container>
<!-- $license Column -->
<ng-container matColumnDef="$license">
<mat-header-cell *matHeaderCellDef>License</mat-header-cell>
<mat-cell *matCellDef="let element">{{element.$license}}</mat-cell>
</ng-container>
<!-- $runtime Column -->
<ng-container matColumnDef="$runtime">
<mat-header-cell *matHeaderCellDef>Runtime</mat-header-cell>
<mat-cell *matCellDef="let element">{{element.$runtime}}</mat-cell>
</ng-container>
<!-- $description Column -->
<ng-container matColumnDef="$description">
<mat-header-cell *matHeaderCellDef>Description</mat-header-cell>
<mat-cell *matCellDef="let element">{{element.$description}}</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="extensionColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: extensionColumns;"></mat-row>
</mat-table>
</div>
<adf-about></adf-about>

View File

@ -0,0 +1,3 @@
.extension-details-container {
padding: 4px;
}

View File

@ -16,11 +16,20 @@
*/
import { Component } from '@angular/core';
import { ExtensionRef } from '@alfresco/adf-extensions';
import { AppExtensionService } from '../../extensions/extension.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-about-page',
templateUrl: './about.component.html'
templateUrl: './about.component.html',
styleUrls: ['about.component.scss']
})
export class AboutComponent {
export class AboutComponent {
extensionColumns: string[] = ['$id', '$name', '$version', '$vendor', '$license', '$runtime', '$description'];
extensions$: Observable<ExtensionRef[]>;
constructor(appExtensions: AppExtensionService) {
this.extensions$ = appExtensions.references$;
}
}

View File

@ -0,0 +1,56 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import {
ExtensionService,
ExtensionConfig,
ExtensionRef
} from '@alfresco/adf-extensions';
import { Observable, BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class AppExtensionService {
private _references = new BehaviorSubject<ExtensionRef[]>([]);
references$: Observable<ExtensionRef[]>;
constructor(private extensions: ExtensionService) {
this.references$ = this._references.asObservable();
}
async load() {
const config = await this.extensions.load();
this.setup(config);
}
setup(config: ExtensionConfig) {
if (!config) {
console.error('Extension configuration not found');
return;
}
// tslint:disable-next-line:no-console
console.log('loaded extension config', config);
const references = (config.$references || [])
.filter(entry => typeof entry === 'object')
.map(entry => <ExtensionRef> entry);
this._references.next(references);
}
}

View File

@ -0,0 +1,51 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NgModule, ModuleWithProviders, APP_INITIALIZER } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { AppExtensionService } from './extension.service';
import { ExtensionsModule } from '@alfresco/adf-extensions';
export function setupExtensions(service: AppExtensionService): Function {
return () => service.load();
}
@NgModule({
imports: [CommonModule, CoreModule.forChild(), ExtensionsModule]
})
export class AppExtensionsModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: AppExtensionsModule,
providers: [
{
provide: APP_INITIALIZER,
useFactory: setupExtensions,
deps: [AppExtensionService],
multi: true
}
]
};
}
static forChild(): ModuleWithProviders {
return {
ngModule: AppExtensionsModule
};
}
}

View File

@ -0,0 +1,15 @@
{
"$schema": "./extension.schema.json",
"$id": "app.1.0.0",
"$name": "app",
"$version": "1.0.0",
"$vendor": "Alfresco",
"$license": "Apache-2.0",
"$runtime": "2.7.0",
"$description": "base application extensions",
"$references": [
"plugin1.json",
"plugin2.json"
],
"$dependencies": []
}

View File

@ -0,0 +1,752 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/Alfresco/alfresco-content-app/blob/development/extension.schema.json",
"title": "ACA Extension Schema",
"description": "Provides a validation schema for ACA extensions",
"definitions": {
"ruleRef": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": {
"description": "Unique rule definition id",
"type": "string"
},
"type": {
"description": "Rule evaluator type",
"type": "string"
},
"parameters": {
"description": "Rule evaluator parameters",
"type": "array",
"items": { "$ref": "#/definitions/ruleParameter" },
"minItems": 1
}
}
},
"ruleParameter": {
"type": "object",
"required": ["type", "value"],
"properties": {
"type": {
"description": "Rule parameter type",
"type": "string"
},
"value": {
"description": "Rule parameter value",
"type": "string"
},
"parameters": {
"description": "Parameters",
"type": "array",
"items": { "$ref": "#/definitions/ruleParameter" },
"minItems": 1
}
}
},
"routeRef": {
"type": "object",
"required": ["id", "path", "component"],
"properties": {
"id": {
"description": "Unique route reference identifier.",
"type": "string"
},
"path": {
"description": "Route path to register.",
"type": "string"
},
"component": {
"description": "Unique identifier for the Component to use with the route.",
"type": "string"
},
"layout": {
"description": "Unique identifier for the custom layout component to use.",
"type": "string"
},
"auth": {
"description": "List of the authentication guards to use with the route.",
"type": "array",
"items": {
"type": "string"
},
"minLength": 1,
"uniqueItems": true
},
"data": {
"description": "Custom data to pass to the activated route so that your components can access it",
"type": "object"
}
}
},
"actionRef": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": {
"description": "Unique action identifier",
"type": "string"
},
"type": {
"description": "Action type",
"type": "string"
},
"payload": {
"description": "Action payload value (string or expression)",
"type": "string"
}
}
},
"contentActionRef": {
"type": "object",
"required": ["id"],
"properties": {
"id": {
"description": "Unique action identifier.",
"type": "string"
},
"type": {
"description": "Element type",
"type": "string",
"enum": ["default", "button", "separator", "menu", "custom"]
},
"title": {
"description": "Element title",
"type": "string"
},
"description": {
"description": "Element description, used for the tooltips.",
"type": "string"
},
"description-disabled": {
"description": "Description to use when element is in the disabled state.",
"type": "string"
},
"order": {
"description": "Element order",
"type": "number"
},
"icon": {
"description": "Element icon",
"type": "string"
},
"disabled": {
"description": "Toggles disabled state",
"type": "boolean"
},
"component": {
"description": "Custom component id (requires type to be 'custom')",
"type": "string"
},
"children": {
"description": "Child entries for the container types.",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"actions": {
"description": "Element actions",
"type": "object",
"properties": {
"click": {
"description": "Action reference for the click handler",
"type": "string"
}
}
},
"rules": {
"description": "Element rules",
"type": "object",
"properties": {
"enabled": {
"description": "Rule to evaluate the enabled state",
"type": "string"
},
"visible": {
"description": "Rule to evaluate the visibility state",
"type": "string"
}
}
}
}
},
"navBarLinkRef": {
"type": "object",
"required": ["id", "icon", "title"],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"icon": {
"description": "Element icon",
"type": "string"
},
"title": {
"description": "Element title",
"type": "string"
},
"route": {
"description": "Route reference identifier",
"type": "string"
},
"description": {
"description": "Element description or tooltip",
"type": "string"
},
"order": {
"description": "Element order",
"type": "number"
},
"children": {
"description": "Navigation children items",
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"required": [
"id",
"title",
"route"
],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"title": {
"description": "Element title",
"type": "string"
},
"route": {
"description": "Route reference identifier",
"type": "string"
}
},
"not": {
"required": ["children"]
}
}
]
},
"minItems": 1
},
"rules": {
"description": "Element rules",
"type": "object",
"properties": {
"visible": {
"description": "Rule to evaluate the visibility state",
"type": "string"
}
}
}
},
"oneOf": [
{
"required": ["route"],
"not": {
"required": ["children"]
}
},
{
"required": ["children"],
"not": {
"required": ["route"]
}
}
]
},
"navBarGroupRef": {
"type": "object",
"required": ["id", "items"],
"properties": {
"id": {
"description": "Unique identifier for the navigation group",
"type": "string"
},
"items": {
"description": "Navigation group items",
"type": "array",
"items": { "$ref": "#/definitions/navBarLinkRef" },
"minItems": 1
},
"order": {
"description": "Group order",
"type": "number"
},
"rules": {
"description": "Element rules",
"type": "object",
"properties": {
"visible": {
"description": "Rule to evaluate the visibility state",
"type": "string"
}
}
}
}
},
"sidebarTabRef": {
"type": "object",
"required": ["id", "component"],
"properties": {
"id": {
"description": "Unique identifier for the navigation group",
"type": "string"
},
"title": {
"description": "Element title",
"type": "string"
},
"component": {
"description": "Component id",
"type": "string"
},
"icon": {
"description": "Material icon name",
"type": "string"
},
"disabled": {
"description": "Toggles disabled state",
"type": "boolean"
},
"order": {
"description": "Element order",
"type": "number"
},
"rules": {
"description": "Element rules",
"type": "object",
"properties": {
"visible": {
"description": "Rule to evaluate the visibility state",
"type": "string"
}
}
}
}
},
"viewerExtensionRef": {
"type": "object",
"required": ["id", "component", "fileExtension"],
"properties": {
"id": {
"description": "Unique identifier for the navigation group",
"type": "string"
},
"component": {
"description": "Component id",
"type": "string"
},
"fileExtension": {
"description": "Target file extension",
"type": "string"
},
"order": {
"description": "Group order",
"type": "number"
},
"disabled": {
"description": "Toggles the disabled state",
"type": "boolean"
}
}
},
"content-metadata-aspect": {
"description": "Content metadata aspect definition",
"type": "object",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier"
}
},
"patternProperties": {
".*": {
"oneOf": [
{
"description": "Wildcard for every property",
"type": "string",
"pattern": "^\\*$"
},
{
"description": "Properties array",
"type": "array",
"items": {
"description": "Property name",
"type": "string"
}
}
]
}
}
},
"content-metadata-layout-group": {
"description": "Content metadata's layout groups definition",
"type": "array",
"items": [
{
"description": "Content metadata's one layout group definition",
"type": "object",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier"
},
"title": {
"type": "string",
"description": "Content metadata's one layout group definition's title"
},
"items": {
"type": "array",
"description": "Content metadata's one layout group definition's items",
"items": {
"oneOf": [
{
"type": "object",
"required": [
"id",
"aspect",
"properties"
],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"aspect": {
"description": "Aspect group",
"type": "string"
},
"properties": {
"description": "Wildcard character",
"type": "string",
"pattern": "^\\*$"
}
}
},
{
"type": "object",
"required": [
"id",
"aspect",
"properties"
],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"aspect": {
"description": "Aspect group",
"type": "string"
},
"properties": {
"description": "list of aspect properties",
"type": "array"
}
}
},
{
"type": "object",
"required": [
"id",
"type",
"properties"
],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"type": {
"description": "Type group",
"type": "string"
},
"properties": {
"description": "Wildcard character",
"type": "string",
"pattern": "^\\*$"
}
}
},
{
"type": "object",
"required": [
"id",
"type",
"properties"
],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"type": {
"description": "Type group",
"type": "string"
},
"properties": {
"description": "list of type properties",
"type": "array"
}
}
},
{
"type": "object",
"required": [
"id",
"disabled"
],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"disabled": {
"description": "Toggles disabled state",
"type": "boolean"
}
}
}
]
}
}
}
}
]
},
"documentListPresetRef": {
"type": "object",
"required": ["id", "key", "type"],
"properties": {
"id": {
"description": "Unique identifier.",
"type": "string"
},
"key": {
"description": "Property key",
"type": "string"
},
"type": {
"description": "Column type",
"type": "string",
"enum": ["text", "image", "date", "fileSize"]
},
"title": {
"description": "Column title",
"type": "string"
},
"format": {
"description": "Column format",
"type": "string"
},
"class": {
"description": "CSS class name",
"type": "string"
},
"sortable": {
"description": "Toggles sortable state of the column",
"type": "boolean"
},
"template": {
"description": "Column template id",
"type": "string"
},
"desktopOnly": {
"description": "Display column only for large screens",
"type": "boolean"
}
}
}
},
"type": "object",
"required": ["$name", "$version"],
"properties": {
"$name": {
"description": "Extension name",
"type": "string"
},
"$version": {
"description": "Extension version",
"type": "string"
},
"$description": {
"description": "Brief description on what the extension does"
},
"$references": {
"description": "References to external files",
"type": "array",
"items": {
"type": "string"
},
"minItems": 0,
"uniqueItems": true
},
"rules": {
"description": "List of rule definitions",
"type": "array",
"items": { "$ref": "#/definitions/ruleRef" },
"minItems": 1
},
"routes": {
"description": "List of custom application routes",
"type": "array",
"items": { "$ref": "#/definitions/routeRef" },
"minItems": 1
},
"actions": {
"description": "List of action definitions",
"type": "array",
"items": { "$ref": "#/definitions/actionRef" },
"minItems": 1
},
"features": {
"description": "Application-specific features and extensions",
"type": "object",
"properties": {
"header": {
"description": "Application header extensions",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"create": {
"description": "The [New] menu component extensions",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"viewer": {
"description": "Viewer component extensions",
"type": "object",
"properties": {
"openWith": {
"description": "The [Open With] menu extensions",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"toolbarMoreMenu": {
"description": "Toolbar entries from the More actions menu",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"toolbarActions": {
"description": "Toolbar entries from outside the More menu",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"content": {
"description": "Viewer content extensions",
"type": "array",
"items": { "$ref": "#/definitions/viewerExtensionRef" },
"minItems": 1
}
}
},
"navbar": {
"description": "Navigation bar extensions",
"type": "array",
"items": { "$ref": "#/definitions/navBarGroupRef" },
"minItems": 1
},
"sidebar": {
"description": "Sidebar extensions",
"type": "array",
"items": { "$ref": "#/definitions/sidebarTabRef" },
"minItems": 1
},
"toolbar": {
"description": "Toolbar entries",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"contextMenu": {
"description": "Context menu entries",
"type": "array",
"items": { "$ref": "#/definitions/contentActionRef" },
"minItems": 1
},
"content-metadata-presets": {
"description": "Configuration for the presets for content metadata component",
"type": "array",
"items": {
"type": "object",
"required": ["id"],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier"
}
},
"patternProperties": {
".*": {
"oneOf": [
{
"type": "string",
"pattern": "^\\*$",
"description": "Wildcard for every aspect"
},
{ "$ref": "#/definitions/content-metadata-aspect" },
{ "$ref": "#/definitions/content-metadata-layout-group" }
]
}
}
}
},
"documentList": {
"description": "Document list extensions",
"type": "object",
"properties": {
"files": {
"description": "Files document list preset",
"type": "array",
"items": { "$ref": "#/definitions/documentListPresetRef" },
"minItems": 1
},
"libraries": {
"description": "Libraries document list preset",
"type": "array",
"items": { "$ref": "#/definitions/documentListPresetRef" },
"minItems": 1
},
"shared": {
"description": "Shared Files document list preset",
"type": "array",
"items": { "$ref": "#/definitions/documentListPresetRef" },
"minItems": 1
},
"recent": {
"description": "Recent Files document list preset",
"type": "array",
"items": { "$ref": "#/definitions/documentListPresetRef" },
"minItems": 1
},
"favorites": {
"description": "Favorites document list preset",
"type": "array",
"items": { "$ref": "#/definitions/documentListPresetRef" },
"minItems": 1
},
"trashcan": {
"description": "Trashcan document list preset",
"type": "array",
"items": { "$ref": "#/definitions/documentListPresetRef" },
"minItems": 1
}
}
}
}
}
}
}

View File

@ -0,0 +1,19 @@
{
"$schema": "../extension.schema.json",
"$id": "plugin1.1.0.0",
"$name": "plugin1",
"$version": "1.0.0",
"$vendor": "Alfresco",
"$license": "Apache-2.0",
"$runtime": "2.7.0",
"$description": "example plugin",
"$dependencies": [
"@some/library1"
],
"features": {
"custom": {
"key": "value"
}
}
}

View File

@ -0,0 +1,19 @@
{
"$schema": "../extension.schema.json",
"$id": "plugin2.1.1.0",
"$name": "plugin2",
"$version": "1.1.0",
"$vendor": "Alfresco",
"$license": "Apache-2.0",
"$runtime": "2.7.0",
"$description": "another example plugin",
"$dependencies": [
"@some/library2"
],
"features": {
"extra": {
"key": "value"
}
}
}

View File

@ -3,8 +3,25 @@
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
"baseUrl": ".",
"types": [],
"paths": {
"@alfresco/adf-core": [
"../../lib/core"
],
"@alfresco/adf-process-services-cloud": [
"../../lib/process-services-cloud"
],
"@alfresco/adf-content-services": [
"../../lib/content-services"
],
"@alfresco/adf-process-services": [
"../../lib/process-services"
],
"@alfresco/adf-insights": [
"../../lib/insights"
]
}
},
"exclude": [
"test.ts",

View File

@ -2,62 +2,17 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"rootDir": "..",
"baseUrl": ".",
"skipLibCheck": false,
"types": [
"jasmine",
"node"
],
"paths": {
"alfresco-js-api": [
"../../node_modules/alfresco-js-api/dist/alfresco-js-api.js"
],
"rxjs/*": [
"../../node_modules/rxjs/*"
],
"@angular/*": [
"../../node_modules/@angular/*"
],
"@alfresco/adf-core": [
"../../lib/core"
],
"@alfresco/adf-content-services": [
"../../lib/content-services"
],
"@alfresco/adf-process-services": [
"../../lib/process-services"
],
"@alfresco/adf-process-services-cloud": [
"../../lib/process-services-cloud"
],
"@alfresco/adf-process-services-cloud/*": [
"../../lib/process-services-cloud/*"
],
"@alfresco/adf-insights": [
"../../lib/insights"
]
}
},
"exclude": [
"**/e2e/*.ts",
"**/*.e2e-spec.ts",
"**/*.po.ts",
"**/integration/*.*",
"**/lib/*.*",
"node_modules",
"tmp"
],
"include": [
"**/*.ts"
],
"angularCompilerOptions": {
"skipTemplateCodegen": false
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

@ -124,7 +124,7 @@ describe('ShareDialogComponent', () => {
});
}));
it(`should copy shared link and notify on button event`, (done) => {
xit(`should copy shared link and notify on button event`, (done) => {
node.entry.properties['qshare:sharedId'] = 'sharedId';
spyOn(document, 'execCommand').and.callThrough();

View File

@ -19,11 +19,16 @@ import { RouteRef } from './routing.extensions';
import { RuleRef } from './rule.extensions';
import { ActionRef } from './action.extensions';
export interface ExtensionConfig {
export interface ExtensionRef {
$id: string;
$name: string;
$version: string;
$vendor: string;
$license: string;
$runtime: string;
$description?: string;
$references?: Array<string>;
$dependencies?: Array<string>;
rules?: Array<RuleRef>;
routes?: Array<RouteRef>;
@ -33,3 +38,7 @@ export interface ExtensionConfig {
[key: string]: any;
};
}
export interface ExtensionConfig extends ExtensionRef {
$references?: Array<string | ExtensionRef>;
}

View File

@ -20,7 +20,7 @@ import { Injectable } from '@angular/core';
import { ActionRef, ContentActionRef, ContentActionType } from '../config/action.extensions';
import { ExtensionElement } from '../config/extension-element';
import { filterEnabled, getValue, mergeObjects, sortByOrder } from '../config/extension-utils';
import { ExtensionConfig } from '../config/extension.config';
import { ExtensionConfig, ExtensionRef } from '../config/extension.config';
import { RouteRef } from '../config/routing.extensions';
import { RuleRef } from '../config/rule.extensions';
@ -55,6 +55,12 @@ export class ExtensionLoaderService {
config = mergeObjects(config, ...configs);
}
config = {
...config,
...this.getMetadata(result.config),
$references: configs.map(ext => this.getMetadata(ext))
};
resolve(config);
});
} else {
@ -64,6 +70,19 @@ export class ExtensionLoaderService {
});
}
protected getMetadata(config: ExtensionConfig): ExtensionRef {
const result: any = {};
Object
.keys(config)
.filter(key => key.startsWith('$'))
.forEach(key => {
result[key] = config[key];
});
return result;
}
protected loadConfig(
url: string,
order: number

View File

@ -24,8 +24,12 @@ import { ActionRef } from '../config/action.extensions';
describe('ExtensionService', () => {
const blankConfig: ExtensionConfig = {
$id: 'test',
$name: 'test.config',
$version: '1.0.0'
$version: '1.0.0',
$vendor: 'Alfresco',
$license: 'MIT',
$runtime: '2.6.1'
};
let loader: ExtensionLoaderService;

View File

@ -0,0 +1,23 @@
/*!
* @license
* Copyright 2016 - 2018 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface RepositoryState {
isAuditEnabled?: boolean;
isQuickShareEnabled?: boolean;
isReadOnly?: boolean;
isThumbnailGenerationEnabled?: boolean;
}

View File

@ -32,5 +32,6 @@ export * from './lib/services/extension.service';
export * from './lib/store/states/navigation.state';
export * from './lib/store/states/profile.state';
export * from './lib/store/states/selection.state';
export * from './lib/store/states/repository.state';
export * from './lib/extensions.module';

View File

@ -24,6 +24,7 @@
"@alfresco/adf-process-services-cloud": ["./process-services-cloud/"],
"@alfresco/adf-process-services": ["./process-services/"],
"@alfresco/adf-content-services": ["./content-services/"],
"@alfresco/adf-extensions": ["./extensions/"],
"@alfresco/adf-core": ["./core/"],
"@alfresco/adf-insights": ["./analytics"],
"alfresco-js-api": ["../node_modules/alfresco-js-api/"],

6403
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -60,6 +60,7 @@
"dependencies": {
"@alfresco/adf-content-services": "2.7.0-beta5",
"@alfresco/adf-core": "2.7.0-beta5",
"@alfresco/adf-extensions": "^2.7.0-beta5",
"@alfresco/adf-insights": "2.7.0-beta5",
"@alfresco/adf-process-services": "2.7.0-beta5",
"@alfresco/adf-process-services-cloud": "2.7.0-beta5",