Skip to content

Commit

Permalink
feat(me): edit button style, add translations and unit test for setso…
Browse files Browse the repository at this point in the history
…rtby
  • Loading branch information
cmoinier committed Sep 8, 2023
1 parent 721e0e5 commit bc8e10a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('RecordsListComponent', () => {
let fixture: ComponentFixture<RecordsListComponent>
let router: Router
let searchService: SearchService
let searchFacade: SearchFacade

beforeEach(() => {
TestBed.configureTestingModule({
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 })
Expand Down
4 changes: 4 additions & 0 deletions apps/metadata-editor/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ body {
.menu-title {
@apply text-xl px-9 py-3;
}

.mat-mdc-button-base {
line-height: normal;
}
2 changes: 1 addition & 1 deletion libs/ui/elements/src/lib/sort/sort.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<mat-icon *ngIf="!asc"> expand_more</mat-icon>
<mat-icon *ngIf="asc"> expand_less</mat-icon>
</gn-ui-button>
</div>
</div>
43 changes: 33 additions & 10 deletions libs/ui/search/src/lib/record-table/record-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@
<div class="contents text-sm">
<div class="record-table-header text-gray-400 flex gap-1">
<gn-ui-button
type="light"
extraClass="px-3 py-2 space-x-1"
(buttonClick)="setSortBy('resourceTitleObject.default.keyword')"
>
<span translate>record.metadata.title</span>
<!-- <gn-ui-sort *ngIf="activeSortElement === 'title'" [records]="records" activeCol="title"></gn-ui-sort> -->
<mat-icon
class="text-base leading-tight"
*ngIf="isSortedBy('resourceTitleObject.default.keyword', 'desc')"
>
expand_more</mat-icon
>
<mat-icon
class="text-base leading-tight"
*ngIf="isSortedBy('resourceTitleObject.default.keyword', 'asc')"
>
expand_less</mat-icon
Expand All @@ -39,42 +42,62 @@
<div class="record-table-header text-gray-400 flex gap-1">
<gn-ui-button
type="light"
extraClass="px-3 py-2"
extraClass="px-3 py-2 space-x-1"
(buttonClick)="setSortBy('recordOwner')"
>
<span translate>record.metadata.author</span>
<mat-icon
class="!w-[16px] !h-[16px]"
class="text-base leading-tight"
*ngIf="isSortedBy('recordOwner', 'desc')"
>
expand_more</mat-icon
>
<mat-icon
class="!w-[16px] !h-[16px]"
class="text-base leading-tight"
*ngIf="isSortedBy('recordOwner', 'asc')"
>
expand_less</mat-icon
>
</gn-ui-button>
</div>
<div class="record-table-header text-gray-400 flex gap-1">
<gn-ui-button (buttonClick)="setSortBy('changeDate')">
<gn-ui-button
type="light"
extraClass="px-3 py-2 space-x-1"
(buttonClick)="setSortBy('changeDate')"
>
<span translate>record.metadata.completion</span>
<mat-icon *ngIf="isSortedBy('changeDate', 'desc')">
<mat-icon
class="text-base leading-tight"
*ngIf="isSortedBy('changeDate', 'desc')"
>
expand_more</mat-icon
>
<mat-icon *ngIf="isSortedBy('changeDate', 'asc')">
<mat-icon
class="text-base leading-tight"
*ngIf="isSortedBy('changeDate', 'asc')"
>
expand_less</mat-icon
>
</gn-ui-button>
</div>
<div class="record-table-header text-gray-400 flex gap-1">
<gn-ui-button (buttonClick)="setSortBy('createDate')">
<gn-ui-button
type="light"
extraClass="px-3 py-2 space-x-1"
(buttonClick)="setSortBy('createDate')"
>
<span translate>record.metadata.createdOn</span>
<mat-icon *ngIf="isSortedBy('createDate', 'desc')">
<mat-icon
class="text-base leading-tight"
*ngIf="isSortedBy('createDate', 'desc')"
>
expand_more</mat-icon
>
<mat-icon *ngIf="isSortedBy('createDate', 'asc')">
<mat-icon
class="text-base leading-tight"
*ngIf="isSortedBy('createDate', 'asc')"
>
expand_less</mat-icon
>
</gn-ui-button>
Expand Down
4 changes: 2 additions & 2 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"record.metadata.catalog": "Catalog",
"record.metadata.completion": "Completion",
"record.metadata.contact": "Contact",
"record.metadata.createdOn": "created on",
"record.metadata.createdOn": "Created on",
"record.metadata.details": "Details",
"record.metadata.download": "Downloads",
"record.metadata.formats": "Formats",
Expand All @@ -188,7 +188,7 @@
"record.metadata.publications": "publications",
"record.metadata.related": "Related records",
"record.metadata.sheet": "Original metadata sheet",
"record.metadata.title": "title",
"record.metadata.title": "Title",
"record.metadata.updateFrequency": "Update Frequency",
"record.metadata.updateStatus": "Update Status",
"record.metadata.updatedOn": "Updated On",
Expand Down
10 changes: 5 additions & 5 deletions translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@
"record.externalViewer.open": "Ouvrir dans le visualiseur externe",
"record.metadata.about": "À propos",
"record.metadata.api": "API",
"record.metadata.author": "",
"record.metadata.author": "Auteur",
"record.metadata.catalog": "Catalogue",
"record.metadata.completion": "",
"record.metadata.completion": "Mis à jour",
"record.metadata.contact": "Contact",
"record.metadata.createdOn": "",
"record.metadata.createdOn": "Créé le",
"record.metadata.details": "Détails",
"record.metadata.download": "Téléchargements",
"record.metadata.formats": "",
"record.metadata.formats": "Formats",
"record.metadata.isOpenData": "Donnée Ouverte",
"record.metadata.keywords": "Mots clés",
"record.metadata.links": "Liens",
Expand All @@ -188,7 +188,7 @@
"record.metadata.publications": "données",
"record.metadata.related": "Voir aussi",
"record.metadata.sheet": "Fiche de métadonnées d'origine",
"record.metadata.title": "titre",
"record.metadata.title": "Titre",
"record.metadata.updateFrequency": "Fréquence de mise à jour",
"record.metadata.updateStatus": "Statut de mise à jour",
"record.metadata.updatedOn": "Dernière mise à jour",
Expand Down

0 comments on commit bc8e10a

Please sign in to comment.