Skip to content

Commit 246f5da

Browse files
committed
MISC changes to site
1 parent f5309df commit 246f5da

4 files changed

Lines changed: 68 additions & 6 deletions

File tree

‎mapping-server.yml‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
iri: https://w3id.org/mapping-commons/server
22
title: Mapping Commons Registry Server (Under Construction)
3+
# Each registry entry represents a remote mapping registry that is aggregated
4+
# into the Mapping Commons Registry.
5+
# id: A short, locally-unique code used to identify this registry in logs,
6+
# error messages, and internal references. Not part of any external ID space.
7+
# url: The URL of the remote registry YAML file.
38
registries:
49
- id: mh_mapping_initiative
5-
uri: https://raw.githubusercontent.com/mapping-commons/mh_mapping_initiative/master/registry.yml
10+
url: https://raw.githubusercontent.com/mapping-commons/mh_mapping_initiative/master/registry.yml
611
- id: disease
7-
uri: https://raw.githubusercontent.com/mapping-commons/disease-mappings/main/mappings.yml
12+
url: https://raw.githubusercontent.com/mapping-commons/disease-mappings/main/mappings.yml
813
- id: monarch
9-
uri: https://raw.githubusercontent.com/monarch-initiative/monarch-mapping-commons/main/registry.yml
14+
url: https://raw.githubusercontent.com/monarch-initiative/monarch-mapping-commons/main/registry.yml
1015
- id: c-path
11-
uri: https://gitlab.c-path.org/c-pathontology/mapping-commons/-/raw/main/registry.yml
16+
url: https://gitlab.c-path.org/c-pathontology/mapping-commons/-/raw/main/registry.yml
1217
- id: mesh-mappings
13-
uri: https://raw.githubusercontent.com/mapping-commons/mesh-mappings/main/mappings.yml
18+
url: https://raw.githubusercontent.com/mapping-commons/mesh-mappings/main/mappings.yml

‎scripts/cli.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def prepare_mapping_registry(registry_file, output_file, log_file):
122122

123123
for registry in main_registry.get("registries", []):
124124
registry_id = registry.get("id")
125-
registry_uri = registry.get("uri")
125+
registry_uri = registry.get("url")
126126

127127
response = requests.get(registry_uri)
128128
if response.status_code != 200:

‎site/index.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ <h3>Object Source</h3>
3636
<div class="facet-group" id="facet-creator">
3737
<h3>Creator</h3>
3838
</div>
39+
<div class="facet-group" id="facet-registry">
40+
<h3>Registry</h3>
41+
</div>
3942
</aside>
4043

4144
<section class="content">

‎site/js/app.js‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,55 @@
1717
subjectSource: new Set(),
1818
objectSource: new Set(),
1919
creator: new Set(),
20+
registry: new Set(),
2021
};
2122

2223
let searchQuery = "";
2324
let debounceTimer = null;
2425

26+
// --- URL State ---
27+
28+
// Facet key -> URL param name mapping
29+
const FACET_PARAMS = {
30+
type: "type",
31+
sourceType: "sourceType",
32+
license: "license",
33+
subjectSource: "subjectSource",
34+
objectSource: "objectSource",
35+
creator: "creator",
36+
registry: "registry",
37+
};
38+
39+
function readStateFromUrl() {
40+
var params = new URLSearchParams(window.location.search);
41+
var q = params.get("query");
42+
if (q) searchQuery = q;
43+
44+
Object.keys(FACET_PARAMS).forEach(function (key) {
45+
var val = params.get(FACET_PARAMS[key]);
46+
if (val) {
47+
val.split(",").forEach(function (v) {
48+
activeFilters[key].add(decodeURIComponent(v));
49+
});
50+
}
51+
});
52+
}
53+
54+
function pushStateToUrl() {
55+
var params = new URLSearchParams();
56+
if (searchQuery.trim()) params.set("query", searchQuery.trim());
57+
58+
Object.keys(FACET_PARAMS).forEach(function (key) {
59+
if (activeFilters[key].size > 0) {
60+
params.set(FACET_PARAMS[key], Array.from(activeFilters[key]).join(","));
61+
}
62+
});
63+
64+
var qs = params.toString();
65+
var newUrl = window.location.pathname + (qs ? "?" + qs : "");
66+
window.history.replaceState(null, "", newUrl);
67+
}
68+
2569
// --- Helpers ---
2670

2771
// Map CC license URL to { label, icon } where icon is the CC button SVG filename
@@ -145,6 +189,10 @@
145189
: [];
146190
case "creator":
147191
return spec.creator && spec.creator.name ? [spec.creator.name] : [];
192+
case "registry":
193+
return (spec.registries || [])
194+
.map(function (r) { return r.name || r.id || null; })
195+
.filter(Boolean);
148196
default:
149197
return [];
150198
}
@@ -168,6 +216,7 @@
168216
{ key: "subjectSource", elementId: "facet-subject-source" },
169217
{ key: "objectSource", elementId: "facet-object-source" },
170218
{ key: "creator", elementId: "facet-creator" },
219+
{ key: "registry", elementId: "facet-registry" },
171220
];
172221

173222
// Count against specs that match search + all OTHER facets (cross-facet counts)
@@ -265,6 +314,7 @@
265314
renderResults();
266315
renderPagination();
267316
renderSummary();
317+
pushStateToUrl();
268318
}
269319

270320
// --- Rendering ---
@@ -628,7 +678,11 @@
628678
// --- Init ---
629679

630680
function init() {
681+
readStateFromUrl();
631682
setupSearch();
683+
// Pre-fill search input from URL state
684+
var input = document.getElementById("search-input");
685+
if (searchQuery) input.value = searchQuery;
632686
loadData().catch((err) => {
633687
console.error(err);
634688
document.getElementById("results-list").innerHTML =

0 commit comments

Comments
 (0)