Merge branch 'new-theme' of code-repo.d4science.org:MaDgIK/openaire-library into new-theme

This commit is contained in:
argirok 2022-04-12 18:18:57 +03:00
commit 0e8143b4e2
8 changed files with 207 additions and 204 deletions

View File

@ -367,13 +367,13 @@
<!-- EGI Notebook--> <!-- EGI Notebook-->
<div *ngIf="resultLandingInfo.showEgiNotebookButton && properties.adminToolsPortalType == 'explore' <div *ngIf="resultLandingInfo.showEgiNotebookButton && properties.adminToolsPortalType == 'explore'
&& (properties.environment == 'beta' || properties.environment == 'development') && (!viewAll || viewAll=='egiNotebook')"> && (properties.environment == 'beta' || properties.environment == 'development') && (!viewAll || viewAll=='egiNotebook')">
<a class="uk-link-text uk-text-bold uk-text-uppercase" <a class="uk-link-text uk-text-bold custom-external"
target="_blank" [href]="properties.egiNotebookLink"> target="_blank" [href]="properties.egiNotebookLink">
<!-- <span class="uk-icon-button uk-icon">--> <!-- <span class="uk-icon-button uk-icon">-->
<img src="assets/common-assets/eosc-logo.png" <img src="assets/common-assets/eosc-logo.png"
loading="lazy" alt="eosc_logo" style="width:27px; height:27px"> loading="lazy" alt="eosc_logo" style="width:27px; height:27px">
<!-- </span>--> <!-- </span>-->
<span class="uk-margin-small-left custom-external"><u>EOSC SERVICE: EGI NOTEBOOK</u></span> <span class="uk-margin-small-left uk-text-uppercase"><u>EOSC SERVICE: EGI NOTEBOOK</u></span>
</a> </a>
</div> </div>
<!-- <hr *ngIf="resultLandingInfo.showEgiNotebookButton && properties.adminToolsPortalType == 'explore'--> <!-- <hr *ngIf="resultLandingInfo.showEgiNotebookButton && properties.adminToolsPortalType == 'explore'-->

View File

