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',
'token': TOKEN,
'chat_id': CHAT_ID,
'level': 'WARNING',
'level': 'ERROR',
}
},
'root': {

View file

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

View file

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

View file

@ -10,12 +10,7 @@ from dirkules.config import staticDir
@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html', error=str(e)), 404
@app.route('/404', methods=['GET'])
def test_404():
abort(404, description="Resource not found")
return render_template('404.html', error=str(e))
@app.route('/', methods=['GET'])
@ -38,6 +33,8 @@ def pools():
@app.route('/pool/<pool>', methods=['GET'])
def pool(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)
return render_template('pool.html', pool=db_pool, health=pool_health)