Revision 58517
Added by Argiro Kokogiannaki about 4 years ago
entitiesSelection.component.ts | ||
---|---|---|
1 |
import {Component, EventEmitter, Input, Output} from '@angular/core'; |
|
1 |
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
|
2 | 2 |
import {FormBuilder} from "@angular/forms"; |
3 | 3 |
import {EnvProperties} from "../../utils/properties/env-properties"; |
4 | 4 |
import {SearchCustomFilter} from "./searchUtils.class"; |
5 | 5 |
import {ConfigurationService} from "../../utils/configuration/configuration.service"; |
6 | 6 |
import {Router} from "@angular/router"; |
7 |
import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; |
|
8 |
import {MatSelect} from "@angular/material"; |
|
7 | 9 |
|
8 | 10 |
@Component({ |
9 | 11 |
selector: 'entities-selection', |
10 | 12 |
template: ` |
11 |
<span class="entitiesSelection portal-box uk-text-small " style="" >
|
|
12 |
<mat-select *ngIf="show>1 && selectedEntity " [(value)]="selectedEntity" |
|
13 |
(valueChange)="entityChanged()" [disableOptionCentering]="true" panelClass="matSelectionPanel">
|
|
13 |
<span *ngIf="!disableSelect" class=" entitiesSelection portal-box uk-text-small clickable" style="" (click)="open()" >
|
|
14 |
<mat-select *ngIf="show>1 && selectedEntity && !disableSelect && !onlyresults" [(value)]="selectedEntity"
|
|
15 |
(valueChange)="entityChanged()" [disableOptionCentering]="true" [panelClass]="matPanelClass" >
|
|
14 | 16 |
<mat-option |
15 | 17 |
*ngIf="simpleView && (show)>1 && !(this.customFilter && this.customFilter.queryFieldName=='communityId' )" |
16 | 18 |
value="all">All content |
... | ... | |
20 | 22 |
<mat-option *ngIf="showDataProviders" value="dataprovider">Content providers</mat-option> |
21 | 23 |
<mat-option *ngIf="showOrganizations" value="organization">Organizations</mat-option> |
22 | 24 |
</mat-select> |
23 |
<div *ngIf="show==1 && currentEntity" > |
|
24 |
<div > |
|
25 |
<span *ngIf="currentEntity=='all'">All content</span> |
|
26 |
<span *ngIf="currentEntity=='result'">Research outcomes</span> |
|
27 |
<span *ngIf="currentEntity=='project'">Projects</span> |
|
28 |
<span *ngIf="currentEntity=='dataprovider'">Content providers</span> |
|
29 |
<span *ngIf="currentEntity=='organization'">Organizations</span> |
|
30 |
</div> |
|
31 |
|
|
25 |
<mat-select *ngIf="onlyresults && show>1 && selectedEntity " [(value)]="selectedEntity" |
|
26 |
(valueChange)="entityChanged()" [disableOptionCentering]="true" [panelClass]="matPanelClass" > |
|
27 |
<mat-option |
|
28 |
*ngIf="simpleView && (show)>1 && !(this.customFilter && this.customFilter.queryFieldName=='communityId' )" |
|
29 |
value="all">All research outcomes |
|
30 |
</mat-option> |
|
31 |
<mat-option *ngIf="showPublications" value="publications">Publications</mat-option> |
|
32 |
<mat-option *ngIf="showDatasets" value="datasets">Datasets</mat-option> |
|
33 |
<mat-option *ngIf="showSoftware" value="software">Software</mat-option> |
|
34 |
<mat-option *ngIf="showOther" value="other">Other Research products</mat-option> |
|
35 |
</mat-select> |
|
36 |
|
|
37 |
</span> |
|
38 |
<span *ngIf=" currentEntity && disableSelect" class="entitiesSelection portal-box uk-text-small " style=""> |
|
39 |
<div> |
|
40 |
<span *ngIf="currentEntity=='all'">{{onlyresults ? 'All research outcomes' : 'All content'}}</span> |
|
41 |
<span *ngIf="currentEntity=='result'">Research outcomes</span> |
|
42 |
<span *ngIf="currentEntity=='project'">Projects</span> |
|
43 |
<span *ngIf="currentEntity=='dataprovider'">Content providers</span> |
|
44 |
<span *ngIf="currentEntity=='organization'">Organizations</span> |
|
45 |
<span *ngIf="currentEntity=='publications'">Publications</span> |
|
46 |
<span *ngIf="currentEntity=='datasets'">Datasets</span> |
|
47 |
<span *ngIf="currentEntity=='software'">Software</span> |
|
48 |
<span *ngIf="currentEntity=='other'">Other Research products</span> |
|
32 | 49 |
</div> |
33 |
</span> |
|
50 |
</span> |
|
51 |
<!--<span *ngIf="onlyresults && !disableSelect"> |
|
52 |
<select *ngIf="show" [(ngModel)]="selectedEntity" class="uk-select uk-width-auto portal-box uk-text-small" (ngModelChange)="entityChanged()" > |
|
53 |
<option |
|
54 |
*ngIf="simpleView && (show)>1 && !(this.customFilter && this.customFilter.queryFieldName=='communityId' )" |
|
55 |
value="all">All research outcomes |
|
56 |
</option> |
|
57 |
<option *ngIf="showPublications" value="publications">Publications</option> |
|
58 |
<option *ngIf="showDatasets" value="datasets">Datasets</option> |
|
59 |
<option *ngIf="showSoftware" value="software">Software</option> |
|
60 |
<option *ngIf="showOther" value="other">Other Research products</option> |
|
61 |
</select> |
|
62 |
</span>--> |
|
34 | 63 |
|
35 | 64 |
|
36 | 65 |
|
... | ... | |
41 | 70 |
export class EntitiesSelectionComponent { |
42 | 71 |
|
43 | 72 |
showResearchOutcomes: boolean = false; |
73 |
showPublications: boolean = false; |
|
74 |
showDatasets: boolean = false; |
|
75 |
showSoftware: boolean = false; |
|
76 |
showOther: boolean = false; |
|
44 | 77 |
showProjects: boolean = false; |
45 | 78 |
showDataProviders: boolean = false; |
46 | 79 |
showOrganizations: boolean = false; |
... | ... | |
51 | 84 |
@Input() simpleView: boolean = true; |
52 | 85 |
@Input() onChangeNavigate: boolean = true; |
53 | 86 |
@Output() selectionChange = new EventEmitter(); |
87 |
@Input() onlyresults: boolean = false; |
|
88 |
@Input() matPanelClass="matSelectionPanel"; |
|
89 |
@Input() disableSelect:boolean=false; |
|
54 | 90 |
show = 0; |
91 |
@ViewChild(MatSelect)matSelect:MatSelect; |
|
55 | 92 |
|
56 | 93 |
constructor(private _fb: FormBuilder, private config: ConfigurationService, private router: Router) { |
57 | 94 |
|
... | ... | |
71 | 108 |
showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"]; |
72 | 109 |
} |
73 | 110 |
this.showResearchOutcomes = showEntity["publication"] || showEntity["dataset"] || showEntity["software"] || showEntity["orp"]; |
111 |
this.showPublications = showEntity["publication"]; |
|
112 |
this.showDatasets = showEntity["dataset"]; |
|
113 |
this.showSoftware = showEntity["software"]; |
|
114 |
this.showOther = showEntity["orp"]; |
|
74 | 115 |
this.showProjects = showEntity["project"]; |
75 | 116 |
this.showOrganizations = showEntity["organization"]; |
76 | 117 |
this.showDataProviders = showEntity["datasource"]; |
... | ... | |
94 | 135 |
if(this.showProjects){ |
95 | 136 |
this.show++; |
96 | 137 |
} |
97 |
|
|
98 |
|
|
138 |
if(this.show ==1){ |
|
139 |
this.disableSelect = true; |
|
140 |
} |
|
99 | 141 |
}); |
100 | 142 |
} |
101 | 143 |
this.selectedEntity = this.currentEntity; |
... | ... | |
123 | 165 |
|
124 | 166 |
getUrl(simpleView: boolean) { |
125 | 167 |
let url = ""; |
126 |
if (this.selectedEntity == "all") { |
|
127 |
url = (simpleView ? "/search/find/" : null); |
|
128 |
} else if (this.selectedEntity == "result") { |
|
168 |
if(!this.onlyresults) { |
|
169 |
if (this.selectedEntity == "all") { |
|
170 |
url = (simpleView ? "/search/find/" : null); |
|
171 |
} else if (this.selectedEntity == "result") { |
|
172 |
url = (simpleView ? this.properties.searchLinkToResults : this.properties.searchLinkToAdvancedResults); |
|
173 |
} else if (this.selectedEntity == "project") { |
|
174 |
url = (simpleView ? this.properties.searchLinkToProjects : this.properties.searchLinkToAdvancedProjects); |
|
175 |
} else if (this.selectedEntity == "dataprovider") { |
|
176 |
url = (simpleView ? this.properties.searchLinkToDataProviders : this.properties.searchLinkToAdvancedDataProviders); |
|
177 |
} else if (this.selectedEntity == "organization") { |
|
178 |
url = (simpleView ? this.properties.searchLinkToOrganizations : this.properties.searchLinkToAdvancedOrganizations); |
|
179 |
} |
|
180 |
}else{ |
|
129 | 181 |
url = (simpleView ? this.properties.searchLinkToResults : this.properties.searchLinkToAdvancedResults); |
130 |
} else if (this.selectedEntity == "project") { |
|
131 |
url = (simpleView ? this.properties.searchLinkToProjects : this.properties.searchLinkToAdvancedProjects); |
|
132 |
} else if (this.selectedEntity == "dataprovider") { |
|
133 |
url = (simpleView ? this.properties.searchLinkToDataProviders : this.properties.searchLinkToAdvancedDataProviders); |
|
134 |
} else if (this.selectedEntity == "organization") { |
|
135 |
url = (simpleView ? this.properties.searchLinkToOrganizations : this.properties.searchLinkToAdvancedOrganizations); |
|
136 | 182 |
} |
137 | 183 |
return url; |
138 | 184 |
} |
185 |
toggle(){ |
|
186 |
if(this.matSelect) { |
|
187 |
this.matSelect.toggle(); |
|
188 |
} |
|
189 |
} |
|
190 |
open(){ |
|
191 |
if(this.matSelect && !this.matSelect.focused) { |
|
192 |
this.matSelect.open(); |
|
193 |
} |
|
194 |
} |
|
139 | 195 |
|
140 |
|
|
141 | 196 |
} |
Also available in: Unified diff
[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