diff --git a/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts b/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
index d4004611b1..485afd352b 100644
--- a/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
+++ b/apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
@@ -1,7 +1,7 @@
describe('dashboard', () => {
- let originalList
- let newList
describe('pagination', () => {
+ let originalList
+ let newList
it('should display different results on click on arrow', () => {
cy.visit('/')
cy.get('gn-ui-record-table')
@@ -36,4 +36,33 @@ describe('dashboard', () => {
})
})
})
+
+ // NEEDS TO WAIT UNTIL STYLE IS DONE
+ describe('sorting', () => {
+ let originalList
+ let newList
+ it('should order the result list on click', () => {
+ cy.visit('/')
+ cy.get('gn-ui-record-table')
+ .find('.record-table-col')
+ .first()
+ .as('pageOne')
+
+ cy.get('@pageOne')
+ .invoke('text')
+ .then((list) => {
+ originalList = list.trim()
+ cy.get('.record-table-header').first().click()
+ cy.get('gn-ui-sort').find('gn-ui-button').first().click()
+ cy.get('gn-ui-record-table')
+ .find('.record-table-col')
+ .first()
+ .invoke('text')
+ .then((list) => {
+ newList = list.trim()
+ expect(newList).not.to.be(originalList)
+ })
+ })
+ })
+ })
})
diff --git a/apps/metadata-editor/src/app/records/records-list.component.html b/apps/metadata-editor/src/app/records/records-list.component.html
index 71204476fc..01198dccb5 100644
--- a/apps/metadata-editor/src/app/records/records-list.component.html
+++ b/apps/metadata-editor/src/app/records/records-list.component.html
@@ -10,6 +10,8 @@
{{ title }}
[records]="results"
[totalHits]="searchFacade.resultsHits$ | async"
(recordSelect)="editRecord($event)"
+ (sortByChange)="setSortBy($event)"
+ [sortBy]="searchFacade.sortBy$ | async"
>
{
let fixture: ComponentFixture
let router: Router
let searchService: SearchService
+ let searchFacade: SearchFacade
beforeEach(() => {
TestBed.configureTestingModule({
@@ -89,6 +90,7 @@ describe('RecordsListComponent', () => {
})
router = TestBed.inject(Router)
searchService = TestBed.inject(SearchService)
+ searchFacade = TestBed.inject(SearchFacade)
fixture = TestBed.createComponent(RecordsListComponent)
component = fixture.componentInstance
fixture.detectChanges()
@@ -116,6 +118,12 @@ describe('RecordsListComponent', () => {
expect(pagination.currentPage).toEqual(currentPage)
expect(pagination.totalPages).toEqual(totalPages)
})
+ it('orders the completion column', () => {
+ expect(searchFacade.setSortBy).toHaveBeenCalledWith([
+ 'desc',
+ 'changeDate',
+ ])
+ })
describe('when click on a record', () => {
beforeEach(() => {
table.recordSelect.emit({ uniqueIdentifier: 123 })
diff --git a/apps/metadata-editor/src/app/records/records-list.component.ts b/apps/metadata-editor/src/app/records/records-list.component.ts
index e11c1f9dbb..f3511d531c 100644
--- a/apps/metadata-editor/src/app/records/records-list.component.ts
+++ b/apps/metadata-editor/src/app/records/records-list.component.ts
@@ -6,6 +6,7 @@ import { CatalogRecord } from '@geonetwork-ui/common/domain/record'
import { SearchFacade, SearchService } from '@geonetwork-ui/feature/search'
import { UiSearchModule } from '@geonetwork-ui/ui/search'
import { UiElementsModule } from '@geonetwork-ui/ui/elements'
+import { SortByField } from '@geonetwork-ui/common/domain/search'
const includes = [
'uuid',
@@ -49,4 +50,8 @@ export class RecordsListComponent {
editRecord(record: CatalogRecord) {
this.router.navigate(['/edit', record.uniqueIdentifier])
}
+
+ setSortBy(newSortBy: SortByField) {
+ this.searchFacade.setSortBy(newSortBy)
+ }
}
diff --git a/apps/metadata-editor/src/styles.css b/apps/metadata-editor/src/styles.css
index e3a2850c1c..41d06136c0 100644
--- a/apps/metadata-editor/src/styles.css
+++ b/apps/metadata-editor/src/styles.css
@@ -21,3 +21,7 @@ body {
.menu-title {
@apply text-xl px-9 py-3;
}
+
+.mat-mdc-button-base {
+ line-height: normal;
+}
diff --git a/libs/ui/search/src/lib/record-table/record-table.component.html b/libs/ui/search/src/lib/record-table/record-table.component.html
index 53365b9bb3..750bb3b409 100644
--- a/libs/ui/search/src/lib/record-table/record-table.component.html
+++ b/libs/ui/search/src/lib/record-table/record-table.component.html
@@ -10,24 +10,97 @@
>
results.records.hits.displayedOn
+