-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
624 lines (599 loc) · 27.2 KB
/
index.html
File metadata and controls
624 lines (599 loc) · 27.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Check My Name - Taxonomic Name Matching Service Explorer</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="js/jquery.collapse.js"></script>
<script src="js/indeterminateCheckbox.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/css/bootstrap.min.css">
<link rel='stylesheet' id='google-fonts-1-css' href='https://fonts.googleapis.com/css?family=Montserrat%3A100%2C100italic%2C200%2C200italic%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C600italic%2C700%2C700italic%2C800%2C800italic%2C900%2C900italic&display=swap&ver=6.3.5' media='all' />
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://cdn.jsdelivr.net/vue/latest/vue.js"></script>
<script src="data.js"></script>
<script src="js/ui_texts.js"></script>
</head>
<body>
<div id="el">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<img id="logo" src="img/TETTRIs_Logo.png" alt="Logo of the TETTRIs Project" /><a class="navbar-brand" href="#" v-on:click="reset()">Check My Name</a>
</div>
</div>
</nav>
<div class="content" style="margin-top: 50px;">
<div id="introduction" class="container">
<h2>Check My Name</h2>
<h4>Taxonomic Name Matching Service Explorer</h4>
<p>Using scientific names based on globally recognized rules of biological nomenclature enables precise and effective communication about the living world. One goal of the TETTRIs project is to integrate taxonomic resources to support cross-domain data linkage. A key requirement for this is the ability to connect names across different sources (particularly with taxonomic data aggregators), which relies on name-matching. This prototype tool helps biodiversity data curators identify name-matching services suited to their specific needs.</p>
</div>
<div id="filters" class="container">
<h3>Filters<span id="filter-reset" v-if="hasFilters" @click="reset">(<span id="filter-reset-inner">reset all filters</span>)</span></h3>
<div id="" class="filter-row filter-row-flex">
<div id="filter-geographic-scope" data-collapse class="filter col c1">
<h4>Geographic Scope</h4>
<div id="filter-geographic-scope-content" class="filter-content">
<ul class="tree" style="">
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.global" value="global" />
<label for="geo.global">Global</label>
<ul>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.europe" value="europe" />
<label for="geo.europe">Europe</label>
<ul>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.at" value="at" />
<label for="geo.at">Austria</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.be" value="be" />
<label for="geo.be">Belgium</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.bg" value="bg" />
<label for="geo.bg">Bulgaria</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.hr" value="hr" />
<label for="geo.hr">Croatia</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.cy" value="cy" />
<label for="geo.cy">Cyprus</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.cz" value="cz" />
<label for="geo.cz">Czech Republic</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.dk" value="dk" />
<label for="geo.dk">Denmark</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.ee" value="ee" />
<label for="geo.ee">Estonia</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.fi" value="fi" />
<label for="geo.fi">Finland</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.fr" value="fr" />
<label for="geo.fr">France</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.de" value="de" />
<label for="geo.de">Germany</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.gr" value="gr" />
<label for="geo.gr">Greece</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.hu" value="hu" />
<label for="geo.hu">Hungary</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.is" value="is" />
<label for="geo.is">Iceland</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.ie" value="ie" />
<label for="geo.ie">Ireland</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.it" value="it" />
<label for="geo.it">Italy</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.lv" value="lv" />
<label for="geo.lv">Latvia</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.lt" value="lt" />
<label for="geo.lt">Lithuania</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.lu" value="lu" />
<label for="geo.lu">Luxembourg</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.mt" value="mt" />
<label for="geo.mt">Malta</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.nl" value="nl" />
<label for="geo.nl">Netherlands</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.no" value="no" />
<label for="geo.no">Norway</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.pl" value="pl" />
<label for="geo.pl">Poland</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.pt" value="pt" />
<label for="geo.pt">Portugal</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.ro" value="ro" />
<label for="geo.ro">Romania</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.sk" value="sk" />
<label for="geo.sk">Slovakia</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.si" value="si" />
<label for="geo.si">Slovenia</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.es" value="es" />
<label for="geo.es">Spain</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.se" value="se" />
<label for="geo.se">Sweden</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.ch" value="ch" />
<label for="geo.ch">Switzerland</label>
</li>
<li>
<input v-model="filter_geographic" class="indeterminate-checkbox" type="checkbox" id="geo.gb" value="gb" />
<label for="geo.gb">United Kingdom</label>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="filter-taxonomic-scope" data-collapse class="filter col c2">
<h4>Taxonomic Scope</h4>
<div id="filter-taxonomic-scope-content" class="filter-content">
<ul class="tree" style="">
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.multiple" value="multiple" />
<label for="tax.multiple">Multiple or unknown</label>
<ul>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.animalia" value="animalia" />
<label for="tax.animalia">Animals</label>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.plantae" value="plantae" />
<label for="tax.plantae">Plants</label>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.algae" value="algae" />
<label for="tax.algae">Algae</label>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.fungi" value="fungi" />
<label for="tax.fungi">Fungi</label>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.cyanobacteria" value="cyanobacteria" />
<label for="tax.cyanobacteria">Bluegreen algae</label>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.bacteria" value="bacteria" />
<label for="tax.bacteria">Bacteria</label>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.virus" value="virus" />
<label for="tax.virus">Virus</label>
</li>
</ul>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.contains_fossils" value="contains_fossils" />
<label for="tax.contains_fossils">Include fossils</label>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.fossil_only" value="fossil_only" />
<label for="tax.fossil_only">Only fossils</label>
</li>
<li>
<input v-model="filter_taxonomic" class="indeterminate-checkbox" type="checkbox" id="tax.marine_only" value="marine_only" />
<label for="tax.marine_only">Only marine species</label>
</li>
</ul>
</div>
</div>
<div id="filter-data-size" data-collapse class="filter col c3">
<h4>Number of records</h4>
<div id="filter-data-size-content" class="filter-content">
Number of names to be check simulaneously:
<br />
<br />
In the User Interface (add items via copy & paste)
<ul class="tree" style="margin-left: 15px;">
<li>
<input v-model="filter_size_ui" class="" type="radio" id="size.ui.small" value="small" checked="checked" />
<label for="size.ui.small">less or equal 5000</label>
</li>
<li>
<input v-model="filter_size_ui" class="" type="radio" id="size.ui.large" value="large" />
<label for="size.ui.large">more than 5000</label>
</li>
</ul>
<br />
Via file upload
<ul class="tree" style="margin-left: 15px;">
<li>
<input v-model="filter_size_upload" class="" type="radio" id="size.upload.small" value="small" checked="checked" />
<label for="size.upload.small">less or equal 5000</label>
</li>
<li>
<input v-model="filter_size_upload" class="" type="radio" id="size.upload.large" value="large" />
<label for="size.upload.large">more than 5000</label>
</li>
</ul>
</div>
</div>
</div>
<div class="filter-row">
<div id="filter-purpose" data-collapse class="filter ">
<h4>Purpose</h4>
<div id="filter-purpose-content" class="filter-content">
I want to check ...
<ul>
<li>
<input type="checkbox" id="purpose.default" checked="checked" disabled="true">
<label for="purpose.default">Orthography of canonical name (name without author / year)</label>
</li>
<li>
<input v-model="filter_purpose" type="checkbox" id="purpose.full_name_checked" value="full_name_checked">
<label for="purpose.full_name_checked">Orthography of full name (also checking author abbreviations and year)</label>
</li>
<li>
<input v-model="filter_purpose" type="checkbox" id="purpose.acceptance" value="acceptance">
<label for="purpose.acceptance">Acceptance (if it is a taxon name, or a synonym of another name, or taxonomically unresolved)</label>
</li>
<li>
<input v-model="filter_purpose" type="checkbox" id="purpose.classification" value="classification">
<label for="purpose.classification">Classification (inclusion in higher taxa according to the dataset’s hierarchy)</label>
</li>
<ul>
</div>
</div>
</div>
<div class="filter-row">
<div id="filter-data-linkage" data-collapse class="filter">
<h4>Data Linkage</h4>
<div id="filter-data-linkage-content" class="filter-content">
Please select your requirements
<ul>
<li>
<input v-model="filter_linkage" type="radio" id="linkage.default" value="default">
<label for="linkage.default">I am not interested in identifiers and links for the name</label>
</li>
<li>
<input v-model="filter_linkage" type="radio" id="linkage.output_persistent_id" value="output_persistent_id">
<label for="linkage.output_persistent_id">I want a persistent identifier for the name in the dataset that corresponds to my local name</label>
</li>
<li>
<input v-model="filter_linkage" type="radio" id="linkage.output_persistent_resolvable_id" value="output_persistent_resolvable_id">
<label for="linkage.output_persistent_resolvable_id">I want a persistent resolvable identifier for the name in the dataset that corresponds to my local name</label>
</li>
<li>
<input v-model="filter_linkage" type="radio" id="linkage.name_id_resolved_2_taxon" value="name_id_resolved_2_taxon">
<label for="linkage.name_id_resolved_2_taxon">I want a persistent resolvable identifier for the taxon (accepted name) that corresponds to my local name</label>
</li>
<ul>
</div>
</div>
</div>
<div class="filter-row">
<div id="filter-technical-requirements" data-collapse class="filter">
<h4>Technical Requirements</h4>
<div id="filter-technical-requirements-content" class="filter-content">
I want to ...
<ul>
<li>
<input v-model="filter_requirements" type="checkbox" id="requirement.direct_matching_interface" value="direct_matching_interface">
<label for="requirement.direct_matching_interface">write or paste the names into a web interface (usually limited number)</label>
</li>
<li>
<input v-model="filter_requirements" type="checkbox" id="requirement.file_matching_interface" value="file_matching_interface">
<label for="requirement.file_matching_interface">upload a list or table and receive the result as table or tables</label>
</li>
<li>
<input v-model="filter_requirements" type="checkbox" id="requirement.open_refine_reconciliation_if" value="open_refine_reconciliation_if">
<label for="requirement.open_refine_reconciliation_if">use OpenRefine as the name matching tool</label>
</li>
<li>
<input v-model="filter_requirements" type="checkbox" id="requirement.download" value="download">
<label for="requirement.download">download the data, I’ll do the matching in my own database</label>
</li>
<li>
<input v-model="filter_requirements" type="checkbox" id="requirement.api" value="api">
<label for="requirement.api">program my name matching using the on-line API of the aggregator</label>
</li>
<li>
<input v-model="filter_requirements" type="checkbox" id="requirement.r_package" value="r_package">
<label for="requirement.r_package">use an R-package that can be downloaded</label>
</li>
<li>
<input v-model="filter_requirements" type="checkbox" id="requirement.local_installation" value="local_installation">
<label for="requirement.local_installation">install the name matching service on my server</label>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="results">
<h3>Suitable Matching Services and Datasets ({{ searchResult.length }})</h3>
<div id="results-content" class="">
<div id="results-area" class="container col-md-10 col-xs-10">
<table class="table table-striped">
<tbody>
<tr :id="`service-${item.id}`" v-for="item of searchResult" v-bind:class="{ selected: (item.id == selected_id) ? 'selected2' : '' }" v-on:click.stop.prevent="showDetails(item)" >
<td >
<b>{{ item.service_name }}</b>
<br />
{{ item.dataset_name }}
</td>
<td>
<span class="bubble bubble-taxon" style="" v-for="group in item.organism_groups" v-if="group != 'multiple'">{{ showLabel(group, 'organism_group') }}</span>
</td>
<td >
<span class="bubble bubble-feature" v-for="requirement in item.requirements">{{ showLabel(requirement, 'requirements') }}</span>
</td>
<td>
<span class="bubble bubble-purpose" >{{ showLabel('canonical_name_checked', 'purpose') }}</span>
<span class="bubble bubble-purpose" v-for="purpose in item.purpose">{{ showLabel(purpose, 'purpose') }}</span>
</td>
<td>
<span v-if="item.geographic_scope.includes('global')" :title="`${showLabel('global', 'countries', 'name')}`">{{ showLabel('global', 'countries', 'flag') }}</span>
<span v-else-if="item.geographic_scope.includes('europe')" :title="`${showLabel('europe', 'countries', 'name')}`">{{ showLabel('europe', 'countries', 'flag') }}</span>
<span v-else v-for="scope in item.geographic_scope" :title="`${showLabel(scope, 'countries', 'name')}`">{{ showLabel(scope, 'countries', 'flag') }}</span>
<!--<a :href="`#service-${item.id}`" v-on:click.stop.prevent="showDetails(item)">show Details >>></a>-->
</td>
</tr>
</tbody>
</table>
</div>
<div id="details-area" v-if="selected_record">
<div id="details-view" >
<a id="details-close" title="close details window" href="#" v-on:click.stop.prevent="closeDetails">✖</a>
<h4 alt="name of the service">{{ selected_record.service_name }}</h4>
<p>with <b>{{ selected_record.dataset_name }}</b> dataset</p>
<p v-if="selected_record.notes">{{ selected_record.notes }}</p>
<table class="table table-striped">
<tbody>
<tr v-if="selected_record.geographic_scope">
<td>Geographic Scope</td>
<td>
<span class="bubble bubble-geo" v-if="selected_record.geographic_scope.includes('global')" :title="`${showLabel('global', 'countries', 'name')}`">{{ showLabel('global', 'countries', 'flag') }} {{ showLabel('global', 'countries', 'name') }}</span>
<span class="bubble bubble-geo" v-else-if="selected_record.geographic_scope.includes('europe')" :title="`${showLabel('europe', 'countries', 'name')}`">{{ showLabel('europe', 'countries', 'flag') }} {{ showLabel('europe', 'countries', 'name') }}</span>
<span class="bubble bubble-geo" v-else v-for="scope in selected_record.geographic_scope" :title="`${showLabel(scope, 'countries', 'name')}`">{{ showLabel(scope, 'countries', 'flag') }} {{ showLabel(scope, 'countries', 'name') }}</span>
</td>
</tr>
<tr v-if="selected_record.organism_groups">
<td>Taxonomic Scope</td>
<td><span class="bubble bubble-taxon" style="" v-for="group in selected_record.organism_groups" v-if="group != 'multiple'">{{ showLabel(group, 'organism_group') }}</span></td>
</tr>
<tr v-if="selected_record.requirements">
<td>Features</td>
<td><span class="bubble bubble-feature" style="" v-for="feature in selected_record.requirements">{{ showLabel(feature, 'requirements') }}</span></td>
</tr>
<tr v-if="selected_record.homepage">
<td>Website of the Dataset</td>
<td><a v-if="selected_record.homepage.startsWith('http')" :href="`${selected_record.homepage}`" target="_blank">{{ selected_record.homepage }}</a><span v-else>{{ selected_record.homepage }}</span></td>
</tr>
<tr v-if="selected_record.api_documentation">
<td>API Documentation</td>
<td><a v-if="selected_record.api_documentation.startsWith('http')" :href="`${selected_record.api_documentation}`" target="_blank">{{ selected_record.api_documentation }}</a><span v-else>{{ selected_record.api_documentation }}</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footer"><i>Check My Name - Taxonomic Name Matching Service Explorer</i> was developed in the <a href="https://www.tettris.eu">TETTRIs Project</a>.<br/> <a href="https://www.bo.berlin/en/imprint">Imprint</a> - <a href="https://github.com/CETAF-EU/CheckMyName/issues">Report an Issue</a></div>
</div>
<script>
// the rows comes from external resources
var vm = new Vue({
el: '#el',
data: {
filter_geographic: [],
filter_taxonomic: [],
filter_size_ui: 'small', //not an array, as it is controlled radio buttons (= only one value)
filter_size_upload: 'small', //not an array, as it is controlled radio buttons (= only one value)
filter_purpose: [],
filter_linkage: 'default', //not an array, as it is controlled radio buttons (= only one value)
filter_requirements: [],
items : rows,
labels : ui_texts,
selected_record : null,
selected_id: -1
},
methods: {
init: function(){
selected_id = window.location.hash.substr(9);
if(selected_id.length){
//TODO: input sanitation
this.selected_id = selected_id;
//TODO: clean up: only works if id = position in array
this.selected_record = this.items[parseInt(selected_id)];
//document.getElementById('service-'+selected_id).scrollIntoView({behavior: 'smooth'});
}
},
showLabel: function(text, context, subcontext = ""){
if(text == ""){
return "";
}
if(context == "" || !Object.keys(this.labels).includes(context)){
return text.replaceAll("_"," ").split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
}
if(subcontext == ""){
if(!Object.keys(this.labels[context]).includes(text)){
return text.replaceAll("_"," ").split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
}else{
return this.labels[context][text];
}
}else{
if(!Object.keys(this.labels[context]).includes(text)){
return text.replaceAll("_"," ").split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
}else if(!Object.keys(this.labels[context][text]).includes(subcontext)){
return text.replaceAll("_"," ").split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
}else{
return this.labels[context][text][subcontext];
}
}
},
scroll:function(){
selected_id = window.location.hash.substr(9);
if(selected_id.length){
setTimeout(() => {
document.getElementById('service-'+selected_id).scrollIntoView({behavior: 'smooth'});
}, "300");
console.log("scroll: "+selected_id);
}
},
showDetails: function(item){
console.log("hello "+item.id);
window.history.pushState(null,null,'#service-'+item.id);
this.selected_record = item;
this.selected_id = item.id;
setTimeout(() => {
document.getElementById('service-'+this.selected_id).scrollIntoView({behavior: 'smooth'});
}, "100");
return true;
},
closeDetails: function(item){
window.history.pushState(null,null,'#');
this.selected_record = null;
this.selected_id = -1;
return true;
},
reset: function () {
this.filter_geographic = [];
this.filter_taxonomic = [];
this.filter_size_ui = 'small'; //not an array, as it is controlled radio buttons (= only one value)
this.filter_size_upload = 'small'; //not an array, as it is controlled radio buttons (= only one value)
this.filter_purpose = [];
this.filter_linkage = 'default'; //not an array, as it is controlled radio buttons (= only one value)
this.filter_requirements = [];
}
},
beforeMount() {
this.init()
},
mounted() {
this.scroll()
},
computed: {
searchResult: function () {
var filter_geographic = this.filter_geographic;
var filter_taxonomic = this.filter_taxonomic;
var filter_size_ui = this.filter_size_ui;
var filter_size_upload = this.filter_size_upload;
var filter_purpose = this.filter_purpose;
var filter_linkage = this.filter_linkage;
var filter_requirements = this.filter_requirements;
console.log(filter_size_ui);
return this.items.filter(function(item, index) {
output = true;
for (const organism_group of filter_taxonomic) {
if(item.organism_groups.indexOf(organism_group) == -1){
return false;
}
}
for (const geographic_scope of filter_geographic) {
if(item.geographic_scope.indexOf(geographic_scope) == -1){
return false;
}
}
for (const purpose of filter_purpose) {
if(item.purpose.indexOf(purpose) == -1){
return false;
}
}
if(filter_size_upload == "large"){
//only filter for large, small is the default case which will show all results
if(item.file_matching_restriction <= 5000){
return false;
}
}
if(filter_size_ui == "large"){
//only filter for large, small is the default case which will show all results
if(item.direct_matching_restriction <= 5000){
return false;
}
}
if(filter_linkage == "default"){
//do nothing
}else if(item.linkage.indexOf(filter_linkage) == -1){
return false;
}
for (const requirement of filter_requirements) {
if(requirement == "download"){
if(index==0)(console.log("special case: download: " + item.requirements.indexOf("download_full_from_website") +" - " +item.requirements.indexOf("download_dataset")))
//special case: download returns the dataset if either of the two flags is set
if(item.requirements.indexOf("download_full_from_website") == -1 && item.requirements.indexOf("download_dataset") == -1 ){
return false;
}
}else if(item.requirements.indexOf(requirement) == -1){
return false;
}
}
return output;
});
},
hasFilters: function () {
//if any of the filters has any value other than its default, the function returns true
result = (this.filter_geographic.length > 0 ||
this.filter_taxonomic.length > 0 ||
this.filter_size_ui != 'small' ||
this.filter_size_upload != 'small' ||
this.filter_purpose.length > 0 ||
this.filter_linkage != 'default' ||
this.filter_requirements.length > 0);
console.log("filter check:"+result);
return result;
}
}
}
);
</script>
<script>
//enable hierarchical checkboxes
IndeterminateCheckbox.init()
</script>
</body>
</html>