Skip to content

Commit

Permalink
[ACA-4728] refactor viewer and preview, save and restore previous sor…
Browse files Browse the repository at this point in the history
…ting in viewer and document pages when client sorting, add viewer unit tests
  • Loading branch information
g-jaskowski committed Mar 14, 2024
1 parent c7dc4e5 commit e1db682
Show file tree
Hide file tree
Showing 25 changed files with 848 additions and 975 deletions.
5 changes: 0 additions & 5 deletions projects/aca-content/preview/ng-package.json

This file was deleted.

32 changes: 0 additions & 32 deletions projects/aca-content/preview/src/lib/preview.module.ts

This file was deleted.

30 changes: 0 additions & 30 deletions projects/aca-content/preview/src/public-api.ts

This file was deleted.

49 changes: 0 additions & 49 deletions projects/aca-content/preview/src/test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion projects/aca-content/src/lib/aca-content.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import { CommentsTabComponent } from './components/info-drawer/comments-tab/comm
import { LibraryMetadataTabComponent } from './components/info-drawer/library-metadata-tab/library-metadata-tab.component';
import { MetadataTabComponent } from './components/info-drawer/metadata-tab/metadata-tab.component';
import { VersionsTabComponent } from './components/info-drawer/versions-tab/versions-tab.component';
import { PreviewComponent } from '@alfresco/aca-content/preview';
import { PreviewComponent } from '@alfresco/aca-content/viewer';
import { ToggleEditOfflineComponent } from './components/toolbar/toggle-edit-offline/toggle-edit-offline.component';
import { ToggleFavoriteLibraryComponent } from './components/toolbar/toggle-favorite-library/toggle-favorite-library.component';
import { ToggleFavoriteComponent } from './components/toolbar/toggle-favorite/toggle-favorite.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.LIBRARIES.MENU.FAVORITE_LIBRARIES.TITL
[class]="column.class"
[sortable]="column.sortable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
<ng-template let-context>
<adf-dynamic-column [id]="column.template" [context]="context"> </adf-dynamic-column>
Expand All @@ -64,6 +65,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.LIBRARIES.MENU.FAVORITE_LIBRARIES.TITL
[class]="column.class"
[sortable]="column.sortable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
</data-column>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.FAVORITES.TITLE' | translate }}</h1>
[class]="column.class"
[sortable]="column.sortable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
<ng-template let-context>
<adf-dynamic-column [id]="column.template" [context]="context"> </adf-dynamic-column>
Expand All @@ -59,6 +60,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.FAVORITES.TITLE' | translate }}</h1>
[class]="column.class"
[sortable]="column.sortable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
</data-column>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@
[node]="nodeResult"
[allowDropFiles]="true"
[navigate]="false"
[sorting]="['name', 'ASC']"
[sorting]="['name', 'asc']"
[imageResolver]="imageResolver"
[headerFilters]="true"
[filterValue]="queryParams"
[isResizingEnabled]="true"
[blurOnResize]="false"
(node-dblclick)="handleNodeClick($event)"
(name-click)="handleNodeClick($event)"
(sorting-changed)="onSortingChanged($event)"
(filterSelection)="onFilterSelected($event)"
(error)="onError()"
>
Expand Down
41 changes: 10 additions & 31 deletions projects/aca-content/src/lib/components/files/files.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { DataTableModule, PaginationModule, ShowHeaderMode, UserPreferencesService } from '@alfresco/adf-core';
import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
import { DataTableModule, PaginationModule, ShowHeaderMode } from '@alfresco/adf-core';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { NodeEntry, Node, PathElement } from '@alfresco/js-api';
import { NodeActionsService } from '../../services/node-actions.service';
Expand All @@ -39,15 +39,7 @@ import {
} from '@alfresco/aca-shared';
import { SetCurrentFolderAction, isAdmin, UploadFileVersionAction, showLoaderSelector } from '@alfresco/aca-shared/store';
import { debounceTime, takeUntil } from 'rxjs/operators';
import {
BreadcrumbModule,
DocumentListComponent,
DocumentListModule,
FilterSearch,
FileUploadEvent,
UploadModule,
ShareDataRow
} from '@alfresco/adf-content-services';
import { BreadcrumbModule, DocumentListModule, FileUploadEvent, FilterSearch, ShareDataRow, UploadModule } from '@alfresco/adf-content-services';
import { DocumentListPresetRef, ExtensionsModule } from '@alfresco/adf-extensions';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
Expand Down Expand Up @@ -77,27 +69,18 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
templateUrl: './files.component.html',
encapsulation: ViewEncapsulation.None
})
export class FilesComponent extends PageComponent implements OnInit, OnDestroy, AfterViewInit {
export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
isValidPath = true;
isAdmin = false;
selectedNode: NodeEntry;
queryParams = null;

showLoader$ = this.store.select(showLoaderSelector);
private nodePath: PathElement[];

columns: DocumentListPresetRef[] = [];
isFilterHeaderActive = false;

@ViewChild('documentList', { static: true })
documentList: DocumentListComponent;

constructor(
private route: ActivatedRoute,
private contentApi: ContentApiService,
private nodeActionsService: NodeActionsService,
private preferences: UserPreferencesService
) {
constructor(private contentApi: ContentApiService, private nodeActionsService: NodeActionsService, private route: ActivatedRoute) {
super();
}

Expand All @@ -119,9 +102,9 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy,
this.isValidPath = true;

if (node?.entry?.isFolder) {
this.updateCurrentNode(node.entry);
void this.updateCurrentNode(node.entry);
} else {
this.router.navigate(['/personal-files', node.entry.parentId], {
void this.router.navigate(['/personal-files', node.entry.parentId], {
replaceUrl: true
});
}
Expand Down Expand Up @@ -152,10 +135,6 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy,
}
}

ngAfterViewInit() {
this.preferences.set('filesPageSortingMode', this.documentList.sortingMode);
}

ngOnDestroy() {
this.store.dispatch(new SetCurrentFolderAction(null));
super.ngOnDestroy();
Expand All @@ -165,7 +144,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy,
const currentNodeId = this.route.snapshot.paramMap.get('folderId');
const urlWithoutParams = decodeURIComponent(this.router.url).split('?')[0];
const urlToNavigate: string[] = this.getUrlToNavigate(urlWithoutParams, currentNodeId, nodeId);
this.router.navigate(urlToNavigate);
void this.router.navigate(urlToNavigate);
}

private getUrlToNavigate(currentURL: string, currentNodeId: string, nextNodeId: string): string[] {
Expand Down Expand Up @@ -370,7 +349,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy,
this.isFilterHeaderActive = true;
this.navigateToFilter(activeFilters);
} else {
this.router.navigate(['.'], { relativeTo: this.route });
void this.router.navigate(['.'], { relativeTo: this.route });
this.isFilterHeaderActive = false;
this.showHeader = ShowHeaderMode.Data;
this.onAllFilterCleared();
Expand All @@ -389,7 +368,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy,
objectFromMap[filter.key] = paramValue;
});

this.router.navigate([], { relativeTo: this.route, queryParams: objectFromMap });
void this.router.navigate([], { relativeTo: this.route, queryParams: objectFromMap });
}

