Eugenio Romano 4043d55fc4
[AAE-10778] Refactor Viewer (#7992)
* refactor version 1 many todo

* split render from viewer
move alfresco render in content pack

* refactor part 2

* test fixed

* fix doc

* [AAE-10778] Fix lint issues

* [AAE-10778] Fix lint issue: remove duplicated declaration

* [AAE-10778] Fix lint issue: use flex shorthand rule

* [AAE-10778] Fix FormService and WidgetComponent imports

* [AAE-10778] Fix import FormModel, FormService, FormFieldModel from adf-core

* [AAE-10778] Implement missing oninit, onchanges and ondestroy

* [AAE-10778] Replace adf-viewer with adf-alfresco-viewer, update escape command to close the viewer

* [AAE-10778] Fix unit test: fix the class name to match the 'adf-viewer-render.image-viewer-scaling' get from the appConfigService

* [AAE-10778] Fix image-viewer unit tests: replace ContentService with UrlService

* [AAE-10778] Fix unit test 'should if the extension change extension Change event be fired': emit file extension when the filename extension change

* [AAE-10778] Fix unit test: expect for internalFileName value instead of display-name id because the display name logic has been moved to the alfresco-viewer.component

* [AAE-10778] Fix unit test: remove display name it because the unknown display name value is no longer handled after refactoring

* [AAE-10778] Fix e2e: [C260096] Should the Viewer able to accept a customToolbar

* [AAE-10778] Update selector to fix e2e: '[C362265] Should the Viewer be able to download a previous version of a file'

* [AAE-10778] Update selector to fix e2e: '[C260038] Should display first page, toolbar and pagination when opening a .pdf file'

* fix aftrer rebase

* fix unit test

* [AAE-10778] Add adf viewer component that is node agnostic, show adf-alfresco-viewer or adf-viewer into file-view-component if blob or node are set

* [AAE-10778] Update viewer export path

* [AAE-10778] Update selectors since have been updated in the viewer component

* [AAE-10778] Call adf-viewer from alfresco-viewer, project adf-alfresco-viewer content to adf-viewer

* [AAE-10778] Remove full screen unit tests from alfresco-viewer component becase that logic is handled in the viewer.component

* [AAE-10778] Export toolbar custom actions component

* [AAE-10778] Pass mimeType as input to adf-viewer to update mime icon

* [AAE-10778] Remove e2e because the custom name behaviour has been removed from the file-view.component (9f21b6dc69\#diff-4b438dc59784dce9eb7634cfeca6d8db61362966343bd3d6895a3edafdf4cfd5L129)

* [AAE-10778] Use two-way binding for showViewer change to fix C260100

* [AAE-10778] Update prefix css selectors to adf-viewer because are related to the adf-viewer component

* [AAE-10778] Update prefix css selectors to adf-viewer in the unit tests because are related to the adf-viewer component

* [AAE-10778] Update the output name to showViewerChange to navigate to primary url after closing the viewer

* [AAE-10778] Pass right and left sidebar template context to viewer component (fix C362242)

* [AAE-10778] Add allowFullScreen input to disable/enable full screen behaviour

* [AAE-10778] Handle loading visualization only inside the viewer-render component

* [AAE-10778] PDF viewer: fix mat-progress-bar is not showed during the pdf loading, center progress bar

* [AAE-10778] Remove isLoading from unit tests because no longer exists

* [AAE-10778] Remove viewerType input from adf-viewer, viewerType will be handled by viewer-render

* [AAE-10778] Remove console.log

* [AAE-10778] Remove check full screen button is not displayed on the media file because is not needed anymore, we don't need to check for the fullscreen button in the viewer component

* [AAE-10778] Check for node rendtion before to assign to urlFileContent and mimeType

* [AAE-10778] Process Services Cloud: register file-viewer widget that uses adf-alfresco-viewer component to display content from ACS

* [AAE-10778] Core: rename file-viewer widget into base-viewer, base-viewer no longer accept nodeId, but will accept urlFile and blobFile

* [AAE-10778] Process Services: register file-viewer widget that uses adf-alfresco-viewer component to display content from ACS

* [AAE-10778] Base viewer widget: show viewer only if there's a file input

* [AAE-10778] Viewer component: check for fileName when urlFile is provided as Input

* [AAE-10778] Viewer component documentation

* [AAE-10778] Update upgrade guide with viewer changes

* [AAE-10778] Fix double quote lint issue after rebase

---------

Co-authored-by: Amedeo Lepore <amedeo.lepore@hyland.com>
Co-authored-by: Amedeo Lepore <amedeo.lepore85@gmail.com>
2023-02-01 17:25:43 +01:00

9.4 KiB

Title
Title
Upgrading from ADF v5.0 to v6.0

Upgrading from ADF v5.0 to v6.0

This guide explains how to upgrade your ADF v5.0 project to work with v6.0.

Do not skip this task, if you want your application to be updated to a most recent version of ADF. Upgrades of multiple versions of ADF cannot be done in one step only, but should follow the chain of sequential updates.

Note: the steps described below might involve making significant changes to your code. If you are working with a versioning system then you should commit any changes you are currently working on. If you aren't using versioning then be sure to make a backup copy of your project before going ahead with the upgrade.

Since 6.0 is a major version release, there are breaking changes you need to take into account as well as the usual library updates. After updating the libraries, check the other sections to see if any of the changes affect your project.

Contents

Library updates

  1. Update the package.json file with the latest library versions:

    "dependencies": {
        ...
        "@alfresco/adf-core": "6.0.0",
        "@alfresco/adf-content-services": "6.0.0",
        "@alfresco/adf-process-services-cloud": "6.0.0",
        "@alfresco/adf-insights": "6.0.0",
        "@alfresco/js-api": "6.0.0",
        ...
    
  2. Clean your old distribution and dependencies by deleting node_modules and package-lock.json.

  3. Reinstall your dependencies

    npm install
    

Breaking changes

The ADF project follows the semver conventions and so we only make breaking changes (ie, not backward-compatible) in major versions. ADF 6.0 is the first major version since general availability so a number of deprecated items have been removed and also some existing items have been renamed. The sections below explain how to adapt your project to the changes in 6.0. See also our For more information about the changes and links to the associated pull requests.

[TODO ADD HERE the PRs ]checkallowableoperationdirective: Moved from ADF Core to ADF content services LibraryFavoriteDirective: Moved from ADF Core to ADF content services LibraryMembershipDirective: Moved from ADF Core to ADF content services NodeDeleteDirective: Moved from ADF Core to ADF content services NodeFavoriteDirective: Moved from ADF Core to ADF content services NodeRestoreDirective: Moved from ADF Core to ADF content services [TODO ADD HERE the PRs ]

Each section needs to contains: Title Description How to fix it:

Deprecated items

Class Before After
LoginDialogService @alfresco/adf-core

DataColumnModule

DataColumnModule has been deprecated and moved in DataTableModule

v6.0.0 and before:

@NgModule({
    imports: [
    ```
    DataColumnModule,
    DataTableModule
    ```    
])

v6.0.0 and after:

@NgModule({
    imports: [
    ```
    DataTableModule,
    ```    
])

PaginationModel

Pagination model from @alfresco/js-api has been now deprecated in favour of internal implementated model PaginationModel evrywhere

Relocated classes

Class Before After
VersionCompatibilityService @alfresco/adf-core @alfresco/adf-content-services
VersionCompatibilityDirective @alfresco/adf-core @alfresco/adf-content-services
SitesService @alfresco/adf-core @alfresco/adf-content-services
SearchService @alfresco/adf-core @alfresco/adf-content-services
AppsProcessService @alfresco/adf-core @alfresco/adf-process-services
CheckAllowableOperationDirective @alfresco/adf-core @alfresco/adf-content-services
LibraryFavoriteDirective @alfresco/adf-core @alfresco/adf-content-services
LibraryMembershipDirective @alfresco/adf-core @alfresco/adf-content-services
NodeDeleteDirective @alfresco/adf-core @alfresco/adf-content-services
NodeFavoriteDirective @alfresco/adf-core @alfresco/adf-content-services
NodeRestoreDirective @alfresco/adf-core @alfresco/adf-content-services
[AppsProcessService] @alfresco/adf-core @alfresco/adf-process-services
SharedLinksApiService @alfresco/adf-core @alfresco/adf-process-services
LockService @alfresco/adf-core @alfresco/adf-process-services
FavoritesApiService @alfresco/adf-core @alfresco/adf-process-services
SearchConfigurationInterface @alfresco/adf-core @alfresco/adf-content-services

Update Data-table a data change

v6.0.0 and after You will need to provide a DataTableService to update a row of your table. The model to update the DataTable require the ID of the row you want change and the new data Object of the row

DataRowUpdateModel {
    obj: any;
    id: string;
}

For example if your table use entry nodes you can pass:

this.dataTableService.rowUpdate.next({id: node.id, obj: {entry: node}});

As good practice is better to provide a DataTableService in the component where you are going to deliver the new object

@Component({
    selector: 'app-files-component',
    templateUrl: './files.component.html',
    styleUrls: ['./files.component.scss'],
    encapsulation: ViewEncapsulation.None,
    providers: [
        DataTableService
    ]
})
export class FilesComponent implements OnInit {

    constructor(private dataTableService: DataTableService,
                private nodeService: NodesApiService) {
    }
    
    ngOnInit() {
        this.nodeService.nodeUpdated.subscribe((node) => {
            this.dataTableService.rowUpdate.next({id: node.id, obj: {entry: node}});
        });
    }

NodeNameTooltipPipe

NodeNameTooltipPipe has been moved in the @alfresco/adf-content-services in ContentPipeModule

v6.0.0 and before:

@NgModule({
    imports: [
    ````
    PipeModule
    ````    
     ]})

v6.0.0 and after:

@NgModule({
    imports: [
    ````
    ContentPipeModule
    ````    
     ]})

nodeUpdated Subject

The nodeUpdated Subject has been moved from AlfrescoApiService to NodesApiService

v6.0.0 and before:

 this.alfrescoApiService.nodeUpdated.pipe .....

v6.0.0 and after:

 this.nodesApiService.nodeUpdated.pipe .....

Comments component

adf-comments component is now a real presentational components. The taskId and nodeId has now renamed to id The adf-comments has now two specialization in :

ViewerComponent

From v.6.0.0 and after ViewerComponent no longer show content from ACS, so instead of taking nodeId as @Input, it takes blobFile and urlFile. For more details check the PR. If you need to display content from ACS you can use instead the new AlfrescoViewerComponent

Renamed items

New Classes or Services

Properties and methods

Component selectors