[Library|Trunk]

Connect - Production release with links to beta: Connect helper ignore community id in domain if in production

Search Page:
	option to include breadcrumb
	show quickFilters for only results view
	Quick Filters: 
		one line if they fit
Entities Selection Component:
	add option to show only result types 
	add check  if different result types are enabled


Add search bar component:
	select different result types 

Navbar: apply changes for searchbar to fit 

	


	


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58517 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-04-22 13:00:13 +00:00
parent 8eb43945ce
commit bfc49c0e18
14 changed files with 350 additions and 60 deletions

View File

@ -13,7 +13,9 @@ export class ConnectHelper {
} else if (domain.indexOf('test.') !== -1) {
return null;
} else {
domain = domain.substr(0, domain.indexOf('.'));
//for production: ignore communities
// domain = domain.substr(0, domain.indexOf('.'));
return null;
}
if (domain === 'connect' || domain === 'explore' || domain === 'monitor' || domain === 'admin'){
return null;

View File

@ -91,7 +91,7 @@ export class SearchAllComponent {
properties: EnvProperties;
@Input() logoURL;
@Input() name;
@Input() customFilter: SearchCustomFilter = null;
@Input() customFilter: SearchCustomFilter = null;
@Input() piwikSiteId = null;
@Input() formPlaceholderText = "Search for research results, projects, content providers & organizations in OpenAIRE";

View File

@ -33,7 +33,7 @@ import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class";
[filters]="filters" [quickFilter]="quickFilter"
[rangeFilters]="rangeFilters" [rangeFields]="rangeFields"
[simpleView]="simpleView" formPlaceholderText="Search by title, author, abstract, DOI, orcid..."
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter" [showBreadcrumb]="showBreadcrumb"
>
</new-search-page>
@ -82,6 +82,7 @@ export class SearchResearchResultsComponent {
value: "Open Access"
};
@Input() includeOnlyResultsAndFilter: boolean = false;
@Input() showBreadcrumb:boolean = false;
@Output() searchPageUpdates = new EventEmitter();
subs: any[]=[];
constructor(private route: ActivatedRoute, private _searchResearchResultsService: SearchResearchResultsService) {

View File

@ -18,9 +18,9 @@
<quick-selections [resultTypes]="resultTypes" (typeChange)="queryChanged()" [isDisabled]="isDisabled"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties"
[properties]="properties" class="uk-grid uk-margin-small-left"
></quick-selections>
<hr *ngIf="resultTypes || quickFilter">
<hr *ngIf="resultTypes || quickFilter" class="uk-margin-small">
<table class=" uk-table uk-table-responsive uk-table-small uk-margin-remove">
<tr>
<td class="uk-text-muted uk-text-uppercase">Field to search</td>

View File

@ -1,16 +1,18 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
import {FormBuilder} from "@angular/forms";
import {EnvProperties} from "../../utils/properties/env-properties";
import {SearchCustomFilter} from "./searchUtils.class";
import {ConfigurationService} from "../../utils/configuration/configuration.service";
import {Router} from "@angular/router";
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
import {MatSelect} from "@angular/material";
@Component({
selector: 'entities-selection',
template: `
<span class="entitiesSelection portal-box uk-text-small " style="" >
<mat-select *ngIf="show>1 && selectedEntity " [(value)]="selectedEntity"
(valueChange)="entityChanged()" [disableOptionCentering]="true" panelClass="matSelectionPanel">
<span *ngIf="!disableSelect" class=" entitiesSelection portal-box uk-text-small clickable" style="" (click)="open()" >
<mat-select *ngIf="show>1 && selectedEntity && !disableSelect && !onlyresults" [(value)]="selectedEntity"
(valueChange)="entityChanged()" [disableOptionCentering]="true" [panelClass]="matPanelClass" >
<mat-option
*ngIf="simpleView && (show)>1 && !(this.customFilter && this.customFilter.queryFieldName=='communityId' )"
value="all">All content
@ -20,17 +22,44 @@ import {Router} from "@angular/router";
<mat-option *ngIf="showDataProviders" value="dataprovider">Content providers</mat-option>
<mat-option *ngIf="showOrganizations" value="organization">Organizations</mat-option>
</mat-select>
<div *ngIf="show==1 && currentEntity" >
<div >
<span *ngIf="currentEntity=='all'">All content</span>
<span *ngIf="currentEntity=='result'">Research outcomes</span>
<span *ngIf="currentEntity=='project'">Projects</span>
<span *ngIf="currentEntity=='dataprovider'">Content providers</span>
<span *ngIf="currentEntity=='organization'">Organizations</span>
</div>
<mat-select *ngIf="onlyresults && show>1 && selectedEntity " [(value)]="selectedEntity"
(valueChange)="entityChanged()" [disableOptionCentering]="true" [panelClass]="matPanelClass" >
<mat-option
*ngIf="simpleView && (show)>1 && !(this.customFilter && this.customFilter.queryFieldName=='communityId' )"
value="all">All research outcomes
</mat-option>
<mat-option *ngIf="showPublications" value="publications">Publications</mat-option>
<mat-option *ngIf="showDatasets" value="datasets">Datasets</mat-option>
<mat-option *ngIf="showSoftware" value="software">Software</mat-option>
<mat-option *ngIf="showOther" value="other">Other Research products</mat-option>
</mat-select>
</span>
<span *ngIf=" currentEntity && disableSelect" class="entitiesSelection portal-box uk-text-small " style="">
<div>
<span *ngIf="currentEntity=='all'">{{onlyresults ? 'All research outcomes' : 'All content'}}</span>
<span *ngIf="currentEntity=='result'">Research outcomes</span>
<span *ngIf="currentEntity=='project'">Projects</span>
<span *ngIf="currentEntity=='dataprovider'">Content providers</span>
<span *ngIf="currentEntity=='organization'">Organizations</span>
<span *ngIf="currentEntity=='publications'">Publications</span>
<span *ngIf="currentEntity=='datasets'">Datasets</span>
<span *ngIf="currentEntity=='software'">Software</span>
<span *ngIf="currentEntity=='other'">Other Research products</span>
</div>
</span>
</span>
<!--<span *ngIf="onlyresults && !disableSelect">
<select *ngIf="show" [(ngModel)]="selectedEntity" class="uk-select uk-width-auto portal-box uk-text-small" (ngModelChange)="entityChanged()" >
<option
*ngIf="simpleView && (show)>1 && !(this.customFilter && this.customFilter.queryFieldName=='communityId' )"
value="all">All research outcomes
</option>
<option *ngIf="showPublications" value="publications">Publications</option>
<option *ngIf="showDatasets" value="datasets">Datasets</option>
<option *ngIf="showSoftware" value="software">Software</option>
<option *ngIf="showOther" value="other">Other Research products</option>
</select>
</span>-->
@ -41,6 +70,10 @@ import {Router} from "@angular/router";
export class EntitiesSelectionComponent {
showResearchOutcomes: boolean = false;
showPublications: boolean = false;
showDatasets: boolean = false;
showSoftware: boolean = false;
showOther: boolean = false;
showProjects: boolean = false;
showDataProviders: boolean = false;
showOrganizations: boolean = false;
@ -51,7 +84,11 @@ export class EntitiesSelectionComponent {
@Input() simpleView: boolean = true;
@Input() onChangeNavigate: boolean = true;
@Output() selectionChange = new EventEmitter();
@Input() onlyresults: boolean = false;
@Input() matPanelClass="matSelectionPanel";
@Input() disableSelect:boolean=false;
show = 0;
@ViewChild(MatSelect)matSelect:MatSelect;
constructor(private _fb: FormBuilder, private config: ConfigurationService, private router: Router) {
@ -71,6 +108,10 @@ export class EntitiesSelectionComponent {
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
}
this.showResearchOutcomes = showEntity["publication"] || showEntity["dataset"] || showEntity["software"] || showEntity["orp"];
this.showPublications = showEntity["publication"];
this.showDatasets = showEntity["dataset"];
this.showSoftware = showEntity["software"];
this.showOther = showEntity["orp"];
this.showProjects = showEntity["project"];
this.showOrganizations = showEntity["organization"];
this.showDataProviders = showEntity["datasource"];
@ -94,8 +135,9 @@ export class EntitiesSelectionComponent {
if(this.showProjects){
this.show++;
}
if(this.show ==1){
this.disableSelect = true;
}
});
}
this.selectedEntity = this.currentEntity;
@ -123,19 +165,32 @@ export class EntitiesSelectionComponent {
getUrl(simpleView: boolean) {
let url = "";
if (this.selectedEntity == "all") {
url = (simpleView ? "/search/find/" : null);
} else if (this.selectedEntity == "result") {
if(!this.onlyresults) {
if (this.selectedEntity == "all") {
url = (simpleView ? "/search/find/" : null);
} else if (this.selectedEntity == "result") {
url = (simpleView ? this.properties.searchLinkToResults : this.properties.searchLinkToAdvancedResults);
} else if (this.selectedEntity == "project") {
url = (simpleView ? this.properties.searchLinkToProjects : this.properties.searchLinkToAdvancedProjects);
} else if (this.selectedEntity == "dataprovider") {
url = (simpleView ? this.properties.searchLinkToDataProviders : this.properties.searchLinkToAdvancedDataProviders);
} else if (this.selectedEntity == "organization") {
url = (simpleView ? this.properties.searchLinkToOrganizations : this.properties.searchLinkToAdvancedOrganizations);
}
}else{
url = (simpleView ? this.properties.searchLinkToResults : this.properties.searchLinkToAdvancedResults);
} else if (this.selectedEntity == "project") {
url = (simpleView ? this.properties.searchLinkToProjects : this.properties.searchLinkToAdvancedProjects);
} else if (this.selectedEntity == "dataprovider") {
url = (simpleView ? this.properties.searchLinkToDataProviders : this.properties.searchLinkToAdvancedDataProviders);
} else if (this.selectedEntity == "organization") {
url = (simpleView ? this.properties.searchLinkToOrganizations : this.properties.searchLinkToAdvancedOrganizations);
}
return url;
}
toggle(){
if(this.matSelect) {
this.matSelect.toggle();
}
}
open(){
if(this.matSelect && !this.matSelect.focused) {
this.matSelect.open();
}
}
}

View File

@ -79,7 +79,8 @@
<div [class]="(usedBy!='deposit' && (!customFilter || customFilter.queryFieldName != 'communityId'))?'uk-position-cover':''" ></div>
<div class="uk-width-1-1">
<div class="uk-position-relative">
<div class="uk-container uk-margin-large-top">
<div [class]="'uk-container '+(customFilter && customFilter.queryFieldName ==
'communityId'?'':' aaa uk-margin-large-top')">
<advanced-search-form
[entityType] = "entityType"
[fieldIds]="fieldIds"
@ -109,6 +110,8 @@
<div id="tm-main" class=" tm-middle">
<div uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<!-- TODO add breadcrumb here-->
<div *ngIf="showBreadcrumb" class=" uk-margin-large-left">Home > Search</div>
<div class="uk-container uk-container-large uk-margin-medium-top">
<div>
@ -246,6 +249,19 @@
</div>
</div>
<div *ngIf="includeOnlyResultsAndFilter" class="uk-margin-medium-top uk-margin-medium-bottom">
<a *ngIf ="advancedSearchLink" routerLinkActive="router-link-active"
[routerLink]="advancedSearchLink" style="z-index:1;" [queryParams]="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
[class]="(disableForms?' uk-disabled uk-link-muted ':'') +' portal-link uk-float-right '">Advanced search
</a>
<quick-selections [resultTypes]="resultTypes"
(typeChange)="queryChanged()"
[isDisabled]="disableForms"
[quickFilter]="quickFilter" [QFselected]="(quickFilter)?quickFilter.selected:null"
[properties]="properties">
</quick-selections>
</div>
<div class="uk-grid helper-grid uk-padding-small uk-padding-remove-vertical uk-margin-large-bottom" >
<div *ngIf="showRefine" class="uk-width-1-4@m search-filters uk-visible@m">
<!-- top: #container-1; bottom: #true; -->

View File

@ -76,6 +76,7 @@ export class NewSearchPageComponent {
@Input() resultTypes = null;
@Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
@Input() includeOnlyResultsAndFilter:boolean = false;
@Input() showBreadcrumb:boolean = false;
@Input() lastIndex: boolean = true;
piwiksub: any;

View File

@ -24,6 +24,7 @@ import {CommunitySearchResultsModule} from "./communitySearchResults.module";
import {SearchResultsModule} from "./searchResults.module";
import {SearchResultsInDepositModule} from "../../deposit/searchResultsInDeposit.module";
import {AdvancedSearchFormModule} from "./advancedSearchForm.module";
import {QuickSelectionsModule} from "./quick-selections.module";
@NgModule({
imports: [
@ -32,7 +33,7 @@ import {AdvancedSearchFormModule} from "./advancedSearchForm.module";
SearchPagingModule, SearchResultsPerPageModule, SearchSortingModule, SearchDownloadModule, ModalModule,
SearchFilterModule, RangeFilterModule,
PiwikServiceModule, HelperModule, Schema2jsonldModule, SEOServiceModule, SearchResultsModule,
SearchResultsInDepositModule, AdvancedSearchFormModule
SearchResultsInDepositModule, AdvancedSearchFormModule, QuickSelectionsModule
],
declarations: [
NewSearchPageComponent

View File

@ -9,14 +9,14 @@ import {debounceTime} from "rxjs/operators";
@Component({
selector: 'quick-selections',
template: `
<form *ngIf="resultTypes || quickFilter" [formGroup]="control" class="uk-text-small uk-margin-small-bottom">
<div *ngIf="quickFilter" class="uk-margin-small-top uk-margin-small-left">
<form *ngIf="resultTypes || quickFilter" [formGroup]="control" class="uk-text-small uk-margin-small-bottom uk-grid">
<div *ngIf="quickFilter" class="uk-margin-small-top uk-padding-remove-left ">
<span class="uk-text-bold">{{quickFilter.value}}</span>
<mat-slide-toggle
class="uk-margin-small-left" formControlName="QFselected" (change)="quickFilterChanged()">
</mat-slide-toggle>
</div>
<div *ngIf="resultTypes && showEntities" class="uk-margin-small-top uk-margin-small-left">
<div *ngIf="resultTypes && showEntities" class="uk-margin-small-top">
<span class="uk-text-muted">Include: </span>
<span>
<span *ngIf="showPublications" class="uk-margin-small-left"> <input type="checkbox" id="publ" name="Publications" formControlName="publication" (change)="changed()"> Publications </span>
@ -144,6 +144,9 @@ export class QuickSelectionsComponent implements OnChanges {
}
}
if (changes.resultTypes) {
this.setFormValues();
}
}
setFormValues() {

View File

@ -16,21 +16,26 @@
<a class="uk-navbar-toggle" href="#tm-mobile" uk-toggle="" style="z-index:1000;">
<div uk-navbar-toggle-icon="" class="uk-navbar-toggle-icon uk-icon custom-navbar-toggle-icon"> </div>
</a>
<a *ngIf="community && !homeurl" class="uk-navbar-item uk-logo" [href]="'https://'+(properties.environment =='beta'?'beta.':'')+community.id+'.openaire.eu'" target="_blank">
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0 || showCommunityName" class="uk-margin-left uk-text-large">
{{community.name}} </div>
</a>
<a *ngIf="community && homeurl" class="uk-navbar-item uk-logo" routerLinkActive="uk-link" routerLink="/" >
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0 || showCommunityName" class="uk-margin-left uk-text-large">
{{community.name}} </div>
</a>
<div *ngIf="enableSearch && isEnabled([searchRoute], showPage)"
class=" ">
<search-bar [searchPlaceHolder]="searchPlaceHolder"
[searchRoute]="searchRoute" [properties]="properties"></search-bar>
</div>
</div>
<div class="uk-navbar-center">
<a *ngIf="!community" class="uk-navbar-item uk-logo" routerLinkActive="uk-link" routerLink="/" >
<img src="{{logoPath}}logo-small-{{portal}}.png" alt="OpenAIRE" class="uk-responsive-height">
</a>
<a *ngIf="community && !homeurl" class="uk-navbar-item uk-logo" [href]="'https://'+(properties.environment =='beta'?'beta.':'')+community.id+'.openaire.eu'" target="_blank">
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0 || showCommunityName" class="uk-margin-left uk-text-large">
{{community.name}} </div>
</a>
<a *ngIf="community && homeurl" class="uk-navbar-item uk-logo" routerLinkActive="uk-link" routerLink="/" >
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0 || showCommunityName" class="uk-margin-left uk-text-large">
{{community.name}} </div>
</a>
</div>
<!--div class="uk-navbar-right uk-margin-xlarge-top">
@ -144,20 +149,13 @@
class="uk-margin-left uk-text-large"> {{community.name}} </div>
</a>
<div *ngIf="enableSearch && isEnabled([searchRoute], showPage) && getCurrentRoute()=='/'"
class=" uk-margin-large-left uk-width-medium">
<div class="">
<form class="uk-search uk-search-default uk-width-1-1">
<a routerLinkActive="uk-link"
routerLink="{{searchRoute}}" [queryParams]="{keyword: keyword}" class="uk-search-icon-flip" uk-search-icon></a>
<input class="uk-search-input" type="search" [placeholder]="searchPlaceHolder"
aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
</form>
</div>
<div *ngIf="enableSearch && isEnabled([searchRoute], showPage)"
class=" uk-margin-large-left ">
<search-bar [searchPlaceHolder]="searchPlaceHolder"
[searchRoute]="searchRoute" [properties]="properties"></search-bar>
</div>
</div>
<div class="uk-navbar-left uk-visible@m uk-hidden@l uk-width-1-3">
<div class="uk-navbar-left uk-visible@m uk-hidden@l ">
<a *ngIf="!community" routerLinkActive="uk-link" routerLink="/" class="uk-logo uk-navbar-item">
<img src="{{logoPath}}logo-small-{{portal}}.png" alt="OpenAIRE" class="uk-responsive-height">
</a>
@ -171,7 +169,11 @@
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0 || showCommunityName"
class="uk-margin-left uk-text-large"> {{community.name}} </div>
</a>
<div *ngIf="enableSearch && isEnabled([searchRoute], showPage)"
class=" ">
<search-bar [searchPlaceHolder]="searchPlaceHolder"
[searchRoute]="searchRoute" [properties]="properties"></search-bar>
</div>
</div>
<!-- <div *ngIf="!onlyTop" class="uk-navbar-center"> -->

View File

@ -8,12 +8,13 @@ import { NavigationBarComponent} from './navigationBar.component';
import { UserMiniModule} from '../login/userMiniModule.module';
import { ConfigurationServiceModule } from '../utils/configuration/configurationService.module';
import {SearchBarModule} from "./searchBar/searchBar.module";
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule, ConfigurationServiceModule,
UserMiniModule
UserMiniModule, SearchBarModule
],
declarations: [
NavigationBarComponent

View File

@ -0,0 +1,42 @@
<div *ngIf="enableSearchbar" class="">
<!-- <form class="uk-search uk-search-default uk-width-1-1">
<a routerLinkActive="uk-link"
routerLink="{{searchRoute}}" [queryParams]="{keyword: keyword}" class="uk-search-icon-flip" uk-search-icon></a>
<input class="uk-search-input" type="search" [placeholder]="searchPlaceHolder"
aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" >
</form>-->
<!-- <advanced-search-form [showAdvancedSearchLink]="false" [simpleView]="true" ></advanced-search-form>-->
<form class=" uk-margin-medium-bottom uk-margin-top searchBar ">
<div class="uk-grid uk-margin-small-left">
<div
[class]="((entitiesSelection)?'':'uk-width-small@s')+' uk-margin-small-top uk-padding-remove-left'">
<entities-selection *ngIf="entitiesSelection" [simpleView]="true" [currentEntity]="entityType"
[selectedEntity]="entityType"
[properties]="properties"
(selectionChange)=" entityChanged($event)"
[customFilter]="customFilter"
[onlyresults]="true" matPanelClass="navbarMatSelectPanelClass"
[onChangeNavigate]="false" ></entities-selection>
</div>
<div class=" uk-padding-remove-left uk-margin-small-top">
<div class="uk-inline">
<a *ngIf="keyword.length > 0" class="uk-form-icon uk-form-icon-flip"
(click)="keyword = ''"
uk-icon="icon: close"></a>
<input type="text" class="uk-input text-input-box"
[placeholder]="searchPlaceHolder" aria-describedby="sizing-addon2"
[(ngModel)]="keyword" name="keyword">
</div>
</div>
<div class="uk-padding-remove-left uk-margin-small-top">
<button (click)="keywordChanged()" type="submit"
class=" uk-button portal-button uk-text-bold ">
Search
</button>
</div>
</div>
</form>
</div>

View File

@ -0,0 +1,142 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {EnvProperties} from "../../utils/properties/env-properties";
import {SearchCustomFilter} from "../../searchPages/searchUtils/searchUtils.class";
@Component({
selector: 'search-bar',
templateUrl: 'searchBar.component.html',
styles:[`
.mat-select-panel-wrap {
z-index: 2001
}
`]
})
export class SearchBarComponent {
@Input() searchRoute: string = "/search/find";
@Input() searchPlaceHolder: string = "Search for research results";
@Input() entitiesSelection:boolean = true;
@Input() properties:EnvProperties;
keyword: string = "";
entityType = "all";
enableSearchbar:boolean = true;
@Input() customFilter: SearchCustomFilter = null;
parameters = {};
constructor(private router: Router,
private route: ActivatedRoute ) {
}
ngOnInit() {
// this.activeRouteEnabled = false;
this.route.queryParams.subscribe(params => {
console.log("Init");
console.log(params);
this.parameters = Object.assign({}, params);
this.entityType = "all";
if (params["type"] && params["type"].length > 0) {
let types= params["type"].split(",");
if(types.length == 1){
if(types.indexOf("publications")!=-1 ){
this.entityType = "publications";
}else if(types.indexOf("datasets")!=-1 ){
this.entityType = "datasets";
}else if(types.indexOf("software")!=-1 ){
this.entityType = "software";
}else if(types.indexOf("other")!=-1 ){
this.entityType = "other";
}
}
}
console.log(this.entityType);
if(this.getCurrentRoute() == "/search/advanced/research-outcomes" ){
this.enableSearchbar = false;
}else{
this.enableSearchbar = true;
}
// this.initialize();
});
}
/*
ngOnDestroy() {
this.sub.unsubscribe();
}
initialize() {
this.activeRouteEnabled = false;
this.isAuthorized = Session.isClaimsCurator(this.user) || Session.isPortalAdministrator(this.user);
/!*if (this.properties.adminToolsAPIURL && this.communityId) {
this.config.getCommunityInformation(this.properties, this.communityId).subscribe(data => {
for (var i = 0; i < data['entities'].length; i++) {
this.showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"];
}
for (var i = 0; i < data['pages'].length; i++) {
this.showPage[data['pages'][i]["route"]] = data['pages'][i]["isEnabled"];
}
},
error => {
this.handleError("Error getting community information (e.g. pages,entities) for community with id: " + this.communityId, error);
});
}*!/
}*/
isEnabled(required, enabled) {
if (!required) {
return true;
}
for (let requiredEntity of required) {
if (typeof enabled[requiredEntity] === "undefined" || enabled[requiredEntity] == false) {
return false;
}
}
return true;
}
private handleError(message: string, error) {
console.error("NavigationBar (component): " + message, error);
}
getCurrentRoute() {
return this.router.url.split('?')[0];
}
entityChanged($event){
this.entityType = $event.entity;
this.searchRoute = $event.simpleUrl;
// this.selectedEntityAdvancedUrl = $event.advancedUrl;
// check if it is search or not
//no search page
}
keywordChanged(){
// this.parameters = {};
if ( this.keyword.length > 0) {
this.parameters["fv0"] = this.keyword;
this.parameters["f0"] = "q";
}else{
delete this.parameters['fv0'];
delete this.parameters['f0'];
}
if(this.entityType != "all"){
this.parameters["type"] = this.entityType;
}else{
delete this.parameters['type'];
}
//set true only if it is not set allready
if(!this.parameters["qf"]) {
this.parameters["qf"] = true;
}
console.log(this.parameters);
this.router.navigate([this.searchRoute], {queryParams: this.parameters} );
}
}

View File

@ -0,0 +1,24 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from "@angular/router";
import { SearchBarComponent} from './searchBar.component';
import {AdvancedSearchFormModule} from "../../searchPages/searchUtils/advancedSearchForm.module";
import {EntitiesSelectionModule} from "../../searchPages/searchUtils/entitiesSelection.module";
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule, AdvancedSearchFormModule, EntitiesSelectionModule
],
declarations: [
SearchBarComponent
],
providers:[],
exports: [
SearchBarComponent
]
})
export class SearchBarModule{ }