Fixes on filters of dmp listing
This commit is contained in:
parent
d3e7f57cbd
commit
5c8c156220
|
@ -1,2 +1,2 @@
|
|||
<a class="col-auto d-flex pointer" (click)="onClose()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a>
|
||||
<app-dmp-criteria-component [showGrant]="data.showGrant" [isPublic]="data.isPublic" (filtersChanged)="onFiltersChanged($event)" class="col-auto"></app-dmp-criteria-component>
|
||||
<app-dmp-criteria-component [showGrant]="data.showGrant" [isPublic]="data.isPublic" [criteriaFormGroup]="data.formGroup" (filtersChanged)="onFiltersChanged($event)" class="col-auto"></app-dmp-criteria-component>
|
||||
|
|
|
@ -2,6 +2,7 @@ import { Inject, Component, ViewChild, OnInit, Output, EventEmitter } from '@ang
|
|||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||
import { DmpCriteriaComponent } from './dmp-criteria.component';
|
||||
import { DmpCriteria } from '@app/core/query/dmp/dmp-criteria';
|
||||
import { FormGroup } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'dmp-criteria-dialog-component',
|
||||
|
@ -14,13 +15,12 @@ export class DmpCriteriaDialogComponent implements OnInit {
|
|||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<DmpCriteriaDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { showGrant: boolean, isPublic: boolean, criteria: DmpCriteria, updateDataFn: Function }
|
||||
@Inject(MAT_DIALOG_DATA) public data: { showGrant: boolean, isPublic: boolean, criteria: DmpCriteria, formGroup: FormGroup, updateDataFn: Function }
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.criteria.setCriteria(this.data.criteria);
|
||||
// this.data.updateDataFn(this.criteria);
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
|
||||
import { FormBuilder, FormControl } from '@angular/forms';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
|
||||
import { GrantListingModel } from '@app/core/model/grant/grant-listing';
|
||||
|
@ -34,6 +34,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
|
||||
@Input() showGrant: boolean;
|
||||
@Input() isPublic: boolean;
|
||||
@Input() criteriaFormGroup: FormGroup;
|
||||
@Output() filtersChanged: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
filteringGrantsAsync = false;
|
||||
|
@ -98,6 +99,15 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
|
||||
// This if is just for passing label on chips of dialog
|
||||
if (this.formGroup && this.criteriaFormGroup) {
|
||||
this.formGroup.get('datasetTemplates').setValue(this.criteriaFormGroup.get('datasetTemplates').value);
|
||||
this.formGroup.get('grants').setValue(this.criteriaFormGroup.get('grants').value);
|
||||
this.formGroup.get('collaborators').setValue(this.criteriaFormGroup.get('collaborators').value);
|
||||
this.formGroup.get('organisations').setValue(this.criteriaFormGroup.get('organisations').value);
|
||||
}
|
||||
|
||||
this.formGroup.get('role').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => this.controlModified());
|
||||
|
@ -133,6 +143,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
this.formGroup.get('collaborators').patchValue(criteria.collaborators);
|
||||
this.formGroup.get('datasetTemplates').patchValue(criteria.datasetTemplates);
|
||||
this.formGroup.get('grantStatus').patchValue(criteria.grantStatus);
|
||||
this.formGroup.get('organisations').patchValue(criteria.organisations);
|
||||
}
|
||||
|
||||
onCallbackError(error: any) {
|
||||
|
|
|
@ -8,15 +8,12 @@
|
|||
<p class="mt-4 pt-2">{{'DMP-LISTING.TEXT-INFO-QUESTION' | translate}} <u>{{'DMP-LISTING.LINK-ZENODO' | translate}}</u> {{'DMP-LISTING.GET-IDEA' | translate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter-btn" [style.right]="dialog.openDialogs.length > 0 ? '456px' : '0px'" [style.width]="hasScrollbar() ? '52px' : '37px'" (click)="openFiltersDialog()"><button mat-raised-button class="p-0">
|
||||
<div class="filter-btn" [style.right]="dialog.openDialogs.length > 0 ? '446px' : '0px'" [style.width]="hasScrollbar() ? '52px' : '37px'" (click)="openFiltersDialog()"><button mat-raised-button class="p-0">
|
||||
<mat-icon class="mr-4">filter_alt</mat-icon>
|
||||
</button></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="listing row pb-2">
|
||||
<!-- <div class="col-12 col-sm-12 col-md-3">
|
||||
<app-dmp-criteria-component [showGrant]="showGrant" [isPublic]="isPublic" class="col-auto"></app-dmp-criteria-component>
|
||||
</div> -->
|
||||
<!-- Search Filter-->
|
||||
<mat-form-field appearance="outline" class="search-form ml-auto col-auto" floatLabel="never">
|
||||
<mat-icon matSuffix>search</mat-icon>
|
||||
|
|
|
@ -209,7 +209,7 @@
|
|||
color: #129d99;
|
||||
}
|
||||
|
||||
::ng-deep .mat-form-field-wrapper {
|
||||
::ng-deep .search-form .mat-form-field-wrapper {
|
||||
background-color: white !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/serv
|
|||
import { isNullOrUndefined } from 'util';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { DmpCriteriaDialogComponent } from './criteria/dmp-criteria-dialog.component';
|
||||
import { FormBuilder, FormControl } from '@angular/forms';
|
||||
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -54,6 +54,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
pageSize: number = 5;
|
||||
|
||||
criteria: DmpCriteria;
|
||||
criteriaFormGroup: FormGroup;
|
||||
public formGroup = new FormBuilder().group({
|
||||
like: new FormControl()
|
||||
})
|
||||
|
@ -295,6 +296,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
showGrant: this.showGrant,
|
||||
isPublic: this.isPublic,
|
||||
criteria: this.criteria,
|
||||
formGroup: this.criteriaFormGroup,
|
||||
// criteria: this.grantId ? this.criteria : this.getDefaultCriteria(),
|
||||
updateDataFn: this.updateDataFn.bind(this)
|
||||
},
|
||||
|
@ -306,6 +308,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
}
|
||||
|
||||
updateDataFn(criteria: DmpCriteriaComponent): void {
|
||||
this.criteriaFormGroup = criteria.formGroup;
|
||||
this.toDmpCriteria(criteria);
|
||||
this.refresh();
|
||||
}
|
||||
|
@ -341,7 +344,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
}
|
||||
|
||||
hasScrollbar(): boolean {
|
||||
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight;
|
||||
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue