Merge branch 'develop'

This commit is contained in:
argirok 2024-02-15 12:15:18 +02:00
commit d2384ea07f
7 changed files with 37 additions and 17 deletions

View File

@ -100,13 +100,10 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
export class EditCommunityComponent { export class EditCommunityComponent {
public communityFb: UntypedFormGroup; public communityFb: UntypedFormGroup;
public statuses: Option[] = [ public statuses: Option[] = [
{label: 'Visible', value: 'all'}, // {label: 'Visible', value: 'all'},
{label: 'Visible [Public*]', value: 'PUBLIC'}, {label: 'Visible', value: 'PUBLIC'},
{label: 'Visible to managers', value: 'manager'}, // {label: 'Visible to managers', value: 'manager'},
{label: 'Visible to managers [Restricted*]', value: 'RESTRICTED'}, {label: 'Visible to managers', value: 'RESTRICTED'},
/*
{label: 'Hidden [Private*]', value: 'PRIVATE'},
*/
{label: 'Hidden', value: 'hidden'} {label: 'Hidden', value: 'hidden'}
] ]
public claimOptions: Option[] = [ public claimOptions: Option[] = [

View File

@ -10,9 +10,11 @@ export class CriteriaUtils {
{value: 'description', label: 'Description'}, {value: 'description', label: 'Description'},
{value: 'subject', label: 'Subject'}, {value: 'subject', label: 'Subject'},
{value: 'fos', label: 'Field of Science'}, {value: 'fos', label: 'Field of Science'},
{value: 'sdg', label: 'SDG'} {value: 'sdg', label: 'SDG'},
{value: 'publisher', label: 'Publisher'},
{value: 'publicationyear', label: 'Publication Year'}
] ]
public readonly numericFields: string[] = ['publicationyear'];
public readonly verbs: Option[] = [ public readonly verbs: Option[] = [
{value: 'contains', label: 'contains'}, {value: 'contains', label: 'contains'},
{value: 'equals', label: 'equals'}, {value: 'equals', label: 'equals'},
@ -20,6 +22,11 @@ export class CriteriaUtils {
{value: 'not_equals', label: 'not equals'}, {value: 'not_equals', label: 'not equals'},
{value: 'starts_with', label: 'starts with'} {value: 'starts_with', label: 'starts with'}
] ]
public readonly verbsForNumbers: Option[] = [
{value: 'equals', label: 'equals'},
{value: 'lesser_than', label: 'lesser than'},
{value: 'greater_than', label: 'greater than'}
]
public getFiltersAsText(criteria: Criteria[]): string { public getFiltersAsText(criteria: Criteria[]): string {
let text = criteria.slice(0, 3).map((criterion, index) => (index + 1) + ". " + criterion.constraint.map(constraint => { let text = criteria.slice(0, 3).map((criterion, index) => (index + 1) + ". " + criterion.constraint.map(constraint => {
@ -28,7 +35,7 @@ export class CriteriaUtils {
if (!constraint.verb.includes('_caseinsensitive')) { if (!constraint.verb.includes('_caseinsensitive')) {
matchCase = true; matchCase = true;
} }
let verb = this.verbs.find(verb => verb.value === constraint.verb.replace("_caseinsensitive", "")).label; let verb = [...this.verbs,...this.verbsForNumbers].find(verb => verb.value === constraint.verb.replace("_caseinsensitive", "")).label;
let value = '"' + constraint.value + '"' + (matchCase ? " (Match case)" : ""); let value = '"' + constraint.value + '"' + (matchCase ? " (Match case)" : "");
return field + " " + verb + " " + value; return field + " " + verb + " " + value;
}).join(" <b>and</b> ")); }).join(" <b>and</b> "));

View File

@ -40,13 +40,17 @@
</button> </button>
</div> </div>
<div class="uk-width-1-1" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}" <div class="uk-width-1-1" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}"
[options]="criteriaUtils.fields" [formInput]="constraint.get('field')"> [options]="criteriaUtils.fields" [formInput]="constraint.get('field')" (valueChange)="resetFieldWhenValueChange(constraint)">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Field:</label> <label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Field:</label>
</div> </div>
<div class="uk-width-1-1" input type="select" inputClass="border-bottom" <div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) == -1" class="uk-width-1-1" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')"> [options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Operator:</label> <label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Operator:</label>
</div> </div>
<div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) != -1" class="uk-width-1-1" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbsForNumbers" [formInput]="constraint.get('verb')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Operator:</label>
</div>
<div class="uk-width-1-1" input [placeholder]="{static: true, label: 'Type a keyword'}" <div class="uk-width-1-1" input [placeholder]="{static: true, label: 'Type a keyword'}"
[formInput]="constraint.get('value')"> [formInput]="constraint.get('value')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Term:</label> <label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Term:</label>
@ -69,8 +73,10 @@
<div class="uk-flex uk-flex-middle uk-grid" uk-grid> <div class="uk-flex uk-flex-middle uk-grid" uk-grid>
<div class="uk-width-1-4" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}" <div class="uk-width-1-4" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}"
[options]="criteriaUtils.fields" [formInput]="constraint.get('field')"></div> [options]="criteriaUtils.fields" [formInput]="constraint.get('field')"></div>
<div class="uk-width-1-4" input type="select" inputClass="border-bottom" <div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) == -1" class="uk-width-1-4" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')"></div> [options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')"></div>
<div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) != -1" class="uk-width-1-4" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbsForNumbers" [formInput]="constraint.get('verb')"></div>
<div *ngIf="constraint.get('field').value !== 'fos' && constraint.get('field').value !== 'sdg'" class="uk-width-1-4" inputClass="flat small" input [placeholder]="{static: true, label: 'Type a keyword'}" <div *ngIf="constraint.get('field').value !== 'fos' && constraint.get('field').value !== 'sdg'" class="uk-width-1-4" inputClass="flat small" input [placeholder]="{static: true, label: 'Type a keyword'}"
[formInput]="constraint.get('value')"></div> [formInput]="constraint.get('value')"></div>
<div *ngIf="constraint.get('field').value === 'fos'" class="uk-width-1-4" inputClass="flat small" input [placeholder]="{static: true, label: 'Choose a FoS'}" <div *ngIf="constraint.get('field').value === 'fos'" class="uk-width-1-4" inputClass="flat small" input [placeholder]="{static: true, label: 'Choose a FoS'}"

View File

@ -225,4 +225,14 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe
}) })
return selectionCriteria; return selectionCriteria;
} }
resetFieldWhenValueChange(constraint){
// if field not numeric, but verb is numeric clear the verb
if(this.criteriaUtils.numericFields.indexOf(constraint.get('field').value) == -1 && this.criteriaUtils.verbs.indexOf(constraint.get('verb').value)){
constraint.get('verb').setValue(this.criteriaUtils.verbs[0].value);
}
if(this.criteriaUtils.numericFields.indexOf(constraint.get('field').value) != -1 && this.criteriaUtils.numericFields.indexOf(constraint.get('verb').value)){
constraint.get('verb').setValue(this.criteriaUtils.verbsForNumbers[0].value);
}
}
} }

