mirror of
https://github.com/vale981/dirkules
synced 2025-03-05 17:31: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 in db, update last visited
|
||||||
drive = db.session.query(Drive).filter(Drive.serial == driveObj.serial).scalar()
|
drive = db.session.query(Drive).filter(Drive.serial == driveObj.serial).scalar()
|
||||||
drive.last_update = current_time
|
drive.last_update = current_time
|
||||||
|
if drive.missing:
|
||||||
|
drive.missing = False
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
@ -71,7 +73,11 @@ def getAllDrives():
|
||||||
# check for old entries alias removed drives
|
# check for old entries alias removed drives
|
||||||
# old drive is list element
|
# old drive is list element
|
||||||
old_drives = db.session.query(Drive).filter(Drive.last_update != current_time).all()
|
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)
|
state = db.Column(db.String)
|
||||||
smart = db.Column(db.Boolean)
|
smart = db.Column(db.Boolean)
|
||||||
last_update = db.Column(DateTime)
|
last_update = db.Column(DateTime)
|
||||||
|
missing = db.Column(db.Boolean)
|
||||||
partitions = db.relationship('Partitions', order_by="Partitions.id", backref="drive", lazy="select")
|
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.name = name
|
||||||
self.model = model
|
self.model = model
|
||||||
self.serial = serial
|
self.serial = serial
|
||||||
|
@ -31,6 +32,7 @@ class Drive(db.Model):
|
||||||
self.state = state
|
self.state = state
|
||||||
self.smart = smart
|
self.smart = smart
|
||||||
self.last_update = time
|
self.last_update = time
|
||||||
|
self.missing = missing
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for drive in drives %}
|
{% for drive in drives %}
|
||||||
<tr>
|
<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>{{ drive.model }}</td>
|
||||||
<td class="right aligned">{{ drive.size|filesizeformat(true) }}</td>
|
<td class="right aligned">{{ drive.size|filesizeformat(true) }}</td>
|
||||||
{% if drive.smart %}
|
{% if drive.smart %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue