mirror of
https://github.com/vale981/dirkules
synced 2025-03-05 09:21:38 -05:00
missing drives are shown red in table
This commit is contained in:
parent
4cf598b889
commit
f5e20273e4
3 changed files with 15 additions and 3 deletions
|
@ -61,6 +61,8 @@ def getAllDrives():
|
|||
# drive in db, update last visited
|
||||
drive = db.session.query(Drive).filter(Drive.serial == driveObj.serial).scalar()
|
||||
drive.last_update = current_time
|
||||
if drive.missing:
|
||||
drive.missing = False
|
||||
db.session.commit()
|
||||
pass
|
||||
else:
|
||||
|
@ -71,7 +73,11 @@ def getAllDrives():
|
|||
# check for old entries alias removed drives
|
||||
# old drive is list element
|
||||
old_drives = db.session.query(Drive).filter(Drive.last_update != current_time).all()
|
||||
communicator.old_drive(old_drives[0])
|
||||
if old_drives:
|
||||
for drive in old_drives:
|
||||
drive.missing = True
|
||||
db.session.commit()
|
||||
communicator.old_drive(old_drives)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@ class Drive(db.Model):
|
|||
state = db.Column(db.String)
|
||||
smart = db.Column(db.Boolean)
|
||||
last_update = db.Column(DateTime)
|
||||
missing = db.Column(db.Boolean)
|
||||
partitions = db.relationship('Partitions', order_by="Partitions.id", backref="drive", lazy="select")
|
||||
|
||||
def __init__(self, name, model, serial, size, rota, rm, hotplug, state, smart, time):
|
||||
def __init__(self, name, model, serial, size, rota, rm, hotplug, state, smart, time, missing=False):
|
||||
self.name = name
|
||||
self.model = model
|
||||
self.serial = serial
|
||||
|
@ -31,6 +32,7 @@ class Drive(db.Model):
|
|||
self.state = state
|
||||
self.smart = smart
|
||||
self.last_update = time
|
||||
self.missing = missing
|
||||
|
||||
def __repr__(self):
|
||||
return self.name
|
||||
|
|
|
@ -22,7 +22,11 @@
|
|||
<tbody>
|
||||
{% for drive in drives %}
|
||||
<tr>
|
||||
<td class="collapsing"><i class="hdd icon"></i> {{ drive.name }}</td>
|
||||
{% if drive.missing %}
|
||||
<td class="collapsing error"><i class="attention icon"></i> Laufwerk nicht gefunden: {{ drive.name }}</td>
|
||||
{% else %}
|
||||
<td class="collapsing"><i class="hdd icon"></i> {{ drive.name }}</td>
|
||||
{% endif %}
|
||||
<td>{{ drive.model }}</td>
|
||||
<td class="right aligned">{{ drive.size|filesizeformat(true) }}</td>
|
||||
{% if drive.smart %}
|
||||
|
|
Loading…
Add table
Reference in a new issue