aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-04-11 18:29:43 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-04-11 18:29:43 +0300
commit5652c7f391b92fb3ef0b9f401e22b9e51ca5a7a5 (patch)
tree1867649c5e60563a601ed00b7546393a872d8af9
parentf3249e31f3f7c9b709f203d2a01a38892d771996 (diff)
downloadarching-kaos-web-ui-5652c7f391b92fb3ef0b9f401e22b9e51ca5a7a5.tar.gz
arching-kaos-web-ui-5652c7f391b92fb3ef0b9f401e22b9e51ca5a7a5.tar.bz2
arching-kaos-web-ui-5652c7f391b92fb3ef0b9f401e22b9e51ca5a7a5.zip
results of render now output results
-rw-r--r--src/css/akn.css20
-rw-r--r--src/index.html5
-rw-r--r--src/js/arching-kaos-tools.js124
-rw-r--r--src/js/environment-setup.js1
4 files changed, 115 insertions, 35 deletions
diff --git a/src/css/akn.css b/src/css/akn.css
index 816b098..0c548b2 100644
--- a/src/css/akn.css
+++ b/src/css/akn.css
@@ -488,3 +488,23 @@ footer {
display: none;
}
}
+
+#unique-overlay {
+ position: fixed;
+ z-index: 1;
+ background: black;
+ width: auto;
+ height: auto;
+ overflow: scroll;
+ top: 0px;
+ left: 0px;
+ right: 0px;
+ bottom: 0px;
+ margin: 0px;
+ padding: 1vh 4vw;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ align-content: flex-start;
+}
diff --git a/src/index.html b/src/index.html
index 66c6b12..11dab10 100644
--- a/src/index.html
+++ b/src/index.html
@@ -77,10 +77,13 @@
align-items: center;
gap: 10px;"
>
- <div>Render since zblock</div>
+ <h3>Render since 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>
+ <div class="results-area">
+ <h3>Results</h3>
+ </div>
<div style="
display: flex;
flex-direction: row;
diff --git a/src/js/arching-kaos-tools.js b/src/js/arching-kaos-tools.js
index af62072..11f7d90 100644
--- a/src/js/arching-kaos-tools.js
+++ b/src/js/arching-kaos-tools.js
@@ -6,6 +6,23 @@ function getArrayLength(array){
return length;
}
+function showResult(id){
+ const found = document.querySelector(`#${id}`);
+ const overlay = document.createElement('div');
+ overlay.id = 'unique-overlay';
+ const title = document.createElement('h3');
+ title.innerText = "Result";
+ overlay.appendChild(title);
+ const closeButton = document.createElement('button');
+ closeButton.onclick = ()=>{
+ document.querySelector('#unique-overlay').remove();
+ };
+ closeButton.innerHTML = 'x';
+ overlay.appendChild(closeButton);
+ overlay.appendChild(found);
+ resultsArea.appendChild(overlay);
+}
+
function renderStellarAddressPlaceholder(stellarAddress){
var divs = document.querySelector('#'+stellarAddress);
if ( divs === null ){
@@ -53,7 +70,7 @@ function nodeInfoRenderAndProceed(json, stellarAddress){
function renderZblockAndProceed(json, params){
console.log(typeof(params))
const [zblockIPFSHash, group, recursive] = params;
- console.log(group)
+ console.log(group);
var zblockElement = document.querySelector('#zb-'+zblockIPFSHash);
if(json.block){
var p = document.createElement("p");
@@ -122,7 +139,7 @@ function blockRenderAndProceed(json, params){
if(detailsPlace!== null) detailsPlace.appendChild(p);
}
progressPlaceholder.value++;
- exe(json.action,json.data,json,zblockIPFSHash,group,zblockObject);
+ exe(json.action,json.data,json,zblockIPFSHash,group,zblockObject,recursive);
if ( checkIfGenesis(json.previous) ){
archingKaosLog("Done loading " + group + " zchain!")
progressPlaceholder.value++;
@@ -273,7 +290,7 @@ function getConfiguration(nodeInfoIPNSLink,stellarAddress){
}
function renderZblockAsModule(json, params){
- const [action, zblockIPFSHash, zblockObject, blockObject, references] = params;
+ const [action, group, zblockIPFSHash, zblockObject, blockObject, references, recursive] = params;
if (action == "files/add") {
akModuleFiles(zblockIPFSHash, blockObject, json);
}
@@ -292,40 +309,79 @@ function renderZblockAsModule(json, params){
else {
archingKaosLog(action + " module not found");
}
+}
+function saveDataAndFullZblocks(json,params){
+ const [action, group, zblockIPFSHash, zblockObject, blockObject, references, recursive] = params;
+ fullZblocks[zblockIPFSHash]={
+ zblock:zblockIPFSHash,
+ block:zblockObject.block,
+ block_signature:zblockObject.block_signature,
+ action:blockObject.action,
+ previous:blockObject.previous,
+ data:blockObject.data,
+ dataExpansion:json,
+ detach:blockObject.detach,
+ gpg:blockObject.gpg,
+ timestamp:blockObject.timestamp
+ };
+ zblocks[group] = new Array;
+ zblocks[group].push(zblockIPFSHash);
+ data[blockObject.data]=json;
+ progressPlaceholder.max++;
+ progressPlaceholder.value++;
}
-function exe(action,dataIPFSHash,blockObject,zblockIPFSHash,group,zblockObject){
- archingKaosLog("Render ZBLOCK "+zblockIPFSHash+" as " + action + " ...");
- archingKaosFetchJSON(getIPFSURL(dataIPFSHash), renderZblockAsModule, [action, zblockIPFSHash, zblockObject, blockObject, references]);
- fetch(getIPFSURL(dataIPFSHash), {
- method:'GET',
- headers:{
- Accept: 'application/json'
- }
- }).then(response=>{
- if(response.ok){
- response.json().then(json=>{
- fullZblocks[zblockIPFSHash]={
- zblock:zblockIPFSHash,
- block:zblockObject.block,
- block_signature:zblockObject.block_signature,
- action:blockObject.action,
- previous:blockObject.previous,
- data:blockObject.data,
- dataExpansion:json,
- detach:blockObject.detach,
- gpg:blockObject.gpg,
- timestamp:blockObject.timestamp
- };
- zblocks[group] = new Array;
- zblocks[group].push(zblockIPFSHash);
- data[dataIPFSHash]=json;
- progressPlaceholder.max++;
- progressPlaceholder.value++;
- })
- }
- })
+function doStuffWithFetchedDataBlock(json, params){
+ saveDataAndFullZblocks(json,params);
+ renderZblockAsModule(json, params);
+}
+
+function exe(action,dataIPFSHash,blockObject,zblockIPFSHash,group,zblockObject,recursive){
+ if (!recursive) {
+ var button = document.createElement('button');
+ button.innerText =`${action.split('/')[0]}-${zblockIPFSHash} 📖`;
+ var params = `${action.split('/')[0]}-${zblockIPFSHash}`
+ button.onclick = ()=>{
+ showResult(params);
+ };
+ resultsArea.appendChild(button);
+ }
+ archingKaosLog(`Render ZBLOCK ${zblockIPFSHash} as ${action} ...`);
+ archingKaosFetchJSON(
+ getIPFSURL(dataIPFSHash),
+ doStuffWithFetchedDataBlock,
+ [action, group, zblockIPFSHash, zblockObject, blockObject, references, recursive]
+ );
+// archingKaosFetchJSON(getIPFSURL(dataIPFSHash), saveDataAndFullZblocks, [group, zblockIPFSHash,zblockObject,blockObject]);
+// fetch(getIPFSURL(dataIPFSHash), {
+// method:'GET',
+// headers:{
+// Accept: 'application/json'
+// }
+// }).then(response=>{
+// if(response.ok){
+// response.json().then(json=>{
+// fullZblocks[zblockIPFSHash]={
+// zblock:zblockIPFSHash,
+// block:zblockObject.block,
+// block_signature:zblockObject.block_signature,
+// action:blockObject.action,
+// previous:blockObject.previous,
+// data:blockObject.data,
+// dataExpansion:json,
+// detach:blockObject.detach,
+// gpg:blockObject.gpg,
+// timestamp:blockObject.timestamp
+// };
+// zblocks[group] = new Array;
+// zblocks[group].push(zblockIPFSHash);
+// data[dataIPFSHash]=json;
+// progressPlaceholder.max++;
+// progressPlaceholder.value++;
+// })
+// }
+// })
}
function getipfstext(ipfsHash, articleid){
diff --git a/src/js/environment-setup.js b/src/js/environment-setup.js
index ebcc4b6..f33e0b8 100644
--- a/src/js/environment-setup.js
+++ b/src/js/environment-setup.js
@@ -22,6 +22,7 @@ var mainContainer = document.querySelector('.main');
var doubleFloorMenu = document.querySelector('#double-floor');
var isMobile = false;
var aknet = document.querySelector('.aknet-network')
+var resultsArea = document.querySelector('.results-area')
/*