[Library | Trunk]: Projects in modal change result-preview to search-results

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58786 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-05-26 15:42:02 +00:00
parent 3154babcaa
commit f7bf1fcbc0
3 changed files with 41 additions and 46 deletions

View File

@ -15,16 +15,18 @@ import {AlertModal} from "../../utils/modal/alert";
@Component({ @Component({
selector: 'projectsInModal', selector: 'projectsInModal',
template: ` template: `
<div *ngIf="fetchProjects.funders.length > 1" class="uk-margin-small-bottom uk-text-muted">Filter by Funder:</div> <div *ngIf="fetchProjects.funders.length > 1" class="uk-margin-bottom">
<ul *ngIf="fetchProjects.funders.length > 1" class="uk-list uk-list-divider uk-margin-remove"> <div class="uk-margin-small-bottom uk-text-muted">Filter by Funder:</div>
<li *ngFor="let filter of fetchProjects.filters "> <ul class="uk-list uk-list-divider uk-margin-remove">
<span *ngFor="let value of filter.values" class="uk-animation-fade uk-margin-small-right"> <li *ngFor="let filter of fetchProjects.filters ">
<input [(ngModel)]="value.selected" type="checkbox" <span *ngFor="let value of filter.values" class="uk-animation-fade uk-margin-small-right">
(ngModelChange)="filterChange(value.selected)"/> <input [(ngModel)]="value.selected" type="checkbox"
<span class="uk-text-bold"> {{value.name}}</span> (ngModelChange)="filterChange(value.selected)"/>
</span> <span class="uk-text-bold"> {{value.name}}</span>
</li> </span>
</ul> </li>
</ul>
</div>
<errorMessages [status]="[fetchProjects.searchUtils.status]" [type]="'projects'" <errorMessages [status]="[fetchProjects.searchUtils.status]" [type]="'projects'"
tab_error_class=true></errorMessages> tab_error_class=true></errorMessages>
<div *ngIf="fetchProjects.searchUtils.status == errorCodes.DONE"> <div *ngIf="fetchProjects.searchUtils.status == errorCodes.DONE">
@ -33,11 +35,11 @@ import {AlertModal} from "../../utils/modal/alert";
[page]="page" [pageSize]="size" [page]="page" [pageSize]="size"
[totalResults]="fetchProjects.searchUtils.totalResults"> [totalResults]="fetchProjects.searchUtils.totalResults">
</no-load-paging> </no-load-paging>
<ul class="uk-list uk-list-divider uk-margin"> <search-result [results]="fetchProjects.results"
<li *ngFor="let result of fetchProjects.results"> [status]="fetchProjects.searchUtils.status"
<result-preview [properties]="properties" [modal]="modal" [result]="getResultPreview(result)"></result-preview> [type]="'project'"
</li> [showLoading]="true" [properties]="properties">
</ul> </search-result>
<no-load-paging *ngIf="fetchProjects.searchUtils.totalResults > size" [type]="'projects'" <no-load-paging *ngIf="fetchProjects.searchUtils.totalResults > size" [type]="'projects'"
(pageChange)="pageChange($event)" (pageChange)="pageChange($event)"
[page]="page" [pageSize]="size" [page]="page" [pageSize]="size"
@ -54,7 +56,6 @@ export class ProjectsInModalComponent {
@Input() modal: AlertModal; @Input() modal: AlertModal;
public page: number = 1; public page: number = 1;
public size: number = 10; public size: number = 10;
public linkToSearchProjects: string;
public routerHelper: RouterHelper = new RouterHelper(); public routerHelper: RouterHelper = new RouterHelper();
public errorCodes: ErrorCodes = new ErrorCodes(); public errorCodes: ErrorCodes = new ErrorCodes();
@ -68,17 +69,12 @@ export class ProjectsInModalComponent {
ngOnInit() { ngOnInit() {
if (this.organizationId) { if (this.organizationId) {
this.linkToSearchProjects = this.properties.searchLinkToAdvancedProjects;//+"?organization="+this.organizationId+"or=and";;
if (this.fetchProjects.searchUtils.totalResults > 0) { if (this.fetchProjects.searchUtils.totalResults > 0) {
this.search(false, ""); this.search(false, "");
} }
} }
} }
public getResultPreview(result: SearchResult): ResultPreview {
return ResultPreview.searchResultConvert(result, 'project');
}
private search(refine: boolean, filterQuery: string) { private search(refine: boolean, filterQuery: string) {
var refineFields: string [] = ["funder"]; var refineFields: string [] = ["funder"];
this.fetchProjects.getResultsForOrganizations(this.organizationId, filterQuery, this.page, this.size, (refine) ? refineFields : [], this.properties); this.fetchProjects.getResultsForOrganizations(this.organizationId, filterQuery, this.page, this.size, (refine) ? refineFields : [], this.properties);

View File

@ -1,33 +1,32 @@
/* This module contains all common components for all landing pages */ /* This module contains all common components for all landing pages */
import { NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import { CommonModule } from '@angular/common'; import {CommonModule} from '@angular/common';
import { FormsModule } from '@angular/forms'; import {FormsModule} from '@angular/forms';
import { RouterModule } from '@angular/router'; import {RouterModule} from '@angular/router';
import { ProjectsServiceModule} from '../../services/projectsService.module'; import {ProjectsServiceModule} from '../../services/projectsService.module';
import { TabResultModule } from '../../searchPages/searchUtils/tabResult.module'; import {TabResultModule} from '../../searchPages/searchUtils/tabResult.module';
import { ProjectsInModalComponent} from './projects-in-modal.component'; import {ProjectsInModalComponent} from './projects-in-modal.component';
import {PagingModule } from '../../utils/paging.module'; import {PagingModule} from '../../utils/paging.module';
import {ErrorMessagesModule} from '../../utils/errorMessages.module'; import {ErrorMessagesModule} from '../../utils/errorMessages.module';
import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module"; import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module";
import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module"; import {SearchResultsModule} from "../../searchPages/searchUtils/searchResults.module";
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule, CommonModule, FormsModule, RouterModule, CommonModule, FormsModule,
ProjectsServiceModule, TabResultModule, ProjectsServiceModule, TabResultModule,
PagingModule, ErrorMessagesModule, NoLoadPaging, ResultPreviewModule PagingModule, ErrorMessagesModule, NoLoadPaging, SearchResultsModule
], ],
declarations: [ declarations: [
ProjectsInModalComponent
],
providers:[
],
exports: [
ProjectsInModalComponent ProjectsInModalComponent
] ],
providers: [],
exports: [
ProjectsInModalComponent
]
}) })
export class ProjectsInModalModule { } export class ProjectsInModalModule {
}

View File

@ -185,15 +185,15 @@
</div> </div>
<div class="uk-margin-small-top uk-flex"> <div class="uk-margin-small-top uk-flex">
<!-- Last Index Info--> <!-- Last Index Info-->
<div class="uk-flex uk-flex-bottom uk-width-2-3"> <div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4"> <img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<span class="uk-margin-small-left uk-text-small uk-text-baseline uk-text-muted">Powered by OpenAIRE Open Research Graph</span> <span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by OpenAIRE Open Research Graph</span>
<span class="uk-margin-small-left uk-text-small uk-text-baseline uk-text-muted"> <span class="uk-text-baseline uk-text-muted">
Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}} . Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
</span> </span>
</div> </div>
<!--Feedback--> <!--Feedback-->
<div class="uk-width-1-3 uk-text-right uk-text-small"> <div class="uk-width-expand uk-text-right">
<span class="uk-text-muted">Any information missing or wrong?</span> <span class="uk-text-muted">Any information missing or wrong?</span>
<a (click)="showFeedback = true; scroll()" class="portal-link space">Report an Issue</a> <a (click)="showFeedback = true; scroll()" class="portal-link space">Report an Issue</a>
</div> </div>
@ -213,8 +213,8 @@
<modal-alert *ngIf="organizationInfo && organizationInfo.deletedByInferenceIds" <modal-alert *ngIf="organizationInfo && organizationInfo.deletedByInferenceIds"
#AlertModalDeletedByInference classBody="uk-width-xxlarge uk-padding-remove-right"> #AlertModalDeletedByInference classBody="uk-width-xxlarge uk-padding-remove-right">
<landing-header [properties]="properties" [title]="organizationInfo.title.name" <landing-header [properties]="properties" [title]="organizationInfo.title.name"
[subTitle]="(organizationInfo.name [subTitle]="(organizationInfo.name && organizationInfo.title.name !== organizationInfo.name)?organizationInfo.name:null"
&& organizationInfo.title.name !== organizationInfo.name)?organizationInfo.name:null" titleClass="title-grey-background"
[entityType]="'organization'"></landing-header> [entityType]="'organization'"></landing-header>
<div class="uk-margin-medium-top uk-margin-medium-right"> <div class="uk-margin-medium-top uk-margin-medium-right">
<organizationsDeletedByInference *ngIf="deleteByInferenceOpened" <organizationsDeletedByInference *ngIf="deleteByInferenceOpened"