mirror of
https://github.com/Doctorado-ML/beflask.git
synced 2025-08-15 15:15:52 +00:00
Finish select benchmark
This commit is contained in:
BIN
app/app.db
BIN
app/app.db
Binary file not shown.
@@ -32,6 +32,9 @@ def index():
|
||||
@main.route("/set_benchmark/<benchmark_id>")
|
||||
@login_required
|
||||
def set_benchmark(benchmark_id):
|
||||
if int(benchmark_id) == current_user.benchmark_id:
|
||||
flash("Benchmark already selected.")
|
||||
return redirect(url_for(INDEX))
|
||||
if current_user.admin:
|
||||
benchmark = Benchmark.query.filter_by(id=benchmark_id).first()
|
||||
if benchmark is None:
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<table id="file-table"
|
||||
class="table table-striped table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<tr class="table-primary">
|
||||
<th>Model</th>
|
||||
<th>Metric</th>
|
||||
<th>Platform</th>
|
||||
|
@@ -1,9 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
{% block styles %}
|
||||
{{ super() }}
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{% include "_table_select.html" %}
|
||||
{% endblock %}
|
||||
{% block jscript %}
|
||||
{{ super() }}
|
||||
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
||||
<script rel="stylesheet"
|
||||
href="https://cdn.datatables.net/1.13.4/js/dataTables.bootstrap5.min.js"></script>
|
||||
<script src="{{ url_for('static', filename="js/select.js") }}"></script>
|
||||
{% endblock %}
|
||||
|
9
app/templates/_benchmarks.html
Normal file
9
app/templates/_benchmarks.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="container col-md-4 col-sm-4 col-lg-offset-4">
|
||||
<h5>Benchmarks</h5>
|
||||
<div class="list-group">
|
||||
{% for benchmark in benchmarks %}
|
||||
<a href="{{ url_for('main.set_benchmark', benchmark_id=benchmark.id) }}"
|
||||
class="list-group-item list-group-item-action {% if benchmark == current_user.benchmark %}active{% endif %}">{{ benchmark.name + " - " + benchmark.description }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
@@ -1,30 +1,35 @@
|
||||
{% from 'bootstrap5/nav.html' import render_nav_item %}
|
||||
<nav class="navbar navbar-expand-sm navbar-dark bg-dark mb-4 justify-content-end">
|
||||
<div class="container">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="{{ url_for("main.index") }}">Benchmark</a>
|
||||
<button class="navbar-toggler"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent"
|
||||
data-bs-target="#navbarToggler"
|
||||
aria-controls="navbarToggler"
|
||||
aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<!-- Left side of navbar -->
|
||||
<ul class="navbar-nav me-auto">
|
||||
{{ render_nav_item('main.index', 'Home') }}
|
||||
</ul>
|
||||
<ul class="navbar-nav justify-content-end">
|
||||
{{ render_nav_item('results.select', 'Results') }}
|
||||
{{ render_nav_item('results.datasets', 'Datasets') }}
|
||||
{{ render_nav_item('main.config', 'Config') }}
|
||||
<div class="collapse navbar-collapse" id="navbarToggler">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
{% if current_user.is_authenticated %}
|
||||
{{ render_nav_item('main.logout', current_user.username + '(Logout) ') }}
|
||||
<li>{{ render_nav_item('main.index', "on " + current_user.benchmark.name) }}</li>
|
||||
{% endif %}
|
||||
<li>{{ render_nav_item('results.select', 'Results') }}</li>
|
||||
<li>{{ render_nav_item('results.datasets', 'Datasets') }}</li>
|
||||
<li>{{ render_nav_item('main.config', 'Config') }}</li>
|
||||
</ul>
|
||||
<div class="navbar-nav justify-content-end">
|
||||
{% if current_user.is_authenticated %}
|
||||
<img src='{{ current_user.avatar(40) }}' height=35 alt="gravatar" />
|
||||
{{ render_nav_item('main.logout',
|
||||
current_user.username + '(Logout) ')|safe }}
|
||||
{% else %}
|
||||
{{ render_nav_item('main.login', 'Login') }}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
@@ -7,6 +7,11 @@
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
{% block styles %}
|
||||
{{ bootstrap.load_css() }}
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/MaterialDesign-Webfont/7.1.96/css/materialdesignicons.css"
|
||||
integrity="sha512-lD1LHcZ8tFHvMFNeo6qOLY/HjzSPCasPJOAoir22byDxlZI1R71S5lZel8zRL2TZ+Dut1wOHfYgSU2lHXuL00w=="
|
||||
crossorigin="anonymous"
|
||||
referrerpolicy="no-referrer" />
|
||||
<link rel="stylesheet"
|
||||
href="{{ url_for('static', filename='css/main.css') }}">
|
||||
{% endblock %}
|
||||
@@ -14,7 +19,7 @@
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% include "_nav.html" %}
|
||||
<div class="container-fluid">{% include "_nav.html" %}</div>
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
@@ -25,7 +30,7 @@
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<div class="container">
|
||||
<div class="container-fluid">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
|
@@ -1,16 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% if benchmarks %}
|
||||
<h5>Benchmarks</h5>
|
||||
<ul>
|
||||
{% for benchmark in benchmarks %}
|
||||
<li>
|
||||
<a href="{{ url_for('main.set_benchmark', benchmark_id=benchmark.id) }}">{{ benchmark.name }}
|
||||
{% if benchmark == current_user.benchmark %}*{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% include "_benchmarks.html" %}
|
||||
{% else %}
|
||||
<img src="{{ url_for('static', filename='img/robert-lukeman-_RBcxo9AU-U-unsplash.jpg') }}"
|
||||
class="img-fluid"
|
||||
|
@@ -1,6 +1,8 @@
|
||||
{% extends 'base.html' %}
|
||||
{% from 'bootstrap5/form.html' import render_form %}
|
||||
{% block content %}
|
||||
<h2>Login</h2>
|
||||
{{ render_form(form) }}
|
||||
<div class="col-md-3 col-lg-offset-4">
|
||||
<h2>Login</h2>
|
||||
{{ render_form(form) }}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
Reference in New Issue
Block a user