Skip to content
Snippets Groups Projects
Commit b1bdfe7b authored by tuhe's avatar tuhe
Browse files

Working on the dashboard

parent ba4e096c
No related branches found
No related tags found
No related merge requests found
/**
body, input { font-family: sans-serif; color: #000; text-align: center;
margin: 1em; padding: 0; font-size: 15px; }
**/
h1, h2, h3 { font-weight: normal; }
input { background-color: #fff; margin: 0; text-align: left;
outline: none !important; }
input[type="submit"] { padding: 3px 6px; }
a { color: #11557C; }
a:hover { color: #177199; }
pre, code,
textarea { font-family: monospace; font-size: 14px; }
div.debugger { text-align: left; padding: 12px; margin: auto;
background-color: white; }
h1 { font-size: 36px; margin: 0 0 0.3em 0; }
div.detail { cursor: pointer; }
div.detail p { margin: 0 0 8px 13px; font-size: 14px; white-space: pre-wrap;
font-family: monospace; }
div.explanation { margin: 20px 13px; font-size: 15px; color: #555; }
div.footer { font-size: 13px; text-align: right; margin: 30px 0;
color: #86989B; }
h2 { font-size: 16px; margin: 1.3em 0 0.0 0; padding: 9px;
background-color: #11557C; color: white; }
h2 em, h3 em { font-style: normal; color: #A5D6D9; font-weight: normal; }
div.traceback, div.plain { border: 1px solid #ddd; margin: 0 0 1em 0; padding: 10px; }
div.plain p { margin: 0; }
div.plain textarea,
div.plain pre { margin: 10px 0 0 0; padding: 4px;
background-color: #E8EFF0; border: 1px solid #D3E7E9; }
div.plain textarea { width: 99%; height: 300px; }
div.traceback h3 { font-size: 1em; margin: 0 0 0.8em 0; }
div.traceback ul { list-style: none; margin: 0; padding: 0 0 0 1em; }
div.traceback h4 { font-size: 13px; font-weight: normal; margin: 0.7em 0 0.1em 0; }
div.traceback pre { margin: 0; padding: 5px 0 3px 15px;
background-color: #E8EFF0; border: 1px solid #D3E7E9; }
div.traceback .library .current { background: white; color: #555; }
div.traceback .expanded .current { background: #E8EFF0; color: black; }
div.traceback pre:hover { background-color: #DDECEE; color: black; cursor: pointer; }
div.traceback div.source.expanded pre + pre { border-top: none; }
div.traceback span.ws { display: none; }
div.traceback pre.before, div.traceback pre.after { display: none; background: white; }
div.traceback div.source.expanded pre.before,
div.traceback div.source.expanded pre.after {
display: block;
}
div.traceback div.source.expanded span.ws {
display: inline;
}
div.traceback blockquote { margin: 1em 0 0 0; padding: 0; white-space: pre-line; }
div.traceback img { float: right; padding: 2px; margin: -3px 2px 0 0; display: none; }
div.traceback img:hover { background-color: #ddd; cursor: pointer;
border-color: #BFDDE0; }
div.traceback pre:hover img { display: block; }
div.traceback cite.filename { font-style: normal; color: #3B666B; }
pre.console { border: 1px solid #ccc; background: white!important;
color: black; padding: 5px!important;
margin: 3px 0 0 0!important; cursor: default!important;
max-height: 400px; overflow: auto; }
pre.console form { color: #555; }
pre.console input { background-color: transparent; color: #555;
width: 90%; font-family: monospace; font-size: 14px;
border: none!important; }
span.string { color: #30799B; }
span.number { color: #9C1A1C; }
span.help { color: #3A7734; }
span.object { color: #485F6E; }
span.extended { opacity: 0.5; }
span.extended:hover { opacity: 1; }
a.toggle { text-decoration: none; background-repeat: no-repeat;
background-position: center center;
background-image: url(?__debugger__=yes&cmd=resource&f=more.png); }
a.toggle:hover { background-color: #444; }
a.open { background-image: url(?__debugger__=yes&cmd=resource&f=less.png); }
pre.console div.traceback,
pre.console div.box { margin: 5px 10px; white-space: normal;
border: 1px solid #11557C; padding: 10px;
font-family: sans-serif; }
pre.console div.box h3,
pre.console div.traceback h3 { margin: -10px -10px 10px -10px; padding: 5px;
background: #11557C; color: white; }
pre.console div.traceback pre:hover { cursor: default; background: #E8EFF0; }
pre.console div.traceback pre.syntaxerror { background: inherit; border: none;
margin: 20px -10px -10px -10px;
padding: 10px; border-top: 1px solid #BFDDE0;
background: #E8EFF0; }
pre.console div.noframe-traceback pre.syntaxerror { margin-top: -10px; border: none; }
pre.console div.box pre.repr { padding: 0; margin: 0; background-color: white; border: none; }
pre.console div.box table { margin-top: 6px; }
pre.console div.box pre { border: none; }
pre.console div.box pre.help { background-color: white; }
pre.console div.box pre.help:hover { cursor: default; }
pre.console table tr { vertical-align: top; }
div.console { border: 1px solid #ccc; padding: 4px; background-color: #fafafa; }
div.traceback pre, div.console pre {
white-space: pre-wrap; /* css-3 should we be so lucky... */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 ?? */
white-space: -o-pre-wrap; /* Opera 7 ?? */
word-wrap: break-word; /* Internet Explorer 5.5+ */
_white-space: pre; /* IE only hack to re-specify in
addition to word-wrap */
}
div.pin-prompt {
position: absolute;
display: none;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(255, 255, 255, 0.8);
}
div.pin-prompt .inner {
background: #eee;
padding: 10px 50px;
width: 350px;
margin: 10% auto 0 auto;
border: 1px solid #ccc;
border-radius: 2px;
}
div.exc-divider {
margin: 0.7em 0 0 -1em;
padding: 0.5em;
background: #11557C;
color: #ddd;
border: 1px solid #ddd;
}
.console.active {
max-height: 0!important;
display: none;
}
.hidden {
display: none;
}
const app = Vue.createApp({
data() {
return {
firstName: 'John',
lastName: 'Doe',
email: 'john@gmail.com',
gender: 'male',
picture: 'https://randomuser.me/api/portraits/men/10.jpg',
}
},
methods: {
async getUser() {
const res = await fetch('https://randomuser.me/api')
const { results } = await res.json()
// console.log(results)
// global scope.
this.firstName = results[0].name.first
this.lastName = results[0].name.last
this.email = results[0].email
this.gender = results[0].gender
this.picture = results[0].picture.large
},
},
compilerOptions: {
delimiters: ["[[", "]]"]
},
})
app.mount('#app')
div id="app">
<img v-bind:src="picture"
:alt="`${firstName} ${lastName}`"
:class="gender"/>
<h1>[[firstName]] [[lastName]]</h1>
<h3>Email: [[email]]</h3>
<button :class="gender" @click="getUser()">Get Random User</button>
[[ lastName ]]
</div>
<script src="https://unpkg.com/vue@next"></script>
<script src="/app.js"></script>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Unitgrade Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<script src="https://unpkg.com/xterm@4.11.0/lib/xterm.js"></script>
<script src="https://unpkg.com/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
<script src="https://unpkg.com/xterm-addon-web-links@0.4.0/lib/xterm-addon-web-links.js"></script>
<script src="https://unpkg.com/xterm-addon-search@0.8.0/lib/xterm-addon-search.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
</head>
<body>
{% block head %} {% endblock %}
{% block content %}
{% endblock %}
</body>
</html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>pyxterm.js</title>
<style>
html {
font-family: arial;
}
</style>
<link
rel="stylesheet"
href="https://unpkg.com/xterm@4.11.0/css/xterm.css"
/>
</head>
<body>
<span style="font-size: 1.4em">pyxterm.js</span>&nbsp;&nbsp;&nbsp;
<span style="font-size: small"
>status:
<span style="font-size: small" id="status">connecting...</span></span
>
<div style="width: 100%; height: calc(100% - 50px)" id="terminal"></div>
<div style="width: 50%; height: calc(20%)" id="term2">another terminal</div>
<p style="text-align: right; font-size: small">
built by <a href="https://chadsmith.dev">Chad Smith</a>
<a href="https://github.com/cs01">GitHub</a>
</p>
<!-- xterm -->
<script src="https://unpkg.com/xterm@4.11.0/lib/xterm.js"></script>
<script src="https://unpkg.com/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
<script src="https://unpkg.com/xterm-addon-web-links@0.4.0/lib/xterm-addon-web-links.js"></script>
<script src="https://unpkg.com/xterm-addon-search@0.8.0/lib/xterm-addon-sear
ch.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
<script>
const term = new Terminal({
cursorBlink: true,
macOptionIsMeta: true,
scrollback: 300,
});
// https://github.com/xtermjs/xterm.js/issues/2941
const fit = new FitAddon.FitAddon();
term.loadAddon(fit);
term.loadAddon(new WebLinksAddon.WebLinksAddon());
term.loadAddon(new SearchAddon.SearchAddon());
term.open(document.getElementById("terminal"));
fit.fit();
term.resize(15, 50);
console.log(`size: ${term.cols} columns, ${term.rows} rows`);
fit.fit();
term.writeln("Welcome to pyxterm.js!");
term.writeln("https://github.com/cs01/pyxterm.js");
term.onData((data) => {
console.log("key pressed in browser:", data);
socket.emit("pty-input", { input: data });
});
{% extends 'base.html' %}
const socket = io.connect("/pty");
const status = document.getElementById("status");
{% macro build_question_body(hi) %}
{{hi}}
{% endmacro %}
{% block head %}
<script language="javascript">
const socket = io.connect("/status"); // Status of the tests.
// const status = document.getElementById("status");
/**
socket.of("/admin").on("state", function (data) {
console.log("new output received from server:", data.output);
term.write(data.output);
});
socket.on("pty-output", function (data) {
socket.on("update", function (data) {
console.log("new output received from server:", data.output);
term.write(data.output);
});
socket.on('test_update', function (data){
console.log('test got some new stuff');
});
socket.on("connect", () => {
fitToscreen();
status.innerHTML =
......@@ -77,12 +37,12 @@ ch.js"></script>
});
function fitToscreen() {
fit.fit();
//fit.fit();
const dims = { cols: term.cols, rows: term.rows };
console.log("sending new dimensions to server's pty", dims);
socket.emit("resize", dims);
}
**/
function debounce(func, wait_ms) {
let timeout;
return function (...args) {
......@@ -92,30 +52,90 @@ ch.js"></script>
};
}
const wait_ms = 50;
window.onresize = debounce(fitToscreen, wait_ms);
</script>
<script>
const term2 = new Terminal({
cursorBlink: true,
macOptionIsMeta: true,
scrollback: true,
function reconnect(){
console.log("hi world");
socket.emit("reconnected", {'hello': 'world'});
$('#status').innerHTML = '<span style="background-color: lightgreen;">connected tp tje server.</span>';
$("#status").css("background-color", "lightgreen");
$("#status").text('Connected')
console.log("changed html");
/**
socket.on("connect", () => {
fitToscreen();
status.innerHTML =
'<span style="background-color: lightgreen;">connected</span>';
});
// https://github.com/xtermjs/xterm.js/issues/2941
const fit2 = new FitAddon.FitAddon();
term2.loadAddon(fit2);
term2.loadAddon(new WebLinksAddon.WebLinksAddon());
term2.loadAddon(new SearchAddon.SearchAddon());
term2.open(document.getElementById("term2"));
fit2.fit();
term2.resize(15, 50);
console.log(`size: ${term.cols} columns, ${term.rows} rows`);
fit2.fit();
term2.writeln("Welcome to pyxterm.js!");
term2.writeln("https://github.com/cs01/pyxterm.js");
**/
}
const wait_ms = 50;
// window.onresize = debounce(fitToscreen, wait_ms);
//reconnect();
window.onload = debounce(reconnect, wait_ms);
</script>
{% endblock %}
{% block content %}
<nav class="navbar navbar-dark bg-dark">
<!--
<a class="navbar-brand" href="#">Navbar</a>-->
<span class="navbar-brand mb-0 h3">Unitgrade <i class="bi bi-emoji-heart-eyes-fill"></i></span>
<form class="form-inline">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">@</span>
</div>
<input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1" value="{{jobdir}}">
</div>
</form>
<span class="navbar-brand mb-0 h2" id="status">Status</span>
<h3> stuff here.</h3>
{% block title %}<h3>Test results</h3>{% endblock %}
<p>{{jobdir}}</p>
<!-- Navbar content -->
</nav>
<div id="status"></div>
</body>
</html>
\ No newline at end of file
<div class="accordion" id="questions">
{% for qkey, qbody in questions.items() %}
<div class="accordion-item">
<h2 class="accordion-header" id="{{qkey}}-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#{{qkey}}-collapse" aria-expanded="true" aria-controls="{{qkey}}-collapse">
{{qbody.title}}: Accordion Item #1 <span class="glyphicon glyphicon-star" aria-hidden="true"> das sdafsdf</span> Star
</button>
</h2>
</div>
<div id="{{qkey}}-collapse" class="accordion-collapse collapse show" aria-labelledby="{{qkey}}-header">
<div class="accordion-body">
<!-- Begin question body -->
<strong>This is the first item's accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
<div class="accordion" id="{{qkey}}-tests">
{% for ikey, ibody in qbody.tests.items() %}
<div class="accordion-item">
<h2 class="accordion-header" id="{{ikey}}-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#{{ikey}}-collapse" aria-expanded="true" aria-controls="{{ikey}}-collapse">
{{ ibody.title }}: Accordion Item #1 <span class="glyphicon glyphicon-star" aria-hidden="true"> das sdafsdf</span> Star
</button>
</h2>
</div>
<div id="{{ikey}}-collapse" class="accordion-collapse collapse show" aria-labelledby="{{ikey}}-header">
<div class="accordion-body">
<!-- Begin item body-->
<strong>This is the first item's accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
<!-- End item body -->
</div>
</div>
{% endfor %}
</div>
<!-- End question body -->
</div>
</div>
{% endfor %}
</div>
{% endblock %}
<html lang="en">
<head>
<meta charset="utf-8" />
<title>pyxterm.js</title>
<style>
html {
font-family: arial;
}
</style>
<link
rel="stylesheet"
href="https://unpkg.com/xterm@4.11.0/css/xterm.css"
/>
</head>
<body>
<span style="font-size: 1.4em">pyxterm.js</span>&nbsp;&nbsp;&nbsp;
<span style="font-size: small"
>status:
<span style="font-size: small" id="status">connecting...</span></span
>
<div style="width: 100%; height: calc(100% - 50px)" id="terminal"></div>
<div style="width: 50%; height: calc(20%)" id="term2">another terminal</div>
<p style="text-align: right; font-size: small">
built by <a href="https://chadsmith.dev">Chad Smith</a>
<a href="https://github.com/cs01">GitHub</a>
</p>
<!-- xterm -->
<script src="https://unpkg.com/xterm@4.11.0/lib/xterm.js"></script>
<script src="https://unpkg.com/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
<script src="https://unpkg.com/xterm-addon-web-links@0.4.0/lib/xterm-addon-web-links.js"></script>
<script src="https://unpkg.com/xterm-addon-search@0.8.0/lib/xterm-addon-sear
ch.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
<script>
const term = new Terminal({
cursorBlink: true,
macOptionIsMeta: true,
scrollback: 300,
});
// https://github.com/xtermjs/xterm.js/issues/2941
const fit = new FitAddon.FitAddon();
term.loadAddon(fit);
term.loadAddon(new WebLinksAddon.WebLinksAddon());
term.loadAddon(new SearchAddon.SearchAddon());
term.open(document.getElementById("terminal"));
fit.fit();
term.resize(15, 50);
console.log(`size: ${term.cols} columns, ${term.rows} rows`);
fit.fit();
term.writeln("Welcome to pyxterm.js!");
term.writeln("https://github.com/cs01/pyxterm.js");
term.onData((data) => {
console.log("key pressed in browser:", data);
socket.emit("pty-input", { input: data });
});
const socket = io.connect("/pty");
const status = document.getElementById("status");
socket.on("pty-output", function (data) {
console.log("new output received from server:", data.output);
term.write(data.output);
});
socket.on("connect", () => {
fitToscreen();
status.innerHTML =
'<span style="background-color: lightgreen;">connected</span>';
});
socket.on("disconnect", () => {
status.innerHTML =
'<span style="background-color: #ff8383;">disconnected</span>';
});
function fitToscreen() {
fit.fit();
const dims = { cols: term.cols, rows: term.rows };
console.log("sending new dimensions to server's pty", dims);
socket.emit("resize", dims);
}
function debounce(func, wait_ms) {
let timeout;
return function (...args) {
const context = this;
clearTimeout(timeout);
timeout = setTimeout(() => func.apply(context, args), wait_ms);
};
}
const wait_ms = 50;
window.onresize = debounce(fitToscreen, wait_ms);
</script>
<script>
const term2 = new Terminal({
cursorBlink: true,
macOptionIsMeta: true,
scrollback: true,
});
// https://github.com/xtermjs/xterm.js/issues/2941
const fit2 = new FitAddon.FitAddon();
term2.loadAddon(fit2);
term2.loadAddon(new WebLinksAddon.WebLinksAddon());
term2.loadAddon(new SearchAddon.SearchAddon());
term2.open(document.getElementById("term2"));
fit2.fit();
term2.resize(15, 50);
console.log(`size: ${term.cols} columns, ${term.rows} rows`);
fit2.fit();
term2.writeln("Welcome to pyxterm.js!");
term2.writeln("https://github.com/cs01/pyxterm.js");
</script>
</body>
</html>
\ No newline at end of file
{% extends 'sidebar.html' %}
{% macro build_question_body(hi) %}
{{hi}}
{% endmacro %}
{% block head %}
{% endblock %}
{% block content %}
<div class="tab-content" id="main_page_tabs">
<script>
var terminals = {};
</script>
{% set count=0 %}
{% for qkey, qbody in questions.items() %}
{% set outer_loop = loop %}
{% for ikey, ibody in qbody.tests.items() %}
<script>terminals["{{ikey}}"] = null; </script>
<div class="tab-pane fade {{ 'show active' if outer_loop.index == 1 and loop.index == 1 else ''}}" id="{{ikey}}-pane" role="tabpanel" aria-labelledby="{{ikey}}-pane-tab">
<!-- begin tab card -->
<h1>{{qbody.title}}</h1>
<h4>
<span class="{{ikey}}-status">
<span id="{{ikey}}-status"><i id="{{ikey}}-icon" class="bi bi-emoji-neutral"></i><span class="text-left">{{ibody.title}}</span></span>
</span>
<a onclick="re_run_test('{{ikey}}');" type="button" class="btn btn-primary">Rerun</a>
</h4>
<div class="card shadow mb-3 bg-white rounded">
<div class="card-header">
Terminal Output
</div>
<div class="card-body">
<p class="card-text">
<div style="width: 100%; height: 20%" id="{{ikey}}"></div>
</p>
</div>
</div>
<div class="row">
<div class="col-sm-8">
<div class="card shadow mb-5 bg-white rounded">
<div class="card-header">Test outcome</div>
<div class="card-body">
<div id="{{ikey}}-stacktrace">{{ibody.wz}}</div>
<!-- <a href="#" class="btn btn-primary">Go somewhere</a> -->
</div>
</div>
</div>
<div class="col-sm-4">
<div class="card shadow mb-5 bg-white rounded">
<div class="card-header"> Hints </div>
<div class="card-body">
<dl>
{% for h in ibody.hints %}
<dt>{% if not h[1] %} Overall hints: {% else %} From the file <emph>{{ h[1] }}</emph> {% endif %}</dt>
<dd>
<ul>
{% for hitem in h[0] %}
<li>{{hitem}}</li>
{% endfor %}
</ul>
</dd>
{% endfor %}
</dl>
<!--
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
-->
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
<div class="tab-pane fade" id="token-pane" role="tabpanel" aria-labelledby="token-pane-tab">
<div class="row">
<div class="col-sm-2"> </div>
<div class="col-sm-8">
<div class="card shadow mb-5 bg-white rounded">
<div class="card-header">Your submission</div>
<div class="card-body">
{% for qkey, qbody in questions.items() %}
<h6> {{qbody.title}}</h6>
<table class="table table-hover" style="td-height: 10px;">
<thead>
<tr>
<td>Test</td>
<td>Unittests result</td>
<td><code>.token</code>-file result</td>
</tr>
</thead>
{% for ikey, ibody in qbody.tests.items() %}
<tr style="line-height: 10px; height: 10px;">
<td class="table-success" id="tbl-{{ikey}}-title">{{ibody.title}} </td>
<td class="table-danger" id="tbl-{{ikey}}-unit">pass</td>
<td id="tbl-{{ikey}}-token">fail</td>
</tr>
<!--
<div class="tab-pane fade" id="{{ikey}}-pane" role="tabpanel" aria-labelledby="{{ikey}}-pane-tab">
-->
<!-- begin tab card -->
<!--
<h1>{{qbody.title}}</h1>-->
{% endfor %}
</table>
{% endfor %}
<h5>Hand-in instructions:</h5>
<p>
To hand in your results, you should run the file <code>{{grade_script}}</code>. You can either do this from your IDE, or by going to the directory:
<pre>
<code>{{root_dir}}</code>
</pre>
and from there run the command:<pre><code>
{{run_cmd_grade}}</code>
</pre>
This will generate a <code>.token</code> file which contains your answers and you should upload to DTU learn.
</p>
</div>
</div>
</div>
<div class="col-sm-2"> </div>
</div>
</div>
{% endblock %}
{% block navigation %}
<span class="test-running"></span>
<span role="tablist" aria-orientation="vertical">
<ul class="list-unstyled ps-0">
{% for qkey, qbody in questions.items() %}
{% set outer_loop = loop %}
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#{{qkey}}-collapse" aria-expanded="true" >
{{qbody.title}} </button>
<div class="collapse show" id="{{qkey}}-collapse">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
{% for ikey, ibody in qbody.tests.items() %}
<li>
<div class="container" style="">
<div class="row" style="background-color: white;">
<div class="col col-lg-11 text-truncate" style="background-color: white;">
<button class="btn rounded collapsed nav-link {{ 'active' if outer_loop.index == 1 and loop.index == 1 else ''}} text-left" style="width: 100%;" id="{{ikey}}-pane-tab" data-bs-toggle="pill" data-bs-target="#{{ikey}}-pane" type="button" role="tab" aria-controls="{{ikey}}-pane" aria-selected="false" data-toggle="tab">
<span class="{{ikey}}-status">
<span id="{{ikey}}-status"><i id="{{ikey}}-icon" class="bi bi-emoji-neutral"></i><span class="text-left">{{ibody.title}}</span></span>
</span>
</button>
</div>
<div class="col col-lg-auto" style="padding: 0px; backgrund-color: white;">
<a onclick="re_run_test('{{ikey}}');" type="button" class="btn btn-primary btn-sm" style="padding: 0px; margin: 0px;"><i class="bi bi-arrow-clockwise"></i></a>
</div>
</div>
</div>
<!--
<button class="nav-link" id="v-pills-settings-tab" data-bs-toggle="pill" data-bs-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</button>
-->
</li>
{% endfor %} <!--
<li><a href="#" class="link-dark rounded">Updates</a></li>
<li><a href="#" class="link-dark rounded">Reports</a></li> -->
</ul>
</div>
</li>
{% endfor %}
</ul>
<hr/>
<button class="btn btn-success" style="width: 100%;" id="token-pane-tab" data-bs-toggle="pill" data-bs-target="#token-pane" type="button" role="tab" aria-controls="token-pane" aria-selected="false" data-toggle="tab">
Submit results
</button>
</span>
{% endblock %}
\ No newline at end of file
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#dashboard-collapse" aria-expanded="false">
Dashboard
</button>
<div class="collapse" id="dashboard-collapse">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
<li><a href="#" class="link-dark rounded">Overview</a></li>
<li><a href="#" class="link-dark rounded">Weekly</a></li>
<li><a href="#" class="link-dark rounded">Monthly</a></li>
<li><a href="#" class="link-dark rounded">Annually</a></li>
</ul>
</div>
</li>
\ No newline at end of file
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<meta name="description" content="">
<meta name="author" content="Tue Herlau">
<meta name="generator" content="Unitgrade">
<title>Unitgrade dashboard</title>
<link rel="canonical" href="https://getbootstrap.com/docs/5.0/examples/sidebars/">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<script src="https://unpkg.com/xterm@4.11.0/lib/xterm.js"></script>
<script src="https://unpkg.com/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
<script src="https://unpkg.com/xterm-addon-web-links@0.4.0/lib/xterm-addon-web-links.js"></script>
<script src="https://unpkg.com/xterm-addon-search@0.8.0/lib/xterm-addon-search.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<!-- terminal related -->
<link rel="stylesheet" href="https://unpkg.com/xterm@4.11.0/css/xterm.css"/>
<script src="https://unpkg.com/xterm@4.11.0/lib/xterm.js"></script>
<script src="https://unpkg.com/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
<script src="https://unpkg.com/xterm-addon-web-links@0.4.0/lib/xterm-addon-web-links.js"></script>
<script src="https://unpkg.com/xterm-addon-search@0.8.0/lib/xterm-addon-search.js"></script>
<!-- end terminal related -->
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
<!-- Custom styles for this template -->
<link href="static/sidebars.css" rel="stylesheet">
<link href="static/wz_style_modified.css" rel="stylesheet">
<script>
var CONSOLE_MODE = false,
EVALEX = false, // console mode is possible.
EVALEX_TRUSTED = true,
SECRET = "Xbtn32ZR6AqRabFk2a3l";
</script>
<link href="static/unitgrade.css" rel="stylesheet">
</head>
<body>
<main>
<div class="flex-shrink-0 p-3 bg-white" style="width: 280px;">
<a href="/" class="d-flex align-items-center pb-3 mb-3 link-dark text-decoration-none border-bottom">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi me-2" width="30" height="24" viewBox="0 0 16 16">
<path d="M8.211 2.047a.5.5 0 0 0-.422 0l-7.5 3.5a.5.5 0 0 0 .025.917l7.5 3a.5.5 0 0 0 .372 0L14 7.14V13a1 1 0 0 0-1 1v2h3v-2a1 1 0 0 0-1-1V6.739l.686-.275a.5.5 0 0 0 .025-.917l-7.5-3.5Z"/>
<path d="M4.176 9.032a.5.5 0 0 0-.656.327l-.5 1.7a.5.5 0 0 0 .294.605l4.5 1.8a.5.5 0 0 0 .372 0l4.5-1.8a.5.5 0 0 0 .294-.605l-.5-1.7a.5.5 0 0 0-.656-.327L8 10.466 4.176 9.032Z"/>
</svg>
<span class="fs-5 fw-semibold"> Unitgrade</span>&nbsp;
<span class="badge rounded-pill bg-success" id="status-connected">Connected</span>
<span class="badge rounded-pill bg-warning text-dark" id="status-connecting">Connecting</span>
</a>
{% block pill %} {% endblock %}
{% block navigation %} {% endblock %}
<!--
<span class="badge rounded-pill bg-primary">Primary</span>
<span class="badge rounded-pill bg-secondary">Secondary</span>
<span class="badge rounded-pill bg-success">Success</span>
<span class="badge rounded-pill bg-danger">Danger</span>
<span class="badge rounded-pill bg-warning text-dark">Warning</span>
<span class="badge rounded-pill bg-info text-dark">Info</span>
<span class="badge rounded-pill bg-light text-dark">Light</span>
<span class="badge rounded-pill bg-dark">Dark</span>
-->
<!--
<ul class="list-unstyled ps-0">
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#home-collapse" aria-expanded="true">
<span class="bi bi-emoji-neutral icon-green"> </span> Home
</button>
<div class="collapse show" id="home-collapse">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
<li><a href="#" class="link-dark rounded">Overview</a></li>
<li><a href="#" class="link-dark rounded">Updates</a></li>
<li><a href="#" class="link-dark rounded">Reports</a></li>
</ul>
</div>
</li>
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#dashboard-collapse" aria-expanded="false">
Dashboard
</button>
<div class="collapse" id="dashboard-collapse">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
<li><a href="#" class="link-dark rounded">Overview</a></li>
<li><a href="#" class="link-dark rounded">Weekly</a></li>
<li><a href="#" class="link-dark rounded">Monthly</a></li>
<li><a href="#" class="link-dark rounded">Annually</a></li>
</ul>
</div>
</li>
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#orders-collapse" aria-expanded="false">
Orders
</button>
<div class="collapse" id="orders-collapse">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
<li><a href="#" class="link-dark rounded">New</a></li>
<li><a href="#" class="link-dark rounded">Processed</a></li>
<li><a href="#" class="link-dark rounded">Shipped</a></li>
<li><a href="#" class="link-dark rounded">Returned</a></li>
</ul>
</div>
</li>
<li class="border-top my-3"></li>
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#account-collapse" aria-expanded="false">
Account
</button>
<div class="collapse" id="account-collapse">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
<li><a href="#" class="link-dark rounded">New...</a></li>
<li><a href="#" class="link-dark rounded">Profile</a></li>
<li><a href="#" class="link-dark rounded">Settings</a></li>
<li><a href="#" class="link-dark rounded">Sign out</a></li>
</ul>
</div>
</li>
</ul>
-->
</div>
<div class="b-example-divider">
{% block content %}
{% endblock %}
<!--
<h1>Subtest 1</h1>
<h4>Test integration and stuff.</h4>
<div class="card shadow mb-3 bg-white rounded">
<div class="card-header">
Terminal Output
</div>
<div class="card-body">
<p class="card-text">
stuff .
{% block terminal %}{% endblock %}
With supporting text below as a natural lead-in to additional content.</p>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="card shadow mb-5 bg-white rounded">
<div class="card-header">
Test outcome
</div>
<div class="card-body">
{% block stacktrace %} {% endblock %}
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="card shadow mb-5 bg-white rounded">
<div class="card-header"> Hints </div>
<div class="card-body">
{% block hints %} {% endblock %}
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
</div>
-->
</div> <!-- example divider ends -->
</main>
<!--
<script src="../assets/dist/js/bootstrap.bundle.min.js"></script> -->
<script src="static/sidebars.js"></script>
<script src="static/unitgrade.js"></script>
<script src="/static/wz_js.js"></script>
</body>
</html>
......@@ -16,8 +16,7 @@
<span style="font-size: 1.4em">pyxterm.js</span>&nbsp;&nbsp;&nbsp;
<span style="font-size: small"
>status:
<span style="font-size: small" id="status">connecting...</span></span
>
<span style="font-size: small" id="status">connecting...</span></span>
<div style="width: 100%; height: calc(100% - 50px)" id="terminal"></div>
......@@ -29,8 +28,7 @@
<script src="https://unpkg.com/xterm@4.11.0/lib/xterm.js"></script>
<script src="https://unpkg.com/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
<script src="https://unpkg.com/xterm-addon-web-links@0.4.0/lib/xterm-addon-web-links.js"></script>
<script src="https://unpkg.com/xterm-addon-search@0.8.0/lib/xterm-addon-sear
ch.js"></script>
<script src="https://unpkg.com/xterm-addon-search@0.8.0/lib/xterm-addon-search.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
<script>
......@@ -60,6 +58,12 @@ ch.js"></script>
const socket = io.connect("/pty");
const status = document.getElementById("status");
socket.of("/admin").on("state", function (data) {
console.log("new output received from server:", data.output);
term.write(data.output);
});
socket.on("pty-output", function (data) {
console.log("new output received from server:", data.output);
term.write(data.output);
......
<!doctype html>
<html lang=en>
<head>
<title>AssertionError
// Werkzeug Debugger</title>
<link rel="canonical" href="https://getbootstrap.com/docs/5.0/examples/sidebars/">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<script src="https://unpkg.com/xterm@4.11.0/lib/xterm.js"></script>
<script src="https://unpkg.com/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.js"></script>
<script src="https://unpkg.com/xterm-addon-web-links@0.4.0/lib/xterm-addon-web-links.js"></script>
<script src="https://unpkg.com/xterm-addon-search@0.8.0/lib/xterm-addon-search.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
<!-- Custom styles for this template -->
<link href="static/sidebars.css" rel="stylesheet">
<link href="static/wz_style.css" rel="stylesheet">
<link href="static/unitgrade.css" rel="stylesheet">
<link rel="stylesheet" href="/static/wz_style_modified.css">
<link rel="shortcut icon"
href="?__debugger__=yes&amp;cmd=resource&amp;f=console.png">
<script src="/static/wz_js.js"></script>
<script>
var CONSOLE_MODE = false,
EVALEX = true,
EVALEX_TRUSTED = true,
SECRET = "Xbtn32ZR6AqRabFk2a3l";
</script>
</head>
<body style="background-color: #fff">
<div class="debugger">
<h1>AssertionError</h1>
<div class="detail">
<p class="errormsg">AssertionError
</p>
</div>
<h2 class="traceback">Traceback <em>(most recent call last)</em></h2>
<div class="traceback">
<h3></h3>
<ul><li><div class="frame" id="frame-140166614937696">
<h4>File <cite class="filename">"/usr/local/lib/python3.10/dist-packages/flask/app.py"</cite>,
line <em class="line">2548</em>,
in <code class="function">__call__</code></h4>
<div class="source library"><pre class="line before"><span class="ws"> </span>def __call__(self, environ: dict, start_response: t.Callable) -&gt; t.Any:</pre>
<pre class="line before"><span class="ws"> </span>&#34;&#34;&#34;The WSGI server calls the Flask application object as the</pre>
<pre class="line before"><span class="ws"> </span>WSGI application. This calls :meth:`wsgi_app`, which can be</pre>
<pre class="line before"><span class="ws"> </span>wrapped to apply middleware.</pre>
<pre class="line before"><span class="ws"> </span>&#34;&#34;&#34;</pre>
<pre class="line current"><span class="ws"> </span>return self.wsgi_app(environ, start_response)</pre></div>
</div>
<li><div class="frame" id="frame-140166595255472">
<h4>File <cite class="filename">"/home/tuhe/.local/lib/python3.10/site-packages/flask_socketio/__init__.py"</cite>,
line <em class="line">43</em>,
in <code class="function">__call__</code></h4>
<div class="source "><pre class="line before"><span class="ws"> </span>socketio_path=socketio_path)</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws"> </span>def __call__(self, environ, start_response):</pre>
<pre class="line before"><span class="ws"> </span>environ = environ.copy()</pre>
<pre class="line before"><span class="ws"> </span>environ[&#39;flask.app&#39;] = self.flask_app</pre>
<pre class="line current"><span class="ws"> </span>return super(_SocketIOMiddleware, self).__call__(environ,</pre>
<pre class="line after"><span class="ws"> </span>start_response)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span>class _ManagedSession(dict, SessionMixin):</pre>
<pre class="line after"><span class="ws"> </span>&#34;&#34;&#34;This class is used for user sessions that are managed by</pre></div>
</div>
<li><div class="frame" id="frame-140166595342432">
<h4>File <cite class="filename">"/home/tuhe/.local/lib/python3.10/site-packages/engineio/middleware.py"</cite>,
line <em class="line">74</em>,
in <code class="function">__call__</code></h4>
<div class="source "><pre class="line before"><span class="ws"> </span>&#39;200 OK&#39;,</pre>
<pre class="line before"><span class="ws"> </span>[(&#39;Content-Type&#39;, static_file[&#39;content_type&#39;])])</pre>
<pre class="line before"><span class="ws"> </span>with open(static_file[&#39;filename&#39;], &#39;rb&#39;) as f:</pre>
<pre class="line before"><span class="ws"> </span>return [f.read()]</pre>
<pre class="line before"><span class="ws"> </span>elif self.wsgi_app is not None:</pre>
<pre class="line current"><span class="ws"> </span>return self.wsgi_app(environ, start_response)</pre>
<pre class="line after"><span class="ws"> </span>return self.not_found(start_response)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"> </span>def not_found(self, start_response):</pre>
<pre class="line after"><span class="ws"> </span>start_response(&#34;404 Not Found&#34;, [(&#39;Content-Type&#39;, &#39;text/plain&#39;)])</pre>
<pre class="line after"><span class="ws"> </span>return [b&#39;Not Found&#39;]</pre></div>
</div>
<li><div class="frame" id="frame-140166595344224">
<h4>File <cite class="filename">"/usr/local/lib/python3.10/dist-packages/flask/app.py"</cite>,
line <em class="line">2528</em>,
in <code class="function">wsgi_app</code></h4>
<div class="source library"><pre class="line before"><span class="ws"> </span>try:</pre>
<pre class="line before"><span class="ws"> </span>ctx.push()</pre>
<pre class="line before"><span class="ws"> </span>response = self.full_dispatch_request()</pre>
<pre class="line before"><span class="ws"> </span>except Exception as e:</pre>
<pre class="line before"><span class="ws"> </span>error = e</pre>
<pre class="line current"><span class="ws"> </span>response = self.handle_exception(e)</pre>
<pre class="line after"><span class="ws"> </span>except: # noqa: B001</pre>
<pre class="line after"><span class="ws"> </span>error = sys.exc_info()[1]</pre>
<pre class="line after"><span class="ws"> </span>raise</pre>
<pre class="line after"><span class="ws"> </span>return response(environ, start_response)</pre>
<pre class="line after"><span class="ws"> </span>finally:</pre></div>
</div>
<li><div class="frame" id="frame-140166595344336">
<h4>File <cite class="filename">"/usr/local/lib/python3.10/dist-packages/flask/app.py"</cite>,
line <em class="line">2525</em>,
in <code class="function">wsgi_app</code></h4>
<div class="source library"><pre class="line before"><span class="ws"> </span>ctx = self.request_context(environ)</pre>
<pre class="line before"><span class="ws"> </span>error: t.Optional[BaseException] = None</pre>
<pre class="line before"><span class="ws"> </span>try:</pre>
<pre class="line before"><span class="ws"> </span>try:</pre>
<pre class="line before"><span class="ws"> </span>ctx.push()</pre>
<pre class="line current"><span class="ws"> </span>response = self.full_dispatch_request()</pre>
<pre class="line after"><span class="ws"> </span>except Exception as e:</pre>
<pre class="line after"><span class="ws"> </span>error = e</pre>
<pre class="line after"><span class="ws"> </span>response = self.handle_exception(e)</pre>
<pre class="line after"><span class="ws"> </span>except: # noqa: B001</pre>
<pre class="line after"><span class="ws"> </span>error = sys.exc_info()[1]</pre></div>
</div>
<li><div class="frame" id="frame-140166595344448">
<h4>File <cite class="filename">"/usr/local/lib/python3.10/dist-packages/flask/app.py"</cite>,
line <em class="line">1822</em>,
in <code class="function">full_dispatch_request</code></h4>
<div class="source library"><pre class="line before"><span class="ws"> </span>request_started.send(self)</pre>
<pre class="line before"><span class="ws"> </span>rv = self.preprocess_request()</pre>
<pre class="line before"><span class="ws"> </span>if rv is None:</pre>
<pre class="line before"><span class="ws"> </span>rv = self.dispatch_request()</pre>
<pre class="line before"><span class="ws"> </span>except Exception as e:</pre>
<pre class="line current"><span class="ws"> </span>rv = self.handle_user_exception(e)</pre>
<pre class="line after"><span class="ws"> </span>return self.finalize_request(rv)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"> </span>def finalize_request(</pre>
<pre class="line after"><span class="ws"> </span>self,</pre>
<pre class="line after"><span class="ws"> </span>rv: t.Union[ft.ResponseReturnValue, HTTPException],</pre></div>
</div>
<li><div class="frame" id="frame-140166595344560">
<h4>File <cite class="filename">"/usr/local/lib/python3.10/dist-packages/flask/app.py"</cite>,
line <em class="line">1820</em>,
in <code class="function">full_dispatch_request</code></h4>
<div class="source library"><pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws"> </span>try:</pre>
<pre class="line before"><span class="ws"> </span>request_started.send(self)</pre>
<pre class="line before"><span class="ws"> </span>rv = self.preprocess_request()</pre>
<pre class="line before"><span class="ws"> </span>if rv is None:</pre>
<pre class="line current"><span class="ws"> </span>rv = self.dispatch_request()</pre>
<pre class="line after"><span class="ws"> </span>except Exception as e:</pre>
<pre class="line after"><span class="ws"> </span>rv = self.handle_user_exception(e)</pre>
<pre class="line after"><span class="ws"> </span>return self.finalize_request(rv)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"> </span>def finalize_request(</pre></div>
</div>
<li><div class="frame" id="frame-140166595344672">
<h4>File <cite class="filename">"/usr/local/lib/python3.10/dist-packages/flask/app.py"</cite>,
line <em class="line">1796</em>,
in <code class="function">dispatch_request</code></h4>
<div class="source library"><pre class="line before"><span class="ws"> </span>and req.method == &#34;OPTIONS&#34;</pre>
<pre class="line before"><span class="ws"> </span>):</pre>
<pre class="line before"><span class="ws"> </span>return self.make_default_options_response()</pre>
<pre class="line before"><span class="ws"> </span># otherwise dispatch to the handler for that endpoint</pre>
<pre class="line before"><span class="ws"> </span>view_args: t.Dict[str, t.Any] = req.view_args # type: ignore[assignment]</pre>
<pre class="line current"><span class="ws"> </span>return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"> </span>def full_dispatch_request(self) -&gt; Response:</pre>
<pre class="line after"><span class="ws"> </span>&#34;&#34;&#34;Dispatches the request and on top of that performs request</pre>
<pre class="line after"><span class="ws"> </span>pre and postprocessing as well as HTTP exception catching and</pre>
<pre class="line after"><span class="ws"> </span>error handling.</pre></div>
</div>
<li><div class="frame" id="frame-140166595344784">
<h4>File <cite class="filename">"/home/tuhe/Documents/unitgrade_private/vue_flask_stuff/server/app.py"</cite>,
line <em class="line">201</em>,
in <code class="function">navbar</code></h4>
<div class="source "><pre class="line before"><span class="ws"> </span>logging.debug(&#34;received input from browser: %s&#34; % data[&#34;input&#34;])</pre>
<pre class="line before"><span class="ws"> </span>os.write(app.config[&#34;fd&#34;], data[&#34;input&#34;].encode())</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws"> </span>@app.route(&#34;/crash&#34;)</pre>
<pre class="line before"><span class="ws"> </span>def navbar():</pre>
<pre class="line current"><span class="ws"> </span>assert False</pre>
<pre class="line after"><span class="ws"> </span># return render_template(&#34;index3.html&#34;)</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws"> </span>@socketio.on(&#34;reconnected&#34;, namespace=&#34;/status&#34;)</pre></div>
</div>
</ul>
<blockquote>AssertionError
</blockquote>
</div>
<div class="plain">
<p>
This is the Copy/Paste friendly version of the traceback.
</p>
<textarea cols="50" rows="10" name="code" readonly>Traceback (most recent call last):
File &#34;/usr/local/lib/python3.10/dist-packages/flask/app.py&#34;, line 2548, in __call__
return self.wsgi_app(environ, start_response)
File &#34;/home/tuhe/.local/lib/python3.10/site-packages/flask_socketio/__init__.py&#34;, line 43, in __call__
return super(_SocketIOMiddleware, self).__call__(environ,
File &#34;/home/tuhe/.local/lib/python3.10/site-packages/engineio/middleware.py&#34;, line 74, in __call__
return self.wsgi_app(environ, start_response)
File &#34;/usr/local/lib/python3.10/dist-packages/flask/app.py&#34;, line 2528, in wsgi_app
response = self.handle_exception(e)
File &#34;/usr/local/lib/python3.10/dist-packages/flask/app.py&#34;, line 2525, in wsgi_app
response = self.full_dispatch_request()
File &#34;/usr/local/lib/python3.10/dist-packages/flask/app.py&#34;, line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File &#34;/usr/local/lib/python3.10/dist-packages/flask/app.py&#34;, line 1820, in full_dispatch_request
rv = self.dispatch_request()
File &#34;/usr/local/lib/python3.10/dist-packages/flask/app.py&#34;, line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File &#34;/home/tuhe/Documents/unitgrade_private/vue_flask_stuff/server/app.py&#34;, line 201, in navbar
assert False
AssertionError
</textarea>
</div>
<div class="explanation">
The debugger caught an exception in your WSGI application. You can now
look at the traceback which led to the error. <span class="nojavascript">
If you enable JavaScript you can also use additional features such as code
execution (if the evalex feature is enabled), automatic pasting of the
exceptions and much more.</span>
</div>
<div class="footer">
Brought to you by <strong class="arthur">DON'T PANIC</strong>, your
friendly Werkzeug powered traceback interpreter.
</div>
</div>
<div class="pin-prompt">
<div class="inner">
<h3>Console Locked</h3>
<p>
The console is locked and needs to be unlocked by entering the PIN.
You can find the PIN printed out on the standard output of your
shell that runs the server.
<form>
<p>PIN:
<input type=text name=pin size=14>
<input type=submit name=btn value="Confirm Pin">
</form>
</div>
</div>
<script src="../assets/dist/js/bootstrap.bundle.min.js"></script>
<script src="static/sidebars.js"></script>
<script src="static/unitgrade.js"></script>
</body>
</html>
<!--
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2548, in __call__
return self.wsgi_app(environ, start_response)
File "/home/tuhe/.local/lib/python3.10/site-packages/flask_socketio/__init__.py", line 43, in __call__
return super(_SocketIOMiddleware, self).__call__(environ,
File "/home/tuhe/.local/lib/python3.10/site-packages/engineio/middleware.py", line 74, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2528, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/home/tuhe/Documents/unitgrade_private/vue_flask_stuff/server/app.py", line 201, in navbar
assert False
AssertionError
import os
from watchdog.events import FileSystemEventHandler
import time
from watchdog.observers import Observer
import datetime
import fnmatch
import os
class Watcher:
# DIRECTORY_TO_WATCH = "/path/to/my/directory"
def __init__(self, base_directory, watched_files_dictionary, watched_files_lock):
self.base_directory = base_directory
self.watched_files_dictionary = watched_files_dictionary
self.watched_files_lock = watched_files_lock
self.observer = Observer()
def run(self):
event_handler = Handler(self.watched_files_dictionary, self.watched_files_lock)
# directory = os.path.commonpath([os.path.dirname(f) for f in self.watched_files_dictionary.keys()])
self.observer.schedule(event_handler, self.base_directory, recursive=True)
self.observer.start()
def close(self):
print("Closing watcher..")
self.observer.stop()
self.observer.join()
print("closed")
def __del__(self):
print("Stopping watcher...")
self.close()
class Handler(FileSystemEventHandler):
def __init__(self, watched_files_dictionary, watched_files_lock):
self.watched_files_dictionary = watched_files_dictionary
self.watched_files_lock = watched_files_lock
super().__init__()
def on_any_event(self, event):
if event.is_directory:
return None
elif event.event_type == 'created' or event.event_type == 'modified':
with self.watched_files_lock:
fnd_ = None
for k in self.watched_files_dictionary:
if fnmatch.fnmatch(event.src_path, k):
fnd_ = k
break
if fnd_ is not None:
self.watched_files_dictionary[fnd_]['last_recorded_change'] = datetime.datetime.now()
self.watched_files_dictionary[fnd_]['file'] = event.src_path
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment