Started conversion to bootstrap for the frontend framework
This commit is contained in:
@ -1,19 +1,17 @@
|
||||
const testId = $("#results-table").data("test-id");
|
||||
|
||||
$(function () {
|
||||
$("#test-result-form").on("submit", function (e) {
|
||||
e.preventDefault();
|
||||
$("#test-result-form").on("submit", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const form = $(this);
|
||||
const formData = form.serialize();
|
||||
const benchmarkId = form.find('[name="result_benchmark"]').val();
|
||||
const form = $(this);
|
||||
const formData = form.serialize();
|
||||
const benchmarkId = form.find('[name="result_benchmark"]').val();
|
||||
|
||||
$.post("/api/v1/result/add", formData, function (response) {
|
||||
if (response === "success") {
|
||||
fetchTestBenchmarkResults(testId, benchmarkId);
|
||||
form[0].reset();
|
||||
}
|
||||
});
|
||||
$.post("/api/v1/result/add", formData, function (response) {
|
||||
if (response === "success") {
|
||||
fetchTestBenchmarkResults(testId, benchmarkId);
|
||||
form[0].reset();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -75,8 +73,10 @@ async function fetchTestBenchmarkResults(testId, benchmarkId) {
|
||||
}
|
||||
}
|
||||
|
||||
$("#results-table tbody tr").each(function (index, tr) {
|
||||
const benchmarkId = $(tr).data("benchmark-id");
|
||||
console.log("Fetching results for benchmark id: " + benchmarkId);
|
||||
fetchTestBenchmarkResults(testId, benchmarkId);
|
||||
$(document).ready(function() {
|
||||
$("#results-table tbody tr").each(function (index, tr) {
|
||||
const benchmarkId = $(tr).data("benchmark-id");
|
||||
console.log("Fetching results for benchmark id: " + benchmarkId);
|
||||
fetchTestBenchmarkResults(testId, benchmarkId);
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
$primary-color: teal;
|
||||
|
||||
body {
|
||||
background: #eee;
|
||||
background: white;
|
||||
}
|
||||
|
@ -5,9 +5,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>{% block title %}{% endblock %} | Leviathan</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/eye.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" charset="utf-8"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.7/js/bootstrap.min.js" charset="utf-8"></script>
|
||||
<script src="/js/scar.js"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
|
@ -1,11 +1,29 @@
|
||||
<nav id="main-nav">
|
||||
<div class="nav-left">
|
||||
<h4>Leviathan</h4>
|
||||
<ul>
|
||||
<li><a href="/">Dashboard</a></li>
|
||||
<li><a href="/test">Tests</a></li>
|
||||
<li><a href="/hardware">Hardware</a></li>
|
||||
<li><a href="/benchmark">Benchmarks</a></li>
|
||||
</ul>
|
||||
<nav id="main-nav" class="navbar navbar-expand-md bg-body-secondary mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand mb-0 h1" href="#">Leviathan</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-md-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/benchmark">Benchmarks</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/hardware">Hardware</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/test">Test</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/report">Reports</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -8,51 +8,47 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<h2>Test: {{ test.title }}</h2>
|
||||
<div class="col-12">
|
||||
<h2>Test: {{ test.title }}</h2>
|
||||
|
||||
<h4>Hardware tested: <a href="/hardware/{{ test.getHardware().id }}">{{ test.getHardware().name }}</a></h4>
|
||||
<h4>Hardware tested: <a href="/hardware/{{ test.getHardware().id }}">{{ test.getHardware().name }}</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<form id="test-result-form" class="twelve columns" action="/api/v1/result/add" method="post">
|
||||
<form id="test-result-form" class="col-12" action="/api/v1/result/add" method="post">
|
||||
<input type="hidden" name="result_test" value="{{ test.id }}">
|
||||
|
||||
<div class="row">
|
||||
<div class="four columns">
|
||||
<label for="result_benchmark">
|
||||
Benchmark:
|
||||
<select class="u-full-width" id="result_benchmark" name="result_benchmark">
|
||||
{% for b in test.getBenchmarks() %}
|
||||
<option value="{{ b.id }}">{{ b.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<div class="col-4">
|
||||
<label class="form-label" for="result_benchmark">Benchmark:</label>
|
||||
<select id="result_benchmark" class="form-select" name="result_benchmark">
|
||||
{% for b in test.getBenchmarks() %}
|
||||
<option value="{{ b.id }}">{{ b.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="two columns">
|
||||
<label for="result_avg">
|
||||
Average:
|
||||
<input type="number" id="result_avg" class="u-full-width" name="result_avg" step="0.01" required>
|
||||
</label>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="result_avg">Average:</label>
|
||||
<input id="result_avg" class="form-control" type="number" name="result_avg" step="0.01" required>
|
||||
</div>
|
||||
|
||||
<div class="two columns">
|
||||
<label for="result_min">
|
||||
Minimum:
|
||||
<input type="number" id="result_min" class="u-full-width" name="result_min" step="0.01">
|
||||
</label>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="result_min">Minimum:</label>
|
||||
<input id="result_min" class="form-control" type="number" name="result_min" step="0.01">
|
||||
</div>
|
||||
|
||||
<div class="two columns">
|
||||
<label for="result_max">
|
||||
Maximum:
|
||||
<input type="number" id="result_max" class="u-full-width" name="result_max" step="0.01">
|
||||
</label>
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="result_max">Maximum:</label>
|
||||
<input id="result_max" class="form-control" type="number" name="result_max" step="0.01">
|
||||
</div>
|
||||
|
||||
<input type="submit" class="two columns" value="Submit">
|
||||
<div class="col-2">
|
||||
<input type="submit" class="btn btn-primary" value="Add Result">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -60,10 +56,10 @@
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
<h3>Benchmarks</h3>
|
||||
<table id="results-table" data-test-id="{{ test.id }}" class="u-full-width">
|
||||
<thead>
|
||||
<div class="col-12">
|
||||
<h3 class="mb-3">Benchmarks</h3>
|
||||
<table id="results-table" class="table table-hover table-responsive" data-test-id="{{ test.id }}">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<td>Benchmark</td>
|
||||
<td>Scoring type</td>
|
||||
|
Reference in New Issue
Block a user