some ui improvements

This commit is contained in:
Daniel 2019-09-12 19:02:06 +02:00
parent 92d6fa244c
commit 91ca317924
4 changed files with 53 additions and 63 deletions

View file

@ -83,7 +83,7 @@ dictConfig({
'formatter': 'telegram', 'formatter': 'telegram',
'token': TOKEN, 'token': TOKEN,
'chat_id': CHAT_ID, 'chat_id': CHAT_ID,
'level': 'WARNING', 'level': 'ERROR',
} }
}, },
'root': { 'root': {

View file

@ -19,9 +19,8 @@ def create_cleaning_obj(jobname, path, active):
def get_pool_health(drive_list): def get_pool_health(drive_list):
drive_split = drive_list.split(",") drive_split = drive_list.split(",")
health = True
for drive in drive_split: for drive in drive_split:
db_drive = db.session.query(Drive).filter(Drive.name == drive).scalar() db_drive = db.session.query(Drive).filter(Drive.name == drive).scalar()
if db_drive.smart is not True: if db_drive.smart is not True:
health = False return False
return health return True

View file

@ -6,15 +6,6 @@
{% block body %} {% block body %}
<div class="topspacer"></div> <div class="topspacer"></div>
<div class="ui container"> <div class="ui container">
<h1 class="ui dividing header">Aktionen</h1>
<div class="ui container">
<a href="{{ url_for('add_pool') }}">
<div class="ui primary labeled icon button">
<i class="plus icon"></i> Neuen Pool erstellen
</div>
</a>
</div>
<h1 class="ui dividing header">Übersicht</h1>
<div class="infobox"> <div class="infobox">
<div class="ui info message"> <div class="ui info message">
<i class="close icon"></i> <i class="close icon"></i>
@ -27,50 +18,53 @@
</p> </p>
</div> </div>
</div> </div>
<div class="ui segment"> <a href="{{ url_for('add_pool') }}">
<table class="ui very basic celled table"> <div class="ui primary labeled icon button">
<thead> <i class="plus icon"></i> Neuen Pool erstellen
<tr> </div>
<th>Name</th> </a>
<th>Größe</th> <table class="ui celled table">
<th>Frei</th> <thead>
<th>Typ</th> <tr>
<th>Dateisystem</th> <th>Name</th>
<th>Mountpoint</th> <th>Größe</th>
<th>Disks</th> <th>Frei</th>
<th>Aktionen</th> <th>Typ</th>
</tr> <th>Dateisystem</th>
</thead> <th>Mountpoint</th>
<th>Disks</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody> <tbody>
{% for pool in pools %} {% for pool in pools %}
<tr> <tr>
<td><i class="download icon"></i> {{ pool.label }}</td> <td><i class="download icon"></i> {{ pool.label }}</td>
<td class="right aligned">{{ pool.size|filesizeformat(true) }}</td> <td class="right aligned">{{ pool.size|filesizeformat(true) }}</td>
{% if pool.free == 2 %} {% if pool.free == 2 %}
<td class="right aligned">unbekannt</td> <td class="right aligned">unbekannt</td>
{% else %} {% else %}
<td class="right aligned">{{ pool.free|filesizeformat(true) }}</td> <td class="right aligned">{{ pool.free|filesizeformat(true) }}</td>
{% endif %} {% endif %}
<td>{{ pool.data_raid }}</td> <td>{{ pool.data_raid }}</td>
<td>{{ pool.fs }}</td> <td>{{ pool.fs }}</td>
{% if pool.mountpoint|length %} {% if pool.mountpoint|length %}
<td>{{ pool.mountpoint }}</td> <td>{{ pool.mountpoint }}</td>
{% else %} {% else %}
<td>nicht eingehängt</td> <td>nicht eingehängt</td>
{% endif %} {% endif %}
<td>{{ pool.drives }}</td> <td>{{ pool.drives }}</td>
<td> <td>
<a href="{{ url_for('pool', pool=(pool.id)) }}" <a href="{{ url_for('pool', pool=(pool.id)) }}"
class="ui primary basic button"> class="ui primary basic button">
<i class="eye icon"></i> <i class="eye icon"></i>
Details Details
</a> </a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -10,12 +10,7 @@ from dirkules.config import staticDir
@app.errorhandler(404) @app.errorhandler(404)
def page_not_found(e): def page_not_found(e):
return render_template('404.html', error=str(e)), 404 return render_template('404.html', error=str(e))
@app.route('/404', methods=['GET'])
def test_404():
abort(404, description="Resource not found")
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])
@ -38,6 +33,8 @@ def pools():
@app.route('/pool/<pool>', methods=['GET']) @app.route('/pool/<pool>', methods=['GET'])
def pool(pool): def pool(pool):
db_pool = Pool.query.get(pool) db_pool = Pool.query.get(pool)
if db_pool is None:
abort(404, description="Pool with ID {} could not be found.".format(pool))
pool_health = viewManager.get_pool_health(db_pool.drives) pool_health = viewManager.get_pool_health(db_pool.drives)
return render_template('pool.html', pool=db_pool, health=pool_health) return render_template('pool.html', pool=db_pool, health=pool_health)