mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
migrate document list to new api
This commit is contained in:
parent
aa848e271e
commit
7396a57e5c
@ -24,7 +24,7 @@
|
||||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
|
||||
<script src="/app/js/xml2json.js"></script>
|
||||
<script src="node_modules/alfresco-js-api/bundle.js"></script>
|
||||
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
||||
|
||||
<script src="node_modules/pdfjs-dist/build/pdf.js"></script>
|
||||
<script src="node_modules/pdfjs-dist/build/pdf.worker.js"></script>
|
||||
|
@ -41,6 +41,10 @@
|
||||
{
|
||||
"name": "Mario Romano",
|
||||
"email": "mario.romano83@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Eugenio Romano",
|
||||
"email": "eugenio.romano@alfresco.com"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
|
@ -90,6 +90,10 @@ export class AlfrescoAuthenticationService extends AlfrescoAuthenticationBase {
|
||||
});
|
||||
}
|
||||
|
||||
getAlfrescoApi(): any {
|
||||
return this.alfrescoApi;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method return tru if the user is logged in
|
||||
* @returns {boolean}
|
||||
|
@ -30,8 +30,8 @@ export class AlfrescoContentService {
|
||||
* @param document Node to get URL for.
|
||||
* @returns {string} URL address.
|
||||
*/
|
||||
getDocumentThumbnailUrl(document: any) {
|
||||
this.authService.alfrescoApi.getDocumentThumbnailUrl(document.entry.id);
|
||||
getDocumentThumbnailUrl(document: any): string {
|
||||
return this.authService.alfrescoApi.getDocumentThumbnailUrl(document.entry.id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,7 +39,7 @@ export class AlfrescoContentService {
|
||||
* @param document Node to get URL for.
|
||||
* @returns {string} URL address.
|
||||
*/
|
||||
getContentUrl(document: any) {
|
||||
this.authService.alfrescoApi.getContentUrl(document.entry.id);
|
||||
getContentUrl(document: any): string {
|
||||
return this.authService.alfrescoApi.getContentUrl(document.entry.id);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
|
||||
<!-- Additional Alfresco libraries -->
|
||||
<script src="node_modules/alfresco-js-api/bundle.js"></script>
|
||||
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
||||
|
||||
<script src="systemjs.config.js"></script>
|
||||
<script>
|
||||
|
@ -39,10 +39,10 @@
|
||||
"material-design-lite": "1.1.3",
|
||||
"ng2-translate": "2.2.2",
|
||||
|
||||
"alfresco-js-api": "^0.1.0",
|
||||
"ng2-alfresco-core": "^0.1.36",
|
||||
"ng2-alfresco-documentlist": "^0.1.34",
|
||||
"ng2-alfresco-datatable": "^0.1.17"
|
||||
"alfresco-js-api": "0.1.0",
|
||||
"ng2-alfresco-core": "0.1.36",
|
||||
"ng2-alfresco-documentlist": "0.1.34",
|
||||
"ng2-alfresco-datatable": "0.1.17"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "2.0.0",
|
||||
|
@ -48,6 +48,10 @@
|
||||
{
|
||||
"name": "Mario Romano",
|
||||
"email": "mario.romano83@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Eugenio Romano",
|
||||
"email": "eugenio.romano@alfresco.com"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
|
@ -68,26 +68,21 @@ export class DocumentListService {
|
||||
) {
|
||||
}
|
||||
|
||||
private getAlfrescoClient() {
|
||||
return AlfrescoApi.getClientWithTicket(this.settings.getApiBaseUrl(), this.authService.getToken());
|
||||
private getAlfrescoApi() {
|
||||
return this.authService.getAlfrescoApi();
|
||||
}
|
||||
|
||||
private getNodesPromise(folder: string) {
|
||||
let alfrescoClient = this.getAlfrescoClient();
|
||||
let apiInstance = new AlfrescoApi.Core.NodesApi(alfrescoClient);
|
||||
let nodeId = '-root-';
|
||||
let opts = {
|
||||
relativePath: folder,
|
||||
include: ['path']
|
||||
};
|
||||
return apiInstance.getNodeChildren(nodeId, opts);
|
||||
return this.getAlfrescoApi().getNodeChildren(nodeId, opts);
|
||||
}
|
||||
|
||||
deleteNode(nodeId: string) {
|
||||
let client = this.getAlfrescoClient();
|
||||
let nodesApi = new AlfrescoApi.Core.NodesApi(client);
|
||||
let opts = {};
|
||||
return Observable.fromPromise(nodesApi.deleteNode(nodeId, opts));
|
||||
return Observable.fromPromise(this.getAlfrescoApi().deleteNode(nodeId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ import { EventMock } from './assets/event.mock';
|
||||
let element = fixture.nativeElement;
|
||||
let component = fixture.componentInstance;
|
||||
component.urlFile = 'http://localhost:9876/fake-url-file.pdf';
|
||||
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#viewer-name-file').innerHTML).toEqual('fake-url-file.pdf');
|
||||
|
Loading…
x
Reference in New Issue
Block a user