Skip to content

Commit cf110dd

Browse files
committed
Misc changes
1 parent 6232c32 commit cf110dd

3 files changed

Lines changed: 47 additions & 3 deletions

File tree

‎site/css/style.css‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ body {
5656
flex: 1;
5757
}
5858

59+
.subheader {
60+
font-size: 0.85rem;
61+
opacity: 0.75;
62+
flex-basis: 100%;
63+
}
64+
65+
.subheader a {
66+
color: inherit;
67+
text-decoration: underline;
68+
}
69+
5970
.github-link {
6071
color: #fff;
6172
text-decoration: none;
@@ -243,6 +254,12 @@ body {
243254
color: #065f46;
244255
}
245256

257+
.status-badge {
258+
cursor: help;
259+
font-size: 0.9rem;
260+
margin-left: 0.3rem;
261+
}
262+
246263
.completeness-score {
247264
display: inline-flex;
248265
align-items: center;

‎site/index.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<div class="header-content">
1313
<h1>Mapping Commons Registry</h1>
1414
<p class="tagline">Search and browse mapping specifications</p>
15+
<p class="subheader">An open registry for data mappings aligned with the <a href="https://github.com/mapping-commons/fair-mappings-schema" target="_blank" rel="noopener">FAIR Mappings Schema</a>. Requests for additions are <a href="https://github.com/mapping-commons/mapping-commons.github.io/issues" target="_blank" rel="noopener">welcome</a>.</p>
1516
<a href="https://github.com/mapping-commons/mapping-commons.github.io" class="github-link" target="_blank" rel="noopener">GitHub</a>
1617
</div>
1718
</header>

‎site/js/app.js‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,19 @@
116116
return str.length > len ? str.slice(0, len) + "..." : str;
117117
}
118118

119+
// Extract a human-friendly short name from a URL (e.g. GitHub/GitLab repo name)
120+
function smartLabel(str) {
121+
if (!str) return "";
122+
try {
123+
var url = new URL(str);
124+
// GitHub / GitLab: use "owner/repo"
125+
var parts = url.pathname.replace(/^\/+|\/+$/g, "").split("/");
126+
if (parts.length >= 2) return parts.slice(0, 2).join("/");
127+
if (parts.length === 1 && parts[0]) return parts[0];
128+
} catch (e) { /* not a URL, fall through */ }
129+
return str;
130+
}
131+
119132
function escapeHtml(str) {
120133
const div = document.createElement("div");
121134
div.textContent = str;
@@ -191,7 +204,7 @@
191204
return spec.creator && spec.creator.name ? [spec.creator.name] : [];
192205
case "registry":
193206
return (spec.registries || [])
194-
.map(function (r) { return r.name || r.id || null; })
207+
.map(function (r) { return r.name || smartLabel(r.id) || r.id || null; })
195208
.filter(Boolean);
196209
default:
197210
return [];
@@ -380,6 +393,19 @@
380393
escapeHtml(display) + '</a>';
381394
}
382395

396+
var STATUS_INFO = {
397+
ok: { icon: "&#x2705;", label: "OK", description: "Metadata was successfully extracted from this mapping set." },
398+
no_metadata: { icon: "&#x26A0;&#xFE0F;", label: "No metadata", description: "No machine-readable metadata header could be found in this mapping set." },
399+
nonstandard_format: { icon: "&#x26A0;&#xFE0F;", label: "Nonstandard format", description: "This mapping set is in a format that could not be parsed (e.g. compressed)." },
400+
fetch_error: { icon: "&#x26A0;&#xFE0F;", label: "Fetch error", description: "This mapping set could not be retrieved from its source URL." },
401+
};
402+
403+
function renderStatus(status) {
404+
var info = STATUS_INFO[status || "ok"] || STATUS_INFO["ok"];
405+
return '<span class="status-badge" title="' + escapeHtml(info.label + ": " + info.description) + '">' +
406+
info.icon + '</span>';
407+
}
408+
383409
function renderFairScore(score) {
384410
if (score == null) return "";
385411
var pct = Math.round(score * 100);
@@ -442,7 +468,6 @@
442468

443469
addDetail("ID", spec.id ? renderUrl(spec.id) : null);
444470
addDetail("Version", spec.version ? escapeHtml(spec.version) : null);
445-
addDetail("Type", spec.type ? escapeHtml(spec.type) : null);
446471
addDetail("License", spec.license ? renderLicenseBadge(spec) : null);
447472
addDetail("Publication date", spec.publication_date ? escapeHtml(spec.publication_date) : null);
448473
addDetail("Mapping method", spec.mapping_method ? escapeHtml(spec.mapping_method) : null);
@@ -456,7 +481,7 @@
456481
addDetail("Description", spec.description ? escapeHtml(spec.description) : null);
457482
if (spec.registries && spec.registries.length) {
458483
var regHtml = spec.registries.map(function(r) {
459-
var label = escapeHtml(r.name || r.id || "Unknown");
484+
var label = escapeHtml(r.name || smartLabel(r.id) || r.id || "Unknown");
460485
return r.url ? '<a href="' + escapeHtml(r.url) + '" target="_blank" rel="noopener" class="detail-link">' + label + '</a>' : label;
461486
}).join(", ");
462487
addDetail("Registries", regHtml);
@@ -471,6 +496,7 @@
471496
'<div class="result-card">' +
472497
'<div class="result-card-header">' +
473498
'<span class="result-card-title">' + title + '</span>' +
499+
renderStatus(spec.status) +
474500
typeBadge +
475501
renderFairScore(spec.metadata_completeness_score) +
476502
'</div>' +

0 commit comments

Comments
 (0)