Fixes bug on public roles filters when logged out. (Issue #175)

This commit is contained in:
apapachristou 2019-10-08 10:40:15 +03:00
parent 72df634132
commit f2833576d3
5 changed files with 41 additions and 25 deletions

View File

@ -45,7 +45,7 @@
</mat-form-field>
</div>
<div class="col-10 gray-container">
<div *ngIf="isAuthenticated()" 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>

View File

@ -28,6 +28,7 @@ import { DataTableData } from '../../../core/model/data-table/data-table-data';
import { DmpListingModel } from '../../../core/model/dmp/dmp-listing';
import { ExploreDmpCriteriaModel } from '../../../core/query/explore-dmp/explore-dmp-criteria';
import { DatasetProfileCriteria } from "../../../core/query/dataset-profile/dataset-profile-criteria";
import { AuthService } from '../../../core/services/auth/auth.service';
@Component({
selector: 'app-explore-dataset-filters-component',
@ -105,6 +106,7 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI
constructor(
public activatedRoute: ActivatedRoute,
private authentication: AuthService,
public grantService: GrantService,
public dmpService: DmpService,
public organisationService: OrganisationService,
@ -361,4 +363,8 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI
return this.organisationService.searchPublicOrganisations(dataTableRequest).pipe(map(x => x.data));
}
public isAuthenticated(): boolean {
return !(!this.authentication.current());
}
}

View File

@ -3,26 +3,29 @@
<div class="row" style="justify-content: center;">
<mat-form-field class="col-11 search">
<input matInput placeholder="{{'CRITERIA.GRANTS.LIKE'| translate}}" name="dmpCriteriaName"
[(ngModel)]="facetCriteria.like" (ngModelChange)="controlModified()">
<input matInput placeholder="{{'CRITERIA.GRANTS.LIKE'| translate}}" name="dmpCriteriaName" [(ngModel)]="facetCriteria.like" (ngModelChange)="controlModified()">
<mat-icon matSuffix class="style-icon">search</mat-icon>
</mat-form-field>
<div class="col-10 gray-container">
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT-STATUS.TITLE' | translate }}</h6>
<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-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">
<h6 class="category-title">{{ 'FACET-SEARCH.GRANT.TITLE' | translate }}</h6>
<mat-form-field>
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-GRANTS' | translate }}"
[configuration]="grantAutoCompleteConfiguration"
(optionSelected)="onGrantOptionSelected($event)" (optionRemoved)="onGrantOptionRemoved($event)">
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-GRANTS' | translate }}" [configuration]="grantAutoCompleteConfiguration" (optionSelected)="onGrantOptionSelected($event)" (optionRemoved)="onGrantOptionRemoved($event)">
</app-multiple-auto-complete>
<mat-icon matSuffix class="style-icon">arrow_drop_down</mat-icon>
</mat-form-field>
@ -31,30 +34,31 @@
<div class="col-10 gray-container">
<h6 class="category-title">{{ 'FACET-SEARCH.PROFILES.TITLE' | translate }}</h6>
<mat-form-field>
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-SPEC' | translate }}"
[configuration]="profileAutoCompleteConfiguration"
(optionSelected)="onProfileOptionSelected($event)" (optionRemoved)="onProfileOptionRemoved($event)">
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-SPEC' | translate }}" [configuration]="profileAutoCompleteConfiguration" (optionSelected)="onProfileOptionSelected($event)" (optionRemoved)="onProfileOptionRemoved($event)">
</app-multiple-auto-complete>
<mat-icon matSuffix class="style-icon">arrow_drop_down</mat-icon>
</mat-form-field>
</div>
<div class="col-10 gray-container">
<div *ngIf="isAuthenticated()" 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-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>
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-ORGANIZATIONS' | translate }}"
[configuration]="organizationAutoCompleteConfiguration"
(optionSelected)="onOrganizationOptionSelected($event)"
(optionRemoved)="onOrganizationOptionRemoved($event)">
<app-multiple-auto-complete placeholder="{{ 'CRITERIA.DATA-SETS.SELECT-ORGANIZATIONS' | translate }}" [configuration]="organizationAutoCompleteConfiguration" (optionSelected)="onOrganizationOptionSelected($event)" (optionRemoved)="onOrganizationOptionRemoved($event)">
</app-multiple-auto-complete>
<mat-icon matSuffix class="style-icon">arrow_drop_down</mat-icon>
</mat-form-field>

View File

@ -23,6 +23,7 @@ import { OrganizationModel } from "../../../core/model/organisation/organization
import { OrganisationCriteria } from "../../../core/query/organisation/organisation-criteria";
import { OrganisationService } from "../../../core/services/organisation/organisation.service";
import { DatasetProfileCriteria } from "../../../core/query/dataset-profile/dataset-profile-criteria";
import { AuthService } from '../../../core/services/auth/auth.service';
@Component({
selector: 'app-explore-dmp-filters-component',
@ -95,6 +96,7 @@ export class ExploreDmpFiltersComponent extends BaseCriteriaComponent implements
public activatedRoute: ActivatedRoute,
public languageService: TranslateService,
public grantService: GrantService,
private authentication: AuthService,
public datasetProfileService: DatasetService,
public organisationService: OrganisationService,
public externalSourcesService: ExternalSourcesService,
@ -340,4 +342,8 @@ export class ExploreDmpFiltersComponent extends BaseCriteriaComponent implements
isOptionSelected(profile: any) {
return this.formGroup.value.map(x => x.id).indexOf(profile.id) !== -1;
}
public isAuthenticated(): boolean {
return !(!this.authentication.current());
}
}

View File

@ -855,7 +855,7 @@
"EXTERNAL-SOURCE-HINT": "External source",
"ACTIONS": {
"YES": "Yes",
"No": "No"
"NO": "No"
}
},
"DATASET-PROFILE-INTERNAL-DMP-ENTITIES-TYPE": {