mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACS-6342] AppExtensionService now fetches extension state from BE on login
This commit is contained in:
parent
2d21340947
commit
8b6fb77fe8
@ -18,9 +18,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ExtensionConfig, ExtensionRef } from '../config/extension.config';
|
||||
import { ExtensionService } from '../services/extension.service';
|
||||
import { Observable, BehaviorSubject } from 'rxjs';
|
||||
import { Observable, BehaviorSubject, from } from 'rxjs';
|
||||
import { ViewerExtensionRef } from '../config/viewer.extensions';
|
||||
import { DocumentListPresetRef } from '../config/document-list.extensions';
|
||||
import { AlfrescoApiService, AppConfigService, AuthenticationService } from '@alfresco/adf-core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -29,8 +30,17 @@ export class AppExtensionService {
|
||||
references$: Observable<ExtensionRef[]>;
|
||||
private _references = new BehaviorSubject<ExtensionRef[]>([]);
|
||||
|
||||
constructor(protected extensionService: ExtensionService) {
|
||||
constructor(protected extensionService: ExtensionService, authenticationService: AuthenticationService, appConfigService: AppConfigService, apiService: AlfrescoApiService) {
|
||||
this.references$ = this._references.asObservable();
|
||||
|
||||
authenticationService.onLogin.subscribe(() => {
|
||||
const instanceId = appConfigService.get('instanceId', '1234');
|
||||
|
||||
const requestParams = [{}, {}, {}, {}, {}, ['application/json'], ['application/json']];
|
||||
from(apiService.getInstance().contentClient.callApi(`/settings/${instanceId}`, 'GET', ...requestParams)).subscribe((pluginConfig) => {
|
||||
extensionService.appendConfig(pluginConfig.entry);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async load() {
|
||||
|
@ -109,6 +109,11 @@ export class ExtensionService {
|
||||
return config;
|
||||
}
|
||||
|
||||
appendConfig(partialConfig: ExtensionConfig) {
|
||||
this.config = { ...this.config, ...partialConfig };
|
||||
this.setup(this.config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers extensions from a config object.
|
||||
* @param config Object with config data
|
||||
|
Loading…
x
Reference in New Issue
Block a user