messages and more

This commit is contained in:
Daniel 2019-04-27 17:29:35 +02:00
parent 2eed31e5f7
commit aa2f789fa5
4 changed files with 70 additions and 13 deletions

View file

@ -19,3 +19,5 @@ SCHEDULER_EXECUTORS = {'default': {'type': 'threadpool', 'max_workers': 3}}
SCHEDULER_JOB_DEFAULTS = {'coalesce': False, 'max_instances': 1}
SCHEDULER_API_ENABLED = True
SECRET_KEY = b'gf3iz3V!R3@Ny!ri'

View file

@ -14,6 +14,7 @@ body {
.tablebox {
width: 50%;
margin: auto;
padding-bottom: 1em;
}
.ui.mymenu.menu {
@ -21,6 +22,10 @@ body {
color: #fff;
}
.buttonspace {
padding-bottom: 0.5em;
}
/*fonts*/
t1 {

View file

@ -1,15 +1,32 @@
{% extends "base.html" %}
{% block title %}Dashboard{% endblock %}
{% block title %}Cleaning{% endblock %}
{% block head %}
{{ super() }}
{% endblock %}
{% block body %}
<div class="ui container">
<a href="{{ url_for('add_cleaning') }}">
<div class="ui primary labeled icon button">
<i class="plus icon"></i> Ordner hinzufügen
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="tablebox">
<div class="ui negative message">
<i class="close icon"></i>
<div class="header">
Ein oder Mehrere Fehler sind aufgetreten
</div>
<ul class="list">
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
</div>
</a>
</div>
{% endif %}
{% endwith %}
<div class="ui container">
<a href="{{ url_for('add_cleaning') }}">
<div class="ui primary labeled icon button">
<i class="plus icon"></i> Job hinzufügen
</div>
</a>
<table class="ui celled fixed table">
<thead>
@ -24,14 +41,38 @@
<tbody>
{% for element in elements %}
<tr>
<td>{{ element.state }}</td>
<td>{{ element.name }}</td>
<td>{{ element.path }}</td>
<td>{{ element.time }}</td>
</tr>
<tr>
<td>{{ element.state }}</td>
<td>{{ element.name }}</td>
<td>{{ element.path }}</td>
<td>{{ element.time }}</td>
<td>
<div class="buttonspace">
<a href="{{ url_for('cleaning', remove=(element.id)) }}">
<div class="ui button">
<i class="plus icon"></i> Job entfernen
</div>
</a></div>
<a href="{{ url_for('cleaning', changestate=(element.id)) }}">
<div class="ui button">
<i class="plus icon"></i> Status ändern
</div>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
$('.message .close')
.on('click', function () {
$(this)
.closest('.message')
.transition('fade')
;
})
;
</script>
{% endblock %}

View file

@ -1,4 +1,4 @@
from flask import Flask, render_template, redirect, request, url_for
from flask import Flask, render_template, redirect, request, url_for, flash
from dirkules import app
import dirkules.driveManagement.driveController as drico
import dirkules.serviceManagement.serviceManager as servMan
@ -38,6 +38,15 @@ def partitions(part):
@app.route('/cleaning', methods=['GET'])
def cleaning():
remove = request.args.get('remove')
changestate = request.args.get('changestate')
if not(remove is not None and changestate is not None):
if remove is not None:
print("remove")
elif changestate is not None:
print("change")
else:
flash("Auswahl nicht eindeutig!")
elements = []
for element in Cleaning.query.order_by(asc(Cleaning.name)).all():
elements.append(viewManager.db_object_as_dict(element))