diff --git a/docs/version-manager.component.md b/docs/version-manager.component.md index 5c807f41bf..7bef06ab9d 100644 --- a/docs/version-manager.component.md +++ b/docs/version-manager.component.md @@ -13,14 +13,25 @@ Displays the version history of a node with the ability to upload a new version. ## Basic Usage ```html - + + ``` ### Properties -| Name | Type | Default value | Description | -| ---- | ---- | ------------- | ----------- | -| node | `MinimalNodeEntryEntity` | | The node whose version history you want to manage. | +| Name | Type | Description | +| ---- | ---- | ----------- | +| node | [MinimalNodeEntryEntity](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeMinimalEntry.md) | The node you want to manage the version history of. | + +### Events + +| Name | Description | +| --- | --- | +| uploadSuccess | Raised when the file is uploaded | +| uploadError | Emitted when an error occurs.| ## Details diff --git a/lib/content-services/version-manager/version-manager.component.html b/lib/content-services/version-manager/version-manager.component.html index ea6f7d54dc..459b242b91 100644 --- a/lib/content-services/version-manager/version-manager.component.html +++ b/lib/content-services/version-manager/version-manager.component.html @@ -1,5 +1,5 @@
- +
diff --git a/lib/content-services/version-manager/version-manager.component.ts b/lib/content-services/version-manager/version-manager.component.ts index a8a7bb1291..7329478d56 100644 --- a/lib/content-services/version-manager/version-manager.component.ts +++ b/lib/content-services/version-manager/version-manager.component.ts @@ -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 = new EventEmitter(); + + @Output() + uploadError: EventEmitter = new EventEmitter(); + + onUploadSuccess(event): void { + this.uploadSuccess.emit(event); + } + + onUploadError(event): any { + this.uploadError.emit(event); + } } + diff --git a/lib/content-services/version-manager/version-upload.component.html b/lib/content-services/version-manager/version-upload.component.html index 74111c1c3d..d994a20c04 100644 --- a/lib/content-services/version-manager/version-upload.component.html +++ b/lib/content-services/version-manager/version-upload.component.html @@ -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)"> diff --git a/lib/content-services/version-manager/version-upload.component.ts b/lib/content-services/version-manager/version-upload.component.ts index a0ade6da7e..0538382e35 100644 --- a/lib/content-services/version-manager/version-upload.component.ts +++ b/lib/content-services/version-manager/version-upload.component.ts @@ -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 = new EventEmitter(); + + @Output() + error: EventEmitter = new EventEmitter(); + + onUploadSuccess(event): void { + this.success.emit(event); + } + + onUploadError(event): void { + this.error.emit(event); + } + } +