-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
769 lines (707 loc) · 22.8 KB
/
index.html
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
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
<!doctype html><html><head>
<meta charset=utf8>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>ITLAB ICRA</title>
<!--libs
-->
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<!--css general-->
<style>
body{
background:white;
text-rendering:optimizeLegibility;
font-family:sans-serif;
--blau-icra:#00b8ef;
overflow-y:scroll;
line-height:1.5;
}
div#app{
max-width:1200px;
margin:auto;
}
summary{
cursor:pointer;
}
summary:hover{
text-decoration:underline;
}
img{
display:block;
}
a{
color:var(--blau-icra);
text-decoration:none;
cursor:pointer;
}
a:hover{
text-decoration:underline;
}
hr.orange{
border:none;
border-bottom:1px solid orange;
width:80%;
}
.gris{
color:#5c6a72;
}
</style>
<!--css llista esquerra-->
<style>
.left_list_item{
cursor:pointer;
white-space:nowrap;
}
.left_list_item[current=true]{
color:var(--blau-icra);
}
.left_list_item:hover{
color:var(--blau-icra);
text-decoration:underline;
}
a[current_sort=true]{
text-decoration:underline;
font-weight:bold;
}
</style>
<!--css grid all apps-->
<style>
.grid_app_container{
/*
*/
display:grid;
grid-template-columns:repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
grid-gap:1px;
}
.grid_item_app{
box-sizing:border-box;
border:2px solid #ccc;
padding:0 20px;
display:grid;
background:white;
/*
--h:450px;
height:var(--h);
width:calc(var(--h)*0.618);
*/
}
.grid_item_app:hover{
border-color:var(--blau-icra);
cursor:pointer;
box-shadow:inset 0 0 10px var(--blau-icra);
}
</style>
<!--css app focus-->
<style>
div.carousel img{
width:100%;
border:1px solid #ccc;
}
div.carousel img:hover{
border-color:var(--blau-icra);
}
span.tag{
display:inline-block;
margin:1px 2px;
background:orange;
border-radius:5px;
padding:0 10px;
font-family:monospace;
box-shadow:1px 1px 2px;
}
</style>
</head><body>
<!--vue template-->
<div id=app style="display:flex;flex-wrap:nowrap;">
<!--left list-->
<div
style="
border-right:1px solid #ccc;
margin-right:8px;
padding-right:8px;
"
>
<div @click="clear_current_app()" style="cursor:pointer;margin-top:10px">
<img
src="img/icra-logo-en.843e73b3.png"
style="max-width:210px"
alt="ICRA logo"
>
</div>
<div style="margin-top:10px;">
<!--featured apps list-->
<details open>
<summary style="white-space:nowrap">
<b>FEATURED APPS & TOOLS ({{repos.length}})</b>
</summary>
<ul class=gris style="list-style:none;padding-left:10px;margin-top:10px">
<li
class="left_list_item"
v-for="repo in repos"
:current="current_app==repo"
@click="set_current_app(repo)"
v-html="repo.name"
></li>
</ul>
</details>
<!--all contributors-->
<details open>
<summary><b>CONTRIBUTORS ({{Object.keys(all_people).length}})</b></summary>
<div>
<div style="font-size:smaller">
Sort by
<b>/</b>
<span v-for="key in ['name','contributions']">
<a
@click="sort_people_by=key"
:current_sort="sort_people_by==key"
v-html="key"
></a>
<b>/</b>
</span>
</div>
<ul
style="
list-style:none;
padding-left:10px;
"
>
<li v-for="arr,name in all_people">
<div style="white-space:nowrap;">{{name}} ({{arr.length}})</div>
<ul style="padding-left:30px">
<li
v-for="repo in arr.map(per=>per.project)"
class="left_list_item gris"
style="font-size:smaller"
:current="current_app==repo"
@click="set_current_app(repo)"
v-html="repo.name"
></li>
</ul>
</li>
</ul>
</div>
</details>
<details open id=all_public_repos>
<summary>
<b>ALL PUBLIC REPOS ({{public_repos.length}})</b>
<span v-if="public_repos_loading"> [loading...]</span>
</summary>
<div>
<div style="font-size:smaller">
Sort by
<b>/</b>
<span v-for="key in ['name','updated','created','stars','forks']">
<a
@click="sort_public_repos_by(key)"
v-html="key"
:current_sort="key==public_repos_sort_by"
></a>
<b>/</b>
</span>
</div>
<ul>
<li v-for="repo in public_repos">
<div style="display:flex;">
<a :href="repo.html_url" target="_blank">{{repo.full_name}}</a>
<div v-if="repo.stargazers_count" style="font-size:smaller;display:flex;align-items:center;" title="stars">
<svg height="16" width="16">
<path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882
3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75
0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0
01-1.088-.79l.72-4.194L.818 6.374a.75.75 0
01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615
5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0
01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77
1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75
0 01-.564-.41L8 2.694v.001z"></path>
</svg>
<div>{{repo.stargazers_count}}</div>
</div>
<div v-if="repo.forks_count" style="font-size:smaller;display:flex;align-items:center;" title="forks">
<svg height="16" width="16">
<path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0
011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75
8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0
002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0
01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5
0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000
1.5z"></path>
</svg>
<div>{{repo.forks_count}}</div>
</div>
<div v-if="repo.open_issues_count" style="font-size:smaller;display:flex;align-items:center;" title="open issues">
<svg height="16" width="16">
<path d="M8 9.5a1.5 1.5 0 100-3 1.5 1.5 0 000
3z"></path><path fill-rule="evenodd" d="M8 0a8 8 0 100 16A8
8 0 008 0zM1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13
0z"></path>
</svg>
<div>{{repo.open_issues_count}}</div>
</div>
</div>
</li>
</ul>
</div>
</details>
<p class=gris>
<small>
<div>
This web is open source. See something that's wrong or unclear?
Submit a pull request.
</div>
<button onclick="window.open('https://github.com/icra/itlab/blob/main/apps.json')">
<svg viewBox="0 0 16 16" width="16" height="16"
style="display:inline-block;user-select:none;vertical-align:text-bottom;overflow:visible"><path
d="M1.5 3.25a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5
0V5.372A2.25 2.25 0 011.5 3.25zm5.677-.177L9.573.677A.25.25 0
0110 .854V2.5h1A2.5 2.5 0 0113.5 5v5.628a2.251 2.251 0 11-1.5
0V5a1 1 0 00-1-1h-1v1.646a.25.25 0 01-.427.177L7.177 3.427a.25.25
0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm0
9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm8.25.75a.75.75 0 101.5 0
.75.75 0 00-1.5 0z"></path></svg>
Make a contribution
</button>
</small>
</p>
<!--new project template-->
<details>
<summary>
<b>New project template</b>
</summary>
<code>
<pre v-html="new_project_template"></pre>
</code>
</details>
</div>
</div>
<!--right part-->
<div style="width:100%">
<nav
style="
display:flex;
flex-wrap:wrap;
justify-content:right;
"
>
<a href="http://icra.cat/index.php?lang=3">ICRA homepage</a>
<a style="padding-left:15px" href="https://github.com/icra">ICRA github</a>
<a style="padding-left:15px" href="all_public_repos.html">All public repos</a>
<a style="padding-left:15px" href="licenses.html">Licensing</a>
<a style="padding-left:15px" href="faqs.html">FAQs</a>
</nav>
<!--all apps grid-->
<div v-if="!current_app">
<h1>ITLAB</h1>
<p class=gris
style="
border-bottom:2px solid var(--blau-icra);
padding-bottom:10px;
margin-bottom:10px;
"
>
ICRA's ITLAB is a catalog of the main IT solutions developed in
research and/or innovation projects with ICRA participation.
It provides a description of each of project and gives credit to the
researchers and computer engineers involved.
It allows accessing the solutions and, in some cases, the source code.
The ITLAB has been promoted by Dr. Lluís Corominas and Prof. Joaquim
Comas and it is maintained by the team of computer engineers involved
in the development of the IT solutions (Lluís Bosch, Adrià Riu, Josep
Pueyo & Joan Saló).
</p>
<!--search box and filters-->
<div style="background:#5a6870;padding:1em;">
<input v-model="current_filter" placeholder="Search apps">
<button @click="current_filter=''" :disabled="current_filter==''">clear</button>
<details style="color:white;margin-top:10px">
<summary>Advanced filters</summary>
<ul>
<li v-for="obj,key in repo_filters" style="margin-bottom:5px">
<div><b>{{key[0].toUpperCase()+key.substring(1)}}</b></div>
<div
style="
display:grid;
grid-template-columns:repeat(4,25%);
"
>
<div v-for="val,keyy in obj">
<label style="display:flex;align-items:center">
<input type=checkbox v-model="obj[keyy]">
<span>{{keyy}}</span>
</label>
</div>
</div>
</li>
</ul>
<button @click="compute_repo_filters()">clear all</button>
</details>
</div>
<!--grid with apps-->
<div class="grid_app_container" style="margin-top:5px">
<div
v-for="repo in get_repos"
class="grid_item_app"
@click="set_current_app(repo)"
>
<h3 style="text-align:center" v-html="repo.name"></h3>
<div>
<img :src="repo.imageName"
alt="Image"
style="
width:100%;
max-width:150px;
margin:auto;
"
>
</div>
<p class=gris style="font-size:smaller;">
{{repo.shortDescription}}
</p>
</div>
</div>
</div>
<!--current app details-->
<div v-if="current_app">
<!--navigation buttons-->
<div style="display:flex;">
<button title="All tools" style="width:75px" @click="clear_current_app()">▲</button>
<button title="Previous tool" style="width:75px" @click="current_app=repos[current_app_index-1]" :disabled="current_app_index<=0">◀</button>
<button title="Next tool" style="width:75px" @click="current_app=repos[current_app_index+1]" :disabled="current_app_index>=repos.length-1">▶</button>
</div>
<!--logo and project name-->
<div style="
display:flex;
flex-wrap:no-wrap;
align-items:center;
background:#5a6870cc;
background:linear-gradient(to right,#5a6870,#5a6870cc);
color:white;
margin-top:3px;
">
<div style="max-width:38.2%">
<img
:src="current_app.imageName"
style="
max-width:100%;
height:100px;
box-sizing:border-box;
border:1px solid #ccc;
background:white;
padding:10px;
"
>
</div>
<div
style="
font-size:2em;
font-weight:bold;
padding:0 0.618em;
height:100px;
box-sizing:border-box;
display:flex;
align-items:center;
"
v-html="current_app.name"
></div>
</div>
<!--description-->
<div>
<p v-html="current_app.description"></p>
<hr class=orange>
</div>
<!--screenshots-->
<div v-if="current_app.otherImages && current_app.otherImages.length">
<div
class=carousel
style="
display:grid;
grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr));
grid-gap:10px;
"
>
<div v-for="src in current_app.otherImages">
<a :href="src" target="_blank">
<img :src="src">
</a>
</div>
</div>
<hr class=orange>
</div>
<!--project details, funding-->
<div v-if="current_app.project">
<h3>Project</h3>
<p v-html="current_app.project"></p>
<hr class=orange>
</div>
<!--publications-->
<div v-if="current_app.publications.length">
<h3>Publications</h3>
<ul>
<li v-for="pub in current_app.publications">
<div>{{pub.authors}}</div>
<div><a :href="pub.link" target="_blank">{{pub.title}}</a></div>
</li>
</ul>
<hr class=orange>
</div>
<!--credits-->
<div>
<h3>Credits</h3>
<div
style="
display:grid;
grid-template-columns:repeat(auto-fill,minmax(33.33%,1fr));
"
>
<ul v-for="per in current_app.credits">
<li>
<div><b>{{per.name}}</b></div>
<div v-if="per.position" style="font-size:smaller">{{per.position}}</div>
<div v-if="per.email" style="display:flex;align-items:center">
<svg width="1em" height="1em"><g><path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555zM0 4.697v7.104l5.803-3.558L0 4.697zM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757zm3.436-.586L16 11.801V4.697l-5.803 3.546z"></path></g></svg>
<a :href="`mailto:${per.email}`" target="_blank">{{per.email}}</a>
</div>
</li>
</ul>
</div>
<hr class=orange>
</div>
<!--links-->
<div v-if="current_app.toolLink || current_app.codeLink">
<h3>Links & Downloads</h3>
<div v-if="current_app.toolLink">
<div>You can use, download or find more information about this tool on the following link:</div>
<ul style="margin-top:5px"><li>
<a :href="current_app.toolLink" target="_blank">{{current_app.toolLink}}</a>
</li></ul>
</div>
<div v-if="current_app.codeLink">
<div>Source code available on:</div>
<ul style="margin-top:5px"><li>
<a :href="current_app.codeLink" target="_blank">{{current_app.codeLink}}</a>
</li></ul>
</div>
<hr class=orange>
</div>
<!--repo filters-->
<div v-if="current_app.filters" id=filters>
<h3>Tags</h3>
<ul>
<li v-for="arr,key in current_app.filters">
<b>{{key[0].toUpperCase()+key.substring(1)}}: </b>
<span v-for="el in arr" class=tag>{{el}}</span>
<code v-if="arr.length==0">∅</code>
</li>
</ul>
</div>
</div>
</div>
</div>
<!--vue instance-->
<script>
let app=Vue.createApp({
data(){return{
repos:[],//array
current_app:false,//bool
current_filter:"",//string
repo_filters:{},//dict
//section "left lists"
sort_people_by:"contributions",//string
//public repos
public_repos:[],//array
public_repos_loading:true,//bool
public_repos_sort_by:"stars",//string
//new project template
new_project_template:"",
}},
methods:{
async set_current_app(repo, no_history_entry){
no_history_entry = no_history_entry||false;
this.current_app=repo;
//history manipulation
if(no_history_entry==false){
const url=new URL(window.location);
url.searchParams.set("app",repo.name);
window.history.pushState({app_name:repo.name},"",url);
}
//fake scroll
await this.$nextTick();
window.scroll(0,0);
},
clear_current_app(){
this.current_app=false;
//history manipulation
const url=new URL(window.location);
url.searchParams.delete("app");
window.history.pushState({},"",url);
},
//load repo if GET param "app" is set in the url
set_current_app_onload(){
const url = new URL(window.location);
let app_name = url.searchParams.get("app");
if(!app_name) return;
let repo = this.repos.find(r=>r.name==app_name);
if(!repo) return;
this.set_current_app(repo,true);
},
sort_public_repos_by(prop){
this.public_repos_sort_by=prop;
let repos = this.public_repos;
switch(prop){
case "stars":
repos.sort((a,b)=>{
return b.stargazers_count-a.stargazers_count;
});break;
case "forks":
repos.sort((a,b)=>{
return b.forks_count-a.forks_count;
});break;
case "name":
repos.sort((a,b)=>{
return b.full_name.toUpperCase()<a.full_name.toUpperCase()?1:-1;
});break;
case "updated":
repos.sort((a,b)=>{
return b.updated_at<a.updated_at?-1:1;
});break;
case "created":
repos.sort((a,b)=>{
return b.created_at<a.created_at?-1:1;
});break;
}
},
//get all filter values (2 levels depth)
//needs to be done only once
compute_repo_filters(){
let dict={};
this.repos.forEach(repo=>{
Object.keys(repo.filters).forEach(key=>{
if(!dict[key]){
dict[key]={};
}
repo.filters[key].forEach(el=>{
dict[key][el]=false;
});
});
});
//sort alphabetically the values (2nd level of depth)
let dict_sorted={};
Object.keys(dict).forEach(key1=>{
dict_sorted[key1]={};
Object.keys(dict[key1]).sort().forEach(key2=>{
dict_sorted[key1][key2]=false;
});
});
this.repo_filters=dict_sorted;
},
},
computed:{
get_repos(){
let repos = [...this.repos];
let filter = this.current_filter;//string
if(filter){
filter = filter.toLowerCase();
repos = this.repos.filter(r=>r.name.toLowerCase().includes(filter));
}
Object.keys(this.repo_filters).forEach(key1=>{
Object.keys(this.repo_filters[key1]).forEach(key2=>{
if(!this.repo_filters[key1][key2]) return;
repos = repos.filter(r=>{
if(!r.filters) return false;
if(!r.filters[key1]) return false;
if(r.filters[key1].includes(key2)) return true;
return false
});
});
});
return repos;
},
current_app_index(){
if(!this.current_app) return -1;
return this.repos.indexOf(this.current_app);
},
all_people(){
let dict={};
this.repos.forEach(repo=>{
repo.credits.forEach(person=>{
if(!dict[person.name]){
dict[person.name]=[];
}
person.project=repo;
dict[person.name].push(person);
});
});
//sort dict keys
let retval={};
let keys=Object.keys(dict);
if(this.sort_people_by=="name"){
keys.sort();
}if(this.sort_people_by=="contributions"){
keys.sort((a,b)=>{
return dict[b].length-dict[a].length;
});
}
keys.forEach(key=>{
retval[key]=dict[key];
});
return retval;
},
},
}).mount("#app");
fetch("apps.json").then(r=>r.json()).then(arr=>{
app.repos=arr;
//sort repos A-Z
app.repos.sort((a,b)=>{
return a.name<b.name?-1:1;
});
app.set_current_app_onload();
app.compute_repo_filters();
});
fetch("new_project_template.json").then(r=>r.text()).then(txt=>{
app.new_project_template=txt;
});
/*history press back button*/
window.onpopstate=function(event){
if(!event){return}
if(!event.state){return}
if(!event.state.app_name){return}
let repo = app.repos.find(r=>r.name==event.state.app_name);
if(!repo) return;
//console.log(repo);
app.set_current_app(repo,true);
}
</script>
<script src="access_token.js"></script>
<script type=module>/*secció fetch api github*/
//funció que llegeix repositoris github
function fetch_repos(page){
page=page||1;
fetch(
`https://api.github.com/orgs/icra/repos?page=${page}`,
{headers},
)
.then(r=>r.json())
.then(arr=>{
if(arr.constructor!=Array){
console.error({arr});
app.public_repos_loading=false;
document.querySelector("#all_public_repos").style.display="none";
throw("Error resposta api github");
}
//end recursive call
if(arr.length==0){
//sort repos
app.sort_public_repos_by(app.public_repos_sort_by);
app.public_repos_loading=false;
return;
};
arr.forEach(repo=>{
app.public_repos.push(repo);
});
//next page
fetch_repos(++page);
});
}
fetch_repos();
</script>