Adds radio box Roles on published DMPs and published Datasets, fixes initial value of radio boxes on filters.

This commit is contained in:
apapachristou 2019-10-03 12:19:45 +03:00
parent 28b748bb03
commit 9841b495c1
11 changed files with 73 additions and 31 deletions

View File

@ -0,0 +1,4 @@
export enum Role {
Owner = 0,
Member = 1
}

View File

@ -1,8 +1,10 @@
import { GrantStateType } from "../../common/enum/grant-state-type";
import { BaseCriteria } from "../base-criteria";
import { Role } from '../../common/enum/role';
export class ExploreDatasetCriteriaModel extends BaseCriteria {
public grantStatus: GrantStateType;
public role: Role;
public dmpIds: string[] = [];
public grants: string[] = [];
public datasetProfile: string[] = [];

View File

@ -1,8 +1,10 @@
import { BaseCriteria } from "../base-criteria";
import { GrantStateType } from "../../common/enum/grant-state-type";
import { Role } from '../../common/enum/role';
export class ExploreDmpCriteriaModel extends BaseCriteria {
public grantStatus: GrantStateType;
public role: Role;
public grants: string[] = [];
public datasetProfile: string[] = [];
public dmpOrganisations: string[] = [];

View File

@ -16,9 +16,9 @@
<div class="col-10 gray-container" >
<h6 class="category-title">{{'CRITERIA.DATA-SETS.STATUS'| translate}}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')">
<mat-list-item><mat-radio-button checked value="null">{{ 'TYPES.DATASET-STATUS.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0" [checked]="status == 0">{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1">{{ 'TYPES.DATASET-STATUS.FINALISED' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="null">{{ 'TYPES.DATASET-STATUS.ANY' | translate }}</mat-radio-button></mat-list-item>
</mat-radio-group>
</div>
<!-- End of Status Filter-->
@ -79,15 +79,9 @@
<div class="col-10 gray-container">
<h6 class="category-title">{{'CRITERIA.DATA-SETS.ROLE' | translate }}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')">
<mat-list-item>
<mat-radio-button value="null">{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button>
</mat-list-item>
<mat-list-item>
<mat-radio-button value="0">{{ 'TYPES.DATASET-ROLE.OWNER' | translate }}</mat-radio-button>
</mat-list-item>
<mat-list-item>
<mat-radio-button value="1">{{ 'TYPES.DATASET-ROLE.MEMBER' | translate }}</mat-radio-button>
</mat-list-item>
<mat-list-item><mat-radio-button checked value="null">{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0">{{ 'TYPES.DATASET-ROLE.OWNER' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1">{{ 'TYPES.DATASET-ROLE.MEMBER' | translate }}</mat-radio-button></mat-list-item>
</mat-radio-group>
</div>
<!-- End of Role Filter -->

View File

@ -16,7 +16,7 @@
<div *ngIf="showGrant" class="col-10 gray-container">
<h6 class="category-title">{{ 'TYPES.DMP-VISIBILITY.VISIBILITY' | translate }}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('status')">
<mat-list-item><mat-radio-button value="null">{{ 'TYPES.DMP-VISIBILITY.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="null" checked>{{ 'TYPES.DMP-VISIBILITY.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="2">{{ 'TYPES.DMP-VISIBILITY.PUBLIC' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1">{{ 'TYPES.DMP-VISIBILITY.FINALIZED' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0">{{ 'TYPES.DMP-VISIBILITY.DRAFT' | translate }}</mat-radio-button></mat-list-item>
@ -67,7 +67,7 @@
<div *ngIf="showGrant" class="col-10 gray-container">
<h6 class="category-title">{{ 'DATASET-PROFILE-LISTING.COLUMNS.ROLE' | translate }}</h6>
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')">
<mat-list-item><mat-radio-button value="null">{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="null" checked>{{ 'TYPES.DATASET-ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0">{{ 'TYPES.DATASET-ROLE.OWNER' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1">{{ 'TYPES.DATASET-ROLE.MEMBER' | translate }}</mat-radio-button></mat-list-item>
</mat-radio-group>

View File

@ -11,15 +11,11 @@
<div class="col-10 gray-container">
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}</h6>
<mat-list-item>
<mat-radio-button value="null" checked (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ANY' | translate }}</mat-radio-button>
</mat-list-item>
<mat-list-item>
<mat-radio-button value="0" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE' | translate }}</mat-radio-button>
</mat-list-item>
<mat-list-item>
<mat-radio-button value="1" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE' | translate }}</mat-radio-button>
</mat-list-item>
<mat-radio-group>
<mat-list-item><mat-radio-button value="null" checked (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE' | translate }}</mat-radio-button></mat-list-item>
</mat-radio-group>
</div>
<div class="col-10 gray-container">
@ -49,6 +45,15 @@
</mat-form-field>
</div>
<div class="col-10 gray-container">
<h6 class="category-title">{{ 'FACET-SEARCH.ROLE.TITLE' | translate }}</h6>
<mat-radio-group>
<mat-list-item><mat-radio-button value="null" checked (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0" (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.OWNER' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1" (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.MEMBER' | translate }}</mat-radio-button></mat-list-item>
</mat-radio-group>
</div>
<div class="col-10 gray-container">
<h6 class="category-title">{{ 'FACET-SEARCH.DMP-ORGANISATIONS.TITLE' | translate }}</h6>
<mat-form-field>

View File

@ -200,6 +200,14 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI
return this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data));
}
public roleChanged(event: any) {
this.facetCriteria.role = event.value;
if (event.value === 'null') {
this.facetCriteria.role = null;
}
this.facetCriteriaChange.emit(this.facetCriteria);
}
public dmpOrganisationChanged(event: any) {
const eventValue = event.option.value.id;
if (event.option.selected) { this.facetCriteria.dmpOrganisations.push(eventValue); }

View File

@ -10,9 +10,11 @@
<div class="col-10 gray-container">
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}</h6>
<mat-list-item><mat-radio-button value="null" checked (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE' | translate }}</mat-radio-button></mat-list-item>
<mat-radio-group>
<mat-list-item><mat-radio-button value="null" checked (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.ACTIVE' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1" (change)="grantStatusChanged($event)">{{ 'FACET-SEARCH.GRANT-STATUS.OPTIONS.INACTIVE' | translate }}</mat-radio-button></mat-list-item>
</mat-radio-group>
</div>
<div class="col-10 gray-container">
@ -37,6 +39,15 @@
</mat-form-field>
</div>
<div class="col-10 gray-container">
<h6 class="category-title">{{ 'FACET-SEARCH.ROLE.TITLE' | translate }}</h6>
<mat-radio-group>
<mat-list-item><mat-radio-button value="null" checked (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.ANY' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="0" (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.OWNER' | translate }}</mat-radio-button></mat-list-item>
<mat-list-item><mat-radio-button value="1" (change)="roleChanged($event)">{{ 'FACET-SEARCH.ROLE.MEMBER' | translate }}</mat-radio-button></mat-list-item>
</mat-radio-group>
</div>
<div class="col-10 gray-container">
<h6 class="category-title">{{ 'FACET-SEARCH.DMP-ORGANISATIONS.TITLE' | translate }}</h6>
<mat-form-field>

View File

@ -254,6 +254,14 @@ export class ExploreDmpFiltersComponent extends BaseCriteriaComponent implements
}
}
public roleChanged(event: any) {
this.facetCriteria.role = event.value;
if (event.value === 'null') {
this.facetCriteria.role = null;
}
this.facetCriteriaChange.emit(this.facetCriteria);
}
dmpOrganisationChanged(event: any) {
const eventValue = event.option.value.id;
if (event.option.selected) { this.facetCriteria.dmpOrganisations.push(eventValue); }

View File

@ -108,10 +108,8 @@
<div *ngSwitchCase="datasetProfileFieldViewStyleEnum.BooleanDecision" class="col-12">
<mat-radio-group [formControl]="form.get('value')" [required]="form.get('validationRequired').value">
<mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="true">Yes
</mat-radio-button>
<mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="false">No
</mat-radio-button>
<mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="true">{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.YES" | translate }}</mat-radio-button>
<mat-radio-button class="radio-button-item" name="{{form.get('id').value}}" value="false">{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.NO" | translate }}</mat-radio-button>
</mat-radio-group>
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>

View File

@ -852,7 +852,11 @@
"DATASET-PROFILE-COMBO-BOX-TYPE": {
"WORD-LIST": "Word List",
"AUTOCOMPLETE": "Autocomplete",
"EXTERNAL-SOURCE-HINT": "External source"
"EXTERNAL-SOURCE-HINT": "External source",
"ACTIONS": {
"YES": "Yes",
"No": "No"
}
},
"DATASET-PROFILE-INTERNAL-DMP-ENTITIES-TYPE": {
"RESEARCHERS": "Researchers",
@ -1022,14 +1026,20 @@
}
},
"GRANT": {
"TITLE": "Grant",
"TITLE": "Related Grant",
"FILTER": "Filter Grants"
},
"PROFILES": {
"TITLE": "Dataset specification"
},
"ROLE": {
"TITLE": "Role",
"ANY": "Any",
"OWNER": "Owner",
"MEMBER": "Member"
},
"DMP-ORGANISATIONS": {
"TITLE": "DMP Organizations",
"TITLE": "Organization",
"FILTER": "Filter Organizations"
}
},