-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
executable file
·771 lines (677 loc) · 29.5 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
770
771
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>ROS Index</title>
<meta name="description" content="a community-maintained index of robotics software
">
<link rel="canonical" href="https://index.ros.org/">
<link rel="icon" sizes="any" type="image/svg+xml" href="/assets/rosindex_logo.svg">
<link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="/css/main.css">
<script type="text/javascript" src=/js/jquery.js></script>
<script src=/bootstrap/js/bootstrap.min.js type="text/javascript"></script>
<script src=/js/jquery-cookie.js type="text/javascript"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-EVD5Z6G6NH"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-EVD5Z6G6NH');
</script>
<script type="text/javascript" src=/js/toc.js></script>
<script src=/js/distro_switch.js></script>
</head>
<body>
<header class="site-header">
<div class="wrapper">
<div class="container-fluid" style="margin-bottom: 10px">
<div class="row">
<!-- title -->
<div class="col-xs-3" style="white-space:nowrap">
<a class="site-title" href="/">
<img src="/assets/rosindex_logo.svg" width="26" height="26" alt="ROS index logo" style="padding-bottom: 3px"/>
ROS Index</a>
</div>
<!-- main internal links -->
<div class="col-xs-6 text-center" style="padding:0px">
<div class="btn-group hidden-xs" role="group" aria-label="..." style="padding: 6px">
<div class="btn-group" role="group">
<a href="/?search_packages=true" class="btn btn-default" role="button">Package List</a>
</div>
<div class="btn-group" role="group">
<a href="/?search_repos=true" class="btn btn-default" role="button">Repository List</a>
</div>
<div class="btn-group" role="group">
<a href="/search_deps" class="btn btn-default" role="button">System Dependencies</a>
</div>
</div>
<div class="hidden-lg hidden-md hidden-sm">
<button id="hLabel" class="btn btn-link dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Lists <span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="hLabel">
<li><a href="/?search_packages=true">Package List</a></li>
<li><a href="/?search_repos=true">Repository List</a></li>
<li><a href="/search_deps">System Dependencies</a></li>
</ul>
</div>
</div>
<!-- additional links -->
<div class="col-xs-3 text-right" style="white-space:nowrap; padding:0px">
<ul class="list-inline" style="margin-bottom:0px;">
<li class="dropdown hidden-xs hidden-sm">
<button id="rLabel" class="btn btn-link" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
ROS Resources <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="rLabel">
<li><a href="http://docs.ros.org/">Documentation</a></li>
<li><a href="http://wiki.ros.org/Support">Support</a></li>
<li><a href="http://discourse.ros.org/">Discussion Forum</a></li>
<li><a href="http://status.ros.org/">Service Status</a></li>
<li><a href="https://robotics.stackexchange.com/questions/tagged/ros">ros @ Robotics Stack Exchange</a></li>
<li><a href="https://docs.ros.org/en/ros2_packages/">Package API</a></li>
</ul>
</li>
<li class="dropdown hidden-xs hidden-sm">
<button id="aLabel" class="btn btn-link" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
About <span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="aLabel">
<li><a href="/about">About </a></li>
<li><a href="/contribute">Contribute</a></li>
<li><a href="/help">Help</a></li>
<li><a href="/stats">Stats</a></li>
</ul>
</li>
<li class="dropdown hidden-md hidden-lg">
<button id="qLabel" class="btn btn-link" type="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Resources <span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="qLabel">
<li><a href="/about">About </a></li>
<li><a href="/contribute">Contribute</a></li>
<li><a href="/help">Help</a></li>
<li><a href="/stats">Stats</a></li>
<hr style="margin:7px" />
<li><a href="http://docs.ros.org/">Documentation</a></li>
<li><a href="http://wiki.ros.org/Support">Support</a></li>
<li><a href="http://discourse.ros.org/">Discussion Forum</a></li>
<li><a href="http://status.ros.org/">Service Status</a></li>
<li><a href="https://robotics.stackexchange.com/questions/tagged/ros">ros @ Robotics Stack Exchange</a></li>
<li><a href="https://docs.ros.org/en/ros2_packages/">Package API</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</header>
<div class="page-content">
<div class="wrapper">
<div class="container-fluid" style="margin-top:20px; height:100%;">
<div class="container-fluid" style="height:100%;">
<div class="row" style="height:var(--breadcrumb-height);">
<ol class="breadcrumb showAsHome" style="display:none">
<li class="active">Home</li>
</ol>
<ol class="breadcrumb showAsSearch" style="display:none">
<li><a href="/">Home</a></li>
<li id="breadcrumb-name" class="active">Package List</li>
</ol>
</div>
<div class="row" style="height:var(--distro-height);">
<div id="distro-switch" class="btn-group btn-group-justified" data-toggle="buttons">
<label id="humble-option" class="distro-button btn btn-xs btn-primary" href="#humble" data="humble">
<input type="radio" name="options" id="humble-radio" autocomplete="off"> humble
</label>
<label id="jazzy-option" class="distro-button btn btn-xs btn-primary" href="#jazzy" data="jazzy">
<input type="radio" name="options" id="jazzy-radio" autocomplete="off"> jazzy
</label>
<label id="rolling-option" class="distro-button btn btn-xs btn-primary" href="#rolling" data="rolling">
<input type="radio" name="options" id="rolling-radio" autocomplete="off"> rolling
</label>
<label id="noetic-option" class="distro-button btn btn-xs btn-primary" href="#noetic" data="noetic">
<input type="radio" name="options" id="noetic-radio" autocomplete="off"> noetic
</label>
<!-- Older distros -->
<div class="btn-group dropdown">
<label type="button" class="btn btn-xs dropdown-toggle btn-primary" data-toggle="dropdown" id="older-distro-button">
<input type="radio" name="options" autocomplete="off">
<span id="older-label">Older</span>
<span class="caret"></span>
</label>
<ul class="dropdown-menu" role="menu">
<li data="ardent" id="ardent-option" class=" older-distro-option" href="#ardent">
<a href="#ardent" data="ardent" id="ardent-button">ardent</a>
</li>
<li data="bouncy" id="bouncy-option" class=" older-distro-option" href="#bouncy">
<a href="#bouncy" data="bouncy" id="bouncy-button">bouncy</a>
</li>
<li data="crystal" id="crystal-option" class=" older-distro-option" href="#crystal">
<a href="#crystal" data="crystal" id="crystal-button">crystal</a>
</li>
<li data="eloquent" id="eloquent-option" class=" older-distro-option" href="#eloquent">
<a href="#eloquent" data="eloquent" id="eloquent-button">eloquent</a>
</li>
<li data="dashing" id="dashing-option" class=" older-distro-option" href="#dashing">
<a href="#dashing" data="dashing" id="dashing-button">dashing</a>
</li>
<li data="galactic" id="galactic-option" class=" older-distro-option" href="#galactic">
<a href="#galactic" data="galactic" id="galactic-button">galactic</a>
</li>
<li data="foxy" id="foxy-option" class=" older-distro-option" href="#foxy">
<a href="#foxy" data="foxy" id="foxy-button">foxy</a>
</li>
<li data="iron" id="iron-option" class=" older-distro-option" href="#iron">
<a href="#iron" data="iron" id="iron-button">iron</a>
</li>
<li data="lunar" id="lunar-option" class=" older-distro-option" href="#lunar">
<a href="#lunar" data="lunar" id="lunar-button">lunar</a>
</li>
<li data="jade" id="jade-option" class=" older-distro-option" href="#jade">
<a href="#jade" data="jade" id="jade-button">jade</a>
</li>
<li data="indigo" id="indigo-option" class=" older-distro-option" href="#indigo">
<a href="#indigo" data="indigo" id="indigo-button">indigo</a>
</li>
<li data="hydro" id="hydro-option" class=" older-distro-option" href="#hydro">
<a href="#hydro" data="hydro" id="hydro-button">hydro</a>
</li>
<li data="kinetic" id="kinetic-option" class=" older-distro-option" href="#kinetic">
<a href="#kinetic" data="kinetic" id="kinetic-button">kinetic</a>
</li>
<li data="melodic" id="melodic-option" class=" older-distro-option" href="#melodic">
<a href="#melodic" data="melodic" id="melodic-button">melodic</a>
</li>
</ul>
</div>
</div>
</div>
<div class="row" style="height:var(--search-height);">
<div class="panel panel-default" style="height:100%;">
<div class="panel-heading" style="height:100%;">
<div class="row" style="height:100%;">
<div class="col-xs-6">
<div class="input-group">
<input id="search-query" type="text" class="form-control"
autocomplete="off" placeholder="Search packages">
<span class="input-group-btn">
<button id="search-button" class="btn btn-default">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
<span class="input-group-addon showCellAsSearch" style="display:none">
<input type="checkbox" id="search-enable-box"/>
<span class="hidden-xs"> Enable search </span>
</span>
</div>
</div>
<div class="col-xs-4" style="line-height:35px;">
<p class="showAsSearch" style="display:none;">
<span class="hidden-xs">Showing </span>
<span id="table-filtered-count">0</span> of
<span id="table-unfiltered-count">0</span>
<span id="filtered-type" class="hidden-xs"> packages</span>
</p>
</div>
<div class="col-xs-2 text-right" style="line-height:35px">
<p>
<a href="/help/package_list/">
<span class="glyphicon glyphicon-question-sign"></span>
<span class="hidden-xs"> Help</span>
</a>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="row showAsHome" style="display:none;">
<h2>Welcome to ROS Index</h2>
<p>
ROS Index is the entry point for searching ROS and ROS 2 resources, including packages, repositories, and system dependencies.
</p>
<p>
You can enter keywords and phrases in the search bar and then filter results by resource type, or you can browse the complete package, repository and system dependency lists.
</p>
<p>
New to ROS Index? Be sure to follow our
<a href="/help/tutorial">Tutorial</a>
To learn more about the process of searching for packages.
</p>
<h2>Active Distributions</h2>
<p>
<a href="https://wiki.ros.org/noetic">ROS Noetic</a>
</p>
<p>
<a href="https://docs.ros.org/en/humble/Releases/Release-Humble-Hawksbill.html">ROS 2 Humble</a>
</p>
<p>
<a href="https://docs.ros.org/en/jazzy/Releases/Release-Jazzy-Jalisco.html">ROS 2 Jazzy</a>
</p>
<h2>Development Distribution</h2>
<p>
<a href="http://docs.ros.org/en/rolling/Releases/Release-Rolling-Ridley.html">ROS 2 Rolling</a>
</p>
<h2>More resources</h2>
<p>
<a href="https://discourse.ros.org/">ROS Discourse</a>
</p>
<p>
<a href="https://robotics.stackexchange.com/">Robotics Stack Exchange</a>
</p>
<p>
<a href="https://www.ros.org/">ros.org</a>
</p>
</div>
<div class="row tab-table showAsSearch" style="height:calc(var(--content-height) - var(--search-height) - var(--distro-height) - var(--breadcrumb-height) - var(--table-margins))">
<div id="packages-table"></div>
</div>
</div>
</div>
<!-- See https://github.com/olifolkerd/tabulator/issues/4419 for issue with Tabulator post-5.6.0 -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/tabulator.min.css" rel="stylesheet">
<link href=css/search_packages.css rel="stylesheet">
<!-- <script src=/js/tabulator.js></script> -->
<script src=/js/distro_switch.js></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/tabulator.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/build/global/luxon.min.js"></script>
<script src="/js/lunr.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var gData_promises = {};
var gIndex_promises = {};
var gTable = null;
var gDistro = "humble";
var gQuery = null;
var gRepoCount = null;
const PACKAGE_SORT = [{column:"url", dir:"asc"}];
const REPO_SORT = [{column: "repo", dir:"asc"}];
const SCORE_SORT = [{column:"score", dir:"desc"}];
function setHome() {
// Show the page as a home page, without the package table.
$("body").css("height", "auto");
$(".page-content").css("height", "auto");
$(".wrapper").css("height", "auto");
$(".showAsSearch").css("display", "none");
$(".showCellAsSearch").css("display", "none");
$(".showAsHome").css("display", "block");
}
function setSearch() {
// Show the page as a package search/list page.
$("body").css("height", "100vh");
$(".page-content").css("height", "var(--content-height)");
$(".wrapper").css("height", "100%");
$(".showAsHome").css("display", "none");
$(".showAsSearch").css("display", "block");
$(".showCellAsSearch").css("display", "table-cell");
}
function getData(distro) {
// Start and return a promise to get distro json data.
if (distro in gData_promises) {
return gData_promises[distro];
}
gData_promises[distro] =
fetch(`/search/packages/data.${distro}.json`)
.then((response) => response.json());
return gData_promises[distro];
}
function getIndex(distro) {
// Start and return a promise to get distro json index.
if (distro in gIndex_promises) {
return gIndex_promises[distro];
}
gIndex_promises[distro] =
fetch(`/search/packages/index.${distro}.json`)
.then((response) => response.json())
.then((indexData) => {
return lunr.Index.load(indexData);
});
return gIndex_promises[distro];
}
function getWindowSearchQuery() {
return new URL(window.location.toString()).searchParams.get('pkgs');
}
function getIsSearch() {
parms = new URL(window.location.toString()).searchParams;
return (parms.has('search_packages') || parms.has('search_repos'));
}
function getIsRepos() {
return new URL(window.location.toString()).searchParams.has('search_repos');
}
function setWindowSearchQuery(query) {
// Populate the search input with querystring parameter.
var url = new URL(window.location.toString());
url.searchParams.set('pkgs', query);
url.searchParams.set('search_packages', true);
window.history.pushState({}, '', url);
}
function copySearchQueryToUI() {
var query = getWindowSearchQuery() || '';
$('#search-query').val(query);
$("#search-enable-box").prop("checked", !!query);
}
function copyUIToSearchQuery() {
if ($("#search-enable-box").prop("checked")) {
setWindowSearchQuery($('#search-query').val());
} else {
setWindowSearchQuery('');
}
}
function getSearchHash(distro, query) {
// Returns a promise resolving to a hash of {ref: score} with hits.
if (!query) {
return Promise.resolve(null);
}
return getIndex(distro).then(searchIndex => {
var searchResults = searchIndex.search(query);
// Tabulator filters don't seem to work with zero entries
var searchHash = {'-1': 0.0};
for (const result of searchResults) {
searchHash[result.ref] = result.score;
}
console.log(`Search returned ${searchResults.length} results`);
return searchHash;
});
}
function updateDataScore(data, searchHash) {
// Update table data score with results from a search.
// Returns array of repo names that the search hit.
var reposSet = new Set();
// Tabulator filters don't like empty arrays.
reposSet.add('__dummy__');
for (const dataValue of data) {
const ref = dataValue['id'].toString();
if (searchHash && ref in searchHash) {
reposSet.add(dataValue['repo']);
dataValue['score'] = searchHash[ref];
}
else {
dataValue['score'] = 0.0;
}
}
return Array.from(reposSet);
}
function makeTable(distro, data, searchArray) {
console.log(`makeTable for distro ${distro}`);
const CALENDAR = "\u{1F4C5}";
const STAR = "\u2605";
const LEFT_ARROW = "\u2B05";
const RIGHT_ARROW = "\u27A1";
const CIRCLED_DOT = "\u2299";
const isRepos = getIsRepos();
const tableSort = searchArray ? SCORE_SORT : (isRepos ? REPO_SORT : PACKAGE_SORT);
if (searchArray) {
if (isRepos) {
var tableFilter = [{field: 'repo', type: 'in', value: searchArray}];
} else {
var tableFilter = [{field: 'id', type: 'in', value: searchArray}];
}
} else {
var tableFilter = [];
}
dateColumn =
{ title:CALENDAR, field: "last_commit_time", width:80, headerHozAlign:"center",
headerTooltip:"last commit date", sorter:"date", sorterParams:{format:"yyyy-MM-dd"}
};
repoColumn =
{ title:"Repo", field:"instance", width:100,
formatter:"link", formatterParams:{labelField:"repo", url:(cell) => {
return `/r/${cell.getValue()}/#${distro}`}}
};
tableColumns = [ //Define Table Columns
{ title:"Package", field:"url", width:200,
formatter:"link", formatterParams:{labelField:"package", urlPrefix:""}},
{ title:"Description", field:"description", minWidth:isRepos ? 160: 300},
{ title:STAR, field:"released", width:40, formatter:"tickCross", headerTooltip:"released: release status", hozAlign:"center",
formatterParams: {allowTruthy: true, allowEmpty: true}},
{ title:LEFT_ARROW, field:"pkg_deps", width:40, headerTooltip:"pkg_deps: package dependency count"},
{ title:RIGHT_ARROW, field:"dependants", width:40, headerTooltip:"dependants: package used by count"},
{ title:CIRCLED_DOT, field:"core", width:40, formatter:"tickCross", headerTooltip:"core: Is dependency of a core package?",
hozAlign:"center", formatterParams: {allowTruthy: true}, sorter:function(a, b, aRow, bRow, column, dir, sorterParams) {
return sorterParams.indexOf(a) - sorterParams.indexOf(b);
}, sorterParams:['ros_core', 'ros_base', 'desktop', 'desktop_full']},
{ title:"Authors", field:"authors", width:120},
{ title:"Maintainers", field:"maintainers", width:120},
{ title:"Org", field:"org", width:100},
{ title:"score", field:"score", width:60, sorter:"number", visible:false},
{ title:"instance", field:"instance", width:100, visible:false},
];
if (isRepos) {
$("#filtered-type").text(' repos');
tableColumns = [dateColumn, repoColumn].concat(tableColumns);
} else {
$("#filtered-type").text(' packages');
tableColumns = tableColumns.concat([repoColumn, dateColumn]);
}
tableOptions = {
columnDefaults:{ tooltip:true },
maxHeight:"100%",
data:data, //assign data to table
layout:"fitColumns", //fit columns to width of table (optional)
rowHeight:30, // Workaround for https://github.com/olifolkerd/tabulator/issues/4419
initialSort: tableSort,
initialFilter: tableFilter,
columns:tableColumns,
};
if (isRepos) {
tableOptions['groupBy'] = 'repo';
tableOptions['groupStartOpen'] = true;
tableOptions['groupToggleElement'] = false; // Always show packages.
tableOptions['groupHeader'] = (value, count, data, group) => {
header =
`<span style='color:#d00;'>${data[0]['last_commit_time']}</span>` +
`<span style='margin-left:11px;'><a href="/r/${value}/#${distro}">${value}</span>`;
return header;
}
}
return new Tabulator("#packages-table", tableOptions);
}
function makeBuiltTable(distro, data, searchArray) {
// Returns a promise resolving to a built Tabulator table.
var table = makeTable(distro, data, searchArray);
if (!gRepoCount) {
const reposSet = new Set();
for (const dataItem of data) {
reposSet.add(dataItem['repo']);
}
gRepoCount = reposSet.size;
console.log(`gRepoCount is ${gRepoCount}`)
}
var tablePromise = new Promise((resolve, reject) => {
table.on("dataFiltered", (filters, rows) => {
if (getIsRepos()) {
const rowsData = rows.map(row => row.getData());
var totalLength = gRepoCount;
const reposSet = new Set();
for (const row of rowsData) {
reposSet.add(row['repo']);
}
var hitsLength = reposSet.size;
} else {
var totalLength = table.getDataCount();
var hitsLength = rows.length;
}
console.log(`Table filtered: total: ${totalLength} rowCount: ${hitsLength}`);
$("#table-filtered-count").text(hitsLength);
$("#table-unfiltered-count").text(totalLength);
});
table.on("tableBuilt", () => {
console.log('tableBuilt');
resolve(table);
});
});
return tablePromise;
}
function showTable(distro, query) {
// Returns a promise that displays a Tabulator table.
console.log(`showTable distro=${distro} query=${query}`);
gQuery = query;
const isRepos = getIsRepos();
if (distro != gDistro) {
// Some of the table links depend on distro. Let's just rebuild the whole thing.
if (gTable) {
gTable.destroy();
}
gTable = null;
gRepoCount = null;
}
gDistro = distro;
var title = isRepos ? 'Search repos' : 'Search packages';
var breadcrumb = isRepos ? 'Repo list' : 'Package List';
$('#search-query').attr('placeholder', title);
$('#breadcrumb-name').text(breadcrumb);
var searchPromise = getSearchHash(distro, query);
return Promise.all([getData(distro), searchPromise]).then(values => {
var data = values[0];
var searchHash = values[1];
var reposArray = updateDataScore(data, searchHash);
if (isRepos) {
var searchArray = searchHash ? reposArray : null;
} else {
var searchArray = searchHash ? Object.keys(searchHash).map(ref => parseInt(ref)) : null;
}
var filteredLength = isRepos ? reposArray.length : data.length;
if (!searchArray) {
console.log(`showTable sets count to ${filteredLength}`);
$("#table-filtered-count").text(filteredLength);
$("#table-unfiltered-count").text(filteredLength);
}
if (gTable) {
if (searchArray) {
if (isRepos) {
gTable.setFilter('repo', 'in', searchArray);
} else {
gTable.setFilter('id', 'in', searchArray);
}
gTable.setSort(SCORE_SORT);
} else {
gTable.clearFilter(true);
gTable.setSort(isRepos ? REPO_SORT : PACKAGE_SORT);
}
gTable.replaceData(data).then(console.log('table data replaced'));
}
else {
makeBuiltTable(distro, data, searchArray).then(table => {
gTable = table;
});
}
});
}
function updatePage() {
// Queries status to update page.
if (getIsSearch()) {
copySearchQueryToUI();
var query = getWindowSearchQuery();
var distro = window.location.hash.substring(1) || gDistro;
// Don't rerun query if nothing changed.
if (gTable && query == gQuery && distro == gDistro) {
console.log('updatePage isSearch no change');
setSearch();
} else {
console.log('updatePage isSearch with change');
showTable(distro, query).then(setSearch());
}
} else {
console.log('updatePage isHome');
setHome();
}
}
$(function() {
console.log('search_packages');
gDistro = setupDistroSwitch("humble");
getData(gDistro);
updatePage();
window.addEventListener('popstate', () => {
console.log(`popstate ${window.location.href}`);
updatePage();
});
window.addEventListener('hashchange', () => {
var distro = window.location.hash.substring(1) || gDistro;
// Trigger distro change if distro UI incorrect.
if (!$('#'+distro+'-option').hasClass('active')) {
console.log(`hashchange ${window.location.href} distro ${distro} triggering`);
const nodes = $('#'+distro+'-option');
console.log(`node ${nodes[0].tagName} ${nodes[0].id}`);
if (nodes[0].tagName == 'LABEL') {
// one of the current distro types
nodes.trigger('click');
} else {
// an older distro type
nodes.children().trigger('click');
}
} else {
console.log(`hashchange ${window.location.href} distro ${distro} no trigger`);
}
});
$('#search-query').on('focus', (e) => {
// Pre-load index to speed up search response.
getIndex(gDistro);
});
$('#search-query').bind('keypress', (e) => {
if (e.which == 13) {
$("#search-enable-box").prop("checked", true);
copyUIToSearchQuery();
updatePage();
}
});
$("#search-enable-box").on('click', (e) => {
var element = e.currentTarget;
var query = $("#search-query").val();
if (element.checked && query) {
copyUIToSearchQuery();
} else {
setWindowSearchQuery('');
query = '';
if (gTable) {
gTable.setSort(getIsRepos() ? REPO_SORT : PACKAGE_SORT);
}
}
showTable(gDistro, query).then(setSearch());
});
$("#search-button").on('click', (e) => {
var query = $("#search-query").val();
if (query) {
$("#search-enable-box").prop("checked", true);
copyUIToSearchQuery();
} else {
setWindowSearchQuery('');
query = '';
if (gTable) {
gTable.setSort(getIsRepos() ? REPO_SORT : PACKAGE_SORT);
}
}
showTable(gDistro, query).then(setSearch());
});
});
</script>
</div>
</div>
<footer class="site-footer">
<div class="wrapper">
<div class="container-fluid">
<div style="float:left;">
<a href="https://github.com/ros-infrastructure/rosindex" title="Find rosindex in Github">
<span class="icon icon--github">
<svg viewBox="0 0 16 16">
<path fill="#828282" d="M7.999,0.431c-4.285,0-7.76,3.474-7.76,7.761 c0,3.428,2.223,6.337,5.307,7.363c0.388,0.071,0.53-0.168,0.53-0.374c0-0.184-0.007-0.672-0.01-1.32 c-2.159,0.469-2.614-1.04-2.614-1.04c-0.353-0.896-0.862-1.135-0.862-1.135c-0.705-0.481,0.053-0.472,0.053-0.472 c0.779,0.055,1.189,0.8,1.189,0.8c0.692,1.186,1.816,0.843,2.258,0.645c0.071-0.502,0.271-0.843,0.493-1.037 C4.86,11.425,3.049,10.76,3.049,7.786c0-0.847,0.302-1.54,0.799-2.082C3.768,5.507,3.501,4.718,3.924,3.65 c0,0,0.652-0.209,2.134,0.796C6.677,4.273,7.34,4.187,8,4.184c0.659,0.003,1.323,0.089,1.943,0.261 c1.482-1.004,2.132-0.796,2.132-0.796c0.423,1.068,0.157,1.857,0.077,2.054c0.497,0.542,0.798,1.235,0.798,2.082 c0,2.981-1.814,3.637-3.543,3.829c0.279,0.24,0.527,0.713,0.527,1.437c0,1.037-0.01,1.874-0.01,2.129 c0,0.208,0.14,0.449,0.534,0.373c3.081-1.028,5.302-3.935,5.302-7.362C15.76,3.906,12.285,0.431,7.999,0.431z"/>
</svg>
</span>
<span class="username">ros-infrastructure/rosindex</span>
</a>
<em class="hidden-xs">| generated on 2025-04-10</em>
</div>
<div style="float:right;">
<p class="text"><span class="hidden-xs">a community-maintained index of robotics software
| </span><a href="/privacy.txt">privacy</a></p>
</div>
</div>
</div>
</footer>
</body>
</html>