@ -207,7 +207,6 @@ export class ResultLandingComponent {
})); }));
this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--navbar-height')); this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--navbar-height'));
console.log(this.offset);
} }
private initMetaAndLinks(type: string) { private initMetaAndLinks(type: string) {

View File

@ -132,42 +132,20 @@
</div> </div>
</form> </form>
<div *ngIf="simpleView"> <div *ngIf="simpleView">
<form [class.uk-disabled]="isDisabled"> <form>
<div class="uk-grid uk-grid-small uk-flex uk-flex-center" uk-grid> <div class="uk-margin-small-bottom uk-flex uk-flex-right" *ngIf="showSwitchSearchLink">
<div *ngIf="entitiesSelection"> <a *ngIf ="this.entityType !='all' && this.entityType == this.selectedEntity && advancedSearchLink"
<entities-selection *ngIf="entitiesSelection" [simpleView]="true" [currentEntity]="entityType" [routerLink]="advancedSearchLink" [queryParams]="advancedSearchLinkParameters"
[properties]="properties" [ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search
(selectionChange)=" simpleEntityChanged($event)"
[onChangeNavigate]="true" [customFilter]="customFilter"></entities-selection>
</div>
<div *ngIf="selectedFields[0]" class="uk-inline uk-link">
<a class="uk-form-icon uk-form-icon-flip uk-link-reset"
(click)="simpleKeywordChanged(null)" type="submit">
<icon name="search" flex="true"></icon>
</a>
<input type="text" class="uk-input uk-width-large@m uk-width-medium"
[placeholder]="formPlaceholderText" role="searchbox"
[(ngModel)]="selectedFields[0].value" name="keyword"/>
</div>
<!-- TODO Check link to advance-->
<!--<div>
<button (click)="simpleKeywordChanged(null)" type="submit"
class="uk-button portal-button uk-margin-small-left uk-text-bold uk-padding uk-padding-remove-top uk-padding-remove-bottom">
Search
</button>
<div class="uk-margin-small-top" *ngIf="showSwitchSearchLink">
<a *ngIf ="this.entityType !='all' && this.entityType == this.selectedEntity && advancedSearchLink" routerLinkActive="router-link-active"
[routerLink]="advancedSearchLink" style="z-index:1;" [queryParams]="advancedSearchLinkParameters"
[class]="(isDisabled)?' uk-disabled uk-link-muted portal-link uk-margin-left ':' portal-link uk-margin-left '">Advanced search
</a> </a>
<a *ngIf =" this.entityType !='all' && this.entityType != this.selectedEntity && selectedEntityAdvancedUrl " <a *ngIf =" this.entityType !='all' && this.entityType != this.selectedEntity && selectedEntityAdvancedUrl "
routerLinkActive="router-link-active" [routerLink]="selectedEntityAdvancedUrl"
[routerLink]="selectedEntityAdvancedUrl" style="z-index:1;"
[queryParams]="{q:this.selectedFields[0].value,op:'and'}" [queryParams]="{q:this.selectedFields[0].value,op:'and'}"
[class]="(isDisabled)?' uk-disabled uk-link-muted portal-link uk-margin-left ':' portal-link uk-margin-left '">Advanced search [ngClass]="(isDisabled)?'uk-disabled uk-link-muted':null">Advanced search
</a> </a>
<a *ngIf="this.entityType=='all'" class="portal-link uk-margin-left">Advanced Search</a> <ng-container *ngIf="this.entityType=='all'">
<div *ngIf="this.entityType =='all'" uk-dropdown class="uk-dropdown default-dropdown"> <a>Advanced Search</a>
<div uk-dropdown class="uk-dropdown">
<ul class="uk-list uk-margin-remove-bottom"> <ul class="uk-list uk-margin-remove-bottom">
<li><a <li><a
[routerLink]="properties.searchLinkToAdvancedResults" [queryParams]="advancedSearchLinkParameters" [routerLink]="properties.searchLinkToAdvancedResults" [queryParams]="advancedSearchLinkParameters"
@ -184,8 +162,17 @@
Organizations</a></li> Organizations</a></li>
</ul> </ul>
</div> </div>
</ng-container>
</div> </div>
</div>--> <div class="uk-flex uk-flex-center">
<div *ngIf="entitiesSelection">
<entities-selection [simpleView]="true" [currentEntity]="entityType"
[properties]="properties"
(selectionChange)=" simpleEntityChanged($event)"
[onChangeNavigate]="true" [customFilter]="customFilter"></entities-selection>
</div>
<div *ngIf="selectedFields[0] && entitiesSelection" search-input [disabled]="isDisabled" [(value)]="selectedFields[0].value"
[placeholder]="formPlaceholderText" (searchEmitter)="simpleKeywordChanged()" class="uk-width-xlarge@l uk-width-large"></div>
</div> </div>
</form> </form>
</div> </div>

View File

@ -42,14 +42,17 @@ export class AdvancedSearchFormComponent {
@Input() entitiesSelection: boolean; @Input() entitiesSelection: boolean;
@Input() showSwitchSearchLink: boolean = true; @Input() showSwitchSearchLink: boolean = true;
sub; sub;
constructor(private route: ActivatedRoute, private router: Router) { constructor(private route: ActivatedRoute, private router: Router) {
} }
ngOnDestroy() { ngOnDestroy() {
if (this.sub instanceof Subscriber) { if (this.sub instanceof Subscriber) {
this.sub.unsubscribe(); this.sub.unsubscribe();
} }
} }
ngOnInit() { ngOnInit() {
this.selectedEntity = this.entityType; this.selectedEntity = this.entityType;
@ -61,12 +64,14 @@ export class AdvancedSearchFormComponent {
this.newFieldId = this.fieldIds[0]; this.newFieldId = this.fieldIds[0];
this.newFieldName = this.fieldIdsMap[this.newFieldId].name; this.newFieldName = this.fieldIdsMap[this.newFieldId].name;
} }
simpleEntityChanged($event) { simpleEntityChanged($event) {
this.selectedEntity = $event.entity; this.selectedEntity = $event.entity;
this.selectedEntitySimpleUrl = $event.simpleUrl; this.selectedEntitySimpleUrl = $event.simpleUrl;
this.selectedEntityAdvancedUrl = $event.advancedUrl; this.selectedEntityAdvancedUrl = $event.advancedUrl;
} }
simpleKeywordChanged($event){
simpleKeywordChanged() {
// this.selectedFields[0].value = $event.value; // this.selectedFields[0].value = $event.value;
if (this.selectedEntity == this.entityType) { if (this.selectedEntity == this.entityType) {
this.queryChanged(); this.queryChanged();
@ -74,6 +79,7 @@ export class AdvancedSearchFormComponent {
this.router.navigate([this.selectedEntitySimpleUrl], {queryParams: {q: this.selectedFields[0].value, op: "and"}}); this.router.navigate([this.selectedEntitySimpleUrl], {queryParams: {q: this.selectedFields[0].value, op: "and"}});
} }
} }
queryChanged() { queryChanged() {
this.validDateFrom = true; this.validDateFrom = true;
this.validDateTo = true; this.validDateTo = true;
@ -95,9 +101,7 @@ export class AdvancedSearchFormComponent {
if (this.validDateFrom && this.validDateTo) { if (this.validDateFrom && this.validDateTo) {
this.queryChange.emit({ this.queryChange.emit({});
});
} }
} }
@ -128,6 +132,7 @@ export class AdvancedSearchFormComponent {
this.selectedFields[index].operatorId = operatorId; this.selectedFields[index].operatorId = operatorId;
this.selectedFields[index].operatorName = operatorName; this.selectedFields[index].operatorName = operatorName;
} }
validateDate(index: number, value: string) { validateDate(index: number, value: string) {
this.selectedFields[index].valid = Dates.isValidYear(value); this.selectedFields[index].valid = Dates.isValidYear(value);
} }
@ -150,12 +155,15 @@ export class AdvancedSearchFormComponent {
this.selectedFields[index].value = "true"; this.selectedFields[index].value = "true";
} }
} }
valueChanged($event, index: number) { valueChanged($event, index: number) {
this.selectedFields[index].value = $event.value; this.selectedFields[index].value = $event.value;
} }
updatedValueLabel($event, index: number) { updatedValueLabel($event, index: number) {
this.selectedFields[index].valueLabel = $event.value; this.selectedFields[index].valueLabel = $event.value;
} }
listUpdated($event, fieldId: number) { listUpdated($event, fieldId: number) {
this.fieldList[fieldId] = $event.value; this.fieldList[fieldId] = $event.value;
} }

View File

@ -12,11 +12,12 @@ import {QuickSelectionsModule} from "./quick-selections.module";
import {EntitiesSelectionModule} from "./entitiesSelection.module"; import {EntitiesSelectionModule} from "./entitiesSelection.module";
import { MatSelectModule } from "@angular/material/select"; import { MatSelectModule } from "@angular/material/select";
import {IconsModule} from "../../utils/icons/icons.module"; import {IconsModule} from "../../utils/icons/icons.module";
import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, EntitiesAutocompleteModule, StaticAutocompleteModule, DateFilterModule, SearchFormModule, QuickSelectionsModule, EntitiesSelectionModule, MatSelectModule, IconsModule CommonModule, FormsModule, RouterModule, EntitiesAutocompleteModule, StaticAutocompleteModule, DateFilterModule, SearchFormModule, QuickSelectionsModule, EntitiesSelectionModule, MatSelectModule, IconsModule, SearchInputModule
], ],
declarations: [ declarations: [
AdvancedSearchFormComponent, AdvancedSearchFormComponent,

View File

@ -95,9 +95,9 @@ declare var UIkit;
</div> </div>
</div> </div>
</ng-template> </ng-template>
<div *ngIf="formControl.disabled || icon || (type === 'select' && selectArrow) || type === 'autocomplete'" <div *ngIf="(formControl.disabled && disabledIcon) || icon || (type === 'select' && selectArrow) || type === 'autocomplete'"
class="uk-margin-left icon"> class="uk-margin-left icon">
<icon *ngIf="formControl.disabled" [name]="'lock'" [flex]="true"></icon> <icon *ngIf="formControl.disabled && disabledIcon" [name]="disabledIcon" [flex]="true"></icon>
<ng-template [ngIf]="formControl.enabled"> <ng-template [ngIf]="formControl.enabled">
<icon *ngIf="!formControl.value && icon" [name]="icon" [flex]="true"></icon> <icon *ngIf="!formControl.value && icon" [name]="icon" [flex]="true"></icon>
<icon *ngIf="!icon && type === 'select' && selectArrow" name="arrow_drop_down" [flex]="true"></icon> <icon *ngIf="!icon && type === 'select' && selectArrow" name="arrow_drop_down" [flex]="true"></icon>
@ -169,6 +169,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
@Input('type') type: InputType = 'text'; @Input('type') type: InputType = 'text';
@Input() validators: ValidatorFn[] | ValidatorFn; @Input() validators: ValidatorFn[] | ValidatorFn;
@Input() disabled: boolean = false; @Input() disabled: boolean = false;
@Input() disabledIcon: string = 'lock';
@Input() value: any | any[]; @Input() value: any | any[];
@Output() valueChange = new EventEmitter<any | any[]>(); @Output() valueChange = new EventEmitter<any | any[]>();
@Input('hint') hint: string; @Input('hint') hint: string;
@ -304,6 +305,13 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
if (changes.formControl || changes.validators || changes.options) { if (changes.formControl || changes.validators || changes.options) {
this.reset(); this.reset();
} }
if(changes.disabled) {
if(this.disabled) {
this.formControl.disable();
} else {
this.formControl.enable();
}
}
} }
} }
@ -359,6 +367,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
this.required = (validator && validator.required); this.required = (validator && validator.required);
} }
this.subscriptions.push(this.formControl.valueChanges.subscribe(value => { this.subscriptions.push(this.formControl.valueChanges.subscribe(value => {
if(this.formControl.enabled) {
value = (value === '') ? null : value; value = (value === '') ? null : value;
if (this.type === 'logoURL') { if (this.type === 'logoURL') {
this.secure = (!value || value.includes('https://')); this.secure = (!value || value.includes('https://'));
@ -375,7 +384,10 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
this.open(true); this.open(true);
} }
} }
if((this.value && value && this.value !== value) || (!this.value && value) || this.value && !value) {
this.valueChange.emit(this.formControl.value); this.valueChange.emit(this.formControl.value);
}
}
})); }));
if (this.input) { if (this.input) {
this.input.nativeElement.disabled = this.formControl.disabled; this.input.nativeElement.disabled = this.formControl.disabled;

View File

@ -20,17 +20,17 @@ import {InputComponent} from "../input/input.component";
<div #searchInput class="search-input" [class.collapsed]="hidden" [ngClass]="searchInputClass"> <div #searchInput class="search-input" [class.collapsed]="hidden" [ngClass]="searchInputClass">
<div class="uk-flex uk-flex-middle"> <div class="uk-flex uk-flex-middle">
<div class="uk-width-expand"> <div class="uk-width-expand">
<div #input [class.uk-hidden]="hidden" input [formInput]="searchControl" inputClass="search" <div #input [class.uk-hidden]="hidden" input [formInput]="searchControl" inputClass="search" [disabledIcon]="null"
[placeholder]="{label: placeholder, static: true}" [value]="value" (valueChange)="valueChange.emit($event)" [placeholder]="{label: placeholder, static: true}" [(value)]="value" (valueChange)="valueChange.emit($event)"
[disabled]="disabled" [type]="(options.length > 0?'autocomplete_soft':'text')" [options]="options"></div> [disabled]="disabled" [type]="(options.length > 0?'autocomplete_soft':'text')" [options]="options"></div>
</div> </div>
<div [class.uk-hidden]="!searchControl?.value && !value" class="uk-width-auto"> <div [class.uk-hidden]="(!searchControl?.value && !value) || disabled" class="uk-width-auto">
<a class="uk-link-text" (click)="reset()"> <a class="uk-link-text" (click)="reset()">
<icon name="close" [flex]="true"></icon> <icon name="close" [flex]="true"></icon>
</a> </a>
</div> </div>
<div class="uk-width-auto"> <div class="uk-width-auto">
<div class="search-icon" [class.disabled]="disabled" (click)="search($event)"> <div class="search-icon" [class.disabled]="disabled" (click)="search()">
<icon name="search" [flex]="true" ratio="1.3"></icon> <icon name="search" [flex]="true" ratio="1.3"></icon>
</div> </div>
</div> </div>
@ -44,8 +44,8 @@ export class SearchInputComponent implements OnInit {
@Input() searchInputClass: string = 'inner'; @Input() searchInputClass: string = 'inner';
@Input() searchControl: AbstractControl; @Input() searchControl: AbstractControl;
@Input() value: string; @Input() value: string;
@Input() options: string[] = [];
@Output() valueChange = new EventEmitter<string>(); @Output() valueChange = new EventEmitter<string>();
@Input() options: string[] = [];
@Input() placeholder: string; @Input() placeholder: string;
@Input() expandable: boolean = false; @Input() expandable: boolean = false;
@Output() searchEmitter: EventEmitter<void> = new EventEmitter<void>(); @Output() searchEmitter: EventEmitter<void> = new EventEmitter<void>();
@ -61,7 +61,7 @@ export class SearchInputComponent implements OnInit {
if(this.input.focused) { if(this.input.focused) {
if(event.code === 'Enter') { if(event.code === 'Enter') {
event.preventDefault(); event.preventDefault();
this.search(event); this.search();
} }
} }
} }
@ -85,22 +85,22 @@ export class SearchInputComponent implements OnInit {
} }
} }
public search(event) { public search() {
if(!this.disabled) { if(!this.disabled) {
if (this.expandable) {
this.expand(!this.expanded);
event.stopPropagation();
}
this.searchEmitter.emit(); this.searchEmitter.emit();
} }
} }
public reset() { public reset() {
if(this.searchControl){
this.searchControl.setValue(''); this.searchControl.setValue('');
} else {
this.valueChange.emit('');
}
} }
get hidden(): boolean { get hidden(): boolean {
return !this.expanded && !this.searchControl.value; return !this.expanded && ((this.searchControl && !this.searchControl.value) || (!this.searchControl && !this.value));
} }
/** @deprecated all*/ /** @deprecated all*/

