mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-3326] Content node selector - sort files by createdAt desc by de… (#6674)
* [AAE-3326] Content node selector - sort files by createdAt desc by default * Fix process custom filter cloud e2e
This commit is contained in:
@@ -79,6 +79,7 @@
|
||||
[contextMenuActions]="false"
|
||||
[contentActions]="false"
|
||||
[allowDropFiles]="false"
|
||||
[sorting]="sorting"
|
||||
sortingMode="server"
|
||||
[where]="where"
|
||||
(folderChange)="onFolderChange($event)"
|
||||
|
@@ -19,7 +19,7 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Node, NodeEntry, NodePaging, RequestScope, ResultSetPaging, SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||
import { FileModel, FileUploadStatus, NodesApiService, setupTestBed, SitesService, UploadService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, FileModel, FileUploadStatus, NodesApiService, setupTestBed, SitesService, UploadService } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { DropdownBreadcrumbComponent } from '../breadcrumb';
|
||||
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
|
||||
@@ -1247,5 +1247,31 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
expect(toggleFiltersPanelButton).toEqual(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sorting', () => {
|
||||
let appConfigService: AppConfigService;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfigService = TestBed.inject(AppConfigService);
|
||||
});
|
||||
|
||||
it('should read the sorting value from appConfig json in case it is present', async () => {
|
||||
const fakeSortingConfig = ['fakeKey', 'fakeAsc'];
|
||||
|
||||
appConfigService.config = Object.assign(appConfigService.config, {
|
||||
'adf-content-node-selector': { sorting: fakeSortingConfig }
|
||||
});
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.sorting).toEqual(fakeSortingConfig);
|
||||
});
|
||||
|
||||
it('should take default sorting when there is no content node selector sorting config in appConfig json', async () => {
|
||||
appConfigService.config = null;
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.sorting).toEqual(['createdAt', 'desc']);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -36,7 +36,9 @@ import {
|
||||
UploadService,
|
||||
FileUploadCompleteEvent,
|
||||
FileUploadDeleteEvent,
|
||||
FileModel
|
||||
FileModel,
|
||||
AppConfigService,
|
||||
DataSorting
|
||||
} from '@alfresco/adf-core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { Node, NodePaging, Pagination, SiteEntry, SitePaging, NodeEntry, QueryBody, RequestScope } from '@alfresco/js-api';
|
||||
@@ -250,6 +252,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
|
||||
target: PaginatedComponent;
|
||||
preselectedNodes: NodeEntry[] = [];
|
||||
sorting: string[] | DataSorting;
|
||||
|
||||
searchPanelExpanded: boolean = false;
|
||||
|
||||
@@ -261,6 +264,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
private nodesApiService: NodesApiService,
|
||||
private uploadService: UploadService,
|
||||
private sitesService: SitesService,
|
||||
private appConfigService: AppConfigService,
|
||||
private contentNodeSelectorPanelService: ContentNodeSelectorPanelService) {
|
||||
}
|
||||
|
||||
@@ -331,6 +335,8 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
.subscribe((currentNode: Node) => {
|
||||
this.currentFolder.emit(currentNode);
|
||||
});
|
||||
|
||||
this.sorting = this.appConfigService.get('adf-content-node-selector.sorting', ['createdAt', 'desc']);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
Reference in New Issue
Block a user