mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
content api service (#455)
* introduce content-api service * upgrade files component * upgrade directives * upgrade directives * update directives * fix profile resolver call ordering issue * fix reducer * update services * extra apis * update about page * update preview component * code updates
This commit is contained in:
committed by
Cilibiu Bogdan
parent
ac6e96530f
commit
af547aac31
@@ -28,7 +28,7 @@ import { Observable } from 'rxjs/Rx';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import {
|
||||
NodesApiService, AlfrescoApiService,
|
||||
AlfrescoApiService,
|
||||
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
||||
} from '@alfresco/adf-core';
|
||||
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
@@ -36,11 +36,12 @@ import { ShareDataTableAdapter } from '@alfresco/adf-content-services';
|
||||
import { LibrariesComponent } from './libraries.component';
|
||||
import { ExperimentalDirective } from '../../directives/experimental.directive';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
|
||||
describe('LibrariesComponent', () => {
|
||||
let fixture: ComponentFixture<LibrariesComponent>;
|
||||
let component: LibrariesComponent;
|
||||
let nodesApi: NodesApiService;
|
||||
let contentApi: ContentApiService;
|
||||
let alfrescoApi: AlfrescoApiService;
|
||||
let router: Router;
|
||||
let page;
|
||||
@@ -81,13 +82,14 @@ describe('LibrariesComponent', () => {
|
||||
fixture = TestBed.createComponent(LibrariesComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
nodesApi = TestBed.get(NodesApiService);
|
||||
alfrescoApi = TestBed.get(AlfrescoApiService);
|
||||
alfrescoApi.reset();
|
||||
router = TestBed.get(Router);
|
||||
|
||||
spyOn(alfrescoApi.sitesApi, 'getSites').and.returnValue((Promise.resolve(page)));
|
||||
spyOn(alfrescoApi.peopleApi, 'getSiteMembership').and.returnValue((Promise.resolve({})));
|
||||
|
||||
contentApi = TestBed.get(ContentApiService);
|
||||
});
|
||||
|
||||
describe('makeLibraryTooltip()', () => {
|
||||
@@ -153,7 +155,7 @@ describe('LibrariesComponent', () => {
|
||||
|
||||
it('navigates to node id', () => {
|
||||
const document = { id: 'documentId' };
|
||||
spyOn(nodesApi, 'getNode').and.returnValue(Observable.of(document));
|
||||
spyOn(contentApi, 'getNode').and.returnValue(Observable.of({ entry: document }));
|
||||
|
||||
component.navigate(node.id);
|
||||
|
||||
|
@@ -25,7 +25,6 @@
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { NodesApiService } from '@alfresco/adf-core';
|
||||
import { ShareDataRow } from '@alfresco/adf-content-services';
|
||||
|
||||
import { PageComponent } from '../page.component';
|
||||
@@ -34,15 +33,16 @@ import { AppStore } from '../../store/states/app.state';
|
||||
import { DeleteLibraryAction } from '../../store/actions';
|
||||
import { SiteEntry } from 'alfresco-js-api';
|
||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './libraries.component.html'
|
||||
})
|
||||
export class LibrariesComponent extends PageComponent implements OnInit {
|
||||
|
||||
constructor(private nodesApi: NodesApiService,
|
||||
private route: ActivatedRoute,
|
||||
constructor(private route: ActivatedRoute,
|
||||
private content: ContentManagementService,
|
||||
private contentApi: ContentApiService,
|
||||
store: Store<AppStore>,
|
||||
private router: Router) {
|
||||
super(store);
|
||||
@@ -89,8 +89,9 @@ export class LibrariesComponent extends PageComponent implements OnInit {
|
||||
|
||||
navigate(libraryId: string) {
|
||||
if (libraryId) {
|
||||
this.nodesApi
|
||||
this.contentApi
|
||||
.getNode(libraryId, { relativePath: '/documentLibrary' })
|
||||
.map(node => node.entry)
|
||||
.subscribe(documentLibrary => {
|
||||
this.router.navigate([ './', documentLibrary.id ], { relativeTo: this.route });
|
||||
});
|
||||
|
Reference in New Issue
Block a user