Fixed issues with public dashboard

This commit is contained in:
George Kalampokis 2020-04-16 18:36:17 +03:00
parent 00e4dd5d36
commit e0211a019c
1 changed files with 14 additions and 7 deletions

View File

@ -25,6 +25,8 @@ import { Observable, of as observableOf } from 'rxjs';
import { mergeMap, takeUntil } from 'rxjs/operators';
import { BreadcrumbItem } from '../misc/breadcrumb/definition/breadcrumb-item';
import { IBreadCrumbComponent } from '../misc/breadcrumb/definition/IBreadCrumbComponent';
import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria';
import { DatasetCriteria } from '@app/core/query/dataset/dataset-criteria';
@Component({
@ -145,26 +147,31 @@ export class DashboardComponent extends BaseComponent implements OnInit, IBreadC
}
getPublicDmps() {
const dmpCriteria = new ExploreDmpCriteriaModel();
const dmpCriteria = new DmpCriteria();
dmpCriteria.allVersions = false;
dmpCriteria.isPublic = true;
dmpCriteria.onlyPublic = true;
const fields: Array<string> = new Array<string>();
fields.push('-finalizedAt');
const dataTableRequest: DataTableRequest<ExploreDmpCriteriaModel> = new DataTableRequest(0, 2, { fields: fields });
const dataTableRequest: DataTableRequest<DmpCriteria> = 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; });
return this.dmpService.getPaged(dataTableRequest, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => { this.dmpListingItems = result.data; });
}
getPublicDatasets() {
const dmpCriteria = new ExploreDatasetCriteriaModel();
const dmpCriteria = new DatasetCriteria();
dmpCriteria.allVersions = false;
dmpCriteria.isPublic = true;
const fields: Array<string> = new Array<string>();
fields.push('-modified');
const dataTableRequest: DataTableRequest<ExploreDatasetCriteriaModel> = new DataTableRequest(0, 4, { fields: fields });
const dataTableRequest: DataTableRequest<DatasetCriteria> = new DataTableRequest(0, 4, { fields: fields });
dataTableRequest.criteria = dmpCriteria;
return this.datasetService.getPublicPaged(dataTableRequest).pipe(takeUntil(this._destroyed)).subscribe(result => { this.datasetListingItems = result.data; });
return this.datasetService.getPaged(dataTableRequest).pipe(takeUntil(this._destroyed)).subscribe(result => { this.datasetListingItems = result.data; });
}
dmpClicked(dmp: DmpListingModel) {
if (!this.isAuthenticated()) {
this.router.navigate(['../explore-plans/overview', dmp.id], { relativeTo: this.route });
this.router.navigate(['../explore-plans/publicOverview', dmp.id], { relativeTo: this.route });
} else {
this.router.navigate(['/plans/publicEdit/' + dmp.id]);
}