mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
committed by
Eugenio Romano
parent
f528d23aff
commit
c2bdbba0dc
@@ -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>;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
23
lib/extensions/src/lib/store/states/repository.state.ts
Normal file
23
lib/extensions/src/lib/store/states/repository.state.ts
Normal 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;
|
||||
}
|
@@ -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';
|
||||
|
Reference in New Issue
Block a user