Skip to content
Snippets Groups Projects
Commit b61090b7 authored by Duc Bui Tien's avatar Duc Bui Tien
Browse files

add report html input

parent 6edcfe5b
No related branches found
No related tags found
2 merge requests!2UnicadoGuiBackend,!1New UnicadoGUI Branch
...@@ -5,9 +5,8 @@ ...@@ -5,9 +5,8 @@
let dict = {} let dict = {}
onMount(async ()=>{ onMount(async ()=>{
for (const element of tabs) { for (const element of tabs) {
const res = await fetch("http://127.0.0.1:8000/log/"+element+".log"); const res = await fetch("http://127.0.0.1:8000/log/"+element+".log",{ cache: "no-cache" });
//const data = await res.json(); await res.text().then(function (text) {
res.text().then(function (text) {
let lineBreak = "\n"; let lineBreak = "\n";
text = text.split(lineBreak).reverse().join(lineBreak); text = text.split(lineBreak).reverse().join(lineBreak);
dict[element]= text; dict[element]= text;
......
<script> <script>
import {Container, Styles, TabContent, TabPane} from "@sveltestrap/sveltestrap"; import {Container, Styles, TabContent, TabPane} from "@sveltestrap/sveltestrap";
import {onMount} from "svelte";
let tabs = ["convergenceLoop","empennageSizing","engineSizing","fuselageDesign","landingGearDesign","propulsionIntegration","wingDesign"] let tabs = ["convergenceLoop","empennageSizing","engineSizing","fuselageDesign","landingGearDesign","propulsionIntegration","wingDesign"]
let dict = {}
onMount(async ()=>{
for (const element of tabs) {
const res = await fetch("http://127.0.0.1:8000/report/"+element+"_report.html",{ cache: "no-cache" });
await res.text().then(function (html) {
let parser = new DOMParser();
let doc = parser.parseFromString(html, "text/html");
let docBody = doc.querySelector('body').innerHTML;
dict[element]= docBody;
});
}
})
</script> </script>
<TabContent vertical pills> <TabContent vertical pills>
{#each tabs as tab} {#each tabs as tab}
...@@ -15,9 +29,7 @@ ...@@ -15,9 +29,7 @@
{:else} {:else}
<TabPane tabId={tab} tab={tab}> <TabPane tabId={tab} tab={tab}>
<Container md> <Container md>
<p style="white-space: pre-line"> {@html dict[tab]}
<slot prop={tab} />
</p>
</Container> </Container>
</TabPane> </TabPane>
{/if} {/if}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment