2019-09-23 10:17:03 +02:00
|
|
|
|
2018-11-27 18:33:17 +01:00
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
2019-09-23 10:17:03 +02:00
|
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
|
|
import { MatSort } from '@angular/material/sort';
|
2018-11-27 18:33:17 +01:00
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
2019-12-11 15:51:03 +01:00
|
|
|
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
|
|
|
import { DmpListingModel } from '@app/core/model/dmp/dmp-listing';
|
|
|
|
import { GrantListingModel } from '@app/core/model/grant/grant-listing';
|
|
|
|
import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria';
|
|
|
|
import { DmpService } from '@app/core/services/dmp/dmp.service';
|
|
|
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
|
|
|
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation.component';
|
|
|
|
import { DmpCriteriaComponent } from '@app/ui/dmp/listing/criteria/dmp-criteria.component';
|
|
|
|
import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item';
|
|
|
|
import { IBreadCrumbComponent } from '@app/ui/misc/breadcrumb/definition/IBreadCrumbComponent';
|
|
|
|
import { BaseComponent } from '@common/base/base.component';
|
2019-05-23 11:40:24 +02:00
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2019-12-11 15:51:03 +01:00
|
|
|
import { Observable, of as observableOf } from 'rxjs';
|
|
|
|
import { takeUntil } from 'rxjs/operators';
|
2019-12-16 11:18:49 +01:00
|
|
|
import { GrantService } from "@app/core/services/grant/grant.service";
|
2020-03-03 10:16:02 +01:00
|
|
|
import { DmpUploadDialogue } from './upload-dialogue/dmp-upload-dialogue.component';
|
|
|
|
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
2020-04-01 17:16:06 +02:00
|
|
|
import { isNullOrUndefined } from 'util';
|
|
|
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
2020-07-07 17:29:15 +02:00
|
|
|
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
2020-07-08 17:23:06 +02:00
|
|
|
import { DmpCriteriaDialogComponent } from './criteria/dmp-criteria-dialog.component';
|
2020-03-03 10:16:02 +01:00
|
|
|
|
2017-12-14 18:13:28 +01:00
|
|
|
|
|
|
|
@Component({
|
2018-10-05 17:00:54 +02:00
|
|
|
selector: 'app-dmp-listing-component',
|
|
|
|
templateUrl: 'dmp-listing.component.html',
|
|
|
|
styleUrls: ['./dmp-listing.component.scss'],
|
2017-12-14 18:13:28 +01:00
|
|
|
})
|
2019-01-18 18:03:45 +01:00
|
|
|
export class DmpListingComponent extends BaseComponent implements OnInit, IBreadCrumbComponent {
|
2017-12-14 18:13:28 +01:00
|
|
|
|
2019-09-23 10:17:03 +02:00
|
|
|
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
|
|
|
|
@ViewChild(MatSort, { static: false }) sort: MatSort;
|
2020-07-07 12:12:57 +02:00
|
|
|
// @ViewChild(DmpCriteriaComponent, { static: true }) criteria: DmpCriteriaComponent;
|
2018-10-05 17:00:54 +02:00
|
|
|
|
2019-09-23 10:17:03 +02:00
|
|
|
breadCrumbs: Observable<BreadcrumbItem[]> = observableOf([{ parentComponentName: null, label: 'DMPs', url: "/plans" }]);
|
2018-10-05 17:00:54 +02:00
|
|
|
itemId: string;
|
2019-08-01 09:54:40 +02:00
|
|
|
grantId: string;
|
|
|
|
showGrant: boolean;
|
2018-10-05 17:00:54 +02:00
|
|
|
titlePrefix: string;
|
2019-04-25 16:04:54 +02:00
|
|
|
totalCount: number;
|
|
|
|
listingItems: DmpListingModel[] = [];
|
2020-01-10 11:44:00 +01:00
|
|
|
allVersions: boolean = false;
|
|
|
|
groupLabel: string;
|
2020-04-01 17:16:06 +02:00
|
|
|
isPublic: boolean = false;
|
2020-07-03 16:17:23 +02:00
|
|
|
public isVisible = true
|
|
|
|
|
|
|
|
startIndex: number = 0;
|
|
|
|
pageSize: number = 5;
|
2019-04-25 16:04:54 +02:00
|
|
|
|
2020-07-07 12:12:57 +02:00
|
|
|
criteria: DmpCriteria;
|
2020-07-07 17:29:15 +02:00
|
|
|
criteriaFormGroup: FormGroup;
|
2020-07-07 14:54:12 +02:00
|
|
|
public formGroup = new FormBuilder().group({
|
|
|
|
like: new FormControl()
|
2020-07-08 16:54:41 +02:00
|
|
|
});
|
2020-07-07 12:12:57 +02:00
|
|
|
|
2020-07-09 09:53:17 +02:00
|
|
|
scrollbar: boolean;
|
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
constructor(
|
2019-01-18 18:03:45 +01:00
|
|
|
private dmpService: DmpService,
|
2018-10-05 17:00:54 +02:00
|
|
|
private router: Router,
|
|
|
|
private route: ActivatedRoute,
|
2020-07-07 12:12:57 +02:00
|
|
|
public dialog: MatDialog,
|
2019-05-23 11:40:24 +02:00
|
|
|
public enumUtils: EnumUtils,
|
|
|
|
private language: TranslateService,
|
2020-03-03 10:16:02 +01:00
|
|
|
private grantService: GrantService,
|
2020-04-01 17:16:06 +02:00
|
|
|
private uiNotificationService: UiNotificationService,
|
|
|
|
private authService: AuthService
|
2018-10-05 17:00:54 +02:00
|
|
|
) {
|
2018-11-27 18:33:17 +01:00
|
|
|
super();
|
2018-10-05 17:00:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-04-01 17:16:06 +02:00
|
|
|
this.isPublic = this.router.url.startsWith('/explore-plans');
|
|
|
|
if (!this.isPublic && isNullOrUndefined(this.authService.current())) {
|
|
|
|
this.router.navigateByUrl("/explore-plans");
|
|
|
|
}
|
2018-11-27 18:33:17 +01:00
|
|
|
this.route.params
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(async params => {
|
2019-08-01 09:54:40 +02:00
|
|
|
let grantLabel;
|
|
|
|
if (params['grantId']) {
|
|
|
|
this.grantId = params['grantId'];
|
2019-12-16 11:18:49 +01:00
|
|
|
this.showGrant = true;
|
|
|
|
this.grantService.getSingle(this.grantId)
|
|
|
|
.subscribe((grant: GrantListingModel) => {
|
|
|
|
// const grant: GrantListingModel = {
|
|
|
|
// id: this.grantId
|
|
|
|
// }
|
2020-07-07 12:12:57 +02:00
|
|
|
// this.breadCrumbs = Observable.of([{ parentComponentName: 'GrantEditorComponent', label: grantLabel, url: '/grants/edit/' + this.grantId }]);
|
|
|
|
grantLabel = this.route.snapshot.queryParams.grantLabel;
|
|
|
|
|
|
|
|
this.criteria = { like: null, grants: [grant], groupIds: null, allVersions: false }
|
|
|
|
// this.criteria.setCriteria({ like: null, grants: [grant], groupIds: null, allVersions: false });
|
2019-12-16 11:18:49 +01:00
|
|
|
|
|
|
|
this.refresh();
|
2020-07-07 12:12:57 +02:00
|
|
|
// this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
2019-12-16 11:18:49 +01:00
|
|
|
})
|
|
|
|
|
2020-01-10 11:44:00 +01:00
|
|
|
} else if (params['groupId']) {
|
|
|
|
this.itemId = params['groupId'];
|
|
|
|
this.showGrant = true;
|
|
|
|
const breadCrumbs = [];
|
|
|
|
this.allVersions = true;
|
|
|
|
|
|
|
|
this.language.get('NAV-BAR.MY-DMPS').pipe(takeUntil(this._destroyed)).subscribe(x => {
|
|
|
|
this.breadCrumbs = observableOf([
|
|
|
|
{
|
|
|
|
parentComponentName: null,
|
|
|
|
label: x,
|
|
|
|
url: '/plans'
|
|
|
|
}]
|
|
|
|
);
|
|
|
|
})
|
|
|
|
this.groupLabel = this.route.snapshot.queryParams.groupLabel;
|
2020-07-07 12:12:57 +02:00
|
|
|
|
|
|
|
// this.criteria.setCriteria(this.getDefaultCriteria());
|
|
|
|
this.criteria = this.getDefaultCriteria();
|
2020-01-10 11:44:00 +01:00
|
|
|
this.refresh();
|
2020-07-07 12:12:57 +02:00
|
|
|
// this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
2018-11-27 18:33:17 +01:00
|
|
|
} else {
|
|
|
|
this.itemId = params['groupId'];
|
2019-08-01 09:54:40 +02:00
|
|
|
this.showGrant = true;
|
2018-11-27 18:33:17 +01:00
|
|
|
const breadCrumbs = [];
|
2018-10-05 17:00:54 +02:00
|
|
|
|
2019-06-07 13:03:10 +02:00
|
|
|
// if (this.itemId) {
|
|
|
|
// const dmplabel = this.route.snapshot.queryParams.groupLabel;
|
|
|
|
// breadCrumbs.push({
|
|
|
|
// parentComponentName: null,
|
|
|
|
// label: this.language.instant('NAV-BAR.DMPS'),
|
|
|
|
// url: '/plans'
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// else
|
2019-06-24 16:46:22 +02:00
|
|
|
|
|
|
|
this.language.get('NAV-BAR.MY-DMPS').pipe(takeUntil(this._destroyed)).subscribe(x => {
|
2019-09-23 10:17:03 +02:00
|
|
|
this.breadCrumbs = observableOf([
|
2019-06-24 16:46:22 +02:00
|
|
|
{
|
|
|
|
parentComponentName: null,
|
|
|
|
label: x,
|
|
|
|
url: '/plans'
|
|
|
|
}]
|
|
|
|
);
|
2019-05-23 11:40:24 +02:00
|
|
|
})
|
2020-07-07 12:12:57 +02:00
|
|
|
// this.criteria.setCriteria(this.getDefaultCriteria());
|
|
|
|
this.criteria = this.getDefaultCriteria();
|
2018-11-27 18:33:17 +01:00
|
|
|
this.refresh();
|
2020-07-07 12:12:57 +02:00
|
|
|
// this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
2018-11-27 18:33:17 +01:00
|
|
|
}
|
2018-10-05 17:00:54 +02:00
|
|
|
|
2019-08-01 09:54:40 +02:00
|
|
|
if (this.grantId != null) {
|
|
|
|
if (grantLabel !== undefined) {
|
|
|
|
this.titlePrefix = 'for ' + grantLabel;
|
2018-11-27 18:33:17 +01:00
|
|
|
}
|
2018-10-05 17:00:54 +02:00
|
|
|
}
|
2019-05-22 11:52:53 +02:00
|
|
|
|
2018-11-27 18:33:17 +01:00
|
|
|
});
|
2020-07-07 14:54:12 +02:00
|
|
|
|
|
|
|
this.formGroup.get('like').valueChanges
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(x => this.controlModified());
|
2018-10-05 17:00:54 +02:00
|
|
|
}
|
|
|
|
|
2020-07-09 09:53:17 +02:00
|
|
|
ngAfterContentChecked(): void {
|
|
|
|
this.scrollbar = this.hasScrollbar();
|
|
|
|
}
|
|
|
|
|
2020-07-07 12:12:57 +02:00
|
|
|
public refresh(resetPages = false) {
|
2020-07-03 16:17:23 +02:00
|
|
|
// if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10;
|
|
|
|
// if (resetPages) this._paginator.pageIndex = 0;
|
|
|
|
// const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
|
|
|
|
2019-04-25 16:04:54 +02:00
|
|
|
let fields: Array<string> = new Array();
|
2019-12-12 10:26:19 +01:00
|
|
|
// if (this.sort && this.sort.active) { fields = this.sort.direction === 'asc' ? ['+' + this.sort.active] : ['-' + this.sort.active]; }
|
|
|
|
fields.push('-modified');
|
2020-07-03 16:17:23 +02:00
|
|
|
|
|
|
|
const request = new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
2020-07-08 17:28:34 +02:00
|
|
|
this.setPublicCriteria();
|
2020-07-07 12:12:57 +02:00
|
|
|
request.criteria = this.criteria;
|
|
|
|
|
2019-04-25 16:04:54 +02:00
|
|
|
this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
if (!result) { return []; }
|
|
|
|
result.data.map(item => {
|
|
|
|
item['datasets'].map(dmp => {
|
|
|
|
dmp.url = 'datasets/edit/' + dmp.url;
|
|
|
|
dmp.all = 'datasets/dmp/' + item.id;
|
|
|
|
return dmp;
|
|
|
|
});
|
|
|
|
return item;
|
|
|
|
});
|
|
|
|
this.listingItems = result.data;
|
2020-07-07 12:12:57 +02:00
|
|
|
this.totalCount = result.totalCount;
|
2019-04-25 16:04:54 +02:00
|
|
|
});
|
2018-10-05 17:00:54 +02:00
|
|
|
}
|
|
|
|
|
2020-07-03 16:17:23 +02:00
|
|
|
public loadMore() {
|
|
|
|
this.startIndex = this.startIndex + this.pageSize;
|
|
|
|
const fields: Array<string> = ["-modified"];
|
|
|
|
const request = new DataTableRequest<DmpCriteria>(this.startIndex, this.pageSize, { fields: fields });
|
2020-07-08 17:28:34 +02:00
|
|
|
this.setPublicCriteria();
|
2020-07-07 12:12:57 +02:00
|
|
|
request.criteria = this.criteria;
|
2020-07-03 16:17:23 +02:00
|
|
|
|
|
|
|
this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
if (!result) { return []; }
|
|
|
|
result.data.map(item => {
|
|
|
|
item['datasets'].map(dmp => {
|
|
|
|
dmp.url = 'datasets/edit/' + dmp.url;
|
|
|
|
dmp.all = 'datasets/dmp/' + item.id;
|
|
|
|
return dmp;
|
|
|
|
});
|
|
|
|
return item;
|
|
|
|
});
|
|
|
|
this.listingItems = this.listingItems.concat(result.data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-08 15:46:53 +02:00
|
|
|
pageThisEvent(event) {
|
|
|
|
this.refresh();
|
|
|
|
}
|
|
|
|
|
2020-07-07 14:54:12 +02:00
|
|
|
controlModified(): void {
|
|
|
|
// this.clearErrorModel();
|
|
|
|
// if (this.refreshCallback != null &&
|
|
|
|
// (this.formGroup.get('like').value == null || this.formGroup.get('like').value.length === 0 || this.formGroup.get('like').value.length > 2)
|
|
|
|
// ) {
|
|
|
|
// setTimeout(() => this.refreshCallback(true));
|
|
|
|
// }
|
|
|
|
this.criteria.like = this.formGroup.get("like").value;
|
|
|
|
this.refresh();
|
|
|
|
}
|
|
|
|
|
2019-10-23 17:36:29 +02:00
|
|
|
// rowClicked(dmp: DmpListingModel) {
|
|
|
|
// this.router.navigate(['/plans/overview/' + dmp.id]);
|
|
|
|
// }
|
2018-10-05 17:00:54 +02:00
|
|
|
|
2020-07-03 16:17:23 +02:00
|
|
|
public closeCard(): void {
|
|
|
|
this.isVisible = false;
|
|
|
|
}
|
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
addDataset(rowId: String) {
|
|
|
|
this.router.navigate(['/datasets/new/' + rowId]);
|
|
|
|
}
|
|
|
|
|
|
|
|
showDatasets(rowId: String, rowLabel: String) {
|
|
|
|
this.router.navigate(['/datasets/dmp/' + rowId, { dmpLabel: rowLabel }]);
|
|
|
|
}
|
|
|
|
|
|
|
|
viewVersions(rowId: String, rowLabel: String) {
|
2019-01-18 18:03:45 +01:00
|
|
|
this.router.navigate(['/plans/versions/' + rowId], { queryParams: { groupLabel: rowLabel } });
|
2018-10-05 17:00:54 +02:00
|
|
|
}
|
|
|
|
|
2019-01-18 18:03:45 +01:00
|
|
|
getDefaultCriteria(): DmpCriteria {
|
|
|
|
const defaultCriteria = new DmpCriteria();
|
2020-07-08 17:23:06 +02:00
|
|
|
if (this.isPublic) {
|
|
|
|
defaultCriteria.isPublic = true;
|
|
|
|
defaultCriteria.onlyPublic = true;
|
|
|
|
}
|
2018-10-05 17:00:54 +02:00
|
|
|
return defaultCriteria;
|
|
|
|
}
|
|
|
|
|
|
|
|
openShareDialog(rowId: any, rowName: any) {
|
2019-01-18 18:03:45 +01:00
|
|
|
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
|
2018-10-05 17:00:54 +02:00
|
|
|
data: {
|
|
|
|
dmpId: rowId,
|
|
|
|
dmpName: rowName
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-03-03 10:16:02 +01:00
|
|
|
|
|
|
|
fileSave(event) {
|
|
|
|
const dialogRef = this.dialog.open(DmpUploadDialogue, {
|
|
|
|
data: {
|
|
|
|
fileList: FileList,
|
|
|
|
success: Boolean,
|
|
|
|
dmpTitle: String
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
|
|
|
if (result && result.success) {
|
2020-05-29 12:39:18 +02:00
|
|
|
this.dmpService.uploadXml(result.fileList, result.dmpTitle, result.dmpProfiles)
|
2020-03-03 10:16:02 +01:00
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe((complete) => this.onCallbackImportComplete(),
|
2020-07-03 16:17:23 +02:00
|
|
|
(error) => this.onCallbackImportFail(error.error));
|
2020-03-03 10:16:02 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private onCallbackImportComplete() {
|
|
|
|
this.uiNotificationService.snackBarNotification(this.language.instant('DMP-UPLOAD.UPLOAD-SUCCESS'), SnackBarNotificationLevel.Success);
|
2020-04-01 17:16:06 +02:00
|
|
|
this.router.navigate(['/reload']).then(() => this.isPublic ? this.router.navigate(['/explore-plans']) : this.router.navigate(['/plans']));
|
2020-03-03 10:16:02 +01:00
|
|
|
}
|
|
|
|
|
2020-06-10 11:22:20 +02:00
|
|
|
private onCallbackImportFail(error: any) {
|
|
|
|
this.uiNotificationService.snackBarNotification(error.message, SnackBarNotificationLevel.Error);
|
2020-03-03 10:16:02 +01:00
|
|
|
}
|
2020-07-03 17:51:27 +02:00
|
|
|
|
|
|
|
openFiltersDialog(): void {
|
|
|
|
const dialogRef = this.dialog.open(DmpCriteriaDialogComponent, {
|
|
|
|
width: '456px',
|
|
|
|
height: '100%',
|
|
|
|
restoreFocus: false,
|
|
|
|
data: {
|
|
|
|
showGrant: this.showGrant,
|
2020-07-07 12:12:57 +02:00
|
|
|
isPublic: this.isPublic,
|
|
|
|
criteria: this.criteria,
|
2020-07-07 17:29:15 +02:00
|
|
|
formGroup: this.criteriaFormGroup,
|
2020-07-07 12:12:57 +02:00
|
|
|
// criteria: this.grantId ? this.criteria : this.getDefaultCriteria(),
|
|
|
|
updateDataFn: this.updateDataFn.bind(this)
|
2020-07-03 17:51:27 +02:00
|
|
|
},
|
|
|
|
position: { right: '0px;' }
|
|
|
|
});
|
|
|
|
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
});
|
|
|
|
}
|
2020-07-07 12:12:57 +02:00
|
|
|
|
|
|
|
updateDataFn(criteria: DmpCriteriaComponent): void {
|
2020-07-07 17:29:15 +02:00
|
|
|
this.criteriaFormGroup = criteria.formGroup;
|
2020-07-07 12:12:57 +02:00
|
|
|
this.toDmpCriteria(criteria);
|
|
|
|
this.refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
toDmpCriteria(criteria: DmpCriteriaComponent): void {
|
|
|
|
let formGroup = criteria.formGroup;
|
|
|
|
this.criteria = {
|
|
|
|
like: formGroup.get('like').value,
|
|
|
|
grants: formGroup.get('grants').value,
|
|
|
|
role: formGroup.get('role').value
|
|
|
|
}
|
|
|
|
this.criteria.status = formGroup.get('status').value;
|
2020-07-08 17:28:34 +02:00
|
|
|
this.setPublicCriteria(formGroup);
|
2020-07-07 12:12:57 +02:00
|
|
|
if (formGroup.get('datasetTemplates').value)
|
|
|
|
this.criteria.datasetTemplates = formGroup.get('datasetTemplates').value.map(x => x.id);
|
|
|
|
if (formGroup.get('collaborators').value)
|
|
|
|
this.criteria.collaborators = formGroup.get('collaborators').value.map(x => x.id);
|
|
|
|
if (formGroup.get('organisations').value)
|
|
|
|
this.criteria.organisations = formGroup.get('organisations').value.map(x => x.id);
|
|
|
|
if (this.itemId) {
|
|
|
|
this.criteria.groupIds = [this.itemId];
|
|
|
|
this.criteria.allVersions = true;
|
|
|
|
}
|
|
|
|
this.criteria.grantStatus = formGroup.get('grantStatus').value;
|
|
|
|
}
|
|
|
|
|
2020-07-08 17:28:34 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-07 12:12:57 +02:00
|
|
|
hasScrollbar(): boolean {
|
2020-07-08 17:28:34 +02:00
|
|
|
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
|
2020-07-07 12:12:57 +02:00
|
|
|
}
|
2017-12-14 18:13:28 +01:00
|
|
|
}
|
|
|
|
|
2019-04-25 16:04:54 +02:00
|
|
|
// export class DmpDataSource extends DataSource<DmpListingModel> {
|
|
|
|
|
|
|
|
// totalCount = 0;
|
|
|
|
|
|
|
|
// constructor(
|
|
|
|
// private _service: DmpService,
|
|
|
|
// private _paginator: MatPaginator,
|
|
|
|
// private _sort: MatSort,
|
|
|
|
// private _criteria: DmpCriteriaComponent,
|
|
|
|
// private itemId
|
|
|
|
// ) {
|
|
|
|
// super();
|
|
|
|
// }
|
|
|
|
|
|
|
|
// connect(): Observable<DmpListingModel[]> {
|
|
|
|
// const displayDataChanges = [
|
|
|
|
// this._paginator.page
|
|
|
|
// ];
|
|
|
|
|
|
|
|
// return Observable.merge(...displayDataChanges)
|
|
|
|
// .startWith(null)
|
|
|
|
// .switchMap(() => {
|
|
|
|
// const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
|
|
|
|
// let fields: Array<string> = new Array();
|
|
|
|
// if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
|
|
|
// const request = new DataTableRequest<DmpCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
|
|
|
|
// request.criteria = this._criteria.formGroup.value;
|
|
|
|
// if (this.itemId) {
|
|
|
|
// request.criteria.groupIds = [this.itemId];
|
|
|
|
// request.criteria.allVersions = true;
|
|
|
|
// }
|
|
|
|
// return this._service.getPaged(request, "listing");
|
|
|
|
// })
|
|
|
|
// /*.catch((error: any) => {
|
|
|
|
// this._snackBar.openFromComponent(SnackBarNotificationComponent, {
|
|
|
|
// data: { message: 'GENERAL.SNACK-BAR.FORMS-BAD-REQUEST', language: this._languageService },
|
|
|
|
// duration: 3000,
|
|
|
|
// extraClasses: ['snackbar-warning']
|
|
|
|
// });
|
|
|
|
// return Observable.of(null);
|
|
|
|
// })*/
|
|
|
|
// .map(result => {
|
|
|
|
// result.data = result.data;
|
|
|
|
// return result;
|
|
|
|
// })
|
|
|
|
// .map(result => {
|
|
|
|
// return result;
|
|
|
|
// })
|
|
|
|
// .map(result => {
|
|
|
|
// if (!result) { return []; }
|
|
|
|
// if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; }
|
|
|
|
// return result.data.map(item => {
|
|
|
|
// item['datasets'].map(dmp => {
|
|
|
|
// dmp.url = 'datasets/edit/' + dmp.url;
|
|
|
|
// dmp.all = 'datasets/dmp/' + item.id;
|
|
|
|
// return dmp;
|
|
|
|
// });
|
|
|
|
// return item;
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
// disconnect() {
|
|
|
|
// }
|
|
|
|
// }
|