[develop | WIP] Search pages (projects, organizations, datasources ) use SearchBase component
This commit is contained in:
parent
b8caff57d4
commit
dfa7c2a8c2
|
@ -1,61 +1,29 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
|
||||||
import {Subscriber} from "rxjs";
|
|
||||||
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
||||||
|
import {SearchBaseComponent} from "../searchBaseComponent";
|
||||||
|
import {CustomFilterService} from "../../../shared/customFilter.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'monitor-advanced-search-dataproviders',
|
selector: 'monitor-advanced-search-dataproviders',
|
||||||
template: `
|
template: `
|
||||||
<search-dataproviders *ngIf="initialized" [simpleView]="false"
|
<search-dataproviders *ngIf="customFilters" [simpleView]="false"
|
||||||
[customFilter]=customFilter [hasPrefix]="false" [searchForm]="searchForm"
|
[customFilters]=customFilters
|
||||||
[includeOnlyResultsAndFilter]="false" [showSwitchSearchLink]="showSwitchSearchLink">
|
[hasPrefix]="false"
|
||||||
|
[showBreadcrumb]="false"
|
||||||
|
[showSwitchSearchLink]="false"
|
||||||
|
[searchForm]="{dark: false, class: 'search-form'}"
|
||||||
|
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/simple/projects'">
|
||||||
</search-dataproviders>
|
</search-dataproviders>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class MonitorAdvancedSearchDataprovidersComponent {
|
export class MonitorAdvancedSearchDataprovidersComponent extends SearchBaseComponent implements OnInit{
|
||||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: false};
|
constructor(protected route: ActivatedRoute,
|
||||||
customFilter: SearchCustomFilter = null;
|
protected router: Router,
|
||||||
initialized: boolean = false;
|
protected customFilterService: CustomFilterService) {
|
||||||
showSwitchSearchLink: boolean = false;
|
super();
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
|
||||||
private router: Router,
|
|
||||||
private stakeholderService: StakeholderService) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
subscriptions = [];
|
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subscriptions.forEach(subscription => {
|
|
||||||
if (subscription instanceof Subscriber) {
|
|
||||||
subscription.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
super.initSearch();
|
||||||
if (params['stakeholder']) {
|
|
||||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
|
||||||
if (stakeholder) {
|
|
||||||
if (stakeholder.type === "organization") {
|
|
||||||
let value = stakeholder.index_id;
|
|
||||||
this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, "");
|
|
||||||
this.showSwitchSearchLink = true;
|
|
||||||
} else if (stakeholder.type === "funder") {
|
|
||||||
let value = stakeholder.index_id + "||" + stakeholder.index_name + "||" + stakeholder.index_shortName;
|
|
||||||
this.customFilter = new SearchCustomFilter("Funder", "relfunder", value, stakeholder.name);
|
|
||||||
} else if (stakeholder.type === "ri") {
|
|
||||||
let value = stakeholder.index_id + "||" + stakeholder.index_name;
|
|
||||||
this.customFilter = new SearchCustomFilter("Community", "community", value, stakeholder.name);
|
|
||||||
}
|
}
|
||||||
this.initialized = true;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +1,29 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
|
||||||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
|
||||||
import {Subscriber} from "rxjs";
|
|
||||||
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
||||||
|
import {SearchBaseComponent} from "../searchBaseComponent";
|
||||||
|
import {CustomFilterService} from "../../../shared/customFilter.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'monitor-advanced-search-organizations',
|
selector: 'monitor-advanced-search-organizations',
|
||||||
template: `
|
template: `
|
||||||
<search-organizations *ngIf="initialized" [simpleView]="false" [showSwitchSearchLink]="false" [customFilter]="customFilter" [searchForm]="searchForm">
|
<search-organizations *ngIf="customFilters" [simpleView]="false" [showSwitchSearchLink]="true" [customFilters]="customFilters"
|
||||||
|
[hasPrefix]="false"
|
||||||
|
[showBreadcrumb]="false"
|
||||||
|
[showSwitchSearchLink]="false"
|
||||||
|
[searchForm]="{dark: false, class: 'search-form'}"
|
||||||
|
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/simple/projects'">
|
||||||
</search-organizations>
|
</search-organizations>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class MonitorAdvancedSearchOrganizationsComponent {
|
export class MonitorAdvancedSearchOrganizationsComponent extends SearchBaseComponent implements OnInit{
|
||||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: false};
|
constructor(protected route: ActivatedRoute,
|
||||||
initialized: boolean = false;
|
protected router: Router,
|
||||||
customFilter: SearchCustomFilter = null;
|
protected customFilterService: CustomFilterService) {
|
||||||
|
super();
|
||||||
constructor(private route: ActivatedRoute,
|
|
||||||
private router: Router,
|
|
||||||
private stakeholderService: StakeholderService) {
|
|
||||||
}
|
}
|
||||||
subscriptions = [];
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subscriptions.forEach(subscription => {
|
|
||||||
if (subscription instanceof Subscriber) {
|
|
||||||
subscription.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
super.initSearch();
|
||||||
if (params['stakeholder']) {
|
|
||||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
|
||||||
if (stakeholder) {
|
|
||||||
if (stakeholder.type === "funder") {
|
|
||||||
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
|
||||||
this.customFilter = new SearchCustomFilter("Funder", "relfunder", value, stakeholder.name);
|
|
||||||
this.customFilter.isHiddenFilter = false;
|
|
||||||
} else if (stakeholder.type === "organization") {
|
|
||||||
let value = stakeholder.index_id;
|
|
||||||
this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, stakeholder.name);
|
|
||||||
this.customFilter.isHiddenFilter = false;
|
|
||||||
} else if (stakeholder.type === "ri") {
|
|
||||||
let value = stakeholder.index_id+"||"+stakeholder.index_name;
|
|
||||||
this.customFilter = new SearchCustomFilter("Community", "community", value, stakeholder.name);
|
|
||||||
this.customFilter.isHiddenFilter = false;
|
|
||||||
}
|
|
||||||
this.initialized = true;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,67 +1,31 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
|
||||||
import {Subscriber} from "rxjs";
|
|
||||||
import {properties} from "../../../../environments/environment";
|
|
||||||
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
||||||
|
import {SearchBaseComponent} from "../searchBaseComponent";
|
||||||
|
import {CustomFilterService} from "../../../shared/customFilter.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'monitor-advanced-search-projects',
|
selector: 'monitor-advanced-search-projects',
|
||||||
template: `
|
template: `
|
||||||
<search-projects *ngIf="initialized" [simpleView]="false"
|
<search-projects *ngIf="customFilters" [simpleView]="false"
|
||||||
[customFilter]=customFilter [hasPrefix]="false"
|
[customFilters]=customFilters
|
||||||
[includeOnlyResultsAndFilter]="false" [showSwitchSearchLink]="showSwitchSearchLink"
|
[hasPrefix]="false"
|
||||||
|
[showBreadcrumb]="false"
|
||||||
|
[showSwitchSearchLink]="false"
|
||||||
|
[searchForm]="{dark: false, class: 'search-form'}"
|
||||||
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/simple/projects'"
|
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/simple/projects'"
|
||||||
[searchForm]="searchForm"
|
|
||||||
>
|
>
|
||||||
</search-projects>
|
</search-projects>
|
||||||
`
|
`
|
||||||
|
|
||||||
})
|
})
|
||||||
export class MonitorAdvancedSearchProjectsComponent {
|
export class MonitorAdvancedSearchProjectsComponent extends SearchBaseComponent implements OnInit{
|
||||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: false};
|
constructor(protected route: ActivatedRoute,
|
||||||
customFilter: SearchCustomFilter = null;
|
protected router: Router,
|
||||||
initialized: boolean = false;
|
protected customFilterService: CustomFilterService) {
|
||||||
showSwitchSearchLink:boolean = false;
|
super();
|
||||||
properties;
|
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
|
||||||
private router: Router,
|
|
||||||
private stakeholderService: StakeholderService) {
|
|
||||||
}
|
}
|
||||||
subscriptions = [];
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subscriptions.forEach(subscription => {
|
|
||||||
if (subscription instanceof Subscriber) {
|
|
||||||
subscription.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.properties = properties;
|
super.initSearch();
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
|
||||||
if (params['stakeholder']) {
|
|
||||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
|
||||||
if (stakeholder) {
|
|
||||||
if (stakeholder.type === "funder") {
|
|
||||||
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
|
||||||
this.customFilter = new SearchCustomFilter("Funder", "funder", value, "");
|
|
||||||
this.showSwitchSearchLink = true;
|
|
||||||
} else if (stakeholder.type === "organization") {
|
|
||||||
let value = stakeholder.index_id;
|
|
||||||
this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, "");
|
|
||||||
this.showSwitchSearchLink = true;
|
|
||||||
} else if (stakeholder.type === "ri") {
|
|
||||||
let value = stakeholder.index_id+"||"+stakeholder.index_name;
|
|
||||||
this.customFilter = new SearchCustomFilter("Community", "community", value, stakeholder.name);
|
|
||||||
}
|
}
|
||||||
this.initialized = true;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,22 @@
|
||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
|
||||||
import {Subscriber} from "rxjs";
|
|
||||||
import {properties} from "../../../../environments/environment";
|
|
||||||
import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service";
|
|
||||||
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
|
||||||
import {BaseComponent} from "../../../openaireLibrary/sharedComponents/base/base.component";
|
|
||||||
import {SearchBaseComponent} from "../searchBaseComponent";
|
import {SearchBaseComponent} from "../searchBaseComponent";
|
||||||
import {CustomFilterService} from "../../../shared/customFilter.service";
|
import {CustomFilterService} from "../../../shared/customFilter.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'monitor-advanced-search-results',
|
selector: 'monitor-advanced-search-results',
|
||||||
template: `
|
template: `
|
||||||
<search-research-results *ngIf="initialized" resultType="result" [simpleView]="false"
|
<search-research-results *ngIf="customFilters" resultType="result" [simpleView]="false"
|
||||||
[customFilters]=customFilters [hasPrefix]="false"
|
[customFilters]=customFilters [hasPrefix]="false"
|
||||||
[includeOnlyResultsAndFilter]="false"
|
[showBreadcrumb]="false"
|
||||||
[showSwitchSearchLink]="true"
|
[showSwitchSearchLink]="true"
|
||||||
|
[searchForm]="{dark: false, class: 'search-form'}"
|
||||||
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/advanced/research-outcomes'"
|
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/advanced/research-outcomes'"
|
||||||
[searchForm]="searchForm"
|
|
||||||
></search-research-results>
|
></search-research-results>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class MonitorAdvancedSearchResearchResultsComponent extends SearchBaseComponent implements OnInit{
|
export class MonitorAdvancedSearchResearchResultsComponent extends SearchBaseComponent implements OnInit{
|
||||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: false};
|
|
||||||
constructor(protected route: ActivatedRoute,
|
constructor(protected route: ActivatedRoute,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected customFilterService: CustomFilterService) {
|
protected customFilterService: CustomFilterService) {
|
||||||
|
|
|
@ -11,7 +11,6 @@ export abstract class SearchBaseComponent extends BaseComponent {
|
||||||
protected route: ActivatedRoute;
|
protected route: ActivatedRoute;
|
||||||
protected router: Router;
|
protected router: Router;
|
||||||
customFilters: SearchCustomFilter[];
|
customFilters: SearchCustomFilter[];
|
||||||
initialized: boolean = false;
|
|
||||||
properties;
|
properties;
|
||||||
keyword = "";
|
keyword = "";
|
||||||
parameters = {};
|
parameters = {};
|
||||||
|
@ -22,7 +21,6 @@ export abstract class SearchBaseComponent extends BaseComponent {
|
||||||
this.subscriptions.push((this.customFilterService.getCustomFilterAsObservable().subscribe(customFilters => {
|
this.subscriptions.push((this.customFilterService.getCustomFilterAsObservable().subscribe(customFilters => {
|
||||||
if(customFilters && customFilters.length > 0) {
|
if(customFilters && customFilters.length > 0) {
|
||||||
this.customFilters = customFilters;
|
this.customFilters = customFilters;
|
||||||
this.initialized = true;
|
|
||||||
}
|
}
|
||||||
})));
|
})));
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||||
|
@ -31,7 +29,6 @@ export abstract class SearchBaseComponent extends BaseComponent {
|
||||||
this.subscriptions.push((this.customFilterService.getCustomFilterAsObservable().subscribe(customFilters => {
|
this.subscriptions.push((this.customFilterService.getCustomFilterAsObservable().subscribe(customFilters => {
|
||||||
if(customFilters && customFilters.length > 0) {
|
if(customFilters && customFilters.length > 0) {
|
||||||
this.customFilters = customFilters;
|
this.customFilters = customFilters;
|
||||||
this.initialized = true;
|
|
||||||
}
|
}
|
||||||
})));
|
})));
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -5,11 +5,12 @@ import {MonitorSearchDataprovidersComponent} from './searchDataproviders.compone
|
||||||
import {SearchDataProvidersRoutingModule} from './searchDataProviders-routing.module';
|
import {SearchDataProvidersRoutingModule} from './searchDataProviders-routing.module';
|
||||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||||
import {SearchDataProvidersModule} from '../../../openaireLibrary/searchPages/searchDataProviders.module';
|
import {SearchDataProvidersModule} from '../../../openaireLibrary/searchPages/searchDataProviders.module';
|
||||||
|
import {SearchInputModule} from "../../../openaireLibrary/sharedComponents/search-input/search-input.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule,
|
CommonModule, FormsModule,
|
||||||
SearchDataProvidersModule, SearchDataProvidersRoutingModule
|
SearchDataProvidersModule, SearchDataProvidersRoutingModule, SearchInputModule
|
||||||
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -7,59 +7,36 @@ import {ConfigurationService} from "../../../openaireLibrary/utils/configuration
|
||||||
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
||||||
import {EnvProperties} from "../../../openaireLibrary/utils/properties/env-properties";
|
import {EnvProperties} from "../../../openaireLibrary/utils/properties/env-properties";
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
|
import {SearchBaseComponent} from "../searchBaseComponent";
|
||||||
|
import {CustomFilterService} from "../../../shared/customFilter.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'monitor-search-dataproviders',
|
selector: 'monitor-search-dataproviders',
|
||||||
template: `
|
template: `
|
||||||
<search-dataproviders *ngIf="initialized"
|
<div class=" uk-flex uk-flex-center ">
|
||||||
[customFilter]=customFilter [hasPrefix]="false" [searchForm]="searchForm"
|
<div search-input [(value)]="keyword" [placeholder]="'Search content providers'"
|
||||||
[includeOnlyResultsAndFilter]="false" [showSwitchSearchLink]="showSwitchSearchLink">
|
[searchInputClass]="'inner background'" (searchEmitter)="search()" class="uk-width-xlarge@l uk-width-large@m"></div>
|
||||||
|
</div>
|
||||||
|
<search-dataproviders *ngIf="customFilters"
|
||||||
|
[customFilters]=customFilters
|
||||||
|
[hasPrefix]="false"
|
||||||
|
[includeOnlyResultsAndFilter]="true" [showBreadcrumb]="false"
|
||||||
|
[showSwitchSearchLink]="false"
|
||||||
|
[searchForm]="{dark: false, class: 'search-form'}">
|
||||||
</search-dataproviders>
|
</search-dataproviders>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class MonitorSearchDataprovidersComponent {
|
export class MonitorSearchDataprovidersComponent extends SearchBaseComponent{
|
||||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: false};
|
|
||||||
customFilter: SearchCustomFilter = null;
|
|
||||||
initialized: boolean = false;
|
|
||||||
showSwitchSearchLink: boolean = false;
|
|
||||||
public properties: EnvProperties = properties;
|
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(protected route: ActivatedRoute,
|
||||||
private router: Router,
|
protected router: Router,
|
||||||
private stakeholderService: StakeholderService) {
|
protected customFilterService: CustomFilterService) {
|
||||||
}
|
super();
|
||||||
|
|
||||||
subscriptions = [];
|
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subscriptions.forEach(subscription => {
|
|
||||||
if (subscription instanceof Subscriber) {
|
|
||||||
subscription.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
super.initSearch();
|
||||||
if (params['stakeholder']) {
|
|
||||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
|
||||||
if (stakeholder) {
|
|
||||||
if (stakeholder.type === "funder") {
|
|
||||||
this.navigateToError();
|
|
||||||
} else if (stakeholder.type === "organization") {
|
|
||||||
let value = stakeholder.index_id;
|
|
||||||
this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, "");
|
|
||||||
} else if (stakeholder.type === "ri") {
|
|
||||||
this.navigateToError();
|
|
||||||
}
|
|
||||||
this.initialized = true;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateToError() {
|
|
||||||
this.router.navigate([this.properties.errorLink], {queryParams: {'page': this.router.url}});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,34 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
import {SearchBaseComponent} from "../searchBaseComponent";
|
||||||
import {Subscriber} from "rxjs";
|
import {CustomFilterService} from "../../../shared/customFilter.service";
|
||||||
import {ConfigurationService} from "../../../openaireLibrary/utils/configuration/configuration.service";
|
|
||||||
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'monitor-search-organizations',
|
selector: 'monitor-search-organizations',
|
||||||
template: `
|
template: `
|
||||||
<search-organizations *ngIf="initialized" [searchForm]="searchForm">
|
<div class=" uk-flex uk-flex-center ">
|
||||||
|
<div search-input [(value)]="keyword" [placeholder]="'Search organizations'"
|
||||||
|
[searchInputClass]="'inner background'" (searchEmitter)="search()" class="uk-width-xlarge@l uk-width-large@m"></div>
|
||||||
|
</div>
|
||||||
|
<search-organizations *ngIf="customFilters" [customFilters]="customFilters"
|
||||||
|
[hasPrefix]="false"
|
||||||
|
[includeOnlyResultsAndFilter]="true" [showBreadcrumb]="false"
|
||||||
|
[showSwitchSearchLink]="false"
|
||||||
|
[searchForm]="{dark: false, class: 'search-form'}">
|
||||||
</search-organizations>
|
</search-organizations>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class MonitorSearchOrganizationsComponent {
|
export class MonitorSearchOrganizationsComponent extends SearchBaseComponent{
|
||||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: false};
|
|
||||||
initialized: boolean = false;
|
constructor(protected route: ActivatedRoute,
|
||||||
constructor(private route: ActivatedRoute,
|
protected router: Router,
|
||||||
private router: Router,
|
protected customFilterService: CustomFilterService) {
|
||||||
private stakeholderService: StakeholderService, private configurationService: ConfigurationService) {
|
super();
|
||||||
}
|
|
||||||
subscriptions = [];
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subscriptions.forEach(subscription => {
|
|
||||||
if (subscription instanceof Subscriber) {
|
|
||||||
subscription.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
super.initSearch();
|
||||||
if (params['stakeholder']) {
|
|
||||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
|
||||||
if (stakeholder) {
|
|
||||||
this.initialized = true;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,13 @@ import {SearchOrganizationsRoutingModule} from './searchOrganizations-routing.mo
|
||||||
import {MonitorSearchOrganizationsComponent} from './searchOrganizations.component';
|
import {MonitorSearchOrganizationsComponent} from './searchOrganizations.component';
|
||||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||||
import {SearchOrganizationsModule} from "../../../openaireLibrary/searchPages/searchOrganizations.module";
|
import {SearchOrganizationsModule} from "../../../openaireLibrary/searchPages/searchOrganizations.module";
|
||||||
|
import {SearchInputModule} from "../../../openaireLibrary/sharedComponents/search-input/search-input.module";
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule,
|
CommonModule, FormsModule,
|
||||||
SearchOrganizationsRoutingModule, SearchOrganizationsModule
|
SearchOrganizationsRoutingModule, SearchOrganizationsModule, SearchInputModule
|
||||||
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -1,65 +1,37 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {SearchCustomFilter} from "../../../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
import {StakeholderService} from "../../../openaireLibrary/monitor/services/stakeholder.service";
|
import {SearchBaseComponent} from "../searchBaseComponent";
|
||||||
import {Subscriber} from "rxjs";
|
import {CustomFilterService} from "../../../shared/customFilter.service";
|
||||||
import {properties} from "../../../../environments/environment";
|
|
||||||
import {SearchForm} from "../../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'monitor-search-projects',
|
selector: 'monitor-search-projects',
|
||||||
template: `
|
template: `
|
||||||
<search-projects *ngIf="initialized"
|
<div class=" uk-flex uk-flex-center ">
|
||||||
[customFilter]=customFilter [hasPrefix]="false"
|
<div search-input [(value)]="keyword" [placeholder]="'Search projects'"
|
||||||
[includeOnlyResultsAndFilter]="false"
|
[searchInputClass]="'inner background'" (searchEmitter)="search()" class="uk-width-xlarge@l uk-width-large@m"></div>
|
||||||
|
</div>
|
||||||
|
<search-projects *ngIf="customFilters"
|
||||||
|
[customFilters]="customFilters" [hasPrefix]="false"
|
||||||
|
[includeOnlyResultsAndFilter]="true" [showBreadcrumb]="false"
|
||||||
|
[showSwitchSearchLink]="false"
|
||||||
|
[searchForm]="{dark: false, class: 'search-form'}"
|
||||||
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/simple/projects'"
|
[openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/simple/projects'"
|
||||||
[searchForm]="searchForm">
|
>
|
||||||
</search-projects>
|
</search-projects>
|
||||||
`
|
`
|
||||||
|
|
||||||
})
|
})
|
||||||
export class MonitorSearchProjectsComponent {
|
export class MonitorSearchProjectsComponent extends SearchBaseComponent{
|
||||||
@Input() searchForm: SearchForm = {class: 'search-form', dark: false};
|
|
||||||
customFilter: SearchCustomFilter = null;
|
constructor(protected route: ActivatedRoute,
|
||||||
initialized: boolean = false;
|
protected router: Router,
|
||||||
properties;
|
protected customFilterService: CustomFilterService) {
|
||||||
constructor(private route: ActivatedRoute,
|
super();
|
||||||
private router: Router,
|
|
||||||
private stakeholderService: StakeholderService) {
|
|
||||||
}
|
|
||||||
subscriptions = [];
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subscriptions.forEach(subscription => {
|
|
||||||
if (subscription instanceof Subscriber) {
|
|
||||||
subscription.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.properties = properties;
|
super.initSearch();
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
|
||||||
if (params['stakeholder']) {
|
|
||||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
|
||||||
if (stakeholder) {
|
|
||||||
if (stakeholder.type === "funder") {
|
|
||||||
let value = stakeholder.index_id+"||"+stakeholder.index_name+"||"+stakeholder.index_shortName;
|
|
||||||
this.customFilter = new SearchCustomFilter("Funder", "funder", value, "");
|
|
||||||
} else if (stakeholder.type === "organization") {
|
|
||||||
let value = stakeholder.index_id;
|
|
||||||
this.customFilter = new SearchCustomFilter("Organization", "relorganizationid", value, "");
|
|
||||||
} else if (stakeholder.type === "ri") {
|
|
||||||
this.navigateToError();
|
|
||||||
}
|
|
||||||
this.initialized = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateToError() {
|
|
||||||
this.router.navigate([this.properties.errorLink], {queryParams: {'page': this.router.url}});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@ import {SearchProjectsRoutingModule} from './searchProjects-routing.module';
|
||||||
import {MonitorSearchProjectsComponent} from './searchProjects.component';
|
import {MonitorSearchProjectsComponent} from './searchProjects.component';
|
||||||
import {SearchProjectsModule} from "../../../openaireLibrary/searchPages/searchProjects.module";
|
import {SearchProjectsModule} from "../../../openaireLibrary/searchPages/searchProjects.module";
|
||||||
import {PreviousRouteRecorder} from "../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
|
import {PreviousRouteRecorder} from "../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
|
||||||
|
import {SearchInputModule} from "../../../openaireLibrary/sharedComponents/search-input/search-input.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule, SearchProjectsRoutingModule, SearchProjectsModule
|
CommonModule, FormsModule, SearchProjectsRoutingModule, SearchProjectsModule, SearchInputModule
|
||||||
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
Loading…
Reference in New Issue