mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Update from development branch
This commit is contained in:
@@ -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>
|
||||
|
@@ -1,58 +1,56 @@
|
||||
{
|
||||
"name": "ng2-alfresco-documentlist-demo",
|
||||
"description": "Alfresco Angular2 Documentlist Component - Demo",
|
||||
"version": "0.1.0",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
"typings": "typings install",
|
||||
"postinstall": "npm run typings && npm run build",
|
||||
"start": "concurrently \"npm run build:w\" \"npm run server\" ",
|
||||
"server": "wsrv -o -s -l",
|
||||
"build": "npm run tslint && rimraf dist && tsc",
|
||||
"build:w": "npm run tslint && rimraf dist && tsc -w",
|
||||
"tslint": "npm run tslint-src && npm run tslint-root",
|
||||
"tslint-src": "tslint -c tslint.json src/{,**/}**.ts",
|
||||
"tslint-root": "tslint -c tslint.json *.ts"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@angular/common": "2.0.0-rc.3",
|
||||
"@angular/compiler": "2.0.0-rc.3",
|
||||
"@angular/core": "2.0.0-rc.3",
|
||||
"@angular/forms": "0.1.1",
|
||||
"@angular/http": "2.0.0-rc.3",
|
||||
"@angular/platform-browser": "2.0.0-rc.3",
|
||||
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
|
||||
"@angular/router": "3.0.0-alpha.7",
|
||||
"@angular/router-deprecated": "2.0.0-rc.2",
|
||||
"@angular/upgrade": "2.0.0-rc.3",
|
||||
"systemjs": "0.19.27",
|
||||
"core-js": "2.4.0",
|
||||
"reflect-metadata": "0.1.3",
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "0.6.12",
|
||||
|
||||
"rimraf": "2.5.2",
|
||||
"material-design-icons": "2.2.3",
|
||||
"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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "2.0.0",
|
||||
"tslint": "3.8.1",
|
||||
"typescript": "1.8.10",
|
||||
"typings": "1.0.4",
|
||||
"wsrv": "0.1.3"
|
||||
},
|
||||
"keywords": [
|
||||
"angular2",
|
||||
"typescript"
|
||||
]
|
||||
"name": "ng2-alfresco-documentlist-demo",
|
||||
"description": "Alfresco Angular2 Documentlist Component - Demo",
|
||||
"version": "0.1.0",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
"typings": "typings install",
|
||||
"postinstall": "npm run typings && npm run build",
|
||||
"start": "concurrently \"npm run build:w\" \"npm run server\" ",
|
||||
"server": "wsrv -o -s -l",
|
||||
"build": "npm run tslint && rimraf dist && tsc",
|
||||
"build:w": "npm run tslint && rimraf dist && tsc -w",
|
||||
"tslint": "npm run tslint-src && npm run tslint-root",
|
||||
"tslint-src": "tslint -c tslint.json src/{,**/}**.ts",
|
||||
"tslint-root": "tslint -c tslint.json *.ts"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@angular/common": "2.0.0-rc.3",
|
||||
"@angular/compiler": "2.0.0-rc.3",
|
||||
"@angular/core": "2.0.0-rc.3",
|
||||
"@angular/forms": "0.1.1",
|
||||
"@angular/http": "2.0.0-rc.3",
|
||||
"@angular/platform-browser": "2.0.0-rc.3",
|
||||
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
|
||||
"@angular/router": "3.0.0-alpha.7",
|
||||
"@angular/router-deprecated": "2.0.0-rc.2",
|
||||
"@angular/upgrade": "2.0.0-rc.3",
|
||||
"systemjs": "0.19.27",
|
||||
"core-js": "2.4.0",
|
||||
"reflect-metadata": "0.1.3",
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "0.6.12",
|
||||
"material-design-icons": "2.2.3",
|
||||
"material-design-lite": "1.1.3",
|
||||
"ng2-translate": "2.2.2",
|
||||
"alfresco-js-api": "^0.2.0",
|
||||
"ng2-alfresco-core": "^0.2.0",
|
||||
"ng2-alfresco-documentlist": "^0.2.0",
|
||||
"ng2-alfresco-datatable": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "2.0.0",
|
||||
"rimraf": "2.5.2",
|
||||
"tslint": "3.8.1",
|
||||
"typescript": "1.8.10",
|
||||
"typings": "1.0.4",
|
||||
"wsrv": "0.1.3"
|
||||
},
|
||||
"keywords": [
|
||||
"angular2",
|
||||
"typescript"
|
||||
]
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ import {
|
||||
operations.
|
||||
</div>
|
||||
<hr>
|
||||
<div class="container">
|
||||
<div class="container" *ngIf="authenticated">
|
||||
|
||||
<alfresco-document-list-breadcrumb
|
||||
[currentFolderPath]="currentPath"
|
||||
@@ -106,7 +106,7 @@ import {
|
||||
title="{{'DOCUMENT_LIST.ACTIONS.FOLDER.DELETE' | translate}}"
|
||||
handler="delete">
|
||||
</content-action>
|
||||
|
||||
|
||||
<!-- document actions -->
|
||||
<content-action
|
||||
target="document"
|
||||
@@ -155,11 +155,9 @@ class DocumentListDemo implements OnInit {
|
||||
private documentActions: DocumentActionsService) {
|
||||
|
||||
alfrescoSettingsService.host = this.host;
|
||||
|
||||
if (this.authService.getToken()) {
|
||||
this.token = this.authService.getToken();
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
}
|
||||
|
||||
translation.addTranslationFolder();
|
||||
documentActions.setHandler('my-handler', this.myDocumentActionHandler.bind(this));
|
||||
}
|
||||
@@ -177,7 +175,7 @@ class DocumentListDemo implements OnInit {
|
||||
this.login();
|
||||
}
|
||||
|
||||
myDocumentActionHandler(obj: any) {
|
||||
myDocumentActionHandler() {
|
||||
window.alert('my custom action handler');
|
||||
}
|
||||
|
||||
@@ -195,6 +193,7 @@ class DocumentListDemo implements OnInit {
|
||||
this.authService.login('admin', 'admin', ['ECM']).subscribe(
|
||||
token => {
|
||||
console.log(token);
|
||||
this.token = token;
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
|
@@ -26,7 +26,7 @@
|
||||
"label-undefined": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
180
|
||||
],
|
||||
"member-ordering": [
|
||||
true,
|
||||
|
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"watch": [
|
||||
"node_modules/ng2-alfresco-datatable/dist/**/*.{html,htm,css,js}",
|
||||
"node_modules/ng2-alfresco-core/dist/**/*.{html,htm,css,js}",
|
||||
"node_modules/ng2-alfresco-documentlist/dist/**/*.{html,htm,css,js}"
|
||||
]
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ module.exports = function (config) {
|
||||
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-alfresco-datatable/dist/**/*.js', included: false, served: true, watched: false},
|
||||
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
||||
{pattern: 'node_modules/alfresco-js-api/dist/alfresco-js-api.js', included: true, watched: false},
|
||||
|
||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||
|
||||
|
@@ -48,6 +48,10 @@
|
||||
{
|
||||
"name": "Mario Romano",
|
||||
"email": "mario.romano83@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Eugenio Romano",
|
||||
"email": "eugenio.romano@alfresco.com"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
@@ -72,11 +76,10 @@
|
||||
"reflect-metadata": "0.1.3",
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "0.6.12",
|
||||
"rimraf": "2.5.2",
|
||||
"ng2-translate": "2.2.2",
|
||||
"ng2-alfresco-core": "0.2.0",
|
||||
"ng2-alfresco-datatable": "0.2.0",
|
||||
"alfresco-js-api": "^0.1.0"
|
||||
"ng2-alfresco-datatable": "0.2.0",
|
||||
"alfresco-js-api": "0.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"material-design-icons": "^2.2.3",
|
||||
@@ -96,6 +99,7 @@
|
||||
"karma-jasmine-html-reporter": "0.2.0",
|
||||
"license-check": "1.1.5",
|
||||
"remap-istanbul": "0.6.3",
|
||||
"rimraf": "2.5.2",
|
||||
"traceur": "0.0.91",
|
||||
"tslint": "3.8.1",
|
||||
"typescript": "1.8.10",
|
||||
|
@@ -36,7 +36,7 @@ export class DocumentListServiceMock extends DocumentListService {
|
||||
authService?: AlfrescoAuthenticationService,
|
||||
contentService?: AlfrescoContentService
|
||||
) {
|
||||
super(settings, authService, contentService);
|
||||
super(authService, contentService);
|
||||
}
|
||||
|
||||
getFolder(folder: string) {
|
||||
|
@@ -39,7 +39,7 @@ describe('DocumentActionsService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
documentListService = new DocumentListServiceMock();
|
||||
contentService = new AlfrescoContentService(null, null);
|
||||
contentService = new AlfrescoContentService(null);
|
||||
service = new DocumentActionsService(documentListService, contentService);
|
||||
});
|
||||
|
||||
|
@@ -48,8 +48,8 @@ describe('DocumentListService', () => {
|
||||
|
||||
settingsService = injector.get(AlfrescoSettingsService);
|
||||
authService = injector.get(AlfrescoAuthenticationService);
|
||||
contentService = new AlfrescoContentService(settingsService, authService);
|
||||
service = new DocumentListService(settingsService, authService, contentService);
|
||||
contentService = new AlfrescoContentService(authService);
|
||||
service = new DocumentListService(authService, contentService);
|
||||
});
|
||||
|
||||
it('should require node to get thumbnail url', () => {
|
||||
@@ -57,7 +57,7 @@ describe('DocumentListService', () => {
|
||||
});
|
||||
|
||||
it('should require content service to get thumbnail url', () => {
|
||||
service = new DocumentListService(settingsService, authService, null);
|
||||
service = new DocumentListService(authService, null);
|
||||
let file = new FileNode();
|
||||
expect(service.getDocumentThumbnailUrl(file)).toBeNull();
|
||||
});
|
||||
|
@@ -20,7 +20,6 @@ import { Response } from '@angular/http';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { NodePaging, MinimalNodeEntity } from './../models/document-library.model';
|
||||
import {
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoAuthenticationService,
|
||||
AlfrescoContentService
|
||||
} from 'ng2-alfresco-core';
|
||||
@@ -62,19 +61,16 @@ export class DocumentListService {
|
||||
};
|
||||
|
||||
constructor(
|
||||
private settings: AlfrescoSettingsService,
|
||||
private authService: AlfrescoAuthenticationService,
|
||||
private contentService: AlfrescoContentService
|
||||
) {
|
||||
}
|
||||
|
||||
private getAlfrescoClient() {
|
||||
return AlfrescoApi.getClientWithTicket(this.settings.getApiBaseUrl(), this.authService.getToken());
|
||||
private getAlfrescoApi() {
|
||||
return this.authService.getAlfrescoApi();
|
||||
}
|
||||
|
||||
private getNodesPromise(folder: string, opts?: any) {
|
||||
let alfrescoClient = this.getAlfrescoClient();
|
||||
let apiInstance = new AlfrescoApi.Core.NodesApi(alfrescoClient);
|
||||
let nodeId = '-root-';
|
||||
let params: any = {
|
||||
relativePath: folder,
|
||||
@@ -90,23 +86,20 @@ export class DocumentListService {
|
||||
}
|
||||
}
|
||||
|
||||
return apiInstance.getNodeChildren(nodeId, params);
|
||||
}
|
||||
deleteNode(nodeId: string) {
|
||||
let client = this.getAlfrescoClient();
|
||||
let nodesApi = new AlfrescoApi.Core.NodesApi(client);
|
||||
let opts = {};
|
||||
return Observable.fromPromise(nodesApi.deleteNode(nodeId, opts));
|
||||
return this.getAlfrescoApi().node.getNodeChildren(nodeId, params);
|
||||
}
|
||||
|
||||
deleteNode(nodeId: string) {
|
||||
return Observable.fromPromise(this.getAlfrescoApi().node.deleteNode(nodeId));
|
||||
}
|
||||
|
||||
// TODO: rename to 'getFolderContent'
|
||||
/**
|
||||
* Gets the folder node with the content.
|
||||
* @param folder Path to folder.
|
||||
* @param opts Options
|
||||
* @param opts Options.
|
||||
* @returns {Observable<NodePaging>} Folder entity.
|
||||
*/
|
||||
getFolder(folder: string, opts?: any): Observable<NodePaging> {
|
||||
getFolder(folder: string, opts?: any) {
|
||||
return Observable.fromPromise(this.getNodesPromise(folder, opts))
|
||||
.map(res => <NodePaging> res)
|
||||
// .do(data => console.log('Node data', data)) // eyeball results in the console
|
||||
@@ -118,7 +111,7 @@ export class DocumentListService {
|
||||
* @param node Node to get URL for.
|
||||
* @returns {string} URL address.
|
||||
*/
|
||||
getDocumentThumbnailUrl(node: MinimalNodeEntity): string {
|
||||
getDocumentThumbnailUrl(node: MinimalNodeEntity) {
|
||||
if (node && this.contentService) {
|
||||
return this.contentService.getDocumentThumbnailUrl(node);
|
||||
}
|
||||
|
Reference in New Issue
Block a user