mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[AAE-4427] Embed upload progress dialog inside the upload from your d… (#6575)
* [AAE-4427] Embed upload progress dialog inside the upload from your device tab in attach file widget * Fix failing unit tesT * Add unit tests * Removed not needed condition * Make upload from your device tab same size as Repository tab * Revert renaming causing breaking change * simplify if conditions * Update js-api version * Use typescript ?. operator * Add unit test for non existing datatable entries
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FileModel, FileUploadStatus, UploadService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { FileModel, FileUploadStatus, UploadService, UserPreferencesService, FileUploadDeleteEvent, FileUploadCompleteEvent } from '@alfresco/adf-core';
|
||||
import { ChangeDetectorRef, Component, Input, Output, EventEmitter, OnDestroy, OnInit, ViewChild, HostBinding, ElementRef } from '@angular/core';
|
||||
import { Subscription, merge, Subject } from 'rxjs';
|
||||
import { FileUploadingListComponent } from './file-uploading-list.component';
|
||||
@@ -39,6 +39,10 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
||||
@Input()
|
||||
position: string = 'right';
|
||||
|
||||
/** Makes the dialog always visible even when there are no uploads. */
|
||||
@Input()
|
||||
alwaysVisible: boolean = false;
|
||||
|
||||
/** Emitted when a file in the list has an error. */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter();
|
||||
@@ -107,7 +111,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
||||
this.uploadService.fileUploadDeleted
|
||||
)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(event => {
|
||||
.subscribe((event: FileUploadCompleteEvent | FileUploadDeleteEvent) => {
|
||||
this.totalCompleted = event.totalComplete;
|
||||
this.changeDetector.detectChanges();
|
||||
});
|
||||
@@ -201,4 +205,20 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
canShowDialog(): boolean {
|
||||
return this.isDialogActive || this.alwaysVisible;
|
||||
}
|
||||
|
||||
canShowCancelAll(): boolean {
|
||||
return this.filesUploadingList?.length && this.hasUploadInProgress();
|
||||
}
|
||||
|
||||
canCloseDialog(): boolean {
|
||||
return !this.hasUploadInProgress() && !this.alwaysVisible;
|
||||
}
|
||||
|
||||
hasUploadInProgress(): boolean {
|
||||
return (!this.uploadList?.isUploadCompleted() && !this.uploadList?.isUploadCancelled());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user