alfresco-ng2-components/docs/content-services/services/new-version-uploader.dialog.service.md
AleksanderSklorz c1cffa9cfb
[ACS-3757] returning focus to element from which they were opened (#8034)
* ACS-3757 Focus first focusable element in modals and allow to autofocus specific element after modal closing

* ACS-3757 Added possibility for autofocus after closing some modals, marking datatable row as source of context menu, fixing tests

* ACS-3757 Run lint

* ACS-3757 Updated documentation

* ACS-3757 Added unit tests

* ACS-3757 Replaced toHaveBeenCalledWith with toHaveBeenCalled and removed testing all falsy
2022-12-13 10:55:46 +00:00

3.7 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
New Version Uploader service v1.0.0 Active 2022-05-26

New Version Uploader service

Display a dialog that allows to upload new file version or to manage the current node versions.

Class members

Methods

  • openUploadNewVersionDialog(data: NewVersionUploaderDialogData, config: MatDialogConfig): Observable
    Opens a dialog to upload new file version or to manage current node versions
    • data: NewVersionUploaderDialogData - The data to pass to the dialog
    • config: MatDialogConfig - A configuration object that allows to override default dialog configuration
    • selectorAutoFocusedOnClose: string - Element's selector which should be autofocused after closing modal
    • Returns Observable - Observable 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 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 Upload new version image

Usage example:

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 Manage versions image

Usage example:

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