From 26f28bca5509f93080b03e2993413554841dc290 Mon Sep 17 00:00:00 2001 From: gkolokythas Date: Mon, 23 Sep 2019 18:11:29 +0300 Subject: [PATCH] Adds descending ordering and sorting by finalized date where published DMP is requested. --- dmp-frontend/src/app/ui/dashboard/dashboard.component.ts | 2 +- .../filters/explore-dataset-filters.component.ts | 2 +- .../src/app/ui/explore-dmp/explore-dmp-listing.component.ts | 4 +++- .../listing-item/explore-dmp-listing-item.component.html | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts index a6d966ea7..545171545 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts @@ -148,7 +148,7 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC getPublicDmps() { const dmpCriteria = new ExploreDmpCriteriaModel(); const fields: Array = new Array(); - fields.push('asc'); + fields.push('-finalizedAt'); const dataTableRequest: DataTableRequest = new DataTableRequest(0, 2, { fields: fields }); dataTableRequest.criteria = dmpCriteria; return this.dmpService.getPublicPaged(dataTableRequest, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => { this.dmpListingItems = result.data; }); diff --git a/dmp-frontend/src/app/ui/explore-dataset/filters/explore-dataset-filters.component.ts b/dmp-frontend/src/app/ui/explore-dataset/filters/explore-dataset-filters.component.ts index 3b4115f32..bbf1867c4 100644 --- a/dmp-frontend/src/app/ui/explore-dataset/filters/explore-dataset-filters.component.ts +++ b/dmp-frontend/src/app/ui/explore-dataset/filters/explore-dataset-filters.component.ts @@ -306,7 +306,7 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI filterDmps(value: string): Observable> { const fields: Array = new Array(); - fields.push('asc'); + fields.push('-finalizedAt'); const dmpDataTableRequest: DataTableRequest = new DataTableRequest(0, null, { fields: fields }); dmpDataTableRequest.criteria = new ExploreDatasetCriteriaModel(); dmpDataTableRequest.criteria.like = value; diff --git a/dmp-frontend/src/app/ui/explore-dmp/explore-dmp-listing.component.ts b/dmp-frontend/src/app/ui/explore-dmp/explore-dmp-listing.component.ts index 6a3068e67..1b1637f43 100644 --- a/dmp-frontend/src/app/ui/explore-dmp/explore-dmp-listing.component.ts +++ b/dmp-frontend/src/app/ui/explore-dmp/explore-dmp-listing.component.ts @@ -22,7 +22,7 @@ import { TranslateService } from "@ngx-translate/core"; export class ExploreDmpListingComponent extends BaseComponent implements OnInit, IBreadCrumbComponent { @ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator; - @ViewChild(MatSort, { static: false }) sort: MatSort; + sort = new MatSort(); exploreDmpCriteriaModel: ExploreDmpCriteriaModel; titlePrefix: string; @@ -37,6 +37,8 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit, private language: TranslateService, ) { super(); + this.sort.direction = 'desc'; + this.sort.active = "publishedAt"; } ngOnInit() { diff --git a/dmp-frontend/src/app/ui/explore-dmp/listing-item/explore-dmp-listing-item.component.html b/dmp-frontend/src/app/ui/explore-dmp/listing-item/explore-dmp-listing-item.component.html index 09001a03f..905d71de2 100644 --- a/dmp-frontend/src/app/ui/explore-dmp/listing-item/explore-dmp-listing-item.component.html +++ b/dmp-frontend/src/app/ui/explore-dmp/listing-item/explore-dmp-listing-item.component.html @@ -28,7 +28,7 @@
{{profile.label}}
-

{{'DMP-PROFILE-LISTING.COLUMNS.PUBLISHED' | translate}} {{dmp.creationTime | date: "shortDate"}}

+

{{'DMP-PROFILE-LISTING.COLUMNS.PUBLISHED' | translate}} {{dmp.finalizedAt | date: "shortDate"}}