mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1291] Attachment list is not instantly refreshed after upload (#2387)
* [ADF-1291] Attachment list after upload list is not instantly refreshed * Implemented NgZone to ensure change detection * [#2377 Github] Attachments control won't let you add a document you removed * Reset the value of input after each upload so that change will be detected if the same file is selected repeatedly * [#2377 Github] Attachments control won't let you add a document you removed * Added test to make sure the input value is rest after upload
This commit is contained in:
committed by
Maurizio Vitale
parent
6b3358cc27
commit
9673772f50
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { NgZone, SimpleChange } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MdProgressSpinnerModule } from '@angular/material';
|
||||
import { By } from '@angular/platform-browser';
|
||||
@@ -41,6 +41,7 @@ describe('TaskAttachmentList', () => {
|
||||
let mockAttachment: any;
|
||||
|
||||
beforeEach(async(() => {
|
||||
let zone = new NgZone({enableLongStackTrace: false});
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreModule,
|
||||
@@ -53,7 +54,8 @@ describe('TaskAttachmentList', () => {
|
||||
providers: [
|
||||
ActivitiContentService,
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: NgZone, useValue: zone }
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, NgZone, OnChanges, Output, SimpleChanges } from '@angular/core';
|
||||
import { ActivitiContentService } from 'ng2-activiti-form';
|
||||
import { ContentService, ThumbnailService } from 'ng2-alfresco-core';
|
||||
|
||||
@@ -51,7 +51,8 @@ export class TaskAttachmentListComponent implements OnChanges {
|
||||
|
||||
constructor(private activitiContentService: ActivitiContentService,
|
||||
private contentService: ContentService,
|
||||
private thumbnailService: ThumbnailService) {
|
||||
private thumbnailService: ThumbnailService,
|
||||
private ngZone: NgZone) {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
@@ -65,16 +66,20 @@ export class TaskAttachmentListComponent implements OnChanges {
|
||||
}
|
||||
|
||||
reload(): void {
|
||||
this.loadAttachmentsByTaskId(this.taskId);
|
||||
this.ngZone.run(() => {
|
||||
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)
|
||||
this.ngZone.run(() => {
|
||||
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)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user