[ADF-4457] StorageService should be independent of AppConfigService (#4712)

* [ADF-4457] StorageService should be independent of AppConfigService

* [ADF-4457] Fix e2e tests

* [ADF-4457] Fix e2e tests

* [ADF-4457] Improve storage service workflow

* Fix linting

* Fix unit tests

* Fix e2e test

* Add missing class to constructor

* Fix e2e test

* Rebase branch

* Improve unit test

* fix test
This commit is contained in:
davidcanonieto
2019-06-25 16:21:13 +01:00
committed by Eugenio Romano
parent 90c403ae9e
commit 5c07d5b3e6
29 changed files with 432 additions and 369 deletions

View File

@@ -25,8 +25,9 @@ import {
} from '@alfresco/js-api';
import { AlfrescoApiCompatibility, AlfrescoApiConfig } from '@alfresco/js-api';
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
import { Subject } from 'rxjs';
import { Subject, Observable } from 'rxjs';
import { OauthConfigModel } from '../models/oauth-config.model';
import { StorageService } from './storage.service';
/* tslint:disable:adf-file-name */
@@ -39,6 +40,9 @@ export class AlfrescoApiService {
*/
nodeUpdated = new Subject<Node>();
protected alfrescoApiInitializedSubject: Subject<any>;
alfrescoApiInitialized: Observable<any>;
protected alfrescoApi: AlfrescoApiCompatibility;
lastConfig: AlfrescoApiConfig;
@@ -95,12 +99,18 @@ export class AlfrescoApiService {
return this.getInstance().core.groupsApi;
}
constructor(protected appConfig: AppConfigService) {
constructor(
protected appConfig: AppConfigService,
protected storageService: StorageService) {
this.alfrescoApiInitializedSubject = new Subject();
this.alfrescoApiInitialized = this.alfrescoApiInitializedSubject.asObservable();
}
async load() {
await this.appConfig.load().then(() => {
this.storageService.prefix = this.appConfig.get<string>(AppConfigValues.STORAGE_PREFIX, '');
this.initAlfrescoApi();
this.alfrescoApiInitializedSubject.next();
});
}