Added report generation page

This commit is contained in:
Gregory Ballantine 2024-06-03 12:25:29 -04:00
parent de01e4b144
commit 27c9267261
4 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,22 @@
<?php
namespace BitGoblin\Colossus\Controllers;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Routing\RouteContext;
use Slim\Views\Twig;
use BitGoblin\Colossus\Models\Benchmark;
class ResultController extends Controller {
public function getGenerate(Request $request, Response $response): Response {
$benchmarks = Benchmark::get();
$view = Twig::fromRequest($request);
return $view->render($response, 'reports/generate.twig', [
'benchmarks' => $benchmarks,
]);
}
}

View File

@ -30,3 +30,7 @@ $app->group('/test', function(RouteCollectorProxy $group) {
$app->group('/result', function(RouteCollectorProxy $group) { $app->group('/result', function(RouteCollectorProxy $group) {
$group->post('/add', '\\BitGoblin\\Colossus\\Controllers\\ResultController:postAdd')->setName('result.add'); $group->post('/add', '\\BitGoblin\\Colossus\\Controllers\\ResultController:postAdd')->setName('result.add');
}); });
$app->group('/reports', function(RouteCollectorProxy $group) {
$group->get('/generate', '\\BitGoblin\\Colossus\Controllers\ReportController:getGenerate')->setName('reports.generate');
});

View File

@ -6,6 +6,7 @@
<li><a href="{{ url_for('benchmark.list') }}">Benchmarks</a></li> <li><a href="{{ url_for('benchmark.list') }}">Benchmarks</a></li>
<li><a href="{{ url_for('component.list') }}">Components</a></li> <li><a href="{{ url_for('component.list') }}">Components</a></li>
<li><a href="{{ url_for('test.list') }}">Test</a></li> <li><a href="{{ url_for('test.list') }}">Test</a></li>
<li><a href="{{ url_for('reports.generate') }}">Reports</a></li>
</ul> </ul>
</nav> </nav>

View File

@ -0,0 +1,33 @@
{% extends 'layout.twig' %}
{% block title %}Dashboard{% endblock %}
{% block content %}
<div class="row">
<div class="twelve columns">
<h1>Generate a Report</h1>
</div>
</div>
<hr>
<div class="row">
<div class="five columns">
<select id="report-benchmarks" class="u-full-width">
{% for b in benchmarks %}
<option value="{{ b.id }}">{{ b.name }}</option>
{% endfor %}
</select>
</div>
<div class="seven columns">
<select id="report-tests" class="u-full-width" multiple>
{% for t in benchmarks[0].tests %}
<option value="{{ t.id }}">{{ t.title }}</option>
{% endfor %}
</select>
</div>
</div>
{% endblock %}