diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-11-30 04:27:26 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-11-30 04:27:26 +0200 |
commit | c138bd5400c46fd44834b8152b86a996b67c4a3d (patch) | |
tree | 195f79d4c6e0f2d17786a15fbc8bc7e9d4f340a1 /src | |
parent | df27d8b8addca3856b564e9a822c959b1b162442 (diff) | |
download | arching-kaos-web-ui-c138bd5400c46fd44834b8152b86a996b67c4a3d.tar.gz arching-kaos-web-ui-c138bd5400c46fd44834b8152b86a996b67c4a3d.tar.bz2 arching-kaos-web-ui-c138bd5400c46fd44834b8152b86a996b67c4a3d.zip |
Fixed settings show
Diffstat (limited to 'src')
-rw-r--r-- | src/js/arching-kaos-web-ui-settings.js | 51 | ||||
-rw-r--r-- | src/js/ui/sections/settingsSection.js | 3 |
2 files changed, 34 insertions, 20 deletions
diff --git a/src/js/arching-kaos-web-ui-settings.js b/src/js/arching-kaos-web-ui-settings.js index c940f31..0435de4 100644 --- a/src/js/arching-kaos-web-ui-settings.js +++ b/src/js/arching-kaos-web-ui-settings.js @@ -157,13 +157,16 @@ function renderAssets(container, value){ function settingPlaceToDOM(key, value){ var container = document.createElement("details"); - container.innerText=key; + var summary = document.createElement("summary"); + console.log("~~KEY: "+key); + summary.innerText=key; + container.appendChild(summary); if ( Array.isArray(value) ){ var ul = document.createElement("select"); value.map((v)=>{ if (v.constructor.name === "Object"){ Object.keys(v).forEach((value)=>{ - makeElement({element:"option", innerText:value + ': ' + v[value], value: value}, ul); + makeElement({element:"option", innerText:`${value}: ${v[value]}`, value: value}, ul); }); } else { makeElement({element:"option", innerText:v, value: v}, ul); @@ -174,25 +177,28 @@ function settingPlaceToDOM(key, value){ console.log("KEY: "+key); switch (key){ case 'ipfs': - makeElement({ element:"summary",innerText:"IPFS" }, container); + makeElement({ element:"h4",innerText:"Gateway" }, container); renderList(container, value.gateway); break; case 'stellar': - makeElement({ element:"summary",innerText:"Asset" }, container); + makeElement({ element:"h4",innerText:"Asset" }, container); renderAssets(container, value.asset); + makeElement({ element:"hr" }, container); - makeElement({ element:"summary",innerText:"Variable Names" }, container); + makeElement({ element:"h4",innerText:"Variable Names" }, container); renderList(container, value.variableNames); + makeElement({ element:"hr" }, container); - makeElement({ element:"summary",innerText:"Horizon" }, container); + makeElement({ element:"h4",innerText:"Horizon" }, container); renderList(container, value.horizon); + makeElement({ element:"hr" }, container); - makeElement({ element:"summary",innerText:"Scan" }, container); + makeElement({ element:"h4",innerText:"Scan" }, container); renderCheck(container, value.scan); break; case 'ak': - makeElement({ element:"summary",innerText:"Connect" }, container); + makeElement({ element:"h4",innerText:"Connect" }, container); renderList(container, value.connect); break; default: @@ -205,17 +211,24 @@ function settingPlaceToDOM(key, value){ getSettingsPage().appendChild(container); } -// settingsKeys.forEach( -// (value) => { -// settingPlaceToDOM(value, settings[value]); -// } -// ); - -/* Small dump as pre text */ -// var predump = document.createElement('pre'); -// predump.innerText = JSON.stringify(settings, null, 2); -// getSettingsPage().appendChild(predump); -/* END of: Small dump as pre text */ +export function showSettings() +{ + for ( var i = 0; i < settingsKeys.length; i++ ) + { + settingPlaceToDOM(settingsKeys[i], settings[settingsKeys[i]]); + } +// settingsKeys.forEach( +// (value) => { +// settingPlaceToDOM(value, settings[value]); +// } +// ); + + /* Small dump as pre text */ + // var predump = document.createElement('pre'); + // predump.innerText = JSON.stringify(settings, null, 2); + // getSettingsPage().appendChild(predump); + /* END of: Small dump as pre text */ +} export function getSettings() { diff --git a/src/js/ui/sections/settingsSection.js b/src/js/ui/sections/settingsSection.js index e6768df..3a0e410 100644 --- a/src/js/ui/sections/settingsSection.js +++ b/src/js/ui/sections/settingsSection.js @@ -1,5 +1,5 @@ import { makeElement } from "../../arching-kaos-generator.js"; -import { getSettings } from "../../arching-kaos-web-ui-settings.js"; +import { getSettings, showSettings } from "../../arching-kaos-web-ui-settings.js"; var settings = getSettings(); console.log(settings); @@ -22,6 +22,7 @@ export function settingsSection() }; makeElement(settingsSection, document.querySelector('.main')); + showSettings(); } export function getSettingsPage() |