Revision 49720
Added by Argiro Kokogiannaki over 6 years ago
modules/uoa-services-portal/trunk/portal-4cli/webpack.server.config.js | ||
---|---|---|
1 |
// Work around for https://github.com/angular/angular-cli/issues/7200 |
|
2 |
|
|
3 |
const path = require('path'); |
|
4 |
const webpack = require('webpack'); |
|
5 |
|
|
6 |
module.exports = { |
|
7 |
entry: { |
|
8 |
// This is our Express server for Dynamic universal |
|
9 |
server: './server.ts', |
|
10 |
// This is an example of Static prerendering (generative) |
|
11 |
prerender: './prerender.ts' |
|
12 |
}, |
|
13 |
target: 'node', |
|
14 |
resolve: { extensions: ['.ts', '.js'] }, |
|
15 |
// Make sure we include all node_modules etc |
|
16 |
externals: [/(node_modules|main\..*\.js)/,], |
|
17 |
output: { |
|
18 |
// Puts the output at the root of the dist folder |
|
19 |
path: path.join(__dirname, 'dist'), |
|
20 |
filename: '[name].js' |
|
21 |
}, |
|
22 |
module: { |
|
23 |
rules: [ |
|
24 |
{ test: /\.ts$/, loader: 'ts-loader' } |
|
25 |
] |
|
26 |
}, |
|
27 |
plugins: [ |
|
28 |
new webpack.ContextReplacementPlugin( |
|
29 |
// fixes WARNING Critical dependency: the request of a dependency is an expression |
|
30 |
/(.+)?angular(\\|\/)core(.+)?/, |
|
31 |
path.join(__dirname, 'src'), // location of your src |
|
32 |
{} // a map of your routes |
|
33 |
), |
|
34 |
new webpack.ContextReplacementPlugin( |
|
35 |
// fixes WARNING Critical dependency: the request of a dependency is an expression |
|
36 |
/(.+)?express(\\|\/)(.+)?/, |
|
37 |
path.join(__dirname, 'src'), |
|
38 |
{} |
|
39 |
) |
|
40 |
] |
|
41 |
} |
|
42 |
|
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard'; |
|
7 |
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; |
|
8 |
|
|
9 |
@NgModule({ |
|
10 |
imports: [ |
|
11 |
RouterModule.forChild([ |
|
12 |
{ path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { |
|
13 |
redirect: '/error' |
|
14 |
}, canDeactivate: [PreviousRouteRecorder] } |
|
15 |
|
|
16 |
]) |
|
17 |
] |
|
18 |
}) |
|
19 |
export class AdvancedSearchDatasetsRoutingModule { } |
modules/uoa-services-portal/trunk/portal-4cli/package.json | ||
---|---|---|
1 |
{ |
|
2 |
"name": "openaire-search", |
|
3 |
"version": "1.0.0", |
|
4 |
"license": "Openaire", |
|
5 |
"contributors": [ |
|
6 |
"Argiro Kokogiannaki <argirok@di.uoa.gr>", |
|
7 |
"Konstantina Galouni <kgalouni@di.uoa.gr>" |
|
8 |
], |
|
9 |
"scripts": { |
|
10 |
"ng": "ng", |
|
11 |
"start": "ng serve --disable-host-check", |
|
12 |
"start:dynamic": "npm run build:dynamic && npm run serve:dynamic", |
|
13 |
"start:static": "npm run build:static && npm run serve:static", |
|
14 |
"build": "ng build", |
|
15 |
"build:client-and-server-bundles": "ng build --prod -sm --stats-json && ng build --prod --app 1 --output-hashing=false", |
|
16 |
"build:static": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:static", |
|
17 |
"build:dynamic": "npm run build:client-and-server-bundles && npm run webpack:server", |
|
18 |
"generate:static": "cd dist && node prerender", |
|
19 |
"webpack:server": "webpack --config webpack.server.config.js --progress --colors", |
|
20 |
"serve:static": "cd dist/browser && http-server", |
|
21 |
"serve:dynamic": "node dist/server" |
|
22 |
}, |
|
23 |
"private": true, |
|
24 |
"dependencies": { |
|
25 |
"@angular/animations": "^4.2.4", |
|
26 |
"@angular/common": "^4.2.4", |
|
27 |
"@angular/compiler": "^4.2.4", |
|
28 |
"@angular/core": "^4.2.4", |
|
29 |
"@angular/forms": "^4.2.4", |
|
30 |
"@angular/http": "^4.2.4", |
|
31 |
"@angular/platform-browser": "^4.2.4", |
|
32 |
"@angular/platform-browser-dynamic": "^4.2.4", |
|
33 |
"@angular/platform-server": "^4.2.4", |
|
34 |
"@angular/router": "^4.2.4", |
|
35 |
"@nguniversal/express-engine": "^1.0.0-beta.3", |
|
36 |
"@nguniversal/module-map-ngfactory-loader": "^1.0.0-beta.3", |
|
37 |
"angular2-datatable": "^0.6.0", |
|
38 |
"citation-js": "^0.3.4", |
|
39 |
"clipboard": "^1.5.16", |
|
40 |
"core-js": "^2.4.1", |
|
41 |
"rxjs": "^5.4.2", |
|
42 |
"ts-md5": "^1.2.0", |
|
43 |
"wikidata-sdk": "^5.2.9", |
|
44 |
"zone.js": "^0.8.14" |
|
45 |
}, |
|
46 |
"devDependencies": { |
|
47 |
"@angular/cli": "^1.3.0", |
|
48 |
"@angular/compiler-cli": "^4.2.4", |
|
49 |
"@angular/language-service": "^4.2.4", |
|
50 |
"@types/node": "^8.0.30", |
|
51 |
"cpy-cli": "^1.0.1", |
|
52 |
"http-server": "^0.10.0", |
|
53 |
"reflect-metadata": "^0.1.10", |
|
54 |
"ts-loader": "^2.3.7", |
|
55 |
"typescript": "~2.3.3" |
|
56 |
} |
|
57 |
} |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import{ AdvancedSearchDataProvidersRoutingModule} from './advancedSearchDataProviders-routing.module'; |
|
6 |
import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component'; |
|
7 |
|
|
8 |
|
|
9 |
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module'; |
|
10 |
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module'; |
|
11 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
12 |
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; |
|
13 |
|
|
14 |
@NgModule({ |
|
15 |
imports: [ |
|
16 |
CommonModule, FormsModule, |
|
17 |
DataProvidersServiceModule, |
|
18 |
AdvancedSearchDataProvidersRoutingModule, AdvancedSearchPageModule |
|
19 |
|
|
20 |
], |
|
21 |
declarations: [ |
|
22 |
AdvancedSearchDataProvidersComponent |
|
23 |
], |
|
24 |
providers:[FreeGuard, IsRouteEnabled], |
|
25 |
exports: [ |
|
26 |
AdvancedSearchDataProvidersComponent |
|
27 |
] |
|
28 |
}) |
|
29 |
export class AdvancedSearchDataProvidersModule { } |
modules/uoa-services-portal/trunk/portal-4cli/src/app/services/searchSoftware.service.ts | ||
---|---|---|
1 |
import {Injectable} from '@angular/core'; |
|
2 |
import {Http, Response} from '@angular/http'; |
|
3 |
import {Observable} from 'rxjs/Observable'; |
|
4 |
import {OpenaireProperties} from '../utils/properties/openaireProperties'; |
|
5 |
import {SearchResult} from '../utils/entities/searchResult'; |
|
6 |
import {RefineResultsUtils} from './servicesUtils/refineResults.class'; |
|
7 |
import 'rxjs/add/observable/of'; |
|
8 |
import 'rxjs/add/operator/do'; |
|
9 |
import 'rxjs/add/operator/share'; |
|
10 |
import { } from '../shared/cache.service'; |
|
11 |
@Injectable() |
|
12 |
export class SearchSoftwareService { |
|
13 |
private sizeOfDescription: number = 270; |
|
14 |
|
|
15 |
constructor(private http: Http ) {} |
|
16 |
|
|
17 |
searchSoftware (params: string, refineParams:string, page: number, size: number, refineFields:string[] ):any { |
|
18 |
|
|
19 |
let link = OpenaireProperties.getSearchAPIURLLast()+"software"; |
|
20 |
|
|
21 |
let url = link+"?"; |
|
22 |
if(params!= null && params != '' ) { |
|
23 |
url += params; |
|
24 |
} |
|
25 |
if(refineParams!= null && refineParams != '' ) { |
|
26 |
url += refineParams; |
|
27 |
} |
|
28 |
url += "&page="+ (page-1) +"&size="+size+"&format=json"; |
|
29 |
|
|
30 |
|
|
31 |
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) |
|
32 |
.map(res => <any> res.json()) |
|
33 |
//.do(res => console.info(res)) |
|
34 |
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); |
|
35 |
} |
|
36 |
searchSoftwareById (id: string ):any { |
|
37 |
|
|
38 |
let url = OpenaireProperties.getSearchAPIURLLast()+"software/"+id+"?format=json"; |
|
39 |
|
|
40 |
|
|
41 |
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) |
|
42 |
.map(res => <any> res.json()) |
|
43 |
.map(res => this.parseResults(res)); |
|
44 |
} |
|
45 |
|
|
46 |
searchAggregators (id: string, params: string, refineParams:string, page: number, size: number ):any { |
|
47 |
|
|
48 |
let link = OpenaireProperties.getSearchAPIURLLast()+"software"; |
|
49 |
|
|
50 |
let url = link+"?"+"&format=json"; |
|
51 |
if(params!= null && params != '' ) { |
|
52 |
url += params; |
|
53 |
} |
|
54 |
if(refineParams!= null && refineParams != '' ) { |
|
55 |
url += refineParams; |
|
56 |
} |
|
57 |
url += "&page="+(page-1)+"&size="+size; |
|
58 |
|
|
59 |
|
|
60 |
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) |
|
61 |
.map(res => <any> res.json()) |
|
62 |
.map(res => this.parseRefineResults(id, res['refineResults'])) |
|
63 |
} |
|
64 |
|
|
65 |
searchSoftwareByDois (DOIs: string[], refineParams:string, page: number, size: number, refineFields:string[] ):any { |
|
66 |
let link = OpenaireProperties.getSearchAPIURLLast()+"software"; |
|
67 |
let url = link+"?"; |
|
68 |
var doisParams = ""; |
|
69 |
|
|
70 |
for(var i =0 ;i < DOIs.length; i++){ |
|
71 |
doisParams+=(doisParams.length > 0?"&":"")+'doi="'+ DOIs[i]+'"'; |
|
72 |
} |
|
73 |
if(doisParams.length > 0){ |
|
74 |
url += "&"+doisParams; |
|
75 |
|
|
76 |
} |
|
77 |
if(refineParams!= null && refineParams != '' ) { |
|
78 |
url += refineParams; |
|
79 |
} |
|
80 |
url += "&page="+ (page-1) +"&size="+size+"&format=json"; |
|
81 |
|
|
82 |
|
|
83 |
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) |
|
84 |
.map(res => <any> res.json()) |
|
85 |
//.do(res => console.info(res)) |
|
86 |
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "software")]); |
|
87 |
} |
|
88 |
advancedSearchSoftware (params: string, page: number, size: number ):any { |
|
89 |
let url = OpenaireProperties.getSearchResourcesAPIURL(); |
|
90 |
var basicQuery = "(oaftype exact result) and (resulttypeid exact software) " |
|
91 |
url += "?query="; |
|
92 |
if(params!= null && params != '' ) { |
|
93 |
url +=" ( "+basicQuery+ " ) " +" and (" + params + ")"; |
|
94 |
}else{ |
|
95 |
url +=" ( "+basicQuery+ " ) "; |
|
96 |
} |
|
97 |
|
|
98 |
url += "&page="+(page-1)+"&size="+size; |
|
99 |
url += "&format=json"; |
|
100 |
|
|
101 |
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) |
|
102 |
.map(res => <any> res.json()) |
|
103 |
//.do(res => console.info(res)) |
|
104 |
.map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
105 |
} |
|
106 |
searchSoftwareForEntity (params: string, page: number, size: number):any { |
|
107 |
let link = OpenaireProperties.getSearchAPIURLLast(); |
|
108 |
let url = link+params+"/software"+"?format=json"; |
|
109 |
|
|
110 |
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) |
|
111 |
.map(res => <any> res.json()) |
|
112 |
.map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
113 |
} |
|
114 |
|
|
115 |
searchSoftwareForDataproviders(params: string, page: number, size: number):any { |
|
116 |
let link = OpenaireProperties.getSearchAPIURLLast(); |
|
117 |
let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json"; |
|
118 |
|
|
119 |
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) |
|
120 |
.map(res => <any> res.json()) |
|
121 |
.map(res => [res['meta'].total, this.parseResults(res['results'])]); |
|
122 |
} |
|
123 |
|
|
124 |
parseResults(data: any): SearchResult[] { |
|
125 |
let results: SearchResult[] = []; |
|
126 |
|
|
127 |
let length = Array.isArray(data) ? data.length : 1; |
|
128 |
|
|
129 |
for(let i=0; i<length; i++) { |
|
130 |
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result']; |
|
131 |
|
|
132 |
var result: SearchResult = new SearchResult(); |
|
133 |
|
|
134 |
result['title'] = {"name": '', "accessMode": '', "sc39": ''}; |
|
135 |
|
|
136 |
if(Array.isArray(resData['title'])) { |
|
137 |
result['title'].name = resData['title'][0].content; |
|
138 |
} else { |
|
139 |
result['title'].name = resData['title'].content; |
|
140 |
} |
|
141 |
|
|
142 |
//result['title'].url = OpenaireProperties.getsearchLinkToSoftware(); |
|
143 |
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
|
144 |
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; |
|
145 |
if(resData['bestaccessright'].hasOwnProperty("classid")) { |
|
146 |
result['title'].accessMode = resData['bestaccessright'].classid; |
|
147 |
} |
|
148 |
|
|
149 |
if(resData['rels'].hasOwnProperty("rel")) { |
|
150 |
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1; |
|
151 |
|
|
152 |
for(let j=0; j<relLength; j++) { |
|
153 |
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel']; |
|
154 |
|
|
155 |
if(relation.hasOwnProperty("to")) { |
|
156 |
/*if(relation['to'].class == "hasAuthor") { |
|
157 |
if(result['authors'] == undefined) { |
|
158 |
result['authors'] = new Array<{"name": string, "id": string}>(); |
|
159 |
} |
|
160 |
|
|
161 |
result['authors'].push({"name": relation.fullname, "id": relation['to'].content}); |
|
162 |
} else */if(relation['to'].class == "isProducedBy") { |
|
163 |
result['projects'] = this.parseProjects(result['projects'], relation); |
|
164 |
} |
|
165 |
} |
|
166 |
} |
|
167 |
} |
|
168 |
|
|
169 |
if(resData.hasOwnProperty("creator") && resData['creator'] != null) { |
|
170 |
if(result['authors'] == undefined) { |
|
171 |
result['authors'] = new Array<string>(); |
|
172 |
} |
|
173 |
|
|
174 |
let authors = resData['creator']; |
|
175 |
let length = Array.isArray(authors) ? authors.length : 1; |
|
176 |
|
|
177 |
for(let i=0; i<length; i++) { |
|
178 |
let author = Array.isArray(authors) ? authors[i] : authors; |
|
179 |
result.authors[author.rank-1] = author.content; |
|
180 |
} |
|
181 |
result.authors = result.authors.filter(function (item) { |
|
182 |
return (item != undefined); |
|
183 |
}); |
|
184 |
} |
|
185 |
|
|
186 |
var date:string = (resData.dateofacceptance)+""; // transform to string in case it is an integer |
|
187 |
result.year = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date; |
|
188 |
if(!Array.isArray(resData.description)) { |
|
189 |
result.description = resData.description; |
|
190 |
} else { |
|
191 |
result.description = resData.description[0]; |
|
192 |
} |
|
193 |
if(result.description.length > this.sizeOfDescription) { |
|
194 |
result.description = result.description.substring(0, this.sizeOfDescription)+"..."; |
|
195 |
} |
|
196 |
|
|
197 |
result.embargoEndDate = resData.embargoenddate; |
|
198 |
|
|
199 |
if(!Array.isArray(resData.publisher)) { |
|
200 |
result.publisher = resData.publisher; |
|
201 |
} else { |
|
202 |
for(let i=0; i<resData.publisher.length; i++) { |
|
203 |
if(result.publisher != undefined){ |
|
204 |
result.publisher += ', '+resData['publisher'][i]; |
|
205 |
} else { |
|
206 |
result.publisher = resData['publisher'][i]; |
|
207 |
} |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
results.push(result); |
|
212 |
} |
|
213 |
|
|
214 |
return results; |
|
215 |
} |
|
216 |
|
|
217 |
parseProjects(projects: { "id": string, "acronym": string, "title": string, |
|
218 |
"funderShortname": string, "funderName": string, |
|
219 |
"code": string }[], relation: any ) : { |
|
220 |
"id": string, "acronym": string, "title": string, |
|
221 |
"funderShortname": string, "funderName": string, |
|
222 |
"code": string }[] { |
|
223 |
if(projects == undefined) { |
|
224 |
projects = new Array< |
|
225 |
{ "id": string, "acronym": string, "title": string, |
|
226 |
"funderShortname": string, "funderName": string, |
|
227 |
"code": string |
|
228 |
}>(); |
|
229 |
} |
|
230 |
|
|
231 |
let countProjects = projects.length; |
|
232 |
|
|
233 |
projects[countProjects] = { |
|
234 |
"id": "", "acronym": "", "title": "", |
|
235 |
"funderShortname": "", "funderName": "", |
|
236 |
"code": "" |
|
237 |
} |
|
238 |
|
|
239 |
if(relation.title != 'unidentified') { |
|
240 |
projects[countProjects]['id'] = |
|
241 |
/*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; |
|
242 |
projects[countProjects]['acronym'] = relation.acronym; |
|
243 |
projects[countProjects]['title'] = relation.title; |
|
244 |
projects[countProjects]['code'] = relation.code; |
|
245 |
} else { |
|
246 |
projects[countProjects]['id'] = ""; |
|
247 |
projects[countProjects]['acronym'] = ""; |
|
248 |
projects[countProjects]['title'] = ""; |
|
249 |
projects[countProjects]['code'] = ""; |
|
250 |
} |
|
251 |
|
|
252 |
if(relation.hasOwnProperty("funding")) { |
|
253 |
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; |
|
254 |
|
|
255 |
for(let z=0; z<fundingLength; z++) { |
|
256 |
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding']; |
|
257 |
|
|
258 |
if(fundingData.hasOwnProperty("funder")) { |
|
259 |
projects[countProjects]['funderShortname'] = fundingData['funder'].shortname; |
|
260 |
projects[countProjects]['funderName'] = fundingData['funder'].name; |
|
261 |
} |
|
262 |
} |
|
263 |
} |
|
264 |
|
|
265 |
return projects; |
|
266 |
} |
|
267 |
|
|
268 |
parseRefineResults(id: string, data: any): any { |
|
269 |
var results:any = []; |
|
270 |
if(data.hasOwnProperty("resulthostingdatasource")) { |
|
271 |
let length = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'].length : 1; |
|
272 |
|
|
273 |
for(let i=0; i<length; i++) { |
|
274 |
let datasource = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'][i] : data['resulthostingdatasource']; |
|
275 |
|
|
276 |
let result: {"name": string, "id": string, "count": number} = {"name": "", "id": "", "count": 0}; |
|
277 |
result['name'] = datasource.name; |
|
278 |
result['id'] = datasource.id.split("||")[0]; |
|
279 |
//result['url'] = OpenaireProperties.getsearchLinkToDataProvider()+result['id']; |
|
280 |
result['count'] = datasource.count; |
|
281 |
|
|
282 |
if(result['id'] != id && result['name'] != "Unknown Repository") { |
|
283 |
results.push(result); |
|
284 |
} |
|
285 |
} |
|
286 |
} |
|
287 |
return results; |
|
288 |
} |
|
289 |
|
|
290 |
numOfSoftware(url: string):any { |
|
291 |
|
|
292 |
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url) |
|
293 |
.map(res => <any> res.json()) |
|
294 |
.map(res => res.total); |
|
295 |
} |
|
296 |
|
|
297 |
numOfEntitySoftware(id: string, entity: string):any { |
|
298 |
var parameters = ""; |
|
299 |
|
|
300 |
if(entity == "project") { |
|
301 |
parameters = "projects/"+id+"/software/count"; |
|
302 |
} |
|
303 |
|
|
304 |
let url = OpenaireProperties.getSearchAPIURLLast()+parameters+"?format=json"; |
|
305 |
return this.numOfSoftware(url); |
|
306 |
} |
|
307 |
|
|
308 |
numOfSearchSoftware(params: string):any { |
|
309 |
let url = OpenaireProperties.getSearchAPIURLLast()+"software/count?format=json"; |
|
310 |
if(params != "") { |
|
311 |
url += "&q=" + params; |
|
312 |
} |
|
313 |
return this.numOfSoftware(url); |
|
314 |
} |
|
315 |
} |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/advanced/advancedSearchPublications.component.ts | ||
---|---|---|
1 |
import {Component, Input, ViewChild} from '@angular/core'; |
|
2 |
import {Observable} from 'rxjs/Observable'; |
|
3 |
import { Router, ActivatedRoute} from '@angular/router'; |
|
4 |
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; |
|
5 |
import {SearchPublicationsService} from '../../services/searchPublications.service'; |
|
6 |
import {SearchResult} from '../../utils/entities/searchResult'; |
|
7 |
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; |
|
8 |
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; |
|
9 |
import {SearchFields} from '../../utils/properties/searchFields'; |
|
10 |
import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; |
|
11 |
|
|
12 |
|
|
13 |
@Component({ |
|
14 |
selector: 'advanced-search-publications', |
|
15 |
template: ` |
|
16 |
<advanced-search-page pageTitle="Advanced Search for Publications" entityType="publication" |
|
17 |
type="publications" |
|
18 |
[(results)] = "results" |
|
19 |
[(searchUtils)] = "searchUtils" |
|
20 |
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" |
|
21 |
(queryChange)="queryChanged($event)" |
|
22 |
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/publications" |
|
23 |
[disableForms]="disableForms" |
|
24 |
[loadPaging]="loadPaging" |
|
25 |
[oldTotalResults]="oldTotalResults"> |
|
26 |
</advanced-search-page> |
|
27 |
` |
|
28 |
}) |
|
29 |
|
|
30 |
export class AdvancedSearchPublicationsComponent { |
|
31 |
private errorCodes: ErrorCodes; |
|
32 |
|
|
33 |
public results =[]; |
|
34 |
public filters =[]; |
|
35 |
|
|
36 |
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
37 |
public searchFields:SearchFields = new SearchFields(); |
|
38 |
|
|
39 |
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS; |
|
40 |
public fieldIdsMap= this.searchFields.RESULT_FIELDS; |
|
41 |
public selectedFields:AdvancedField[] = []; |
|
42 |
public resourcesQuery = "((oaftype exact result) and (resulttypeid exact publication))"; |
|
43 |
public csvParams: string; |
|
44 |
public disableForms: boolean = false; |
|
45 |
public loadPaging: boolean = true; |
|
46 |
public oldTotalResults: number = 0; |
|
47 |
|
|
48 |
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; |
|
49 |
|
|
50 |
|
|
51 |
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) { |
|
52 |
|
|
53 |
this.results =[]; |
|
54 |
this.errorCodes = new ErrorCodes(); |
|
55 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
56 |
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedPublications; |
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
} |
|
61 |
ngOnInit() { |
|
62 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
63 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
64 |
this.sub = this.route.queryParams.subscribe(params => { |
|
65 |
if(params['page'] && this.searchUtils.page != params['page']) { |
|
66 |
this.loadPaging = false; |
|
67 |
this.oldTotalResults = this.searchUtils.totalResults; |
|
68 |
} |
|
69 |
|
|
70 |
let page = (params['page']=== undefined)?1:+params['page']; |
|
71 |
this.searchUtils.page = ( page <= 0 ) ? 1 : page; |
|
72 |
this.searchPage.fieldIds = this.fieldIds; |
|
73 |
this.selectedFields =[]; |
|
74 |
this.searchPage.selectedFields = this.selectedFields; |
|
75 |
this.searchPage.fieldIdsMap = this.fieldIdsMap; |
|
76 |
|
|
77 |
this.searchPage.getSelectedFiltersFromUrl(params); |
|
78 |
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); |
|
79 |
}); |
|
80 |
} |
|
81 |
ngOnDestroy() { |
|
82 |
this.sub.unsubscribe(); |
|
83 |
} |
|
84 |
sub: any; |
|
85 |
public getResults(parameters:string, page: number, size: number){ |
|
86 |
if(parameters!= null && parameters != '' ) { |
|
87 |
this.csvParams ="&type=publications&query=("+this.resourcesQuery +" and (" + parameters + "))"; |
|
88 |
}else{ |
|
89 |
this.csvParams ="&type=publications&query="+this.resourcesQuery; |
|
90 |
} |
|
91 |
|
|
92 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
93 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
94 |
//this.searchPage.openLoading(); |
|
95 |
this.disableForms = true; |
|
96 |
this.results = []; |
|
97 |
this.searchUtils.totalResults = 0; |
|
98 |
|
|
99 |
console.info("Advanced Search for Publications: Execute search query "+parameters); |
|
100 |
this._searchPublicationsService.advancedSearchPublications(parameters, page, size).subscribe( |
|
101 |
data => { |
|
102 |
this.searchUtils.totalResults = data[0]; |
|
103 |
console.info("searchPubl total="+this.searchUtils.totalResults); |
|
104 |
this.results = data[1]; |
|
105 |
this.searchPage.updateBaseUrlWithParameters(); |
|
106 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
107 |
this.searchUtils.status = this.errorCodes.DONE; |
|
108 |
if(this.searchUtils.totalResults == 0 ){ |
|
109 |
this.searchUtils.status = this.errorCodes.NONE; |
|
110 |
} |
|
111 |
//this.searchPage.closeLoading(); |
|
112 |
this.disableForms = false; |
|
113 |
|
|
114 |
if(this.searchUtils.status == this.errorCodes.DONE) { |
|
115 |
// Page out of limit!!! |
|
116 |
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); |
|
117 |
if(!(Number.isInteger(totalPages))) { |
|
118 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
119 |
} |
|
120 |
if(totalPages < page) { |
|
121 |
this.searchUtils.totalResults = 0; |
|
122 |
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; |
|
123 |
} |
|
124 |
} |
|
125 |
}, |
|
126 |
err => { |
|
127 |
console.log(err); |
|
128 |
console.info("error"); |
|
129 |
//TODO check erros (service not available, bad request) |
|
130 |
// if( ){ |
|
131 |
// this.searchUtils.status = ErrorCodes.ERROR; |
|
132 |
// } |
|
133 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
134 |
//this.searchUtils.status = errorCodes.NOT_AVAILABLE; |
|
135 |
if(err.status == '404') { |
|
136 |
this.searchUtils.status = this.errorCodes.NOT_FOUND; |
|
137 |
} else if(err.status == '500') { |
|
138 |
this.searchUtils.status = this.errorCodes.ERROR; |
|
139 |
} else { |
|
140 |
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; |
|
141 |
} |
|
142 |
|
|
143 |
//this.searchPage.closeLoading(); |
|
144 |
this.disableForms = false; |
|
145 |
|
|
146 |
} |
|
147 |
); |
|
148 |
} |
|
149 |
|
|
150 |
public queryChanged($event) { |
|
151 |
this.loadPaging = true; |
|
152 |
|
|
153 |
var parameters = $event.value; |
|
154 |
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size); |
|
155 |
console.info("queryChanged: Execute search query "+parameters); |
|
156 |
|
|
157 |
} |
|
158 |
|
|
159 |
|
|
160 |
} |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/find/mainSearch.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
import { RouterModule } from '@angular/router'; |
|
5 |
|
|
6 |
import{MainSearchRoutingModule} from './mainSearch-routing.module'; |
|
7 |
import{SearchComponent} from './search.component'; |
|
8 |
|
|
9 |
import {SearchResultsModule } from '../searchUtils/searchResults.module'; |
|
10 |
|
|
11 |
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module'; |
|
12 |
import {DatasetsServiceModule} from '../../services/datasetsService.module'; |
|
13 |
import {SoftwareServiceModule} from '../../services/softwareService.module'; |
|
14 |
import {ProjectsServiceModule} from '../../services/projectsService.module'; |
|
15 |
import {PublicationsServiceModule} from '../../services/publicationsService.module'; |
|
16 |
import {OrganizationsServiceModule} from '../../services/organizationsService.module'; |
|
17 |
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module'; |
|
18 |
import {SearchFormModule} from '../searchUtils/searchForm.module'; |
|
19 |
//import {SearchFilterModalModule} from '../searchUtils/searchFilterModal.module'; |
|
20 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
21 |
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module'; |
|
22 |
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard'; |
|
23 |
|
|
24 |
@NgModule({ |
|
25 |
imports: [ |
|
26 |
CommonModule, FormsModule, RouterModule, |
|
27 |
DataProvidersServiceModule, DatasetsServiceModule, SoftwareServiceModule, ProjectsServiceModule, |
|
28 |
PublicationsServiceModule, OrganizationsServiceModule, |
|
29 |
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, MainSearchRoutingModule, PiwikServiceModule |
|
30 |
|
|
31 |
], |
|
32 |
declarations: [ |
|
33 |
SearchComponent |
|
34 |
], |
|
35 |
providers:[FreeGuard, PreviousRouteRecorder |
|
36 |
], |
|
37 |
exports: [ |
|
38 |
SearchComponent |
|
39 |
] |
|
40 |
}) |
|
41 |
export class MainSearchModule { } |
modules/uoa-services-portal/trunk/portal-4cli/.angular-cli.json | ||
---|---|---|
1 |
{ |
|
2 |
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", |
|
3 |
"project": { |
|
4 |
"name": "ng-universal-demo" |
|
5 |
}, |
|
6 |
"apps": [ |
|
7 |
{ |
|
8 |
"root": "src", |
|
9 |
"outDir": "dist/browser", |
|
10 |
"assets": [ |
|
11 |
"assets", |
|
12 |
"favicon.ico" |
|
13 |
], |
|
14 |
"index": "index.html", |
|
15 |
"main": "main.ts", |
|
16 |
"polyfills": "polyfills.ts", |
|
17 |
"test": "test.ts", |
|
18 |
"tsconfig": "tsconfig.app.json", |
|
19 |
"testTsconfig": "tsconfig.spec.json", |
|
20 |
"prefix": "app", |
|
21 |
"styles": [ |
|
22 |
"styles.css" |
|
23 |
], |
|
24 |
"scripts": [], |
|
25 |
"environmentSource": "environments/environment.ts", |
|
26 |
"environments": { |
|
27 |
"dev": "environments/environment.ts", |
|
28 |
"prod": "environments/environment.prod.ts" |
|
29 |
} |
|
30 |
}, |
|
31 |
{ |
|
32 |
"platform": "server", |
|
33 |
"root": "src", |
|
34 |
"outDir": "dist/server", |
|
35 |
"assets": [ |
|
36 |
"assets", |
|
37 |
"favicon.ico" |
|
38 |
], |
|
39 |
"index": "index.html", |
|
40 |
"main": "main.server.ts", |
|
41 |
"test": "test.ts", |
|
42 |
"tsconfig": "tsconfig.server.json", |
|
43 |
"testTsconfig": "tsconfig.spec.json", |
|
44 |
"prefix": "app", |
|
45 |
"styles": [ |
|
46 |
"styles.css" |
|
47 |
], |
|
48 |
"scripts": [], |
|
49 |
"environmentSource": "environments/environment.ts", |
|
50 |
"environments": { |
|
51 |
"dev": "environments/environment.ts", |
|
52 |
"prod": "environments/environment.prod.ts" |
|
53 |
} |
|
54 |
} |
|
55 |
], |
|
56 |
"e2e": { |
|
57 |
"protractor": { |
|
58 |
"config": "./protractor.conf.js" |
|
59 |
} |
|
60 |
}, |
|
61 |
"lint": [ |
|
62 |
{ |
|
63 |
"project": "src/tsconfig.app.json", |
|
64 |
"exclude": "**/node_modules/**" |
|
65 |
}, |
|
66 |
{ |
|
67 |
"project": "src/tsconfig.spec.json", |
|
68 |
"exclude": "**/node_modules/**" |
|
69 |
}, |
|
70 |
{ |
|
71 |
"project": "e2e/tsconfig.e2e.json", |
|
72 |
"exclude": "**/node_modules/**" |
|
73 |
} |
|
74 |
], |
|
75 |
"test": { |
|
76 |
"karma": { |
|
77 |
"config": "./karma.conf.js" |
|
78 |
} |
|
79 |
}, |
|
80 |
"defaults": { |
|
81 |
"styleExt": "css", |
|
82 |
"component": { |
|
83 |
"spec": false, |
|
84 |
"inlineStyle": true, |
|
85 |
"inlineTemplate": true |
|
86 |
}, |
|
87 |
"directive": { |
|
88 |
"spec": false |
|
89 |
}, |
|
90 |
"class": { |
|
91 |
"spec": false |
|
92 |
}, |
|
93 |
"guard": { |
|
94 |
"spec": false |
|
95 |
}, |
|
96 |
"module": { |
|
97 |
"spec": false |
|
98 |
}, |
|
99 |
"pipe": { |
|
100 |
"spec": false |
|
101 |
}, |
|
102 |
"service": { |
|
103 |
"spec": false |
|
104 |
} |
|
105 |
} |
|
106 |
} |
modules/uoa-services-portal/trunk/portal-4cli/tsconfig.json | ||
---|---|---|
1 |
{ |
|
2 |
"compileOnSave": false, |
|
3 |
"compilerOptions": { |
|
4 |
"outDir": "./dist/out-tsc", |
|
5 |
"sourceMap": true, |
|
6 |
"declaration": false, |
|
7 |
"moduleResolution": "node", |
|
8 |
"emitDecoratorMetadata": true, |
|
9 |
"experimentalDecorators": true, |
|
10 |
"target": "es5", |
|
11 |
"typeRoots": [ |
|
12 |
"node_modules/@types" |
|
13 |
], |
|
14 |
"lib": [ |
|
15 |
"es2017", |
|
16 |
"dom" |
|
17 |
] |
|
18 |
} |
|
19 |
} |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/find/search.component.html | ||
---|---|---|
1 |
|
|
2 |
|
|
3 |
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" > |
|
4 |
<div uk-grid uk-grid> |
|
5 |
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first "> |
|
6 |
<div class=""> |
|
7 |
|
|
8 |
<div class="uk-width-1-1 "> |
|
9 |
<div class="uk-background-norepeat uk-background-cover uk-section uk-flex uk-flex-middle generalSearchForm"> |
|
10 |
<div class="uk-width-1-1"> |
|
11 |
<search-form [(keyword)]=keyword (keywordChange)="keywordChanged($event)" placeholderText="Search for research results, software, projects, content providers, organizations in OpenAIRE information space"></search-form> |
|
12 |
</div> |
|
13 |
</div> |
|
14 |
</div> |
|
15 |
<div class=" uk-margin-small-top uk-container"> |
|
16 |
<div class="uk-grid uk-margin-top"> |
|
17 |
<ul class=" uk-tab uk-tab-left uk-width-1-5 uk-visible@m" uk-tab="animation: uk-animation-fade"> |
|
18 |
<li *ngIf="showPublications" (click)="searchPublications()" [class]="activeTab == 'publications'?'uk-active':''"> |
|
19 |
<a> |
|
20 |
Publications |
|
21 |
<span [class]="(fetchPublications.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchPublications.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchPublications.searchUtils.totalResults :'')}}</span> |
|
22 |
|
|
23 |
</a> |
|
24 |
</li> |
|
25 |
<li *ngIf="showDatasets" (click)="searchDatasets()" [class]="activeTab == 'research data'?'uk-active':''"> |
|
26 |
<a> |
|
27 |
Research Data |
|
28 |
<span [class]="(fetchDatasets.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchDatasets.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchDatasets.searchUtils.totalResults :'')}}</span> |
|
29 |
|
|
30 |
</a> |
|
31 |
</li> |
|
32 |
<li *ngIf="showSoftware" (click)="searchSoftware()" [class]="activeTab == 'software'?'uk-active':''"> |
|
33 |
<a> |
|
34 |
Software |
|
35 |
<span [class]="(fetchSoftware.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchSoftware.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchSoftware.searchUtils.totalResults :'')}}</span> |
|
36 |
|
|
37 |
</a> |
|
38 |
</li> |
|
39 |
<li *ngIf="showProjects" (click)="searchProjects()" [class]="activeTab == 'projects'?'uk-active':''"> |
|
40 |
<a> |
|
41 |
Projects |
|
42 |
<span [class]="(fetchProjects.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchProjects.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchProjects.searchUtils.totalResults :'')}}</span> |
|
43 |
|
|
44 |
</a> |
|
45 |
</li> |
|
46 |
<li *ngIf="showDataProviders" (click)="searchDataProviders()" [class]="activeTab == 'content providers'?'uk-active':''"> |
|
47 |
<a> |
|
48 |
Content Providers |
|
49 |
<span [class]="(fetchDataproviders.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchDataproviders.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchDataproviders.searchUtils.totalResults :'')}}</span> |
|
50 |
|
|
51 |
</a> |
|
52 |
</li> |
|
53 |
<li *ngIf="showOrganizations" (click)="searchOrganizations()" [class]="activeTab == 'organizations'?'uk-active':''"> |
|
54 |
<a> |
|
55 |
Organizations |
|
56 |
<span [class]="(fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0)?'uk-badge uk-badge-notification':''"> {{((fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0)? fetchOrganizations.searchUtils.totalResults :'')}}</span> |
|
57 |
</a> |
|
58 |
</li> |
|
59 |
</ul> |
|
60 |
<div class="uk-hidden@m uk-clearfix uk-width-1-1 uk-margin-bottom"> |
|
61 |
<button class="uk-button uk-button-default uk-hidden@m " type="button"> |
|
62 |
<span uk-navbar-toggle-icon></span> <span class="uk-margin-small-left">{{activeTab}}</span> |
|
63 |
</button> |
|
64 |
|
|
65 |
<ul id="toggle-small-tabs" class="uk-subnav uk-subnav-pill uk-dropdown uk-hidden@m" uk-switcher="connect: #searchtabs; animation: uk-animation-fade" uk-dropdown="mode: click" uk-toggle="target: #toggle-small-tabs"> |
|
66 |
<li *ngIf="showPublications" (click)="searchPublications()" [class]="activeTab == 'publications'?'uk-active':''"> |
|
67 |
<a> |
|
68 |
Publications |
|
69 |
<span *ngIf = "fetchPublications.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span> |
|
70 |
<span *ngIf = "fetchPublications.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification">{{((keyword.length > 0)? fetchPublications.searchUtils.totalResults :'')}}</span> |
|
71 |
</a> |
|
72 |
</li> |
|
73 |
<li *ngIf="showDatasets" (click)="searchDatasets()" [class]="activeTab == 'research data'?'uk-active':''"> |
|
74 |
<a> |
|
75 |
Research Data |
|
76 |
<span *ngIf = "fetchDatasets.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span> |
|
77 |
<span *ngIf = "fetchDatasets.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchDatasets.searchUtils.totalResults :'')}}</span> |
|
78 |
</a> |
|
79 |
</li> |
|
80 |
<li *ngIf="showSoftware" (click)="searchSoftware()" [class]="activeTab == 'software'?'uk-active':''"> |
|
81 |
<a> |
|
82 |
Software |
|
83 |
<span *ngIf = "fetchSoftware.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span> |
|
84 |
<span *ngIf = "fetchSoftware.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchSoftware.searchUtils.totalResults :'')}}</span> |
|
85 |
</a> |
|
86 |
</li> |
|
87 |
<li *ngIf="showProjects" (click)="searchProjects()" [class]="activeTab == 'projects'?'uk-active':''"> |
|
88 |
<a> |
|
89 |
Projects |
|
90 |
<span *ngIf = "fetchProjects.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span> |
|
91 |
<span *ngIf = "fetchProjects.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchProjects.searchUtils.totalResults :'')}}</span> |
|
92 |
</a> |
|
93 |
</li> |
|
94 |
<li *ngIf="showDataProviders" (click)="searchDataProviders()" [class]="activeTab == 'content providers'?'uk-active':''"> |
|
95 |
<a> |
|
96 |
Content Providers |
|
97 |
<span *ngIf = "fetchDataproviders.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span> |
|
98 |
<span *ngIf = "fetchDataproviders.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchDataproviders.searchUtils.totalResults :'')}}</span> |
|
99 |
</a> |
|
100 |
</li> |
|
101 |
<li *ngIf="showOrganizations" (click)="searchOrganizations()" [class]="activeTab == 'organizations'?'uk-active':''"> |
|
102 |
<a> |
|
103 |
Organizations |
|
104 |
<span *ngIf = "fetchOrganizations.searchUtils.status == errorCodes.LOADING && keyword.length > 0" class="uk-icon-spinner uk-icon-spin"></span> |
|
105 |
<span *ngIf = "fetchOrganizations.searchUtils.status != errorCodes.LOADING && keyword.length > 0" class="uk-badge uk-badge-notification"> {{((keyword.length > 0)? fetchOrganizations.searchUtils.totalResults :'')}}</span> |
|
106 |
</a> |
|
107 |
</li> |
|
108 |
|
|
109 |
</ul> |
|
110 |
</div> |
|
111 |
|
|
112 |
<!--ul id="searchtabs" class="uk-switcher uk-width-1-1 uk-margin-top custom-tab-content-large"> |
|
113 |
<li--> |
|
114 |
<div class="uk-width-expand custom-tab-content-large"> |
|
115 |
<div *ngIf = "activeTab=='publications' && showPublications"> |
|
116 |
<div *ngIf = "keyword.length > 0 && activeTab=='publications'" class ="uk-animation-fade"> |
|
117 |
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults> 10"> |
|
118 |
<!--a [href] = "linkToSearchPublications"--> |
|
119 |
<a [queryParams]="routerHelper.createQueryParam('keyword', keyword)" |
|
120 |
routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications" class="uk-button uk-button-text"> |
|
121 |
View all {{fetchPublications.searchUtils.totalResults}} results |
|
122 |
</a> |
|
123 |
</div> |
|
124 |
<search-result [(results)]="fetchPublications.results" |
|
125 |
[(status)]= "fetchPublications.searchUtils.status" showLoading = true |
|
126 |
type="publication" urlParam="articleId"> |
|
127 |
</search-result> |
|
128 |
</div> |
|
129 |
<div *ngIf = "keyword.length == 0 && activeTab=='publications'" class ="uk-animation-fade" > |
|
130 |
<browse-entities entityName="publication" baseUrl="/search/find/publications" [refineFields]=searchFields.RESULT_REFINE_FIELDS></browse-entities> |
|
131 |
</div> |
|
132 |
<!--/li> |
|
133 |
<li--> |
|
134 |
</div> |
|
135 |
<div *ngIf = "activeTab=='research data' && showDatasets" > |
|
136 |
<div *ngIf = "keyword.length > 0 && activeTab=='research data'" class ="uk-animation-fade"> |
|
137 |
<div class = "uk-text-right" *ngIf = "fetchDatasets.searchUtils.totalResults> 10"> |
|
138 |
<!--a [href] = "linkToSearchDatasets"--> |
|
139 |
<a [queryParams]="routerHelper.createQueryParam('keyword', keyword)" |
|
140 |
routerLinkActive="router-link-active" [routerLink]="linkToSearchDatasets" class="uk-button uk-button-text"> |
|
141 |
View all {{fetchDatasets.searchUtils.totalResults}} results |
|
142 |
</a> |
|
143 |
</div> |
|
144 |
<search-result [(results)]="fetchDatasets.results" |
|
145 |
[(status)]= "fetchDatasets.searchUtils.status" showLoading = true |
|
146 |
type="dataset" urlParam="datasetId"> |
|
147 |
</search-result> |
|
148 |
</div> |
|
149 |
<div *ngIf = "keyword.length == 0 && activeTab=='research data'" class ="uk-animation-fade"> |
|
150 |
<browse-entities entityName="dataset" baseUrl="/search/find/datasets" [refineFields]=searchFields.RESULT_REFINE_FIELDS></browse-entities> |
|
151 |
</div> |
|
152 |
<!--/li> |
|
153 |
<li--> |
|
154 |
</div> |
|
155 |
<div *ngIf = "activeTab=='software' && showSoftware" > |
|
156 |
<div *ngIf = "keyword.length > 0 && activeTab=='software'" class ="uk-animation-fade"> |
|
157 |
<div class = "uk-text-right" *ngIf = "fetchSoftware.searchUtils.totalResults> 10"> |
|
158 |
<a [queryParams]="routerHelper.createQueryParam('keyword', keyword)" |
|
159 |
routerLinkActive="router-link-active" [routerLink]="linkToSearchSoftware" class="uk-button uk-button-text"> |
|
160 |
View all {{fetchSoftware.searchUtils.totalResults}} results |
|
161 |
</a> |
|
162 |
</div> |
|
163 |
<search-result [(results)]="fetchSoftware.results" |
|
164 |
[(status)]= "fetchSoftware.searchUtils.status" showLoading = true |
|
165 |
type="software" urlParam="softwareId"> |
|
166 |
</search-result> |
|
167 |
</div> |
|
168 |
<div *ngIf = "keyword.length == 0 && activeTab=='software'" class ="uk-animation-fade"> |
|
169 |
<browse-entities entityName="software" baseUrl="/search/find/software" [refineFields]=searchFields.RESULT_REFINE_FIELDS></browse-entities> |
|
170 |
</div> |
|
171 |
<!--/li> |
|
172 |
<li--> |
|
173 |
</div> |
|
174 |
<div *ngIf = "activeTab=='projects' && showProjects"> |
|
175 |
<div *ngIf = "keyword.length > 0 && activeTab=='projects'" class ="uk-animation-fade"> |
|
176 |
<div class = "uk-text-right" *ngIf = "fetchProjects.searchUtils.totalResults> 10"> |
|
177 |
<!--a [href] = "linkToSearchProjects"--> |
|
178 |
<a [queryParams]="routerHelper.createQueryParam('keyword', keyword)" |
|
179 |
routerLinkActive="router-link-active" [routerLink]="linkToSearchProjects" class="uk-button uk-button-text"> |
|
180 |
View all {{fetchProjects.searchUtils.totalResults}} results |
|
181 |
</a> |
|
182 |
</div> |
|
183 |
<search-result [(results)]="fetchProjects.results" |
|
184 |
[(status)]= "fetchProjects.searchUtils.status" showLoading = true |
|
185 |
type="project" urlParam="projectId"> |
|
186 |
</search-result> |
|
187 |
</div> |
|
188 |
<div *ngIf = "keyword.length == 0 && activeTab=='projects'" class ="uk-animation-fade"> |
|
189 |
<browse-entities entityName="project" baseUrl="/search/find/projects" [refineFields]=searchFields.PROJECT_REFINE_FIELDS></browse-entities> |
|
190 |
</div> |
|
191 |
<!--/li> |
|
192 |
<li--> |
|
193 |
</div> |
|
194 |
<div *ngIf = "activeTab=='content providers' && showDataProviders"> |
|
195 |
<div *ngIf = "keyword.length > 0 && activeTab=='content providers'" class ="uk-animation-fade"> |
|
196 |
<div class = "uk-text-right" *ngIf = "fetchDataproviders.searchUtils.totalResults> 10"> |
|
197 |
<!--a [href] = "linkToSearchDataproviders"--> |
|
198 |
<a [queryParams]="routerHelper.createQueryParam('keyword', keyword)" |
|
199 |
routerLinkActive="router-link-active" [routerLink]="linkToSearchDataproviders" class="uk-button uk-button-text"> |
|
200 |
View all {{fetchDataproviders.searchUtils.totalResults}} results |
|
201 |
</a> |
|
202 |
</div> |
|
203 |
<search-result [(results)]="fetchDataproviders.results" |
|
204 |
[(status)]= "fetchDataproviders.searchUtils.status" showLoading = true |
|
205 |
type="dataprovider" urlParam="datasourceId"> |
|
206 |
</search-result> |
|
207 |
</div> |
|
208 |
<div *ngIf = "keyword.length == 0 && activeTab=='content providers'" class ="uk-animation-fade" > |
|
209 |
<browse-entities entityName="dataprovider" baseUrl="/search/find/dataproviders" [refineFields]=searchFields.DATASOURCE_REFINE_FIELDS></browse-entities> |
|
210 |
</div> |
|
211 |
<!--/li> |
|
212 |
<li--> |
|
213 |
</div> |
|
214 |
<div *ngIf = "activeTab=='organizations' && showOrganizations"> |
|
215 |
<div *ngIf = "keyword.length > 0" class ="uk-animation-fade"> |
|
216 |
<div class = "uk-text-right" *ngIf = "fetchOrganizations.searchUtils.totalResults> 10"> |
|
217 |
<!--a [href] = "linkToSearchOrganizations"--> |
|
218 |
<a [queryParams]="routerHelper.createQueryParam('keyword', keyword)" |
|
219 |
routerLinkActive="router-link-active" [routerLink]="linkToSearchOrganizations" class="uk-button uk-button-text"> |
|
220 |
View all {{fetchOrganizations.searchUtils.totalResults}} results |
|
221 |
</a> |
|
222 |
</div> |
|
223 |
<search-result [(results)]="fetchOrganizations.results" |
|
224 |
[(status)]= "fetchOrganizations.searchUtils.status" showLoading = true |
|
225 |
type="organization" urlParam="organizationId"> |
|
226 |
</search-result> |
|
227 |
</div> |
|
228 |
<div *ngIf = "keyword.length == 0" class ="uk-animation-fade"> |
|
229 |
<browse-entities entityName="organization" baseUrl="/search/find/organizations" [refineFields]=searchFields.ORGANIZATION_REFINE_FIELDS></browse-entities> |
|
230 |
</div> |
|
231 |
|
|
232 |
</div> |
|
233 |
</div> |
|
234 |
</div> |
|
235 |
<!--/li> |
|
236 |
|
|
237 |
</ul--> |
|
238 |
</div> |
|
239 |
</div> |
|
240 |
</div> |
|
241 |
</div> |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard'; |
|
7 |
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; |
|
8 |
|
|
9 |
@NgModule({ |
|
10 |
imports: [ |
|
11 |
RouterModule.forChild([ |
|
12 |
{ path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard, IsRouteEnabled], data: { |
|
13 |
redirect: '/error' |
|
14 |
},canDeactivate: [PreviousRouteRecorder]} |
|
15 |
|
|
16 |
]) |
|
17 |
] |
|
18 |
}) |
|
19 |
export class AdvancedSearchOrganizationsRoutingModule { } |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.component'; |
|
5 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
6 |
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard'; |
|
7 |
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; |
|
8 |
|
|
9 |
@NgModule({ |
|
10 |
imports: [ |
|
11 |
RouterModule.forChild([ |
|
12 |
{ path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard, IsRouteEnabled], data: { |
|
13 |
redirect: '/error' |
|
14 |
}, canDeactivate: [PreviousRouteRecorder] } |
|
15 |
|
|
16 |
]) |
|
17 |
] |
|
18 |
}) |
|
19 |
export class AdvancedSearchPublicationsRoutingModule { } |
modules/uoa-services-portal/trunk/portal-4cli/src/app/test/test.component.ts | ||
---|---|---|
1 |
import {Component, ElementRef} from '@angular/core'; |
|
2 |
import { Subject } from 'rxjs/Subject'; |
|
3 |
import {Observable} from 'rxjs/Observable'; |
|
4 |
|
|
5 |
import {SearchFields} from '../utils/properties/searchFields'; |
|
6 |
|
|
7 |
@Component({ |
|
8 |
selector: 'test', |
|
9 |
template: ` |
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
` |
|
14 |
|
|
15 |
}) |
|
16 |
export class TestComponent { |
|
17 |
|
|
18 |
constructor() { |
|
19 |
|
|
20 |
} |
|
21 |
|
|
22 |
|
|
23 |
ngOnInit() { |
|
24 |
|
|
25 |
} |
|
26 |
|
|
27 |
|
|
28 |
test(){ |
|
29 |
var sf:SearchFields = new SearchFields(); |
|
30 |
console.info("~~~RESULT"); |
|
31 |
|
|
32 |
this.checktables(sf.RESULT_REFINE_FIELDS,sf.RESULT_FIELDS,sf.RESULT_FIELDS); |
|
33 |
this.checktables(sf.RESULT_ADVANCED_FIELDS,sf.RESULT_FIELDS,sf.RESULT_FIELDS); |
|
34 |
console.info("~~~PR"); |
|
35 |
|
|
36 |
this.checktables(sf.PROJECT_REFINE_FIELDS,sf.PROJECT_FIELDS,sf.PROJECT_FIELDS); |
|
37 |
this.checktables(sf.PROJECT_ADVANCED_FIELDS,sf.PROJECT_FIELDS,sf.PROJECT_FIELDS); |
|
38 |
console.info("~~~DATAPR"); |
|
39 |
|
|
40 |
this.checktables(sf.DATASOURCE_REFINE_FIELDS,sf.DATASOURCE_FIELDS,sf.DATASOURCE_FIELDS); |
|
41 |
this.checktables(sf.DATASOURCE_ADVANCED_FIELDS,sf.DATASOURCE_FIELDS,sf.DATASOURCE_FIELDS); |
|
42 |
|
|
43 |
console.info("~~~ORG"); |
|
44 |
this.checktables(sf.ORGANIZATION_REFINE_FIELDS,sf.ORGANIZATION_FIELDS,sf.ORGANIZATION_FIELDS); |
|
45 |
this.checktables(sf.ORGANIZATION_ADVANCED_FIELDS,sf.ORGANIZATION_FIELDS,sf.ORGANIZATION_FIELDS); |
|
46 |
console.info("~~~PERSON"); |
|
47 |
|
|
48 |
} |
|
49 |
checktables(fields,fieldsDetails,fieldsParam){ |
|
50 |
for(var i =0; i < fields.length; i++){ |
|
51 |
if(!fieldsDetails[fields[i]]){ |
|
52 |
console.info("!!!!"+fields[i]+ "field has to details"); |
|
53 |
} |
|
54 |
} |
|
55 |
|
|
56 |
} |
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
} |
modules/uoa-services-portal/trunk/portal-4cli/src/app/test/test.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
|
|
3 |
import { SharedModule } from '../shared/shared.module'; |
|
4 |
import { TestComponent } from './test.component'; |
|
5 |
import { TestRoutingModule } from './test-routing.module'; |
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
@NgModule({ |
|
10 |
imports: [ |
|
11 |
SharedModule, |
|
12 |
TestRoutingModule, |
|
13 |
|
|
14 |
], |
|
15 |
declarations: [ |
|
16 |
TestComponent |
|
17 |
] |
|
18 |
}) |
|
19 |
export class TestModule { } |
modules/uoa-services-portal/trunk/portal-4cli/src/app/test/test-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import { TestComponent } from './test.component'; |
|
5 |
|
|
6 |
@NgModule({ |
|
7 |
imports: [ |
|
8 |
RouterModule.forChild([ |
|
9 |
{ path: '', component: TestComponent}, |
|
10 |
|
|
11 |
]) |
|
12 |
] |
|
13 |
}) |
|
14 |
export class TestRoutingModule { } |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/advanced/advancedSearchSoftware.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import{ AdvancedSearchSoftwareRoutingModule} from './advancedSearchSoftware-routing.module'; |
|
6 |
import{AdvancedSearchSoftwareComponent} from './advancedSearchSoftware.component'; |
|
7 |
|
|
8 |
|
|
9 |
import {SoftwareServiceModule} from '../../services/softwareService.module'; |
|
10 |
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module'; |
|
11 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
12 |
|
|
13 |
@NgModule({ |
|
14 |
imports: [ |
|
15 |
CommonModule, FormsModule, |
|
16 |
SoftwareServiceModule, |
|
17 |
AdvancedSearchSoftwareRoutingModule, AdvancedSearchPageModule |
|
18 |
|
|
19 |
], |
|
20 |
declarations: [ |
|
21 |
AdvancedSearchSoftwareComponent |
|
22 |
], |
|
23 |
providers:[FreeGuard |
|
24 |
], |
|
25 |
exports: [ |
|
26 |
AdvancedSearchSoftwareComponent |
|
27 |
] |
|
28 |
}) |
|
29 |
export class AdvancedSearchSoftwareModule { } |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/advanced/advancedSearchProjects.module.ts | ||
---|---|---|
1 |
import { NgModule} from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { FormsModule } from '@angular/forms'; |
|
4 |
|
|
5 |
import{ AdvancedSearchProjectsRoutingModule} from './advancedSearchProjects-routing.module'; |
|
6 |
import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component'; |
|
7 |
|
|
8 |
|
|
9 |
import {ProjectsServiceModule} from '../../services/projectsService.module'; |
|
10 |
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module'; |
|
11 |
import {FreeGuard} from'../../login/freeGuard.guard'; |
|
12 |
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; |
|
13 |
|
|
14 |
@NgModule({ |
|
15 |
imports: [ |
|
16 |
CommonModule, FormsModule, |
|
17 |
ProjectsServiceModule, |
|
18 |
AdvancedSearchProjectsRoutingModule, AdvancedSearchPageModule |
|
19 |
|
|
20 |
], |
|
21 |
declarations: [ |
|
22 |
AdvancedSearchProjectsComponent |
|
23 |
], |
|
24 |
providers:[FreeGuard, IsRouteEnabled], |
|
25 |
exports: [ |
|
26 |
AdvancedSearchProjectsComponent |
|
27 |
] |
|
28 |
}) |
|
29 |
export class AdvancedSearchProjectsModule { } |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/searchUtils/advancedSearchForm.component.html | ||
---|---|---|
1 |
|
|
2 |
<form [class]="(isDisabled )?'uk-disabled advancedSearchForm uk-tile uk-tile-muted':'advancedSearchForm uk-tile uk-tile-muted'"> |
|
3 |
<table class=" uk-table uk-table-responsive" > |
|
4 |
<tr *ngFor="let selectedField of selectedFields; let i = index" class="-row "> |
|
5 |
<td *ngIf ="i==0 " class="">Search for:</td> |
|
6 |
|
|
7 |
<td *ngIf = "i != 0" class=""><select [(ngModel)]="selectedField.operatorId" name="selectOp_{{i}}" > |
|
8 |
<option *ngFor="let op of operators" (change)="fieldOperatorChanged(i, op.id, op.id)" (click)="fieldOperatorChanged(i, op.id, op.id)" [value]="op.id">{{op.id}}</option> |
|
9 |
</select></td> |
|
10 |
<td ><select [(ngModel)]="selectedField.id" name="selectField_{{i}}" (ngModelChange)="fieldIdsChanged(i,selectedField.id)" ><!--(click)="fieldIdsChanged(i)" --> |
|
11 |
<option *ngFor="let id of fieldIds" [value]="id" >{{fieldIdsMap[id].name}} </option> |
|
12 |
</select> </td> |
|
13 |
<td *ngIf = "selectedField.type == 'keyword'" ><input type="text" class="form-control" placeholder="Type keywords..." |
|
14 |
[(ngModel)]="selectedField.value" name="value[{{i}}]"></td> |
|
15 |
<td *ngIf = "selectedField.type == 'date'" > |
|
16 |
<date-filter [(dateValue)]=selectedField.dateValue ></date-filter> |
|
17 |
</td> |
|
18 |
<td *ngIf = " selectedField.id && selectedField.type == 'vocabulary'" > |
|
19 |
<static-autocomplete *ngIf = " selectedField.id" [(vocabularyId)] = selectedField.param [fieldId]=selectedField.id |
|
20 |
[(list)] = this.fieldList[selectedField.id] [entityName] = "entityType" [selectedValue]=selectedField.value [showSelected]=true |
|
21 |
[placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false |
|
22 |
(selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete> |
|
23 |
</td> |
|
24 |
<td *ngIf = " selectedField.id && selectedField.type == 'refine'" > |
|
25 |
<static-autocomplete [(list)] = this.fieldList[selectedField.id] [fieldId]=selectedField.id [entityName] = "entityType" [fieldName] = [selectedField.id] [selectedValue]=selectedField.value [showSelected]=true [placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)"></static-autocomplete></td> |
|
26 |
<td *ngIf = "selectedField.type == 'entity'" ><entities-autocomplete [fieldId]=selectedField.id [entityType]=selectedField.param [selectedValue]=selectedField.value [showSelected]=true |
|
27 |
[placeHolderMessage] = "'Search for '+selectedField.name" [title] = "selectedField.name" [multipleSelections]=false |
|
28 |
(selectedValueChanged)="valueChanged($event,i)" (listUpdated) = "listUpdated($event,selectedField.id)" > |
|
29 |
</entities-autocomplete></td> |
|
30 |
|
|
31 |
<td *ngIf = "selectedField.type == 'boolean'" class="input-group" > |
|
32 |
<span class="input-group-addon"> |
|
33 |
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param value="true">Yes<br> |
|
34 |
</span> |
|
35 |
<span class="input-group-addon"> |
|
36 |
<input type="radio" [(ngModel)]="selectedField.value" [name]=selectedField.param value="false">No<br> |
|
37 |
</span> |
|
38 |
</td> |
|
39 |
<td class=" " > |
|
40 |
<span *ngIf="selectedFields.length > 1" type="button" class="uk-icon-button" (click)="removeField(i)"> |
|
41 |
<span class=""><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="minus" ratio="1"><rect height="1" width="18" y="9" x="1"></rect></svg></span> |
|
42 |
</span> |
|
43 |
<span *ngIf="selectedFields.length == 1" type="button" class="uk-icon-button" disabled> |
|
44 |
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="minus" ratio="1"><rect height="1" width="18" y="9" x="1"></rect></svg></span> |
|
45 |
</span> |
|
46 |
</td> |
|
47 |
<td *ngIf="i == selectedFields.length-1 " class=" "><span type="button" class="uk-icon-button" (click)="addField()"> |
|
48 |
<span><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="plus" ratio="1"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span> |
|
49 |
</span></td> |
|
50 |
</tr> |
|
51 |
</table> |
|
52 |
<div class="-row uk-text-right"> |
|
53 |
<button (click)="queryChanged()" type="submit" class="uk-button uk-button-primary">Search</button> |
|
54 |
</div> |
|
55 |
|
|
56 |
</form> |
modules/uoa-services-portal/trunk/portal-4cli/src/app/searchPages/advanced/advancedSearchDataProviders.component.ts | ||
---|---|---|
1 |
import {Component, Input, ViewChild} from '@angular/core'; |
|
2 |
import {Observable} from 'rxjs/Observable'; |
|
3 |
import { Router, ActivatedRoute} from '@angular/router'; |
|
4 |
import {Filter, Value,AdvancedField} from '../searchUtils/searchHelperClasses.class'; |
|
5 |
import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; |
|
6 |
import {SearchResult} from '../../utils/entities/searchResult'; |
|
7 |
import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; |
|
8 |
import {AdvancedSearchPageComponent} from '../searchUtils/advancedSearchPage.component'; |
|
9 |
import {SearchFields} from '../../utils/properties/searchFields'; |
|
10 |
import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; |
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
@Component({ |
|
15 |
selector: 'advanced-search-dataprovider', |
|
16 |
template: ` |
|
17 |
<advanced-search-page pageTitle="Advanced Search for Content Providers" entityType="dataprovider" |
|
18 |
type = "content providers" |
|
19 |
[(results)] = "results" |
|
20 |
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields" |
|
21 |
[(searchUtils)] = "searchUtils" |
|
22 |
(queryChange)="queryChanged($event)" |
|
23 |
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/dataproviders" |
|
24 |
[disableForms]="disableForms" |
|
25 |
[loadPaging]="loadPaging" |
|
26 |
[oldTotalResults]="oldTotalResults"> |
|
27 |
</advanced-search-page> |
|
28 |
|
|
29 |
` |
|
30 |
}) |
|
31 |
|
|
32 |
export class AdvancedSearchDataProvidersComponent { |
|
33 |
private errorCodes: ErrorCodes; |
|
34 |
|
|
35 |
public results =[]; |
|
36 |
public filters =[]; |
|
37 |
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
38 |
public searchFields:SearchFields = new SearchFields(); |
|
39 |
|
|
40 |
public fieldIds: string[] = this.searchFields.DATASOURCE_ADVANCED_FIELDS; |
|
41 |
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS; |
|
42 |
public selectedFields:AdvancedField[] = []; |
|
43 |
|
|
44 |
@ViewChild (AdvancedSearchPageComponent) searchPage : AdvancedSearchPageComponent ; |
|
45 |
public resourcesQuery = "(oaftype exact datasource)"; |
|
46 |
public csvParams: string; |
|
47 |
public disableForms: boolean = false; |
|
48 |
public loadPaging: boolean = true; |
|
49 |
public oldTotalResults: number = 0; |
|
50 |
|
|
51 |
constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) { |
|
52 |
this.results =[]; |
|
53 |
this.errorCodes = new ErrorCodes(); |
|
54 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
55 |
this.searchUtils.baseUrl = OpenaireProperties.searchLinkToAdvancedDataProviders; |
|
56 |
console.info("Con -base url:"+this.searchUtils.baseUrl ); |
|
57 |
|
|
58 |
} |
|
59 |
ngOnInit() { |
|
60 |
this.sub = this.route.queryParams.subscribe(params => { |
|
61 |
if(params['page'] && this.searchUtils.page != params['page']) { |
|
62 |
this.loadPaging = false; |
|
63 |
this.oldTotalResults = this.searchUtils.totalResults; |
|
64 |
} |
|
65 |
|
|
66 |
let page = (params['page']=== undefined)?0:+params['page']; |
|
67 |
this.searchUtils.page = ( page < 1 ) ? 1 : page; |
|
68 |
this.searchPage.fieldIds = this.fieldIds; |
|
69 |
this.selectedFields =[]; |
|
70 |
this.searchPage.selectedFields = this.selectedFields; |
|
71 |
this.searchPage.fieldIdsMap = this.fieldIdsMap; |
|
72 |
this.searchPage.getSelectedFiltersFromUrl(params); |
|
73 |
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); |
|
74 |
}); |
|
75 |
} |
|
76 |
ngOnDestroy() { |
|
77 |
this.sub.unsubscribe(); |
|
78 |
} |
|
79 |
sub: any; |
|
80 |
public getResults(parameters:string, page: number, size: number){ |
|
81 |
if(parameters!= null && parameters != '' ) { |
|
82 |
this.csvParams ="&type=datasources&query=( "+this.resourcesQuery + "and (" + parameters + "))"; |
|
83 |
}else{ |
|
84 |
this.csvParams ="&type=datasources&query="+this.resourcesQuery; |
|
85 |
} |
|
86 |
|
|
87 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
88 |
this.searchUtils.status = this.errorCodes.LOADING; |
|
89 |
//this.searchPage.openLoading(); |
|
90 |
this.disableForms = true; |
|
91 |
this.results = []; |
|
92 |
this.searchUtils.totalResults = 0; |
|
93 |
|
|
94 |
console.info("Advanced Search for Content Providers: Execute search query "+parameters); |
|
95 |
this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size).subscribe( |
|
96 |
data => { |
|
97 |
this.searchUtils.totalResults = data[0]; |
|
98 |
console.info("Adv Search Content Providers total="+this.searchUtils.totalResults); |
|
99 |
this.results = data[1]; |
|
100 |
this.searchPage.updateBaseUrlWithParameters(); |
|
101 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
102 |
this.searchUtils.status = this.errorCodes.DONE; |
|
103 |
if(this.searchUtils.totalResults == 0 ){ |
|
104 |
this.searchUtils.status = this.errorCodes.NONE; |
|
105 |
} |
|
106 |
//this.searchPage.closeLoading(); |
|
107 |
this.disableForms = false; |
|
108 |
|
|
109 |
if(this.searchUtils.status == this.errorCodes.DONE) { |
|
110 |
// Page out of limit |
|
111 |
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size); |
|
112 |
if(!(Number.isInteger(totalPages))) { |
|
113 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
114 |
} |
|
115 |
if(totalPages < page) { |
|
116 |
this.searchUtils.totalResults = 0; |
|
117 |
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; |
|
118 |
} |
|
119 |
} |
|
120 |
}, |
|
121 |
err => { |
|
122 |
console.log(err); |
|
123 |
console.info("error"); |
|
124 |
//TODO check erros (service not available, bad request) |
|
125 |
// if( ){ |
|
126 |
// this.searchUtils.status = errorCodes.ERROR; |
|
127 |
// } |
|
128 |
//var errorCodes:ErrorCodes = new ErrorCodes(); |
|
129 |
//this.searchUtils.status = errorCodes.NOT_AVAILABLE; |
Also available in: Unified diff
Adding a first draft for angular4-cli universal