diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html
index fda209eb2e..90374137c7 100644
--- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html
+++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html
@@ -81,15 +81,17 @@
add
-
-
+
+
+
+
+ (success)="onFileUploadComplete($event)">
diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts
index 782d37666f..7a754fa5d6 100644
--- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts
+++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts
@@ -42,8 +42,8 @@ import {
ObjectDataRow,
DataSorting
} from 'ng2-alfresco-datatable';
-import { AlfrescoApiService } from 'ng2-alfresco-core';
-import { FormService, FormRenderingService, FormEvent, FormFieldEvent } from 'ng2-activiti-form';
+import { AlfrescoApiService, UploadService } from 'ng2-alfresco-core';
+import { FormService, FormRenderingService, FormEvent, FormFieldEvent, ProcessUploadService } from 'ng2-activiti-form';
import { /*CustomEditorComponent*/ CustomStencil01 } from './custom-editor/custom-editor.component';
declare var componentHandler;
@@ -53,7 +53,10 @@ const currentProcessIdNew = '__NEW__';
@Component({
selector: 'activiti-demo',
templateUrl: './activiti-demo.component.html',
- styleUrls: ['./activiti-demo.component.css']
+ styleUrls: ['./activiti-demo.component.css'],
+ providers: [
+ { provide: UploadService, useClass: ProcessUploadService }
+ ]
})
export class ActivitiDemoComponent implements AfterViewInit {
@@ -122,6 +125,7 @@ export class ActivitiDemoComponent implements AfterViewInit {
private route: ActivatedRoute,
private router: Router,
private apiService: AlfrescoApiService,
+ private uploadService: UploadService,
private formRenderingService: FormRenderingService,
private formService: FormService) {
this.dataTasks = new ObjectDataTableAdapter();
@@ -170,6 +174,9 @@ export class ActivitiDemoComponent implements AfterViewInit {
this.currentProcessInstanceId = null;
});
this.layoutType = ActivitiApps.LAYOUT_GRID;
+
+ this.uploadService.fileUploadComplete.subscribe(value => this.onFileUploadComplete(value.data));
+
}
ngOnDestroy() {
@@ -274,6 +281,10 @@ export class ActivitiDemoComponent implements AfterViewInit {
this.contentName = content.name;
}
+ onFileUploadComplete(content: any) {
+ this.taskAttachList.add(content);
+ }
+
onAttachmentClick(content: any): void {
this.fileShowed = true;
this.content = content.contentBlob;
diff --git a/demo-shell-ng2/app/components/files/files.component.ts b/demo-shell-ng2/app/components/files/files.component.ts
index 6a54eac5c5..8edf707eaf 100644
--- a/demo-shell-ng2/app/components/files/files.component.ts
+++ b/demo-shell-ng2/app/components/files/files.component.ts
@@ -18,9 +18,8 @@
import { Component, Input, OnInit, Optional, ViewChild, ChangeDetectorRef } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { MdDialog } from '@angular/material';
-import { AlfrescoContentService, FolderCreatedEvent, NotificationService } from 'ng2-alfresco-core';
+import { AlfrescoContentService, FolderCreatedEvent, NotificationService, FileUploadCompleteEvent, UploadService } from 'ng2-alfresco-core';
import { DocumentListComponent } from 'ng2-alfresco-documentlist';
-import { UploadService, FileUploadCompleteEvent } from 'ng2-alfresco-upload';
import { CreateFolderDialog } from '../../dialogs/create-folder.dialog';
diff --git a/ng2-components/ng2-activiti-form/index.ts b/ng2-components/ng2-activiti-form/index.ts
index a1bc9bef82..00147fe702 100644
--- a/ng2-components/ng2-activiti-form/index.ts
+++ b/ng2-components/ng2-activiti-form/index.ts
@@ -33,12 +33,14 @@ import { FormRenderingService } from './src/services/form-rendering.service';
import { FormService } from './src/services/form.service';
import { NodeService } from './src/services/node.service';
import { WidgetVisibilityService } from './src/services/widget-visibility.service';
+import { ProcessUploadService } from './src/services/process-upload.service';
export * from './src/components/activiti-form.component';
export * from './src/components/adf-form-list.component';
export * from './src/components/activiti-content.component';
export * from './src/components/activiti-start-form.component';
export * from './src/services/form.service';
+export * from './src/services/process-upload.service';
export * from './src/services/activiti-content-service';
export * from './src/components/widgets/index';
export * from './src/services/ecm-model.service';
@@ -57,6 +59,7 @@ export const ACTIVITI_FORM_DIRECTIVES: any[] = [
export const ACTIVITI_FORM_PROVIDERS: any[] = [
FormService,
+ ProcessUploadService,
ActivitiContentService,
EcmModelService,
NodeService,
diff --git a/ng2-components/ng2-activiti-form/src/services/process-upload.service.ts b/ng2-components/ng2-activiti-form/src/services/process-upload.service.ts
new file mode 100644
index 0000000000..88c36eee8b
--- /dev/null
+++ b/ng2-components/ng2-activiti-form/src/services/process-upload.service.ts
@@ -0,0 +1,39 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Injectable } from '@angular/core';
+import { AlfrescoApiService, AppConfigService, UploadService } from 'ng2-alfresco-core';
+
+@Injectable()
+export class ProcessUploadService extends UploadService {
+
+ instanceApi: AlfrescoApiService;
+
+ constructor(apiService: AlfrescoApiService, appConfigService: AppConfigService) {
+ super(apiService, appConfigService);
+ this.instanceApi = apiService;
+ }
+
+ getUploadPromise(file: any) {
+ let opts = {
+ isRelatedContent: true
+ };
+ let taskId = file.options.parentId;
+ return this.instanceApi.getInstance().activiti.contentApi.createRelatedContentOnTask(taskId, file.file, opts);
+ }
+
+}
diff --git a/ng2-components/ng2-activiti-tasklist/index.ts b/ng2-components/ng2-activiti-tasklist/index.ts
index 70814134a0..718d472685 100644
--- a/ng2-components/ng2-activiti-tasklist/index.ts
+++ b/ng2-components/ng2-activiti-tasklist/index.ts
@@ -73,7 +73,7 @@ export const ACTIVITI_TASKLIST_PROVIDERS: any[] = [
DataTableModule,
ActivitiFormModule,
MdIconModule,
- MdButtonModule
+ MdButtonModule,
],
declarations: [
...ACTIVITI_TASKLIST_DIRECTIVES
diff --git a/ng2-components/ng2-activiti-tasklist/src/components/adf-task-attachment-list.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/adf-task-attachment-list.component.ts
index 8b236dbc63..ebb6961688 100644
--- a/ng2-components/ng2-activiti-tasklist/src/components/adf-task-attachment-list.component.ts
+++ b/ng2-components/ng2-activiti-tasklist/src/components/adf-task-attachment-list.component.ts
@@ -64,13 +64,23 @@ export class TaskAttachmentListComponent implements OnChanges {
this.loadAttachmentsByTaskId(this.taskId);
}
+ add(content: any): void {
+ this.attachments.push({
+ id: content.id,
+ name: content.name,
+ created: content.created,
+ createdBy: content.createdBy.firstName + ' ' + content.createdBy.lastName,
+ icon: this.thumbnailService.getMimeTypeIcon(content.mimeType)
+ });
+ }
+
private loadAttachmentsByTaskId(taskId: string) {
if (taskId) {
- this.reset();
this.activitiContentService.getTaskRelatedContent(taskId).subscribe(
(res: any) => {
+ let attachList = [];
res.data.forEach(content => {
- this.attachments.push({
+ attachList.push({
id: content.id,
name: content.name,
created: content.created,
@@ -78,6 +88,7 @@ export class TaskAttachmentListComponent implements OnChanges {
icon: this.thumbnailService.getMimeTypeIcon(content.mimeType)
});
});
+ this.attachments = attachList;
this.success.emit(this.attachments);
},
(err) => {
diff --git a/ng2-components/ng2-alfresco-core/index.ts b/ng2-components/ng2-alfresco-core/index.ts
index de6d37e776..e669ecf573 100644
--- a/ng2-components/ng2-alfresco-core/index.ts
+++ b/ng2-components/ng2-alfresco-core/index.ts
@@ -49,7 +49,8 @@ import {
NotificationService,
RenditionsService,
StorageService,
- ThumbnailService
+ ThumbnailService,
+ UploadService
} from './src/services/index';
import { DataColumnListComponent } from './src/components/data-column/data-column-list.component';
@@ -75,6 +76,7 @@ export * from './src/utils/index';
export * from './src/events/base.event';
export * from './src/events/base-ui.event';
export * from './src/events/folder-created.event';
+export * from './src/events/file.event';
export * from './src/models/index';
export * from './src/models/index';
diff --git a/ng2-components/ng2-alfresco-upload/src/events/file.event.ts b/ng2-components/ng2-alfresco-core/src/events/file.event.ts
similarity index 100%
rename from ng2-components/ng2-alfresco-upload/src/events/file.event.ts
rename to ng2-components/ng2-alfresco-core/src/events/file.event.ts
diff --git a/ng2-components/ng2-alfresco-upload/src/models/file.model.ts b/ng2-components/ng2-alfresco-core/src/models/file.model.ts
similarity index 100%
rename from ng2-components/ng2-alfresco-upload/src/models/file.model.ts
rename to ng2-components/ng2-alfresco-core/src/models/file.model.ts
diff --git a/ng2-components/ng2-alfresco-core/src/models/index.ts b/ng2-components/ng2-alfresco-core/src/models/index.ts
index bb5d60245a..fff2631f30 100644
--- a/ng2-components/ng2-alfresco-core/src/models/index.ts
+++ b/ng2-components/ng2-alfresco-core/src/models/index.ts
@@ -16,3 +16,4 @@
*/
export * from './card-view.model';
+export * from './file.model';
diff --git a/ng2-components/ng2-alfresco-core/src/services/index.ts b/ng2-components/ng2-alfresco-core/src/services/index.ts
index 2d7bda28fa..366db8fbb2 100644
--- a/ng2-components/ng2-alfresco-core/src/services/index.ts
+++ b/ng2-components/ng2-alfresco-core/src/services/index.ts
@@ -32,3 +32,4 @@ export * from './alfresco-translation.service';
export * from './alfresco-translate-loader.service';
export * from './app-config.service';
export * from './thumbnail.service';
+export * from './upload.service';
diff --git a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.ts b/ng2-components/ng2-alfresco-core/src/services/upload.service.spec.ts
similarity index 98%
rename from ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.ts
rename to ng2-components/ng2-alfresco-core/src/services/upload.service.spec.ts
index 9c8ed57e64..e1addca753 100644
--- a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.ts
+++ b/ng2-components/ng2-alfresco-core/src/services/upload.service.spec.ts
@@ -17,9 +17,8 @@
import { EventEmitter } from '@angular/core';
import { TestBed } from '@angular/core/testing';
-import { CoreModule, AppConfigModule } from 'ng2-alfresco-core';
+import { AppConfigModule, CoreModule, FileModel, FileUploadOptions } from 'ng2-alfresco-core';
import { UploadService } from './upload.service';
-import { FileModel, FileUploadOptions } from '../models/file.model';
declare let jasmine: any;
diff --git a/ng2-components/ng2-alfresco-upload/src/services/upload.service.ts b/ng2-components/ng2-alfresco-core/src/services/upload.service.ts
similarity index 96%
rename from ng2-components/ng2-alfresco-upload/src/services/upload.service.ts
rename to ng2-components/ng2-alfresco-core/src/services/upload.service.ts
index 9901da277c..c170fb66ec 100644
--- a/ng2-components/ng2-alfresco-upload/src/services/upload.service.ts
+++ b/ng2-components/ng2-alfresco-core/src/services/upload.service.ts
@@ -17,10 +17,11 @@
import { EventEmitter, Injectable } from '@angular/core';
import * as minimatch from 'minimatch';
-import { AlfrescoApiService, AppConfigService } from 'ng2-alfresco-core';
import { Subject } from 'rxjs/Rx';
import { FileUploadCompleteEvent, FileUploadEvent } from '../events/file.event';
import { FileModel, FileUploadProgress, FileUploadStatus } from '../models/file.model';
+import { AlfrescoApiService } from './alfresco-api.service';
+import { AppConfigService } from './app-config.service';
@Injectable()
export class UploadService {
@@ -142,10 +143,10 @@ export class UploadService {
this.totalAborted = 0;
}
- private beginUpload(file: FileModel, /* @deprecated */emitter: EventEmitter): any {
+ getUploadPromise(file: FileModel) {
let opts: any = {
- renditions: 'doclib'
- };
+ renditions: 'doclib'
+ };
if (file.options.newVersion === true) {
opts.overwrite = true;
@@ -153,13 +154,19 @@ export class UploadService {
} else {
opts.autoRename = true;
}
- let promise = this.apiService.getInstance().upload.uploadFile(
+ return this.apiService.getInstance().upload.uploadFile(
file.file,
file.options.path,
file.options.parentId,
null,
opts
);
+ }
+
+ private beginUpload(file: FileModel, /* @deprecated */emitter: EventEmitter): any {
+
+ let promise = this.getUploadPromise(file);
+
promise.on('progress', (progress: FileUploadProgress) => {
this.onUploadProgress(file, progress);
})
@@ -178,6 +185,7 @@ export class UploadService {
.catch(err => {
this.onUploadError(file, err);
});
+
return promise;
}
diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts
index 958c983dc4..740e422575 100644
--- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts
+++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.ts
@@ -21,7 +21,7 @@ import {
} from '@angular/core';
import { MdCheckboxChange } from '@angular/material';
import { DataColumnListComponent } from 'ng2-alfresco-core';
-import { Observable, Observer } from 'rxjs/Rx';
+import { Observable, Observer, Subscription } from 'rxjs/Rx';
import { DataColumn, DataRow, DataRowEvent, DataSorting, DataTableAdapter } from '../../data/datatable-adapter';
import { ObjectDataRow, ObjectDataTableAdapter } from '../../data/object-datatable-adapter';
import { DataCellEvent } from './data-cell.event';
@@ -101,6 +101,9 @@ export class DataTableComponent implements AfterContentInit, AfterViewInit, OnCh
private differ: any;
+ private singleClickStreamSub: Subscription;
+ private multiClickStreamSub: Subscription;
+
constructor(
@Optional() private el: ElementRef,
private differs: IterableDiffers) {
@@ -169,12 +172,13 @@ export class DataTableComponent implements AfterContentInit, AfterViewInit, OnCh
}
private initAndSubscribeClickStream() {
+ this.unsubscribeClickStream();
let singleClickStream = this.click$
.buffer(this.click$.debounceTime(250))
.map(list => list)
.filter(x => x.length === 1);
- singleClickStream.subscribe((obj: DataRowEvent[]) => {
+ this.singleClickStreamSub = singleClickStream.subscribe((obj: DataRowEvent[]) => {
let event: DataRowEvent = obj[0];
let el = obj[0].sender.el;
this.rowClick.emit(event);
@@ -193,7 +197,7 @@ export class DataTableComponent implements AfterContentInit, AfterViewInit, OnCh
.map(list => list)
.filter(x => x.length >= 2);
- multiClickStream.subscribe((obj: DataRowEvent[]) => {
+ this.multiClickStreamSub = multiClickStream.subscribe((obj: DataRowEvent[]) => {
let event: DataRowEvent = obj[0];
let el = obj[0].sender.el;
this.rowDblClick.emit(event);
@@ -208,6 +212,15 @@ export class DataTableComponent implements AfterContentInit, AfterViewInit, OnCh
});
}
+ private unsubscribeClickStream() {
+ if(this.singleClickStreamSub) {
+ this.singleClickStreamSub.unsubscribe();
+ }
+ if (this.multiClickStreamSub) {
+ this.multiClickStreamSub.unsubscribe();
+ }
+ }
+
private initTable() {
this.data = new ObjectDataTableAdapter(this.rows, this.schema);
}
diff --git a/ng2-components/ng2-alfresco-upload/README.md b/ng2-components/ng2-alfresco-upload/README.md
index e3322d43b4..a4adf29ccf 100644
--- a/ng2-components/ng2-alfresco-upload/README.md
+++ b/ng2-components/ng2-alfresco-upload/README.md
@@ -66,7 +66,7 @@ npm install ng2-alfresco-upload
```html
{
diff --git a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.ts b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.ts
index 25e271aa7a..f97cc91688 100644
--- a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.ts
+++ b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.ts
@@ -16,10 +16,7 @@
*/
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
-import { AlfrescoTranslationService } from 'ng2-alfresco-core';
-import { FileUploadCompleteEvent } from '../events/file.event';
-import { FileModel, FileUploadStatus } from '../models/file.model';
-import { UploadService } from '../services/upload.service';
+import { AlfrescoTranslationService, FileModel, FileUploadCompleteEvent, FileUploadStatus, UploadService } from 'ng2-alfresco-core';
@Component({
selector: 'file-uploading-dialog',
diff --git a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-list.component.ts b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-list.component.ts
index 15152242cf..0f4ad6d081 100644
--- a/ng2-components/ng2-alfresco-upload/src/components/file-uploading-list.component.ts
+++ b/ng2-components/ng2-alfresco-upload/src/components/file-uploading-list.component.ts
@@ -16,8 +16,7 @@
*/
import { Component, Input } from '@angular/core';
-import { FileModel, FileUploadStatus } from '../models/file.model';
-import { UploadService } from '../services/upload.service';
+import { FileModel, FileUploadStatus, UploadService } from 'ng2-alfresco-core';
@Component({
selector: 'adf-file-uploading-list, alfresco-file-uploading-list',
diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.spec.ts b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.spec.ts
index b4774b303c..6246d59fb7 100644
--- a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.spec.ts
+++ b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.spec.ts
@@ -18,9 +18,8 @@
import { DebugElement, SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { UploadButtonComponent } from './upload-button.component';
-import { CoreModule, AlfrescoTranslationService, AlfrescoContentService} from 'ng2-alfresco-core';
+import { CoreModule, AlfrescoTranslationService, AlfrescoContentService, UploadService } from 'ng2-alfresco-core';
import { TranslationMock } from '../assets/translation.service.mock';
-import { UploadService } from '../services/upload.service';
import { Observable } from 'rxjs/Rx';
describe('UploadButtonComponent', () => {
diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts
index a311eed8fe..2db23474d3 100644
--- a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts
+++ b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts
@@ -17,11 +17,9 @@
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
-import { AlfrescoApiService, AlfrescoContentService, AlfrescoTranslationService, FileUtils, LogService, NotificationService } from 'ng2-alfresco-core';
+import { AlfrescoApiService, AlfrescoContentService, AlfrescoTranslationService, FileModel, FileUtils, LogService, NotificationService, UploadService } from 'ng2-alfresco-core';
import { Observable, Subject } from 'rxjs/Rx';
-import { FileModel } from '../models/file.model';
import { PermissionModel } from '../models/permissions.model';
-import { UploadService } from '../services/upload.service';
@Component({
selector: 'adf-upload-button, alfresco-upload-button',
diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.spec.ts b/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.spec.ts
index 9d9151a5ea..d44a019f82 100644
--- a/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.spec.ts
+++ b/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.spec.ts
@@ -17,13 +17,11 @@
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { DebugElement } from '@angular/core';
-import { AlfrescoTranslationService, CoreModule, LogService, LogServiceMock } from 'ng2-alfresco-core';
+import { AlfrescoTranslationService, CoreModule, FileModel, LogService, LogServiceMock, UploadService } from 'ng2-alfresco-core';
import { UploadDragAreaComponent } from './upload-drag-area.component';
import { FileDraggableDirective } from '../directives/file-draggable.directive';
import { TranslationMock } from '../assets/translation.service.mock';
-import { UploadService } from '../services/upload.service';
-import { FileModel } from '../models/file.model';
let fakeShareDataRow = {
obj: {
diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.ts b/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.ts
index 68a8ed3e53..5a37beb8e4 100644
--- a/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.ts
+++ b/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.ts
@@ -16,9 +16,7 @@
*/
import { Component, EventEmitter, Input, Output } from '@angular/core';
-import { AlfrescoTranslationService, FileInfo, FileUtils, NotificationService } from 'ng2-alfresco-core';
-import { FileModel } from '../models/file.model';
-import { UploadService } from '../services/upload.service';
+import { AlfrescoTranslationService, FileInfo, FileModel, FileUtils, NotificationService, UploadService } from 'ng2-alfresco-core';
@Component({
selector: 'adf-upload-drag-area, alfresco-upload-drag-area',
@@ -60,9 +58,18 @@ export class UploadDragAreaComponent {
@Input()
currentFolderPath: string = '/';
+ /**
+ * @deprecated Deprecated in 1.6.2, this property is not used for couple of releases already. Use parentId instead.
+ *
+ * @type {string}
+ * @memberof UploadDragAreaComponent
+ */
@Input()
rootFolderId: string = '-root-';
+ @Input()
+ parentId: string;
+
@Output()
onSuccess = new EventEmitter();
@@ -85,9 +92,9 @@ export class UploadDragAreaComponent {
if (isAllowed) {
let files: FileInfo[] = event.detail.files;
if (files && files.length > 0) {
- let parentId = this.rootFolderId;
+ let parentId = this.parentId || this.rootFolderId;
if (event.detail.data && event.detail.data.obj.entry.isFolder) {
- parentId = event.detail.data.obj.entry.id || this.rootFolderId;
+ parentId = event.detail.data.obj.entry.id || this.parentId || this.rootFolderId;
}
const fileModels = files.map(fileInfo => new FileModel(fileInfo.file, {
newVersion: this.versioning,
@@ -109,7 +116,7 @@ export class UploadDragAreaComponent {
const fileModels = files.map(file => new FileModel(file, {
newVersion: this.versioning,
path: '/',
- parentId: this.rootFolderId
+ parentId: this.parentId || this.rootFolderId
}));
this.uploadService.addToQueue(...fileModels);
this.uploadService.uploadFilesInTheQueue(this.onSuccess);
@@ -129,7 +136,7 @@ export class UploadDragAreaComponent {
item.file((file: File) => {
const fileModel = new FileModel(file, {
newVersion: this.versioning,
- parentId: this.rootFolderId,
+ parentId: this.parentId || this.rootFolderId,
path: item.fullPath.replace(item.name, '')
});
this.uploadService.addToQueue(fileModel);
@@ -151,7 +158,7 @@ export class UploadDragAreaComponent {
let files = entries.map(entry => {
return new FileModel(entry.file, {
newVersion: this.versioning,
- parentId: this.rootFolderId,
+ parentId: this.parentId || this.rootFolderId,
path: entry.relativeFolder
});
});