[ACA-4492] - Start restyling of search sorting (#2190)

* Started adding search sorting refactoring

* [ACA-4492] - attempt to fix e2e with new sorting menu

* [ACA-4436] - fixed linting

* [ACA-4436] - fixed linting

* fixed lint

* [ACA-4492] - fixed e2e with new sorting

* [ACA-4492] - fixed e2e with new sorting
This commit is contained in:
Vito
2021-07-12 10:27:30 +01:00
committed by GitHub
parent bc40d6f08b
commit 7d66579423
9 changed files with 265 additions and 74 deletions

View File

@@ -89,109 +89,93 @@ describe('Search sorting', () => {
it('[C277722] Sorting options are displayed', async () => { it('[C277722] Sorting options are displayed', async () => {
expect(await page.sortingPicker.isSortOrderButtonDisplayed()).toBe(true, 'Sort order button not displayed'); expect(await page.sortingPicker.isSortOrderButtonDisplayed()).toBe(true, 'Sort order button not displayed');
expect(await page.sortingPicker.isSortByOptionDisplayed()).toBe(true, 'Sort options not displayed');
expect(await page.sortingPicker.getSortOrder()).toBe('DESC', 'Incorrect default sort order');
expect(await page.sortingPicker.getSelectedSortByOption()).toBe('Relevance', 'Incorrect selected sort option');
await page.sortingPicker.clickSortByDropdown(); await page.sortingPicker.clickSortByDropdown();
const expectedOptions = ['Relevance', 'Filename', 'Title', 'Modified date', 'Modifier', 'Created date', 'Size', 'Type']; const expectedOptions = ['Relevance', 'Filename', 'Title', 'Modified date', 'Modifier', 'Created date', 'Size', 'Type'];
expect(await page.sortingPicker.getSortByOptionsList()).toEqual(expectedOptions, 'Incorrect sort options list'); const optionListed = await page.sortingPicker.getSortByOptionsList();
expect(optionListed).toEqual(expectedOptions, 'Incorrect sort options list');
}); });
it('[C277728] Sort by Name', async () => { it('[C277728] Sort by Name', async () => {
await page.sortingPicker.sortBy('Filename'); await page.sortingPicker.sortBy('Filename', 'asc');
await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Filename'); await page.sortingPicker.sortBy('Filename', 'desc');
await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
}); });
it('[C277740] Sort by Type', async () => { it('[C277740] Sort by Type', async () => {
await page.sortingPicker.sortBy('Type'); await page.sortingPicker.sortBy('Type', 'asc');
await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
await page.sortingPicker.sortBy('Type'); await page.sortingPicker.sortBy('Type', 'desc');
await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
}); });
it('[C277738] Sort by Size', async () => { it('[C277738] Sort by Size', async () => {
await page.sortingPicker.sortBy('Size'); await page.sortingPicker.sortBy('Size', 'asc');
await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
await page.sortingPicker.sortBy('Size'); await page.sortingPicker.sortBy('Size', 'desc');
await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
}); });
it('[C277734] Sort by Created date', async () => { it('[C277734] Sort by Created date', async () => {
await page.sortingPicker.sortBy('Created date'); await page.sortingPicker.sortBy('Created date', 'asc');
await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Created date'); await page.sortingPicker.sortBy('Created date', 'desc');
await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
}); });
it('[C277736] Sort by Modified date', async () => { it('[C277736] Sort by Modified date', async () => {
await page.sortingPicker.sortBy('Modified date'); await page.sortingPicker.sortBy('Modified date', 'asc');
await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Modified date'); await page.sortingPicker.sortBy('Modified date', 'desc');
await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
}); });
it('[C277727] Sort by Relevance', async () => { it('[C277727] Sort by Relevance', async () => {
await page.sortingPicker.sortBy('Relevance'); await page.sortingPicker.sortBy('Relevance', 'asc');
await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Relevance'); await page.sortingPicker.sortBy('Relevance', 'desc');
await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);
}); });
it('[C277732] Sort by Modifier', async () => { it('[C277732] Sort by Modifier', async () => {
await page.sortingPicker.sortBy('Modifier'); await page.sortingPicker.sortBy('Modifier', 'asc');
await page.sortingPicker.setSortOrderASC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name);
await page.sortingPicker.sortBy('Modifier'); await page.sortingPicker.sortBy('Modifier', 'desc');
await page.sortingPicker.setSortOrderDESC();
expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name);
expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name);

View File

@@ -32,13 +32,13 @@ export type SortByType = 'Relevance' | 'Title' | 'Filename' | 'Modified date' |
export type SortOrderType = 'ASC' | 'DESC' | ''; export type SortOrderType = 'ASC' | 'DESC' | '';
export class SearchSortingPicker extends Component { export class SearchSortingPicker extends Component {
sortOrderButton = this.byCss('button[mat-icon-button]'); actionMenu = browser.element(by.css('aca-search-action-menu > button'));
sortByDropdownCollapsed = this.byCss('.mat-select'); sortOrderButton = browser.element(by.css('#aca-button-sorting-menu'));
sortByDropdownExpanded = browser.element(by.css('.mat-select-panel')); sortByDropdownExpanded = browser.element.all(by.css('.mat-menu-panel')).get(1);
sortByList = this.sortByDropdownExpanded.all(by.css('.mat-option .mat-option-text')); sortByList = this.sortByDropdownExpanded.all(by.css('button'));
constructor(ancestor?: string) { constructor(ancestor?: string) {
super('adf-search-sorting-picker', ancestor); super('aca-button-action-menu', ancestor);
} }
async waitForSortByDropdownToExpand(): Promise<void> { async waitForSortByDropdownToExpand(): Promise<void> {
@@ -50,35 +50,20 @@ export class SearchSortingPicker extends Component {
} }
async isSortOrderButtonDisplayed(): Promise<boolean> { async isSortOrderButtonDisplayed(): Promise<boolean> {
return isPresentAndDisplayed(this.sortOrderButton); return isPresentAndDisplayed(this.actionMenu);
}
async getSortOrder(): Promise<SortOrderType> {
const orderArrow = await this.sortOrderButton.getText();
if (orderArrow.includes('upward')) {
return 'ASC';
} else if (orderArrow.includes('downward')) {
return 'DESC';
} else {
return '';
}
} }
async isSortByOptionDisplayed(): Promise<boolean> { async isSortByOptionDisplayed(): Promise<boolean> {
return isPresentAndDisplayed(this.sortByDropdownCollapsed); return isPresentAndDisplayed(this.sortOrderButton);
} }
async isSortByDropdownExpanded(): Promise<boolean> { async isSortByDropdownExpanded(): Promise<boolean> {
return isPresentAndDisplayed(this.sortByDropdownExpanded); return isPresentAndDisplayed(this.sortByDropdownExpanded);
} }
async getSelectedSortByOption(): Promise<string> {
return this.sortByDropdownCollapsed.getText();
}
async clickSortByDropdown(): Promise<void> { async clickSortByDropdown(): Promise<void> {
await BrowserActions.click(this.sortByDropdownCollapsed); await BrowserActions.click(this.actionMenu);
await BrowserActions.click(this.sortOrderButton);
await this.waitForSortByDropdownToExpand(); await this.waitForSortByDropdownToExpand();
} }
@@ -88,23 +73,14 @@ export class SearchSortingPicker extends Component {
}); });
} }
async sortBy(option: SortByType): Promise<void> { async sortBy(option: SortByType, direction: string): Promise<void> {
if (!(await this.isSortByDropdownExpanded())) { if (!(await this.isSortByDropdownExpanded())) {
await this.clickSortByDropdown(); await this.clickSortByDropdown();
} }
const elem = browser.element(by.cssContainingText('.mat-option .mat-option-text', option)); const elem = browser.element(by.cssContainingText('.mat-menu-item', option));
const optionId = await elem.getAttribute('id');
await BrowserActions.click(elem); await BrowserActions.click(elem);
} const directionSortElement = browser.element(by.id(`${optionId}-${direction.toLocaleLowerCase()}`));
await BrowserActions.click(directionSortElement);
async setSortOrderASC(): Promise<void> {
if ((await this.getSortOrder()) !== 'ASC') {
await BrowserActions.click(this.sortOrderButton);
}
}
async setSortOrderDESC(): Promise<void> {
if ((await this.getSortOrder()) !== 'DESC') {
await BrowserActions.click(this.sortOrderButton);
}
} }
} }

