[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

@@ -18,7 +18,14 @@
import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { Node } from '@alfresco/js-api';
import { Observable, Subject, of } from 'rxjs';
import { CardViewItem, NodesApiService, LogService, CardViewUpdateService, AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
import {
CardViewItem,
NodesApiService,
LogService,
CardViewUpdateService,
AlfrescoApiService,
TranslationService
} from '@alfresco/adf-core';
import { ContentMetadataService } from '../../services/content-metadata.service';
import { CardViewGroup } from '../../interfaces/content-metadata.interfaces';
import { switchMap, takeUntil, catchError } from 'rxjs/operators';
@@ -78,7 +85,8 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
private logService: LogService,
private alfrescoApiService: AlfrescoApiService,
private translationService: TranslationService
) {}
) {
}
ngOnInit() {
this.cardViewUpdateService.itemUpdated$
@@ -112,7 +120,8 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
try {
statusCode = JSON.parse(error.message).error.statusCode;
} catch {}
} catch {
}
let message = `METADATA.ERRORS.${statusCode}`;
@@ -143,12 +152,12 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
return this.nodesApiService.updateNode(this.node.id, nodeBody);
}
showGroup(group: CardViewGroup) {
showGroup(group: CardViewGroup): boolean {
const properties = group.properties.filter((property) => {
return !!property.displayValue;
});
return properties.length;
return properties.length > 0;
}
ngOnDestroy() {

View File

@@ -16,7 +16,7 @@
*/
import { AlfrescoApiServiceMock, AppConfigService, ContentService,
setupTestBed, CoreModule, TranslationMock
setupTestBed, CoreModule, TranslationMock, StorageService
} from '@alfresco/adf-core';
import { FileNode, FolderNode } from '../../mock';
import { ContentActionHandler } from '../models/content-action.model';
@@ -37,7 +37,7 @@ describe('DocumentActionsService', () => {
beforeEach(() => {
const contentService = new ContentService(null, null, null, null);
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null));
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
documentListService = new DocumentListService(contentService, alfrescoApiService, null, null);
service = new DocumentActionsService(null, null, new TranslationMock(), documentListService, contentService);

View File

@@ -16,7 +16,7 @@
*/
import { AlfrescoApiServiceMock, AlfrescoApiService,
AppConfigService, ContentService, setupTestBed, CoreModule, LogService, AppConfigServiceMock } from '@alfresco/adf-core';
AppConfigService, ContentService, setupTestBed, CoreModule, LogService, AppConfigServiceMock, StorageService } from '@alfresco/adf-core';
import { DocumentListService } from './document-list.service';
import { CustomResourcesService } from './custom-resources.service';
@@ -70,7 +70,7 @@ describe('DocumentListService', () => {
beforeEach(() => {
const logService = new LogService(new AppConfigServiceMock(null));
const contentService = new ContentService(null, null, null, null);
alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null));
alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
const customActionService = new CustomResourcesService(alfrescoApiService, logService);
service = new DocumentListService(contentService, alfrescoApiService, logService, customActionService);
jasmine.Ajax.install();

View File

@@ -16,7 +16,8 @@
*/
import { TestBed } from '@angular/core/testing';
import { AlfrescoApiServiceMock, AppConfigService, ContentService, setupTestBed, CoreModule, TranslationMock } from '@alfresco/adf-core';
import { AlfrescoApiServiceMock, AppConfigService, ContentService, setupTestBed,
CoreModule, TranslationMock, StorageService } from '@alfresco/adf-core';
import { Observable } from 'rxjs';
import { FileNode, FolderNode } from '../../mock';
import { ContentActionHandler } from '../models/content-action.model';
@@ -39,7 +40,7 @@ describe('FolderActionsService', () => {
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
const contentService = new ContentService(null, null, null, null);
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null));
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
documentListService = new DocumentListService(contentService, alfrescoApiService, null, null);
service = new FolderActionsService(null, documentListService, contentService, new TranslationMock());
});