aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-07-13 18:13:06 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-07-13 18:13:06 +0300
commitf6fc624b2a4c5fff80e8e070b5cb065bcced0aed (patch)
tree8ec19da31a8196cb30cecc053b10ee11a48b4835
parentb165b0e78e04d269eca33f78df6b86922fcae56e (diff)
downloadarching-kaos-web-ui-f6fc624b2a4c5fff80e8e070b5cb065bcced0aed.tar.gz
arching-kaos-web-ui-f6fc624b2a4c5fff80e8e070b5cb065bcced0aed.tar.bz2
arching-kaos-web-ui-f6fc624b2a4c5fff80e8e070b5cb065bcced0aed.zip
refactoring
-rw-r--r--src/index.html2
-rw-r--r--src/js/arching-kaos-log.js4
-rw-r--r--src/js/arching-kaos-stellar-network.js1
-rw-r--r--src/js/arching-kaos-tools.js2
-rw-r--r--src/js/arching-kaos-web-ui-settings.js61
5 files changed, 56 insertions, 14 deletions
diff --git a/src/index.html b/src/index.html
index 11dab10..795a3d9 100644
--- a/src/index.html
+++ b/src/index.html
@@ -77,7 +77,7 @@
align-items: center;
gap: 10px;"
>
- <h3>Render since zblock</h3>
+ <h3>Render explicit zblock</h3>
<input id="search-field" type="text" name="search" placeholder="Enter a zblock hash"/>
<button onclick="seekZblock(this.parentElement.querySelector('#search-field').value, ['search', false])">Render</button>
</div>
diff --git a/src/js/arching-kaos-log.js b/src/js/arching-kaos-log.js
index b812678..47dcab9 100644
--- a/src/js/arching-kaos-log.js
+++ b/src/js/arching-kaos-log.js
@@ -1,9 +1,9 @@
function archingKaosLog(message){
- var sta = document.createElement("pre");
+ var sta = document.createElement("div");
var lts = new Date(Date.now());
var fmsg = lts.toISOString() + " " + message;
sta.innerText = fmsg
- currentLogMessageElement.innerText = fmsg;
+ currentLogMessageElement.innerHTML = fmsg;
logsAreaElement.appendChild(sta);
}
diff --git a/src/js/arching-kaos-stellar-network.js b/src/js/arching-kaos-stellar-network.js
index 4926f80..5fe503f 100644
--- a/src/js/arching-kaos-stellar-network.js
+++ b/src/js/arching-kaos-stellar-network.js
@@ -92,6 +92,7 @@ function checkAddressForConfigurationVariable(stellarAddress) {
}
var server = new StellarSdk.Server(activeSettings.horizonAddresses[activeSettings.horizonSelectedAddress], {allowHttp:true});
+
function steptwo(r){
const L = r;
putit(L);
diff --git a/src/js/arching-kaos-tools.js b/src/js/arching-kaos-tools.js
index d7f69e0..1de38a9 100644
--- a/src/js/arching-kaos-tools.js
+++ b/src/js/arching-kaos-tools.js
@@ -7,7 +7,7 @@ function getArrayLength(array){
}
function showResult(id){
- const found = document.querySelector(`#${id}`);
+ const found = document.querySelector(`#${id}`).cloneNode(true);
const overlay = document.createElement('div');
overlay.id = 'unique-overlay';
const title = document.createElement('h3');
diff --git a/src/js/arching-kaos-web-ui-settings.js b/src/js/arching-kaos-web-ui-settings.js
index 601c176..3338d0f 100644
--- a/src/js/arching-kaos-web-ui-settings.js
+++ b/src/js/arching-kaos-web-ui-settings.js
@@ -87,31 +87,66 @@ var settingsPage = document.querySelector('#settings-section');
var settingsKeys = Object.keys(activeSettings);
+function renderCheck(container, value){
+ var checkbox = document.createElement('input');
+ checkbox.type = 'checkbox';
+ if (value === true){
+ checkbox.checked = true;
+ }
+ container.appendChild(checkbox);
+}
+
+function renderList(container, value){
+ var selectOptions = document.createElement('select');
+ for ( i = 0 ; i < value.list.length; i++ ){
+ var option = document.createElement("option");
+ if ( i === value.active ) {
+ option.selected = true;
+ };
+ option.innerText = value.list[i];
+ option.value = i;
+ selectOptions.appendChild(option);
+ }
+ container.appendChild(selectOptions);
+}
+
+function renderAssets(container, value){
+ var selectOptions = document.createElement('select');
+ for ( i = 0 ; i < value.list.length; i++ ){
+ var option = document.createElement("option");
+ if ( i === value.active ) {
+ option.selected = true;
+ };
+ option.innerText = value.list[i].code + "-" + value.list[i].issuer;
+ option.value = i;
+ selectOptions.appendChild(option);
+ }
+ container.appendChild(selectOptions);
+}
+
function settingPlaceToDOM(key, value){
- var container = document.createElement("div");
- var label = document.createElement("label");
- label.innerText=key;
- container.appendChild(label);
- var paragraph = document.createElement("p");
- container.appendChild(paragraph);
+ var container = document.createElement("fieldset");
+ container.innerText=key;
if ( Array.isArray(value) ){
- var ul = document.createElement("ul");
+ var ul = document.createElement("select");
value.map((v)=>{
if (v.constructor.name === "Object"){
Object.keys(v).forEach((value)=>{
- var li = document.createElement("li");
+ var li = document.createElement("option");
li.innerText = value + ': ' + v[value];
+ li.value = value;
ul.appendChild(li);
});
} else {
- var li = document.createElement("li");
+ var li = document.createElement("option");
li.innerText = v;
+ li.value = v;
ul.appendChild(li);
}
});
paragraph.appendChild(ul);
} else {
- paragraph.innerText = value;
+ container.innerText = value;
}
settingsPage.appendChild(container);
}
@@ -122,6 +157,12 @@ settingsKeys.forEach(
}
);
+/* Small dump as pre text */
+var predump = document.createElement('pre');
+predump.innerText = JSON.stringify(activeSettings, null, 2);
+settingsPage.appendChild(predump);
+/* END of: Small dump as pre text */
+
// console.log(activeSettings.ipfsGatewayAddress[activeSettings.ipfsSelectedGatewayAddress]);
// vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4