add callback for VersionManagerComponent and VersionUploadComponent (#3008)

This commit is contained in:
Chen
2018-03-01 01:22:02 +07:00
committed by Eugenio Romano
parent 224dd17042
commit dc1a17686e
5 changed files with 52 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
<div class="adf-new-version-uploader-container" fxLayout="row" fxLayoutAlign="end center">
<adf-version-upload [node]="node"></adf-version-upload>
<adf-version-upload [node]="node" (success)="onUploadSuccess($event)" (error)="onUploadError($event)"></adf-version-upload>
</div>
<div class="adf-version-list-container">
<adf-version-list [id]="node.id"></adf-version-list>

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { Component, Input, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
@Component({
@@ -26,7 +26,21 @@ import { MinimalNodeEntryEntity } from 'alfresco-js-api';
})
export class VersionManagerComponent {
/** The node whose version history you want to manage. */
@Input()
node: MinimalNodeEntryEntity;
@Output()
uploadSuccess: EventEmitter<any> = new EventEmitter();
@Output()
uploadError: EventEmitter<any> = new EventEmitter();
onUploadSuccess(event): void {
this.uploadSuccess.emit(event);
}
onUploadError(event): any {
this.uploadError.emit(event);
}
}

View File

@@ -4,5 +4,7 @@
staticTitle="Upload new version"
[rootFolderId]="node.parentId"
tooltip="Restriction: upload file with the same name to create a new version of it"
[versioning]="true">
[versioning]="true"
(success)="onUploadSuccess($event)"
(error)="onUploadError($event)">
</adf-upload-button>

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { Component, Input, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
@Component({
@@ -30,4 +30,20 @@ export class VersionUploadComponent {
@Input()
node: MinimalNodeEntryEntity;
@Output()
success: EventEmitter<any> = new EventEmitter();
@Output()
error: EventEmitter<any> = new EventEmitter();
onUploadSuccess(event): void {
this.success.emit(event);
}
onUploadError(event): void {
this.error.emit(event);
}
}