Fixes bug on public dmp / datasets listing
This commit is contained in:
parent
3d51b6bd3c
commit
ff532c56fb
|
@ -137,6 +137,7 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
|||
fields.push('-modified');
|
||||
//if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
|
||||
const request = new DataTableRequest<DatasetCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
||||
this.criteria.isPublic = this.isPublic;
|
||||
request.criteria = this.criteria;
|
||||
|
||||
this.datasetService.getPaged(request).pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
|
@ -151,6 +152,7 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
|||
this.startIndex = this.startIndex + this.pageSize;
|
||||
const fields: Array<string> = ["-modified"];
|
||||
const request = new DataTableRequest<DatasetCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
||||
this.criteria.isPublic = this.isPublic;
|
||||
request.criteria = this.criteria;
|
||||
|
||||
this.datasetService.getPaged(request).pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
|
|
|
@ -174,6 +174,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
fields.push('-modified');
|
||||
|
||||
const request = new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
||||
this.setPublicCriteria();
|
||||
request.criteria = this.criteria;
|
||||
|
||||
this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
|
@ -195,6 +196,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
this.startIndex = this.startIndex + this.pageSize;
|
||||
const fields: Array<string> = ["-modified"];
|
||||
const request = new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
||||
this.setPublicCriteria();
|
||||
request.criteria = this.criteria;
|
||||
|
||||
this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
|
@ -321,15 +323,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
role: formGroup.get('role').value
|
||||
}
|
||||
this.criteria.status = formGroup.get('status').value;
|
||||
if (formGroup.get('status').value == 2) {
|
||||
this.criteria.isPublic = true;
|
||||
} else {
|
||||
this.criteria.isPublic = false;
|
||||
}
|
||||
this.criteria.onlyPublic = this.isPublic;
|
||||
if (this.isPublic) {
|
||||
this.criteria.isPublic = true;
|
||||
}
|
||||
this.setPublicCriteria(formGroup);
|
||||
if (formGroup.get('datasetTemplates').value)
|
||||
this.criteria.datasetTemplates = formGroup.get('datasetTemplates').value.map(x => x.id);
|
||||
if (formGroup.get('collaborators').value)
|
||||
|
@ -343,6 +337,19 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
this.criteria.grantStatus = formGroup.get('grantStatus').value;
|
||||
}
|
||||
|
||||
setPublicCriteria(formGroup?: FormGroup): void {
|
||||
if (formGroup && formGroup.get('status').value == 2) {
|
||||
this.criteria.isPublic = true;
|
||||
}
|
||||
|
||||
this.criteria.onlyPublic = this.isPublic;
|
||||
if (this.isPublic) {
|
||||
this.criteria.isPublic = true;
|
||||
} else {
|
||||
this.criteria.isPublic = false;
|
||||
}
|
||||
}
|
||||
|
||||
hasScrollbar(): boolean {
|
||||
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue