diff --git a/css/ds.css b/css/ds.css index 44bae60..efb6aed 100644 --- a/css/ds.css +++ b/css/ds.css @@ -1,5 +1,9 @@ @import '../vendor/fontawesome-free/css/all.css'; +:root { + --ispc-blue: #213B55; +} + body { height: 100%; } @@ -51,6 +55,20 @@ td ul { .mt-2 { margin-top: 2rem !important; } +.blue-bg { + background-color: var(--ispc-blue) !important; +} +.btn { + color: #fff; + background-color: var(--ispc-blue); + border-color: var(--ispc-blue); +} +.btn:hover { + color: #fff; + background-color: var(--ispc-blue); + opacity: 0.7; + border-color: var(--ispc-blue); +} table.table td, table.table th { border: none; diff --git a/js/ds.js b/js/ds.js index a9ffaa0..5a55a65 100644 --- a/js/ds.js +++ b/js/ds.js @@ -14,6 +14,7 @@ DataSpace.RESOURCE_REPORT = { 'Object' : resmap.OBJECT_REPORT, 'Context' : resmap.CONTEXT_REPORT, 'Sample' : resmap.SAMPLE_REPORT, + 'Analysis' : resmap.ANALYSIS_REPORT, }; /** * Populate partial objects from @@ -70,7 +71,7 @@ DataSpace.createShape = function (resource, resType) { * * @return {void} */ -DataSpace.renderReport = function (report, archesJson, images) +DataSpace.renderReport = async function (report, archesJson, images) { let resource = report.resource; let resKeys = Object.keys(resource); @@ -82,14 +83,6 @@ DataSpace.renderReport = function (report, archesJson, images) let resType = resKeys[0].split(' ')[0]; - if (resType === 'Sample') { - const container = document.querySelector('#analysis'); - container.classList.remove('d-hide'); - // TODO handle click on "View Analysis" - container.querySelector('button').onclick = () => { - console.log(this.getRelatedAnalysisId(archesJson)); - } - } if (['Object', 'Context'].includes(resType)) { const geoJSON = JSON.parse( @@ -125,6 +118,62 @@ DataSpace.renderReport = function (report, archesJson, images) // Create after-gallery... _createReportTail(resType, shape, resource); + + if (resType === 'Sample') { + const container = document.querySelector('#analysis'); + container.classList.remove('d-hide'); + const report = await this.fetchReport( + this.getRelatedAnalysisId(archesJson) + ); + + container.innerHTML += this.renderAnalysisReport( + report.resource, + report.displayname + ); + } +} +/** + * Create Analysis report + * @param {string} uuid The analysis resource's UUID + * @param {string} type The analysis displayname + * + * @returns {string} HTML + */ +DataSpace.renderAnalysisReport = function (resource, type) +{ + const shape = this.createShape(resource, 'Analysis'); + let html = ` +
+ ${key.replace('Analysis', '')} | +${resource[key]} | +
${key.replace('Analysis Photos', '')}
+