Keep all ontology domains in menu
This commit is contained in:
@@ -225,30 +225,37 @@ export default class extends Controller {
|
||||
/**
|
||||
* Temporary implementation to show domains only
|
||||
* @todo Don't rebuild it every time, use caching, return a container
|
||||
* @param {Object} ontology The traversed ontology object (temp)
|
||||
* @param {Array<{id: string, tree: Array<Object>}>} domains The traversed ontology domains
|
||||
* @param {HTMLElement} tab Tab content element
|
||||
*/
|
||||
#buildOntologyMenu(ontology, tab) {
|
||||
#buildOntologyMenu(domains, tab) {
|
||||
const mainNode = tab.querySelector('#ontology-list');
|
||||
mainNode.innerHTML = html`
|
||||
<span class="fs-5 fw-bold">${ontology.ontology}</span>
|
||||
`;
|
||||
mainNode.classList.add('pb-3');
|
||||
|
||||
let domainList = document.createElement('div');
|
||||
for (let domain of domains) {
|
||||
const heading = document.createElement('span');
|
||||
heading.className ="fs-5 fw-bold";
|
||||
heading.textContent = domain.id;
|
||||
mainNode.appendChild(heading);
|
||||
|
||||
for (let domain of ontology.domains) {
|
||||
const domainItem = document.createElement('div');
|
||||
domainItem.className = 'border-start border-bottom rounded';
|
||||
domainItem.textContent = domain.label;
|
||||
// Indentation...
|
||||
domainItem.classList.add(`ms-${domain.depth}`, `ps-${domain.depth}`, 'py-2');
|
||||
let domainList = document.createElement('div');
|
||||
|
||||
if (domain.depth === 1) domainItem.classList.add('fw-bold');
|
||||
console.debug(domain.tree);
|
||||
|
||||
domainList.appendChild(domainItem);
|
||||
// Traverse class trees for each domain
|
||||
for (let item of domain.tree) {
|
||||
const domainItem = document.createElement('div');
|
||||
domainItem.className = 'border-start border-bottom rounded';
|
||||
domainItem.textContent = item.label;
|
||||
// Indentation...
|
||||
domainItem.classList.add(`ms-${item.depth}`, `ps-${item.depth}`, 'py-2');
|
||||
|
||||
if (item.depth === 1) domainItem.classList.add('fw-bold');
|
||||
|
||||
domainList.appendChild(domainItem);
|
||||
}
|
||||
|
||||
mainNode.appendChild(domainList);
|
||||
}
|
||||
|
||||
mainNode.appendChild(domainList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user