dist folder for uploader component

This commit is contained in:
Mario Romano
2016-05-19 16:23:13 +01:00
parent 283e214e94
commit c771c0a205
9 changed files with 34 additions and 18 deletions

View File

@@ -24,7 +24,7 @@
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable', 'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable',
'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist/dist', 'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist/dist',
'ng2-alfresco-login': 'node_modules/ng2-alfresco-login', 'ng2-alfresco-login': 'node_modules/ng2-alfresco-login',
'ng2-alfresco-upload': 'node_modules/ng2-alfresco-upload', 'ng2-alfresco-upload': 'node_modules/ng2-alfresco-upload/dist',
'ng2-translate': 'node_modules/ng2-translate', 'ng2-translate': 'node_modules/ng2-translate',
'rxjs': 'node_modules/rxjs' 'rxjs': 'node_modules/rxjs'
}; };

View File

@@ -0,0 +1,14 @@
npm-debug.log
.idea
assets/
coverage/
demo/
node_modules
typings/
src/
/ng2-alfresco-upload.ts
/ng2-alfresco-upload.d.ts
/ng2-alfresco-upload.js
/ng2-alfresco-upload.js.map

View File

@@ -17,7 +17,7 @@
"es6-shim": "0.35.0", "es6-shim": "0.35.0",
"material-design-icons": "^2.2.3", "material-design-icons": "^2.2.3",
"material-design-lite": "^1.1.3", "material-design-lite": "^1.1.3",
"ng2-alfresco-core": "^0.1.0", "ng2-alfresco-core": "^0.1.6",
"ng2-alfresco-upload": "^0.1.0", "ng2-alfresco-upload": "^0.1.0",
"ng2-translate": "^1.11.2", "ng2-translate": "^1.11.2",
"reflect-metadata": "0.1.2", "reflect-metadata": "0.1.2",

View File

@@ -18,7 +18,7 @@
*/ */
import { Component } from 'angular2/core'; import { Component } from 'angular2/core';
import { ALFRESCO_ULPOAD_COMPONENT } from 'ng2-alfresco-upload/dist/ng2-alfresco-upload'; import { ALFRESCO_ULPOAD_COMPONENT } from 'ng2-alfresco-upload/ng2-alfresco-upload';
@Component({ @Component({
selector: 'my-demo', selector: 'my-demo',

View File

@@ -20,7 +20,7 @@ import { bootstrap } from 'angular2/platform/browser';
import { HTTP_PROVIDERS } from 'angular2/http'; import { HTTP_PROVIDERS } from 'angular2/http';
import { MyDemoComponent } from "./components/my-demo.component"; import { MyDemoComponent } from "./components/my-demo.component";
import { TranslateLoader, TranslateService } from 'ng2-translate/ng2-translate'; import { TranslateLoader, TranslateService } from 'ng2-translate/ng2-translate';
import { AlfrescoTranslationLoader } from 'ng2-alfresco-core/services'; import { AlfrescoTranslationLoader } from 'ng2-alfresco-core/services/AlfrescoTranslationService';
@Component({ @Component({
selector: 'my-app', selector: 'my-app',

View File

@@ -1,7 +1,7 @@
{ {
"name": "ng2-alfresco-upload", "name": "ng2-alfresco-upload",
"description": "Alfresco Angular2 Upload Component", "description": "Alfresco Angular2 Upload Component",
"version": "0.1.1", "version": "0.1.2",
"author": "Alfresco Software, Ltd.", "author": "Alfresco Software, Ltd.",
"scripts": { "scripts": {
"typings": "typings install", "typings": "typings install",

View File

@@ -180,7 +180,7 @@ export class UploadButtonComponent {
* @returns {any} * @returns {any}
*/ */
private getSiteId(): string { private getSiteId(): string {
return this.currentFolderPath.replace('/Sites/','').split('/')[0]; return this.currentFolderPath.replace('/Sites/', '').split('/')[0];
} }
/** /**
@@ -188,6 +188,6 @@ export class UploadButtonComponent {
* @returns {any} * @returns {any}
*/ */
private getContainerId(): string { private getContainerId(): string {
return this.currentFolderPath.replace('/Sites/','').split('/')[1]; return this.currentFolderPath.replace('/Sites/', '').split('/')[1];
} }
} }

View File

@@ -131,9 +131,9 @@ export class UploadDragAreaComponent {
}); });
}, },
error => { error => {
error; console.log(error);
} }
); );
} }
} }
@@ -144,8 +144,8 @@ export class UploadDragAreaComponent {
*/ */
private _traverseFileTree(item: any): void { private _traverseFileTree(item: any): void {
if (item.isFile) { if (item.isFile) {
let self = this; let self = this;
self.onFilesEntityDropped(item); self.onFilesEntityDropped(item);
} else { } else {
if (item.isDirectory) { if (item.isDirectory) {
let self = this; let self = this;
@@ -166,7 +166,7 @@ export class UploadDragAreaComponent {
* @returns {string} * @returns {string}
*/ */
private getSiteId(): string { private getSiteId(): string {
return this.currentFolderPath.replace('/Sites/','').split('/')[0]; return this.currentFolderPath.replace('/Sites/', '').split('/')[0];
} }
/** /**
@@ -174,6 +174,6 @@ export class UploadDragAreaComponent {
* @returns {string} * @returns {string}
*/ */
private getContainerId(): string { private getContainerId(): string {
return this.currentFolderPath.replace('/Sites/','').split('/')[1]; return this.currentFolderPath.replace('/Sites/', '').split('/')[1];
} }
} }

View File

@@ -21,6 +21,8 @@ import { EventEmitter } from 'angular2/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Response } from 'angular2/http'; import { Response } from 'angular2/http';
declare let AlfrescoApi: any;
/** /**
* *
* UploadService keep the queue of the file to upload and uploads them. * UploadService keep the queue of the file to upload and uploads them.
@@ -195,7 +197,7 @@ export class UploadService {
let xmlHttpRequest = this.createXMLHttpRequestInstance(uploadingFileModel, elementEmit); let xmlHttpRequest = this.createXMLHttpRequestInstance(uploadingFileModel, elementEmit);
xmlHttpRequest.open(this._method, this._host + this._url, true); xmlHttpRequest.open(this._method, this._host + this._url, true);
let authToken = btoa(basicAuth.username +':'+ basicAuth.password); let authToken = btoa(basicAuth.username + ':' + basicAuth.password);
if (authToken) { if (authToken) {
xmlHttpRequest.setRequestHeader('Authorization', `${basicAuth.type} ${authToken}`); xmlHttpRequest.setRequestHeader('Authorization', `${basicAuth.type} ${authToken}`);
} }
@@ -230,14 +232,14 @@ export class UploadService {
let apiInstance = new AlfrescoApi.NodesApi(this._alfrescoClient); let apiInstance = new AlfrescoApi.NodesApi(this._alfrescoClient);
let nodeId = '-root-'; let nodeId = '-root-';
let nodeBody = { let nodeBody = {
'name':name, 'name': name,
'nodeType':'cm:folder', 'nodeType': 'cm:folder',
'relativePath':relativePath 'relativePath': relativePath
}; };
return Observable.fromPromise(apiInstance.addNode(nodeId, nodeBody)) return Observable.fromPromise(apiInstance.addNode(nodeId, nodeBody))
.map(res => { .map(res => {
console.log(res); console.log(res);
} ) })
.do(data => console.log('Node data', data)) // eyeball results in the console .do(data => console.log('Node data', data)) // eyeball results in the console
.catch(this.handleError); .catch(this.handleError);
} }