mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-6242] upload a new version of a file attached in a form (#7651)
* [AAE-6242] Create upload new version dialog to handle the upload of the new file version * [AAE-6242] Create version manager service to open version manager dialog * [AAE-6242] Export service and dialog * [AAE-6242] add adf-upload button to the show the upload new file button * [AAE-6242] open upload new version dialog * [AAE-6242] Removed console log * [AAE-8798] display update option name to newVersion * [AAE-8799] Emit version manager data when new file version is uploaded * [AAE-8799] When a new file version is uploaded open new version dialog and update current file version with the new file version * [AAE-8799] Rename UploadNewVersionDialogComponent to VersionManagerDialogComponent and UploadNewVersionDialogData to VersionManagerDialogData * [AAE-8799] Use default root folder id * [AAE-8799] Add #uploadSingleFile ViewChild in order get the input reference * [AAE-8799] Trigger adf-upload-button by clicking on the button in order to open the file chooser and upload a new file version * [AAE-8799] Version manager dialog emits file upload error * [AAE-8799] Format version manager dialog code * [AAE-8799] Reject upload and permission errors * [AAE-8799] Catch upload new version errors * [AAE-8799] Update allowable operation type * [AAE-8799] Rename VersionManagerDialogComponent into NewVersionUploaderDialogComponent and VersionManagerService into NewVersionUploaderService, create specific folder for new version uploader component and service * Restore previous UploadButtonComponent version * [AAE-8799] Use [adf-upload] directive to upload new file version * [AAE-8799] Add mock file for new version uploader unit tests * [AAE-8799] Override mat dialog configuration * [AAE-8799] Add unit test related to event emitted from Dialog * [AAE-8799] Create model to handle New Version Uploader data * [AAE-8799] Return data on dialog close * [AAE-8799] Add showVersionsOnly property to dialog to show only file version list * [AAE-8799] Add dialogAction to emit dialog actions * [AAE-8799] Return observable instead of promise * [AAE-8799] Update new file version type * [AAE-8799] Subscribe dialog because return an Observable * [AAE-8799] Add license header * [AAE-8799] Add i18n new version uploader translations * [AAE-8799] If data.title is not provided, add a default title * [AAE-8799] Change panelClass for manage versions visualizations, add dialog styles * [AAE-8799] Add upload new version dialog unit test * [AAE-8799] Add upload new version dialog unit test related to manage versions section * [AAE-8799] Add onUploadNewFileVersion unit tests * [AAE-8799] Test new dialog panelClass * [AAE-8799] Create a method to set dialog title, if title isn't provided from parent component, a default title is set * [AAE-8799] Add doc to new-version-uploader-dilog component and service * [AAE-8799] Add new-version-uploader.dialog.service documentation
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
---
|
||||
Title: New Version Uploader service
|
||||
Added: v1.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2022-05-26
|
||||
---
|
||||
|
||||
# [New Version Uploader service](../../../lib/content-services/src/lib/new-version-uploader/new-version-uploader.service.ts "Defined in new-version-uploader.service.ts")
|
||||
|
||||
Display a dialog that allows to upload new file version or to manage the current node versions.
|
||||
|
||||
## Class members
|
||||
|
||||
### Methods
|
||||
|
||||
- **openUploadNewVersionDialog**(data: [NewVersionUploaderDialogData](../../../lib/content-services/src/lib/new-version-uploader/models/new-version-uploader.model.ts), config: `MatDialogConfig`): `Observable`<br/>
|
||||
Opens a dialog to upload new file version or to manage current node versions
|
||||
- _data:_ [NewVersionUploaderDialogData](../../../lib/content-services/src/lib/new-version-uploader/models/new-version-uploader.model.ts) - The data to pass to the dialog
|
||||
- _config:_ `MatDialogConfig` - A configuration object that allows to override default dialog configuration
|
||||
- **Returns** `Observable` - [`Observable`](http://reactivex.io/documentation/observable.html) which you can subscribe in order to get information about the dialog actions or error notification in case of error condition.
|
||||
## Details
|
||||
|
||||
You can open dialog in two different ways:
|
||||
|
||||
- [Upload new file version](#upload-new-version)
|
||||
- [Manage node versions](#manage-versions)
|
||||
|
||||
### Upload New Version
|
||||
|
||||
The dialog shows
|
||||
|
||||
- a side by side comparison between the current target node (type, name, icon) and the new file that should update it's version
|
||||
- the new version's minor/major changes
|
||||
- the optional comment
|
||||
- a button to upload a new file version
|
||||

|
||||
|
||||
Usage example:
|
||||
```ts
|
||||
import { NewVersionUploaderService } from '@alfresco/adf-content-services'
|
||||
|
||||
constructor(private newVersionUploaderService: NewVersionUploaderService){}
|
||||
|
||||
yourFunctionToOpenDialog(){
|
||||
const newVersionUploaderDialogData: NewVersionUploaderDialogData = {
|
||||
file,
|
||||
node
|
||||
};
|
||||
this.newVersionUploaderService.openUploadNewVersionDialog(newVersionUploaderDialogData).subscribe(
|
||||
(data: NewVersionUploaderData) => {
|
||||
// place your action here on operation success!
|
||||
},
|
||||
(error) => {
|
||||
// place your action here on operation error!
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Manage Versions
|
||||
|
||||
Setting `showVersionsOnly` to `true` the dialog displays the version history of a node, with the ability to restore, delete and view version of the current node
|
||||

|
||||
|
||||
Usage example:
|
||||
```ts
|
||||
import { NewVersionUploaderService } from '@alfresco/adf-content-services'
|
||||
|
||||
constructor(private newVersionUploaderService: NewVersionUploaderService){}
|
||||
|
||||
yourFunctionToOpenDialog(){
|
||||
const newVersionUploaderDialogData: NewVersionUploaderDialogData = {
|
||||
file,
|
||||
node,
|
||||
showVersionsOnly: true
|
||||
};
|
||||
this.newVersionUploaderService.openUploadNewVersionDialog(newVersionUploaderDialogData).subscribe(
|
||||
(data: NewVersionUploaderData) => {
|
||||
// place your action here on operation success!
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- [Version list component](../components/docs/content-services/components/version-list.component.md)
|
||||
- [Version Comparison Component](../components/docs/content-services/components/version-comparison.component.md)
|
||||
- [Version Upload Component](../components/docs/content-services/components/version-upload.component.md)
|
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
docs/docassets/images/adf-new-version-uploader_upload.png
Normal file
BIN
docs/docassets/images/adf-new-version-uploader_upload.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Reference in New Issue
Block a user