View File

@ -7,9 +7,9 @@
alt="Enermaps tool preview" loading="lazy"> alt="Enermaps tool preview" loading="lazy">
<div class="uk-overlay uk-margin-medium-left uk-overlay-default uk-position-bottom uk-hidden-hover uk-padding-small"> <div class="uk-overlay uk-margin-medium-left uk-overlay-default uk-position-bottom uk-hidden-hover uk-padding-small">
<p>Visit <a <p>Visit <a
class=" uk-margin-right uk-margin-small-top" class="custom-external uk-margin-right uk-margin-small-top"
[href]="properties.enermapsURL + '/?shared_id=' + result.enermapsId" target="_blank" > [href]="properties.enermapsURL + '/?shared_id=' + result.enermapsId" target="_blank" >
Enermaps tool <span class="custom-external custom-icon space"></span> Enermaps tool
</a></p> </a></p>
</div> </div>
@ -55,7 +55,7 @@
<a *ngIf="externalUrl && result.id && !(result.resultType == 'dataprovider' && result.compatibilityUNKNOWN) " <a *ngIf="externalUrl && result.id && !(result.resultType == 'dataprovider' && result.compatibilityUNKNOWN) "
(click)="onClick()" (click)="onClick()"
target="_blank" [href]="externalUrl+result.id" class="uk-link uk-width-expand"> target="_blank" [href]="externalUrl+result.id" class="custom-external uk-link uk-width-expand">
<span *ngIf="(result.title) || result.acronym"> <span *ngIf="(result.title) || result.acronym">
<span *ngIf="result.acronym"> <span *ngIf="result.acronym">
{{result.acronym}} {{result.acronym}}
@ -67,7 +67,6 @@
<span *ngIf="!result.title && !result.acronym"> <span *ngIf="!result.title && !result.acronym">
[no title available] [no title available]
</span> </span>
<span class="custom-external custom-icon space"></span>
</a> </a>
<div *ngIf="!result.id || (result.resultType == 'dataprovider' && result.compatibilityUNKNOWN)" <div *ngIf="!result.id || (result.resultType == 'dataprovider' && result.compatibilityUNKNOWN)"
@ -224,8 +223,7 @@
<div *ngIf="result.websiteURL && result.websiteURL != '' && !promoteWebsiteURL" class="uk-margin-small-bottom"> <div *ngIf="result.websiteURL && result.websiteURL != '' && !promoteWebsiteURL" class="uk-margin-small-bottom">
<span class="uk-text-meta">Website URL: </span> <span class="uk-text-meta">Website URL: </span>
<span> <span>
<a href="{{result.websiteURL}}" target="_blank"> <a href="{{result.websiteURL}}" target="_blank" class="custom-external">
<span class="custom-external custom-icon"></span>
{{result.websiteURL}} {{result.websiteURL}}
</a> </a>
</span> </span>
@ -234,8 +232,7 @@
<div *ngIf="result.OAIPMHURL && result.OAIPMHURL != ''" class="uk-margin-small-bottom"> <div *ngIf="result.OAIPMHURL && result.OAIPMHURL != ''" class="uk-margin-small-bottom">
<span class="uk-text-meta">OAI-PMH URL: </span> <span class="uk-text-meta">OAI-PMH URL: </span>
<span> <span>
<a href="{{result.OAIPMHURL}}" target="_blank"> <a href="{{result.OAIPMHURL}}" target="_blank" class="custom-external">
<span class="custom-external custom-icon"></span>
{{result.OAIPMHURL}} {{result.OAIPMHURL}}
</a> </a>
</span> </span>
@ -271,8 +268,7 @@
<span class="uk-text-meta">Download from: </span> <span class="uk-text-meta">Download from: </span>
<a *ngIf="from.downloadUrl" <a *ngIf="from.downloadUrl"
[href]="from.downloadUrl" target="_blank" class="title"> [href]="from.downloadUrl" target="_blank" class="title">
<span>{{from.downloadNames.join("; ")}}</span> <span class="custom-external">{{from.downloadNames.join("; ")}}</span>
<span class="custom-external space"></span>
</a> </a>
<span *ngIf="!from.downloadUrl || from.downloadUrl.length === 0" class="title"> <span *ngIf="!from.downloadUrl || from.downloadUrl.length === 0" class="title">
<span>{{from.downloadNames.join(", ")}}</span> <span>{{from.downloadNames.join(", ")}}</span>