View File

@@ -0,0 +1,26 @@
<button mat-icon-button [matMenuTriggerFor]="dataSorting" id="aca-button-action-menu" aria-label="Search action menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #dataSorting="matMenu">
<button mat-menu-item [matMenuTriggerFor]="sorting" id="aca-button-sorting-menu">{{'SEARCH.SORT.SORTING_OPTION' | translate}}</button>
</mat-menu>
<mat-menu #sorting="matMenu">
<ng-template matMenuContent>
<button mat-menu-item *ngFor="let option of options" [id]="option.key+'-sorting-option'"
[matMenuTriggerFor]="direction" [matMenuTriggerData]="{option: option}">
{{option.label | translate}}
</button>
</ng-template>
</mat-menu>
<mat-menu #direction="matMenu">
<ng-template matMenuContent let-option="option">
<button mat-menu-item [id]="option.key+'-sorting-option-asc'"
(click)="onAscSortingClicked(option)">{{'SEARCH.SORT.ASCENDING' | translate}}</button>
<button mat-menu-item [id]="option.key+'-sorting-option-desc'"
(click)="onDescSortingClicked(option)">{{'SEARCH.SORT.DESCENDING' | translate}}</button>
</ng-template>
</mat-menu>

View File

@@ -0,0 +1,137 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { SearchSortingDefinition } from '@alfresco/adf-content-services/lib/search/models/search-sorting-definition.interface';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { SearchActionMenuComponent } from './search-action-menu.component';
const mockSortingData: SearchSortingDefinition[] = [
{
ascending: false,
field: 'fieldA',
key: 'keyA',
label: 'LabelA',
type: 'A'
},
{
ascending: true,
field: 'fieldB',
key: 'keyB',
label: 'Zorro',
type: 'Z'
}
];
describe('SearchActionMenuComponent', () => {
let fixture: ComponentFixture<SearchActionMenuComponent>;
let component: SearchActionMenuComponent;
let queryService: SearchQueryBuilderService;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [AppTestingModule],
declarations: [SearchActionMenuComponent],
providers: [SearchQueryBuilderService]
});
fixture = TestBed.createComponent(SearchActionMenuComponent);
queryService = TestBed.inject(SearchQueryBuilderService);
component = fixture.componentInstance;
});
it('should emit sortingSelected event when asc sorting option is selected', async () => {
spyOn(queryService, 'getSortingOptions').and.returnValue(mockSortingData);
const expectedOption: SearchSortingDefinition = {
ascending: true,
field: 'fieldA',
key: 'keyA',
label: 'LabelA',
type: 'A'
};
spyOn(component.sortingSelected, 'emit').and.callThrough();
fixture.detectChanges();
await fixture.whenStable();
const actionMenuButton: HTMLButtonElement = fixture.nativeElement.querySelector('#aca-button-action-menu');
actionMenuButton.dispatchEvent(new Event('click'));
await fixture.whenStable();
fixture.detectChanges();
const sortingMenuButton: HTMLButtonElement = document.querySelector('#aca-button-sorting-menu');
sortingMenuButton.dispatchEvent(new Event('click'));
await fixture.whenStable();
fixture.detectChanges();
const fieldAMenuButton: HTMLButtonElement = document.querySelector('#keyA-sorting-option');
fieldAMenuButton.dispatchEvent(new Event('click'));
await fixture.whenStable();
fixture.detectChanges();
const directionButton: HTMLButtonElement = document.querySelector('#keyA-sorting-option-asc');
directionButton.dispatchEvent(new Event('click'));
await fixture.whenStable();
fixture.detectChanges();
expect(component.sortingSelected.emit).toHaveBeenCalledWith(expectedOption);
});
it('should emit sortingSelected event when desc sorting option is selected', async () => {
spyOn(queryService, 'getSortingOptions').and.returnValue(mockSortingData);
const expectedOption: SearchSortingDefinition = {
ascending: false,
field: 'fieldB',
key: 'keyB',
label: 'Zorro',
type: 'Z'
};
spyOn(component.sortingSelected, 'emit').and.callThrough();
fixture.detectChanges();
await fixture.whenStable();
const actionMenuButton: HTMLButtonElement = fixture.nativeElement.querySelector('#aca-button-action-menu');
actionMenuButton.dispatchEvent(new Event('click'));
await fixture.whenStable();
fixture.detectChanges();
const sortingMenuButton: HTMLButtonElement = document.querySelector('#aca-button-sorting-menu');
sortingMenuButton.dispatchEvent(new Event('click'));
await fixture.whenStable();
fixture.detectChanges();
const fieldAMenuButton: HTMLButtonElement = document.querySelector('#keyB-sorting-option');
fieldAMenuButton.dispatchEvent(new Event('click'));
await fixture.whenStable();
fixture.detectChanges();
const directionButton: HTMLButtonElement = document.querySelector('#keyB-sorting-option-desc');
directionButton.dispatchEvent(new Event('click'));
await fixture.whenStable();
fixture.detectChanges();
expect(component.sortingSelected.emit).toHaveBeenCalledWith(expectedOption);
});
});

