Start & unblock all buttons

This commit is contained in:
Ruben van de Ven 2019-11-13 12:20:32 +01:00
parent a264ceee51
commit 163b4821f3
2 changed files with 24 additions and 1 deletions

View file

@ -33,6 +33,11 @@
</li>
</ul>
<div class='hvactions'>
<span class='btn' id='unblock-all' @click="unblockAll">Unblock all</span>
<span class='btn' id='start-all' @click="startAll">Start all</span>
</div>
</div>
<div class='hugvey' v-for="hv in hugveys"
:class="[{'hugvey--on': hv.status != 'off'},'hugvey--' + hv.status, 'hugvey--light-' + hv.light_on]"

View file

@ -86,7 +86,25 @@ class Panopticon {
panopticon.hugveys.logbook = [];
panopticon.hugveys.logbookId = null;
panopticon.updateSelectedHugvey();
}
},
unblockAll: function(){
for(let hv of panopticon.hugveys.hugveys) {
console.log(hv, this);
if(hv.status == 'blocked') {
hv.status = "loading";
return panopticon.unblock(hv.id)
}
}
},
startAll: function(){
for(let hv of panopticon.hugveys.hugveys) {
console.log(hv, this);
if(hv.status == 'available') {
hv.status = "loading";
return panopticon.restart(hv.id)
}
}
},
}
} );