onError() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.LIBRARIES.MENU.MY_LIBRARIES.TITLE' | t
[class]="column.class"
[sortable]="column.sortable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
<ng-template let-context>
<adf-dynamic-column [id]="column.template" [context]="context"> </adf-dynamic-column>
Expand All @@ -63,6 +64,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.LIBRARIES.MENU.MY_LIBRARIES.TITLE' | t
[resizable]="column.resizable"
[sortable]="column.sortable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
</data-column>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.RECENT.TITLE' | translate }}</h1>
[draggable]="column.draggable"
[resizable]="column.resizable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
<ng-template let-context>
<adf-dynamic-column [id]="column.template" [context]="context"> </adf-dynamic-column>
Expand All @@ -59,6 +60,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.RECENT.TITLE' | translate }}</h1>
[isHidden]="column.isHidden"
[draggable]="column.draggable"
[resizable]="column.resizable"
[sortingKey]="column.sortingKey || column.key"
>
</data-column>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.SHARED.TITLE' | translate }}</h1>
[isHidden]="column.isHidden"
[draggable]="column.draggable"
[resizable]="column.resizable"
[sortingKey]="column.sortingKey || column.key"
>
<ng-template let-context>
<adf-dynamic-column [id]="column.template" [context]="context"> </adf-dynamic-column>
Expand All @@ -58,6 +59,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.SHARED.TITLE' | translate }}</h1>
[class]="column.class"
[sortable]="column.sortable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
</data-column>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.TRASHCAN.TITLE' | translate }}</h1>
[class]="column.class"
[sortable]="column.sortable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
<ng-template let-context>
<adf-dynamic-column [id]="column.template" [context]="context"> </adf-dynamic-column>
Expand All @@ -64,6 +65,7 @@ <h1 class="aca-page-title">{{ 'APP.BROWSE.TRASHCAN.TITLE' | translate }}</h1>
[draggable]="column.draggable"
[resizable]="column.resizable"
[isHidden]="column.isHidden"
[sortingKey]="column.sortingKey || column.key"
>
</data-column>
</ng-container>
Expand Down
Loading

0 comments on commit e1db682

Please sign in to comment.