View File

@@ -0,0 +1,57 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { SearchSortingDefinition } from '@alfresco/adf-content-services/lib/search/models/search-sorting-definition.interface';
import { Component, OnInit, Output, ViewEncapsulation, EventEmitter } from '@angular/core';
@Component({
selector: 'aca-search-action-menu',
templateUrl: './search-action-menu.component.html',
encapsulation: ViewEncapsulation.None,
host: { class: 'aca-search-input' }
})
export class SearchActionMenuComponent implements OnInit {
@Output()
sortingSelected: EventEmitter<SearchSortingDefinition> = new EventEmitter();
options: SearchSortingDefinition[] = [];
constructor(private queryBuilder: SearchQueryBuilderService) {}
ngOnInit(): void {
this.options = this.queryBuilder.getSortingOptions();
}
onAscSortingClicked(option: SearchSortingDefinition) {
option.ascending = true;
this.sortingSelected.emit(option);
}
onDescSortingClicked(option: SearchSortingDefinition) {
option.ascending = false;
this.sortingSelected.emit(option);
}
}

View File

@@ -37,6 +37,7 @@ import { AppCommonModule } from '../common/common.module';
import { DirectivesModule } from '../../directives/directives.module'; import { DirectivesModule } from '../../directives/directives.module';
import { AppLayoutModule } from '../layout/layout.module'; import { AppLayoutModule } from '../layout/layout.module';
import { ContextMenuModule } from '../context-menu/context-menu.module'; import { ContextMenuModule } from '../context-menu/context-menu.module';
import { SearchActionMenuComponent } from './search-action-menu/search-action-menu.component';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -51,7 +52,7 @@ import { ContextMenuModule } from '../context-menu/context-menu.module';
ContextMenuModule, ContextMenuModule,
LockedByModule LockedByModule
], ],
declarations: [SearchResultsComponent, SearchLibrariesResultsComponent, SearchResultsRowComponent], declarations: [SearchResultsComponent, SearchLibrariesResultsComponent, SearchResultsRowComponent, SearchActionMenuComponent],
exports: [SearchResultsComponent, SearchLibrariesResultsComponent, SearchResultsRowComponent] exports: [SearchResultsComponent, SearchLibrariesResultsComponent, SearchResultsRowComponent, SearchActionMenuComponent]
}) })
export class AppSearchResultsModule {} export class AppSearchResultsModule {}

