Skip to content

Commit

Permalink
add separate page for cases
Browse files Browse the repository at this point in the history
  • Loading branch information
metelkin committed Jun 17, 2024
1 parent 65104b9 commit bbccb7f
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 1 deletion.
Binary file removed static/STARTME.lnk
Binary file not shown.
62 changes: 62 additions & 0 deletions static/case/case.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const url = new URL(window.location.href);
let p = new URLSearchParams(url.search);
let caseId = p.get('id');
const path = '../../' + config.path;

$(window).ready(() => {
$.get(`${path}/summary.json`, (data) => {
let x = data.cases.find((x) => x.id == caseId);
console.log(x);

$('#caseId').html(x.id);
$('#caseId').removeClass().addClass('retCode_' + x.l2v5RetCode);
$('#casePath').html(`${path}/cases/${x.id}/`);
$('#retCode').html(x.l2v5RetCode);

$.get(`${path}/cases/${x.id}/synopsis.txt`, (data) => {
let shorted = splitLines(data);
$('#synopsis pre code').html(shorted);
}).fail(() => {
$('#synopsis pre code').html('No synopsis.txt file found');
});

$.get(`${path}/cases/${x.id}/l2v5/heta-code/output.heta`, (data) => {
$('#heta-code-l2v5 pre code').html(data);
}).fail(() => {
$('#heta-code-l2v5 pre code').html('No l2v5/heta-code/output.heta file found');
});
$.get(`${path}/cases/${x.id}/l2v5/build.log`, (data) => {
$('#logs-l2v5 pre code').html(data);
}).fail(() => {
$('#logs-l2v5 pre code').html('No l2v5/build.log file found');
});

$.get(`${path}/cases/${x.id}/l3v2/heta-code/output.heta`, (data) => {
$('#heta-code-l3v2 pre code').html(data);
}).fail(() => {
$('#heta-code-l3v2 pre code').html('No l3v2/heta-code/output.heta file found');
});
$.get(`${path}/cases/${x.id}/l3v2/build.log`, (data) => {
$('#logs-l3v2 pre code').html(data);
}).fail(() => {
$('#logs-l3v2 pre code').html('No l3v2/build.log file found');
});
});
});

function splitLines(s) {
let newS = [];
s.split('\n').forEach((line) => {
if (line.length <= 180) {
newS.push(line);
} else {
let i = 0;
while (i < line.length) {
newS.push(line.slice(i, i + 100));
i += 100;
}
}
});

return newS.join('\n');
}
42 changes: 42 additions & 0 deletions static/case/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<HTML>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="../config.js"></script>
<script src="case.js"></script>
<link rel="stylesheet" href="../style.css"/>
<title>SBML case result</title>
</head>
<body>
<div>
<h1>SBML case results</h1>
<div id="preamble">
<h2 id="caseId"></h2>
<p>Case path: <span id="casePath"></span></p>
<p>Return code: <span id="retCode"></span></p>
</div>
<div id="synopsis">
<h3>Synopsis</h3>
<pre><code class="text"></code></pre>
</div>
<div id="heta-code-l2v5">
<h3>Heta code</h3>
<pre class="heta"><code></code></pre>
</div>
<div id="logs-l2v5">
<h3>Logs</h3>
<pre><code class="text"></code></pre>
</div>
<div id="heta-code-l3v2">
<h3>Heta code</h3>
<pre class="heta"><code></code></pre>
</div>
<div id="logs-l3v2">
<h3>Logs</h3>
<pre><code class="text"></code></pre>
</div>
</div>
</body>
</HTML>
2 changes: 1 addition & 1 deletion static/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
window.config = {
results: './results.json',
figPath: './cases/output',
path: 'latest', // base_dir
path: 'result/latest',
};
1 change: 1 addition & 0 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="main.js"></script>
<link rel="stylesheet" href="style.css"/>
<title>SBML cases testing</title>
</head>
<body>
<h1>Result of testing SBML cases</h1>
<p><i>Repository's home is <a href="https://github.com/insysbio/sbml-heta-cases">HERE</a></i></p>
Expand Down

0 comments on commit bbccb7f

Please sign in to comment.