mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
Improved type safety
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
HostListener
|
||||
} from '@angular/core';
|
||||
import { Subject } from 'rxjs/Rx';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import {
|
||||
CONTEXT_MENU_DIRECTIVES,
|
||||
AlfrescoTranslationService
|
||||
@@ -43,7 +44,6 @@ import {
|
||||
} from 'ng2-alfresco-datatable';
|
||||
|
||||
import { DocumentListService } from './../services/document-list.service';
|
||||
import { MinimalNodeEntity } from './../models/document-library.model';
|
||||
import { ContentActionModel } from './../models/content-action.model';
|
||||
import {
|
||||
ShareDataTableAdapter,
|
||||
|
@@ -24,7 +24,8 @@ import {
|
||||
import {
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoAuthenticationService,
|
||||
AlfrescoContentService
|
||||
AlfrescoContentService,
|
||||
AlfrescoApiService
|
||||
} from 'ng2-alfresco-core';
|
||||
import { FileNode } from '../assets/document-library.model.mock';
|
||||
import { ReflectiveInjector } from '@angular/core';
|
||||
@@ -42,6 +43,7 @@ describe('DocumentListService', () => {
|
||||
beforeEach(() => {
|
||||
injector = ReflectiveInjector.resolveAndCreate([
|
||||
HTTP_PROVIDERS,
|
||||
AlfrescoApiService,
|
||||
AlfrescoAuthenticationService,
|
||||
AlfrescoSettingsService
|
||||
]);
|
||||
|
@@ -18,14 +18,12 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Response } from '@angular/http';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { NodePaging, MinimalNodeEntity } from './../models/document-library.model';
|
||||
import { AlfrescoJsApi, NodePaging, MinimalNodeEntity } from 'alfresco-js-api';
|
||||
import {
|
||||
AlfrescoAuthenticationService,
|
||||
AlfrescoContentService
|
||||
} from 'ng2-alfresco-core';
|
||||
|
||||
declare let AlfrescoApi: any;
|
||||
|
||||
@Injectable()
|
||||
export class DocumentListService {
|
||||
|
||||
@@ -66,11 +64,11 @@ export class DocumentListService {
|
||||
) {
|
||||
}
|
||||
|
||||
private getAlfrescoApi() {
|
||||
private getAlfrescoApi(): AlfrescoJsApi {
|
||||
return this.authService.getAlfrescoApi();
|
||||
}
|
||||
|
||||
private getNodesPromise(folder: string, opts?: any) {
|
||||
private getNodesPromise(folder: string, opts?: any): Promise<NodePaging> {
|
||||
let nodeId = '-root-';
|
||||
let params: any = {
|
||||
relativePath: folder,
|
||||
@@ -86,11 +84,11 @@ export class DocumentListService {
|
||||
}
|
||||
}
|
||||
|
||||
return this.getAlfrescoApi().node.getNodeChildren(nodeId, params);
|
||||
return this.getAlfrescoApi().nodes.getNodeChildren(nodeId, params);
|
||||
}
|
||||
|
||||
deleteNode(nodeId: string) {
|
||||
return Observable.fromPromise(this.getAlfrescoApi().node.deleteNode(nodeId));
|
||||
deleteNode(nodeId: string): Observable<any> {
|
||||
return Observable.fromPromise(this.getAlfrescoApi().nodes.deleteNode(nodeId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user