mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
reload folder after success upload event only if is the event is related to the current folder #1637 (#1813)
This commit is contained in:
parent
4bee113e36
commit
dba5d5a037
@ -1,8 +1,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<alfresco-upload-drag-area
|
<alfresco-upload-drag-area
|
||||||
[rootFolderId]="documentList.currentFolderId"
|
[rootFolderId]="documentList.currentFolderId"
|
||||||
[versioning] = "versioning"
|
[versioning] = "versioning">
|
||||||
(onSuccess)="documentList.reload()">
|
|
||||||
<alfresco-document-list-breadcrumb
|
<alfresco-document-list-breadcrumb
|
||||||
[target]="documentList"
|
[target]="documentList"
|
||||||
[folderNode]="documentList.folderNode">
|
[folderNode]="documentList.folderNode">
|
||||||
@ -145,23 +144,23 @@
|
|||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!acceptedFilesTypeShow">
|
<div *ngIf="!acceptedFilesTypeShow">
|
||||||
<alfresco-upload-button data-automation-id="multiple-file-upload"
|
<alfresco-upload-button #uploadButton
|
||||||
|
data-automation-id="multiple-file-upload"
|
||||||
[rootFolderId]="documentList.currentFolderId"
|
[rootFolderId]="documentList.currentFolderId"
|
||||||
[multipleFiles]="multipleFileUpload"
|
[multipleFiles]="multipleFileUpload"
|
||||||
[uploadFolders]="folderUpload"
|
[uploadFolders]="folderUpload"
|
||||||
[versioning] = "versioning"
|
[versioning] = "versioning">
|
||||||
(onSuccess)="documentList.reload()">
|
|
||||||
<div class="mdl-spinner mdl-js-spinner is-active"></div>
|
<div class="mdl-spinner mdl-js-spinner is-active"></div>
|
||||||
</alfresco-upload-button>
|
</alfresco-upload-button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="acceptedFilesTypeShow">
|
<div *ngIf="acceptedFilesTypeShow">
|
||||||
<alfresco-upload-button data-automation-id="multiple-file-upload"
|
<alfresco-upload-button #uploadButton
|
||||||
|
data-automation-id="multiple-file-upload"
|
||||||
[rootFolderId]="documentList.currentFolderId"
|
[rootFolderId]="documentList.currentFolderId"
|
||||||
[acceptedFilesType]="acceptedFilesType"
|
[acceptedFilesType]="acceptedFilesType"
|
||||||
[multipleFiles]="multipleFileUpload"
|
[multipleFiles]="multipleFileUpload"
|
||||||
[uploadFolders]="folderUpload"
|
[uploadFolders]="folderUpload"
|
||||||
[versioning] = "versioning"
|
[versioning] = "versioning">
|
||||||
(onSuccess)="documentList.reload()">
|
|
||||||
<div class="mdl-spinner mdl-js-spinner is-active"></div>
|
<div class="mdl-spinner mdl-js-spinner is-active"></div>
|
||||||
</alfresco-upload-button>
|
</alfresco-upload-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,18 +15,19 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, Optional, ViewChild, ChangeDetectorRef } from '@angular/core';
|
import { Component, OnInit, AfterViewInit, Optional, ViewChild, ViewChildren, ChangeDetectorRef } from '@angular/core';
|
||||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||||
import { AlfrescoAuthenticationService, LogService } from 'ng2-alfresco-core';
|
import { AlfrescoAuthenticationService, LogService } from 'ng2-alfresco-core';
|
||||||
import { DocumentActionsService, DocumentListComponent, ContentActionHandler, DocumentActionModel, FolderActionModel } from 'ng2-alfresco-documentlist';
|
import { DocumentActionsService, DocumentListComponent, ContentActionHandler, DocumentActionModel, FolderActionModel } from 'ng2-alfresco-documentlist';
|
||||||
import { FormService } from 'ng2-activiti-form';
|
import { FormService } from 'ng2-activiti-form';
|
||||||
|
import { UploadButtonComponent, UploadDragAreaComponent } from 'ng2-alfresco-upload';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'files-component',
|
selector: 'files-component',
|
||||||
templateUrl: './files.component.html',
|
templateUrl: './files.component.html',
|
||||||
styleUrls: ['./files.component.css']
|
styleUrls: ['./files.component.css']
|
||||||
})
|
})
|
||||||
export class FilesComponent implements OnInit {
|
export class FilesComponent implements OnInit, AfterViewInit {
|
||||||
// The identifier of a node. You can also use one of these well-known aliases: -my- | -shared- | -root-
|
// The identifier of a node. You can also use one of these well-known aliases: -my- | -shared- | -root-
|
||||||
currentFolderId: string = '-my-';
|
currentFolderId: string = '-my-';
|
||||||
|
|
||||||
@ -42,6 +43,12 @@ export class FilesComponent implements OnInit {
|
|||||||
@ViewChild(DocumentListComponent)
|
@ViewChild(DocumentListComponent)
|
||||||
documentList: DocumentListComponent;
|
documentList: DocumentListComponent;
|
||||||
|
|
||||||
|
@ViewChild(UploadButtonComponent)
|
||||||
|
uploadButton: UploadButtonComponent;
|
||||||
|
|
||||||
|
@ViewChild(UploadDragAreaComponent)
|
||||||
|
uploadDragArea: UploadDragAreaComponent;
|
||||||
|
|
||||||
constructor(private documentActions: DocumentActionsService,
|
constructor(private documentActions: DocumentActionsService,
|
||||||
private authService: AlfrescoAuthenticationService,
|
private authService: AlfrescoAuthenticationService,
|
||||||
private formService: FormService,
|
private formService: FormService,
|
||||||
@ -113,6 +120,20 @@ export class FilesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.uploadButton.onSuccess
|
||||||
|
.debounceTime(100)
|
||||||
|
.subscribe((event)=> {
|
||||||
|
this.reload(event);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.uploadDragArea.onSuccess
|
||||||
|
.debounceTime(100)
|
||||||
|
.subscribe((event)=> {
|
||||||
|
this.reload(event);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
viewActivitiForm(event?: any) {
|
viewActivitiForm(event?: any) {
|
||||||
this.router.navigate(['/activiti/tasksnode', event.value.entry.id]);
|
this.router.navigate(['/activiti/tasksnode', event.value.entry.id]);
|
||||||
}
|
}
|
||||||
@ -146,4 +167,12 @@ export class FilesComponent implements OnInit {
|
|||||||
window.alert(`Starting BPM process: ${processDefinition.id}`);
|
window.alert(`Starting BPM process: ${processDefinition.id}`);
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reload(event: any) {
|
||||||
|
if (event && event.value && event.value.entry && event.value.entry.parentId) {
|
||||||
|
if (this.documentList.currentFolderId === event.value.entry.parentId) {
|
||||||
|
this.documentList.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,6 +291,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
if (node && node.entry && node.entry.isFolder) {
|
if (node && node.entry && node.entry.isFolder) {
|
||||||
this.currentFolderId = node.entry.id;
|
this.currentFolderId = node.entry.id;
|
||||||
this.folderNode = node.entry;
|
this.folderNode = node.entry;
|
||||||
|
this.skipCount = 0;
|
||||||
this.loadFolder();
|
this.loadFolder();
|
||||||
this.folderChange.emit(new NodeEntryEvent(node.entry));
|
this.folderChange.emit(new NodeEntryEvent(node.entry));
|
||||||
return true;
|
return true;
|
||||||
@ -321,6 +322,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
this.documentListService.getFolderNode(nodeId).then(node => {
|
this.documentListService.getFolderNode(nodeId).then(node => {
|
||||||
this.folderNode = node;
|
this.folderNode = node;
|
||||||
this.currentFolderId = node.id;
|
this.currentFolderId = node.id;
|
||||||
|
this.skipCount = 0;
|
||||||
this.loadFolderNodesByFolderNodeId(node.id, this.pageSize, this.skipCount).catch(err => this.error.emit(err));
|
this.loadFolderNodesByFolderNodeId(node.id, this.pageSize, this.skipCount).catch(err => this.error.emit(err));
|
||||||
})
|
})
|
||||||
.catch(err => this.error.emit(err));
|
.catch(err => this.error.emit(err));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user