Adds descending ordering and sorting by finalized date where published DMP is requested.

This commit is contained in:
gkolokythas 2019-09-23 18:11:29 +03:00
parent 3f117d4a0f
commit 26f28bca55
4 changed files with 6 additions and 4 deletions

View File

@ -148,7 +148,7 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC
getPublicDmps() { getPublicDmps() {
const dmpCriteria = new ExploreDmpCriteriaModel(); const dmpCriteria = new ExploreDmpCriteriaModel();
const fields: Array<string> = new Array<string>(); const fields: Array<string> = new Array<string>();
fields.push('asc'); fields.push('-finalizedAt');
const dataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, 2, { fields: fields }); const dataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, 2, { fields: fields });
dataTableRequest.criteria = dmpCriteria; dataTableRequest.criteria = dmpCriteria;
return this.dmpService.getPublicPaged(dataTableRequest, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => { this.dmpListingItems = result.data; }); return this.dmpService.getPublicPaged(dataTableRequest, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => { this.dmpListingItems = result.data; });

View File

@ -306,7 +306,7 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI
filterDmps(value: string): Observable<DataTableData<DmpListingModel>> { filterDmps(value: string): Observable<DataTableData<DmpListingModel>> {
const fields: Array<string> = new Array<string>(); const fields: Array<string> = new Array<string>();
fields.push('asc'); fields.push('-finalizedAt');
const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields }); const dmpDataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, null, { fields: fields });
dmpDataTableRequest.criteria = new ExploreDatasetCriteriaModel(); dmpDataTableRequest.criteria = new ExploreDatasetCriteriaModel();
dmpDataTableRequest.criteria.like = value; dmpDataTableRequest.criteria.like = value;

View File

@ -22,7 +22,7 @@ import { TranslateService } from "@ngx-translate/core";
export class ExploreDmpListingComponent extends BaseComponent implements OnInit, IBreadCrumbComponent { export class ExploreDmpListingComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator; @ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
@ViewChild(MatSort, { static: false }) sort: MatSort; sort = new MatSort();
exploreDmpCriteriaModel: ExploreDmpCriteriaModel; exploreDmpCriteriaModel: ExploreDmpCriteriaModel;
titlePrefix: string; titlePrefix: string;
@ -37,6 +37,8 @@ export class ExploreDmpListingComponent extends BaseComponent implements OnInit,
private language: TranslateService, private language: TranslateService,
) { ) {
super(); super();
this.sort.direction = 'desc';
this.sort.active = "publishedAt";
} }
ngOnInit() { ngOnInit() {

View File

@ -28,7 +28,7 @@
<div *ngFor="let profile of dmp.associatedProfiles" class="pt-1"> <div *ngFor="let profile of dmp.associatedProfiles" class="pt-1">
<div matTooltip="{{profile.label}}" class="chip ml-2 mr-2">{{profile.label}}</div> <div matTooltip="{{profile.label}}" class="chip ml-2 mr-2">{{profile.label}}</div>
</div> </div>
<p>{{'DMP-PROFILE-LISTING.COLUMNS.PUBLISHED' | translate}} {{dmp.creationTime | date: "shortDate"}}</p> <p>{{'DMP-PROFILE-LISTING.COLUMNS.PUBLISHED' | translate}} {{dmp.finalizedAt | date: "shortDate"}}</p>
</div> </div>
</div> </div>
</div> </div>