View File

@@ -26,8 +26,9 @@
<adf-search-filter-chips class="content__filter"></adf-search-filter-chips> <adf-search-filter-chips class="content__filter"></adf-search-filter-chips>
<button mat-button adf-reset-search class='content__reset-action'><mat-icon> refresh </mat-icon></button> <button mat-button adf-reset-search class='content__reset-action'><mat-icon> refresh </mat-icon></button>
</div>
<adf-search-sorting-picker class="content__sort-picker"></adf-search-sorting-picker> <div>
<aca-search-action-menu (sortingSelected)="onSearchSortingUpdate($event)"></aca-search-action-menu>
</div> </div>
<adf-document-list <adf-document-list

View File

@@ -43,6 +43,7 @@ import { ContentManagementService } from '../../../services/content-management.s
import { ShowHeaderMode, TranslationService } from '@alfresco/adf-core'; import { ShowHeaderMode, TranslationService } from '@alfresco/adf-core';
import { combineLatest, Observable } from 'rxjs'; import { combineLatest, Observable } from 'rxjs';
import { AppExtensionService } from '@alfresco/aca-shared'; import { AppExtensionService } from '@alfresco/aca-shared';
import { SearchSortingDefinition } from '@alfresco/adf-content-services/lib/search/models/search-sorting-definition.interface';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
@Component({ @Component({
@@ -243,4 +244,9 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
this.store.dispatch(new SetInfoDrawerPreviewStateAction(false)); this.store.dispatch(new SetInfoDrawerPreviewStateAction(false));
this.store.dispatch(new SetInfoDrawerStateAction(false)); this.store.dispatch(new SetInfoDrawerStateAction(false));
} }
onSearchSortingUpdate(option: SearchSortingDefinition) {
this.queryBuilder.sorting = [{ ...option, ascending: option.ascending }];
this.queryBuilder.update();
}
} }

View File

@@ -489,6 +489,9 @@
"HINT": "Search input must have at least 2 alphanumeric characters." "HINT": "Search input must have at least 2 alphanumeric characters."
}, },
"SORT": { "SORT": {
"SORTING_OPTION": "Sort by",
"ASCENDING": "Ascending",
"DESCENDING": "Descending",
"RELEVANCE": "Relevance", "RELEVANCE": "Relevance",
"FILENAME": "Filename", "FILENAME": "Filename",
"TITLE": "Title", "TITLE": "Title",