diff --git a/css/ds.css b/css/ds.css index a0983f5..4226c38 100644 --- a/css/ds.css +++ b/css/ds.css @@ -1,13 +1,23 @@ +body { + height: 100%; +} header { background-image: url('http://150.145.56.132/static/img/logos/dataspace_icon.svg'); background-position: center; background-repeat: no-repeat; background-size: contain; min-height: 200px; + border-bottom: 1px lightgrey solid; } main { width: 75%; margin: 0 auto; + padding: 2rem 0 5rem 0; +} +footer { + min-height: 40px; + background-color: rgba(5, 5, 5, 0.6); + padding: 3rem; } ul { list-style: none; @@ -16,7 +26,14 @@ ul li { padding: 5px; } +td ul { + margin-left: 0; + padding-left: 0; +} .mt-2 { margin-top: 2rem !important; } +.key { + min-width: 200px; +} diff --git a/index.html b/index.html index 6972d53..bae2370 100644 --- a/index.html +++ b/index.html @@ -30,5 +30,8 @@ + \ No newline at end of file diff --git a/js/ds.js b/js/ds.js index 3ce8ee6..e53146d 100644 --- a/js/ds.js +++ b/js/ds.js @@ -26,21 +26,16 @@ export async function fetchResourceList(max = 20) * @param {string} id The ID of the UL element * @param {string} replace The string that should replace loalhost... * + * @return {void} */ export function createLinks(links, id, replace) { - /* - links = links.map(e => e.replace( - 'http://localhost:8000/resources/', - replace - )); - */ for (const link of links) { const item = document.createElement('li'); item.innerHTML = - ` - ${link.substring(link.lastIndexOf('/')+1)} + ` + ${link.substring(link.lastIndexOf('/') + 1)} `; document.querySelector(`#${id}`).appendChild(item); } @@ -62,6 +57,15 @@ export async function fetchReport(uuid) // Arbitrary slice... return jsonRep; } +/** + * Fetch file blob (CORS...) + * @todo + * + * @param {string} fileUri The file's URI in Arches + * + * @return {object} + */ +//export async function fetchFileBlob(fileUri); /** * Query report links to determine * resource instance type... diff --git a/js/views/index.js b/js/views/index.js index 93e638f..0d83bed 100644 --- a/js/views/index.js +++ b/js/views/index.js @@ -6,14 +6,7 @@ import { document.addEventListener('readystatechange', async () => { const resList = await fetchResourceList(); - createLinks( - resList, - 'links', - `${BASE_URL}/report/` - ); - createLinks( - resList, - 'rep-links', - `/report?id=` - ); + + createLinks(resList, 'links', `${BASE_URL}/report/`); + createLinks( resList, 'rep-links', `/report?id=`); }) \ No newline at end of file diff --git a/js/views/report.js b/js/views/report.js index b382811..1976aa7 100644 --- a/js/views/report.js +++ b/js/views/report.js @@ -13,20 +13,46 @@ document.addEventListener('readystatechange', async () => { if (resKeys.length) { resType = resKeys[0].split(' ')[0]; + document.querySelector('#rep-tit') .innerText = `${resType} ${report.displayname}`; const repTable = document.querySelector('#resource tbody'); - // TODO manage files and nested objects // e.g. if (typeof report.resource[key] == 'object') ... for (const key of resKeys) { const row = document.createElement('tr'); + let rowspan = ''; + let innerList = null; + + if (typeof report.resource[key] == 'object') { + const boolValue = '@value' in report.resource[key]; + innerList = document.createElement('ul'); + + if (! boolValue) { + rowspan = Object.keys(report.resource[key]).length; + + for (const k in report.resource[key]) { + const li = document.createElement('li'); + li.innerHTML = + `${k.replace(key,'')}: + ${report.resource[key][k]}`; + + if (report.resource[key][k] !== null) { + innerList.appendChild(li); + } + } + } else { + innerList.innerHTML = `
  • ${report.resource[key]['@value']}
  • `; + } + } if (!key.includes('Coordinates')) { + let value = innerList !== null ? + innerList.outerHTML : report.resource[key]; row.innerHTML = ` - ${key.replace(resType, '')} - ${report.resource[key]} + ${key.replace(resType, '')} + ${value} `; } diff --git a/report/index.html b/report/index.html index 814cf0b..384c1be 100644 --- a/report/index.html +++ b/report/index.html @@ -8,10 +8,10 @@
    +

    + Report Light +

    -

    - Report Light -

    @@ -27,6 +27,9 @@

    + \ No newline at end of file