fixed template javascript
Some checks failed
FHIR IG CI/CD Pipeline with Version Persistence / build-ig (push) Failing after 4m42s
FHIR IG CI/CD Pipeline with Version Persistence / deploy (push) Has been skipped

This commit is contained in:
2026-03-07 04:08:55 +06:00
parent 3b48bd79e2
commit fdca2f9c3b

View File

@@ -34,63 +34,58 @@
</div> </div>
<script> <script>
(async function() { (function() {
const loadingDiv = document.getElementById('version-history-loading'); var loadingDiv = document.getElementById('version-history-loading');
const contentDiv = document.getElementById('version-history-content'); var contentDiv = document.getElementById('version-history-content');
const errorDiv = document.getElementById('version-history-error'); var errorDiv = document.getElementById('version-history-error');
const tbody = document.getElementById('versions-tbody'); var tbody = document.getElementById('versions-tbody');
const ciDiv = document.getElementById('ci-build-info'); var ciDiv = document.getElementById('ci-build-info');
// We try multiple paths to ensure we find the JSON whether we are at root or in a version folder var pathsToTry = [
const pathsToTry = [ 'package-list.json',
'package-list.json', // Current folder '../package-list.json',
'../package-list.json', // Parent folder '/core/package-list.json'
'/core/package-list.json' // Absolute web root
]; ];
let data = null; function loadData(index) {
if (index >= pathsToTry.length) {
loadingDiv.style.display = 'none';
errorDiv.style.display = 'block';
return;
}
for (const path of pathsToTry) { fetch(pathsToTry[index])
try { .then(function(response) {
console.log('Attempting to fetch history from:', path); if (!response.ok) throw new Error('Not found');
const response = await fetch(path); return response.json();
if (response.ok) { })
data = await response.json(); .then(function(data) {
console.log('Successfully loaded version history from:', path); if (!data.list) throw new Error('Invalid format');
break;
for (var i = 0; i < data.list.length; i++) {
var entry = data.list[i];
if (entry.version !== 'current') {
var row = tbody.insertRow();
row.insertCell(0).innerHTML = '<a href="' + entry.path + '"><b>' + entry.version + '</b></a>';
row.insertCell(1).textContent = entry.date || 'N/A';
row.insertCell(2).innerHTML = '<span class="badge">' + (entry.status || 'unknown') + '</span>';
row.insertCell(3).textContent = entry.desc || '';
} else {
ciDiv.innerHTML = '<div style="background-color: #f8f9fa; padding: 10px; border-left: 5px solid #007bff;">' +
'<p>Latest development build: <a href="' + entry.path + '">' + entry.path + '</a></p>' +
'</div>';
}
} }
} catch (e) { loadingDiv.style.display = 'none';
console.warn('Failed to fetch from:', path, e); contentDiv.style.display = 'block';
} })
.catch(function() {
// Try the next path in the array
loadData(index + 1);
});
} }
if (!data || !data.list) { loadData(0);
loadingDiv.style.display = 'none';
errorDiv.style.display = 'block';
return;
}
// Sort list to show newest first (optional, but recommended)
data.list.forEach(entry => {
if (entry.version !== 'current') {
const row = tbody.insertRow();
// Use entry.path from JSON to ensure links always point to the right place
row.insertCell(0).innerHTML = `<a href="${entry.path}"><b>${entry.version}</b></a>`;
row.insertCell(1).textContent = entry.date || 'N/A';
row.insertCell(2).innerHTML = `<span class="badge">${entry.status || 'unknown'}</span>`;
row.insertCell(3).textContent = entry.desc || '';
} else {
// Continuous Integration Build info
ciDiv.innerHTML = `
<div style="background-color: #f8f9fa; padding: 10px; border-left: 5px solid #007bff;">
<p>The latest development build is available at: <a href="${entry.path}">${entry.path}</a></p>
<p><small>Note: This is a continuous integration build and may be unstable.</small></p>
</div>`;
}
});
loadingDiv.style.display = 'none';
contentDiv.style.display = 'block';
})(); })();
</script> </script>
</div> </div>