save sid in html label

This commit is contained in:
Cayo Puigdefabregas 2022-06-08 09:26:09 +02:00
parent 92fafa2358
commit 5932213764
2 changed files with 12 additions and 1 deletions

View file

@ -401,6 +401,12 @@ class Device(Thing):
return history return history
@property
def sid(self):
actions = [x for x in self.actions if x.t == 'Snapshot' and x.sid]
if actions:
return actions[0]
@property @property
def tradings(self): def tradings(self):
return {str(x.id): self.trading(x.lot) for x in self.actions if x.t == 'Trade'} return {str(x.id): self.trading(x.lot) for x in self.actions if x.t == 'Trade'}

View file

@ -35,7 +35,8 @@
<div style="padding-top: 55px"> <div style="padding-top: 55px">
<b class="tag" data-serial-number="{{ dev.serial_number or '' }}" <b class="tag" data-serial-number="{{ dev.serial_number or '' }}"
data-manufacturer="{{ dev.manufacturer or '' }}" data-manufacturer="{{ dev.manufacturer or '' }}"
data-model="{{ dev.model or '' }}">{{ dev.devicehub_id }}</b> data-model="{{ dev.model or '' }}"
data-sid="{{ dev.sid or '' }}">{{ dev.devicehub_id }}</b>
</div> </div>
</div> </div>
</div> </div>
@ -103,6 +104,10 @@
<input class="form-check-input" name="dhid" type="checkbox" id="dhidCheck" checked=""> <input class="form-check-input" name="dhid" type="checkbox" id="dhidCheck" checked="">
<label class="form-check-label" for="dhidCheck">Dhid</label> <label class="form-check-label" for="dhidCheck">Dhid</label>
</div> </div>
<div class="form-switch">
<input class="form-check-input" name="sid" type="checkbox" id="dhidCheck">
<label class="form-check-label" for="dhidCheck">Sid</label>
</div>
<div class="form-switch"> <div class="form-switch">
<input class="form-check-input" name="serial_number" type="checkbox" id="serialNumberCheck"> <input class="form-check-input" name="serial_number" type="checkbox" id="serialNumberCheck">
<label class="form-check-label" for="serialNumberCheck">Serial number</label> <label class="form-check-label" for="serialNumberCheck">Serial number</label>