Removed webapp client
This commit is contained in:
parent
4b4486881c
commit
c7d9e56489
86
index.html
86
index.html
@ -10203,75 +10203,6 @@
|
|||||||
reactor.registerEvent("startUpErrorLog");
|
reactor.registerEvent("startUpErrorLog");
|
||||||
reactor.addEventListener("startUpErrorLog", (log) => console.error(log));
|
reactor.addEventListener("startUpErrorLog", (log) => console.error(log));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="webAppClient">
|
|
||||||
//Add this to the client script to request data from floWebappServer
|
|
||||||
const webAppClient = {
|
|
||||||
util: {
|
|
||||||
requestData(request = []) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
var websocket = new WebSocket("wss://" + floGlobals.webAppURL + "/ws");
|
|
||||||
websocket.onmessage = (evt) => {
|
|
||||||
if (evt.data == "$+") {
|
|
||||||
websocket.send(`?${JSON.stringify(request)}`);
|
|
||||||
} else if (evt.data == "$-") {
|
|
||||||
reject(`webApp not available`);
|
|
||||||
websocket.close();
|
|
||||||
} else {
|
|
||||||
resolve(JSON.parse(evt.data));
|
|
||||||
websocket.close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
websocket.onerror = (evt) => {
|
|
||||||
reject(`webApp server not found`);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
requestGeneralData: function (type, vectorClock = "0") {
|
|
||||||
if (typeof vectorClock !== "string") vectorClock.toString();
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.util
|
|
||||||
.requestData([
|
|
||||||
floGlobals.application,
|
|
||||||
"generalData",
|
|
||||||
type,
|
|
||||||
vectorClock,
|
|
||||||
])
|
|
||||||
.then((result) => {
|
|
||||||
if (result[0]) resolve(result[1]);
|
|
||||||
else reject(result[1]);
|
|
||||||
})
|
|
||||||
.catch((error) => reject(error));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
requestObjectData: function (keyPath) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.util
|
|
||||||
.requestData([floGlobals.application, "appObjects"].concat(keyPath))
|
|
||||||
.then((result) => {
|
|
||||||
if (result[0]) resolve(result[1]);
|
|
||||||
else reject(result[1]);
|
|
||||||
})
|
|
||||||
.catch((error) => reject(error));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
requestSubAdminList: function () {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.util
|
|
||||||
.requestData([floGlobals.application, "subAdmins"])
|
|
||||||
.then((result) => {
|
|
||||||
if (result[0]) resolve(result[1]);
|
|
||||||
else reject(result[1]);
|
|
||||||
})
|
|
||||||
.catch((error) => reject(error));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script id="onLoadStartUp">
|
<script id="onLoadStartUp">
|
||||||
let notifications = document.getElementById("sm-notifications"),
|
let notifications = document.getElementById("sm-notifications"),
|
||||||
genblockchainID = document.getElementById("gen-floid"),
|
genblockchainID = document.getElementById("gen-floid"),
|
||||||
@ -10552,12 +10483,11 @@
|
|||||||
|
|
||||||
let repourl = "https://api.github.com/repos/ranchimall/articles/contents";
|
let repourl = "https://api.github.com/repos/ranchimall/articles/contents";
|
||||||
|
|
||||||
Promise.all([fetch(repourl), webAppClient.requestGeneralData("test")]).then(
|
fetch(repourl).then(async (response) => {
|
||||||
async (values) => {
|
|
||||||
window.articles = {};
|
window.articles = {};
|
||||||
window.parsedarticles = {};
|
window.parsedarticles = {};
|
||||||
|
|
||||||
const repocontent = await values[0].json();
|
const repocontent = await response.json();
|
||||||
|
|
||||||
const allPromises = []
|
const allPromises = []
|
||||||
const allArticleNames = []
|
const allArticleNames = []
|
||||||
@ -10573,18 +10503,6 @@
|
|||||||
allArticleHTML.forEach((html, index) => articles[allArticleNames[index]] = html)
|
allArticleHTML.forEach((html, index) => articles[allArticleNames[index]] = html)
|
||||||
parseArticles(articles);
|
parseArticles(articles);
|
||||||
let map_articlekey_column = renderColumns(parsedarticles);
|
let map_articlekey_column = renderColumns(parsedarticles);
|
||||||
let articleInfo = values[1];
|
|
||||||
let articles_votesmapping = {};
|
|
||||||
|
|
||||||
for (let i = 0; i < articleInfo.length; i++) {
|
|
||||||
let article_message = JSON.parse(articleInfo[i].message);
|
|
||||||
|
|
||||||
if (!(article_message.articlekey in articles_votesmapping)) {
|
|
||||||
articles_votesmapping[article_message.articlekey] = 1;
|
|
||||||
} else {
|
|
||||||
articles_votesmapping[article_message.articlekey]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user