View File

@ -83,7 +83,7 @@ type Tab = 'all' | 'communities' | 'ris';
<div class="uk-card uk-card-default uk-card-body uk-position-relative"> <div class="uk-card uk-card-default uk-card-body uk-position-relative">
<div class="uk-position-top-right uk-margin-small-right uk-margin-small-top"> <div class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
<div class="uk-flex uk-flex-middle"> <div class="uk-flex uk-flex-middle">
<icon [flex]="true" [name]="community.status == 'all'?'earth':(community.status == 'manager'?'restricted':'incognito')" ratio="0.6"></icon> <icon [flex]="true" [name]="community.isPublic()?'earth':(community.isRestricted()?'restricted':'incognito')" ratio="0.6"></icon>
</div> </div>
</div> </div>
<a class="uk-display-block uk-text-center uk-link-reset" [routerLink]="community.communityId"> <a class="uk-display-block uk-text-center uk-link-reset" [routerLink]="community.communityId">

View File

@ -42,7 +42,7 @@ export class UsersManagersComponent implements OnInit {
this.link = this.getURL(this.community.communityId); this.link = this.getURL(this.community.communityId);
this.message = 'A manager has the right to access the administration part of Research Community Dashboard, ' + this.message = 'A manager has the right to access the administration part of Research Community Dashboard, ' +
'where he is able to customize and manage the content, invite other users as managers or members.'; 'where he is able to customize and manage the content, invite other users as managers or members.';
if(community.status === "hidden") { if(community.isPrivate()) {
this.inviteDisableMessage = "Community's status is Hidden and invitation to manage the Research community dashboard is disabled. Update the community status to enable invitations." this.inviteDisableMessage = "Community's status is Hidden and invitation to manage the Research community dashboard is disabled. Update the community status to enable invitations."
} }
this.loading = false; this.loading = false;

View File

@ -46,8 +46,8 @@ export class UsersSubscribersComponent implements OnInit {
this.link = this.getURL(this.community.communityId); this.link = this.getURL(this.community.communityId);
this.message = 'A member can access the community dashboard and link research results with projects, ' + this.message = 'A member can access the community dashboard and link research results with projects, ' +
'communities and other research projects.'; 'communities and other research projects.';
if(community.status !== "all") { if(!community.isPublic()) {
this.inviteDisableMessage = "Community's status is " + (community.status === 'manager'?'Visible to managers':'Hidden') + " and invitation to join the Research community dashboard is disabled. Update the community status to enable invitations." this.inviteDisableMessage = "Community's status is " + (community.isRestricted()?'Visible to managers':'Hidden') + " and invitation to join the Research community dashboard is disabled. Update the community status to enable invitations."
} }
this.loading = false; this.loading = false;
} }