diff --git a/dmp-frontend/src/app/app.component.html b/dmp-frontend/src/app/app.component.html index 68f4c4a75..6243a45e8 100644 --- a/dmp-frontend/src/app/app.component.html +++ b/dmp-frontend/src/app/app.component.html @@ -5,7 +5,7 @@ -
+
diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.ts index d4319f40b..bbb59b775 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.ts @@ -247,12 +247,10 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl } removeTag(tag: any) { - console.log((this.formGroup.get('tags')).value); (this.formGroup.get('tags')).removeAt(((this.formGroup.get('tags')).value as any[]).indexOf(tag)); } addTag(ev: MatChipInputEvent) { - console.log((this.formGroup.get('tags')).value); if (ev.value !== '' && isNullOrUndefined(((this.formGroup.get('tags')).value as ExternalTagEditorModel[]).find(tag => tag.name === ev.value))) { (this.formGroup.get('tags')).push(new ExternalTagEditorModel('', ev.value).buildForm()); } diff --git a/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria-dialog.component.html b/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria-dialog.component.html index a558369b6..d137b3900 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria-dialog.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria-dialog.component.html @@ -1,2 +1,2 @@ clear - + diff --git a/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria-dialog.component.ts index 945d900cf..31355d3e4 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria-dialog.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria-dialog.component.ts @@ -1,17 +1,27 @@ -import { Inject, Component } from '@angular/core'; +import { Inject, Component, ViewChild, OnInit, Output, EventEmitter } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; +import { DmpCriteriaComponent } from './dmp-criteria.component'; +import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria'; @Component({ selector: 'dmp-criteria-dialog-component', templateUrl: './dmp-criteria-dialog.component.html', }) -export class DmpCriteriaDialogComponent { +export class DmpCriteriaDialogComponent implements OnInit { + + @ViewChild(DmpCriteriaComponent, { static: true }) criteria: DmpCriteriaComponent; constructor( public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: { showGrant: boolean, isPublic: boolean } - ) { } + @Inject(MAT_DIALOG_DATA) public data: { showGrant: boolean, isPublic: boolean, criteria: DmpCriteria, updateDataFn: Function } + ) { + } + + ngOnInit() { + this.criteria.setCriteria(this.data.criteria); + // this.data.updateDataFn(this.criteria); + } onNoClick(): void { this.dialogRef.close(); @@ -21,4 +31,8 @@ export class DmpCriteriaDialogComponent { this.dialogRef.close(); } + onFiltersChanged(event) { + this.data.updateDataFn(this.criteria); + } + } diff --git a/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria.component.html b/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria.component.html index 737b12ee5..4181250b5 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/criteria/dmp-criteria.component.html @@ -16,7 +16,7 @@
{{ 'TYPES.DMP-VISIBILITY.VISIBILITY' | translate }}
- {{ 'TYPES.DMP-VISIBILITY.ANY' | translate }} + {{ 'TYPES.DMP-VISIBILITY.ANY' | translate }} {{ 'TYPES.DMP-VISIBILITY.PUBLIC' | translate }} {{ 'TYPES.DMP-VISIBILITY.FINALIZED' | translate }} {{ 'TYPES.DMP-VISIBILITY.DRAFT' | translate }} @@ -81,7 +81,7 @@
{{ 'DATASET-PROFILE-LISTING.COLUMNS.ROLE' | translate }}
- {{ 'TYPES.DATASET-ROLE.ANY' | translate }} + {{ 'TYPES.DATASET-ROLE.ANY' | translate }} {{ 'TYPES.DATASET-ROLE.OWNER' | translate }} {{ 'TYPES.DATASET-ROLE.MEMBER' | translate }} diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html index ac5cf9a16..b860a01eb 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html @@ -8,18 +8,18 @@

{{'DMP-LISTING.TEXT-INFO-QUESTION' | translate}} {{'DMP-LISTING.LINK-ZENODO' | translate}} {{'DMP-LISTING.GET-IDEA' | translate}}

-
+
-
+ +
-
+
diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.scss b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.scss index 3fe73fa18..6248d3a2d 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.scss +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.scss @@ -189,12 +189,13 @@ position: fixed; right: 0px; z-index: 100; + width: 37px; } .filter-btn button { color: white; background-color: #23BCBA; - width: 52px; + width: 37px; height: 45px; } diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts index 1f74408d3..8cd507e04 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts @@ -35,7 +35,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread @ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator; @ViewChild(MatSort, { static: false }) sort: MatSort; - @ViewChild(DmpCriteriaComponent, { static: true }) criteria: DmpCriteriaComponent; + // @ViewChild(DmpCriteriaComponent, { static: true }) criteria: DmpCriteriaComponent; breadCrumbs: Observable = observableOf([{ parentComponentName: null, label: 'DMPs', url: "/plans" }]); itemId: string; @@ -52,11 +52,13 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread startIndex: number = 0; pageSize: number = 5; + criteria: DmpCriteria; + constructor( private dmpService: DmpService, private router: Router, private route: ActivatedRoute, - private dialog: MatDialog, + public dialog: MatDialog, public enumUtils: EnumUtils, private language: TranslateService, private grantService: GrantService, @@ -83,12 +85,14 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread // const grant: GrantListingModel = { // id: this.grantId // } - this.criteria.setCriteria({ like: null, grants: [grant], groupIds: null, allVersions: false }); + // 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 }); this.refresh(); - grantLabel = this.route.snapshot.queryParams.grantLabel; - // this.breadCrumbs = Observable.of([{ parentComponentName: 'GrantEditorComponent', label: grantLabel, url: '/grants/edit/' + this.grantId }]); - this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); + // this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); }) } else if (params['groupId']) { @@ -106,10 +110,12 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread }] ); }) - this.criteria.setCriteria(this.getDefaultCriteria()); this.groupLabel = this.route.snapshot.queryParams.groupLabel; + + // this.criteria.setCriteria(this.getDefaultCriteria()); + this.criteria = this.getDefaultCriteria(); this.refresh(); - this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); + // this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); } else { this.itemId = params['groupId']; this.showGrant = true; @@ -134,9 +140,10 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread }] ); }) - this.criteria.setCriteria(this.getDefaultCriteria()); + // this.criteria.setCriteria(this.getDefaultCriteria()); + this.criteria = this.getDefaultCriteria(); this.refresh(); - this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); + // this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages)); } if (this.grantId != null) { @@ -148,7 +155,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread }); } - refresh(resetPages = false) { + public refresh(resetPages = false) { // if (this._paginator.pageSize === undefined) this._paginator.pageSize = 10; // if (resetPages) this._paginator.pageIndex = 0; // const startIndex = this._paginator.pageIndex * this._paginator.pageSize; @@ -158,36 +165,10 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread fields.push('-modified'); const request = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields }); - let value = this.criteria.formGroup.value; - request.criteria = { - like: value.like, - grants: value.grants, - role: value.role - } - if (value.status == 2) { - request.criteria.isPublic = true; - } else { - request.criteria.status = value.status; - request.criteria.isPublic = false; - } - request.criteria.onlyPublic = this.isPublic; - if (this.isPublic) { - request.criteria.isPublic = true; - } - if (value.datasetTemplates) - request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id); - if (value.collaborators) - request.criteria.collaborators = value.collaborators.map(x => x.id); - if (value.organisations) - request.criteria.organisations = value.organisations.map(x => x.id); - if (this.itemId) { - request.criteria.groupIds = [this.itemId]; - request.criteria.allVersions = true; - } - request.criteria.grantStatus = value.grantStatus; + request.criteria = this.criteria; + this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => { if (!result) { return []; } - // if (this._paginator.pageIndex === 0) { this.totalCount = result.totalCount; } result.data.map(item => { item['datasets'].map(dmp => { dmp.url = 'datasets/edit/' + dmp.url; @@ -197,6 +178,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread return item; }); this.listingItems = result.data; + this.totalCount = result.totalCount; }); } @@ -204,37 +186,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread this.startIndex = this.startIndex + this.pageSize; const fields: Array = ["-modified"]; const request = new DataTableRequest(this.startIndex, this.pageSize, { fields: fields }); - - // request.criteria = new DmpCriteria(); - // request.criteria.like = ""; - - let value = this.criteria.formGroup.value; - request.criteria = { - like: value.like, - grants: value.grants, - role: value.role - } - if (value.status == 2) { - request.criteria.isPublic = true; - } else { - request.criteria.status = value.status; - request.criteria.isPublic = false; - } - request.criteria.onlyPublic = this.isPublic; - if (this.isPublic) { - request.criteria.isPublic = true; - } - if (value.datasetTemplates) - request.criteria.datasetTemplates = value.datasetTemplates.map(x => x.id); - if (value.collaborators) - request.criteria.collaborators = value.collaborators.map(x => x.id); - if (value.organisations) - request.criteria.organisations = value.organisations.map(x => x.id); - if (this.itemId) { - request.criteria.groupIds = [this.itemId]; - request.criteria.allVersions = true; - } - request.criteria.grantStatus = value.grantStatus; + request.criteria = this.criteria; this.dmpService.getPaged(request, "listing").pipe(takeUntil(this._destroyed)).subscribe(result => { if (!result) { return []; } @@ -281,8 +233,6 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread openShareDialog(rowId: any, rowName: any) { const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { - // height: '250px', - // width: '700px', data: { dmpId: rowId, dmpName: rowName @@ -324,7 +274,10 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread restoreFocus: false, data: { showGrant: this.showGrant, - isPublic: this.isPublic + isPublic: this.isPublic, + criteria: this.criteria, + // criteria: this.grantId ? this.criteria : this.getDefaultCriteria(), + updateDataFn: this.updateDataFn.bind(this) }, position: { right: '0px;' } }); @@ -332,6 +285,45 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread dialogRef.afterClosed().subscribe(result => { }); } + + updateDataFn(criteria: DmpCriteriaComponent): void { + 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; + 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; + } + 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; + } + + hasScrollbar(): boolean { + return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight; + } } // export class DmpDataSource extends DataSource { diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts index 1d233f5fc..a68fe6841 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts @@ -187,7 +187,6 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { this.router.navigate(['/datasets/publicEdit/' + datasetId]); } else { this.router.navigate(['/datasets/edit/' + datasetId]); - console.log('inhere') } } @@ -585,16 +584,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { } }); } - + copyDoi(doi) { - console.log(doi.nativeElement.innerHTML); let domElement = doi.nativeElement as HTMLInputElement; domElement.select(); document.execCommand('copy'); domElement.setSelectionRange(0, 0); alert('Doi Copied to Clipboard'); } - + public getOrcidPath(): string { return this.configurationService.orcidPath; } @@ -610,7 +608,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { return this.dmp.users.find(x => x.id === principal.id); } } - + createOrUpdate(id: string): void { if (!this.lockStatus) { this.lock = new LockModel(id, this.getUserFromDMP()); @@ -629,7 +627,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { // this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => this.lock.id = Guid.parse(result)); // } - + // advancedClicked() { // const dialogRef = this.dialog.open(ExportMethodDialogComponent, { // maxWidth: '500px', diff --git a/dmp-frontend/src/app/ui/misc/oauth2-dialog/oauth2-dialog.component.ts b/dmp-frontend/src/app/ui/misc/oauth2-dialog/oauth2-dialog.component.ts index 7d9c2f6aa..c73a6c673 100644 --- a/dmp-frontend/src/app/ui/misc/oauth2-dialog/oauth2-dialog.component.ts +++ b/dmp-frontend/src/app/ui/misc/oauth2-dialog/oauth2-dialog.component.ts @@ -29,7 +29,6 @@ export class Oauth2DialogComponent extends BaseComponent implements OnInit{ } private loadUrl(url: string ) { - console.log(url); window.location.href = url; }