Console changes

This commit is contained in:
Ruben van de Ven 2019-11-13 23:43:02 +01:00
parent a4c02a062f
commit 0c1936126c
3 changed files with 34 additions and 14 deletions

View file

@ -44,7 +44,7 @@
@click="showHugvey(hv)"
>
<h1>
{{ hv.id }}
{{ hv.light_id }} <span v-if="hv.id != hv.light_id">(#{{hv.id}})</span>
</h1>
<div class='status'>{{ hv.status }}</div>
<div v-if="hv.status != 'off' && hv.status != 'gone' && hv.status != 'loading'">

View file

@ -38,11 +38,22 @@ class Panopticon {
}
},
changeLanguageForAvailable: function(code){
console.log('TODO: set loader icon for 3 sec', this);
panopticon.send( { action: 'change_language_for_available', lang_code: code } );
let el = document.getElementById("change-lang-"+code);
el.classList.add('loading');
setTimeout(function(){el.classList.remove('loading');}, 3000);
console.log(el);
panopticon.send( { action: 'change_language_for_available', lang_code: code } );
// TODO: loop with a timer
let i = 0;
for(let hv of panopticon.hugveys.hugveys) {
setTimeout(function(){
console.log(hv['available']);
if(hv.hasOwnProperty('available') && hv['available']) {
panopticon.change_language(hv.id, code);
}
}, i * 1000);
i++;
}
setTimeout(function(){el.classList.remove('loading');}, i*1000);
},
block: function(hv) {
hv.status = "loading";
@ -90,19 +101,27 @@ class Panopticon {
panopticon.updateSelectedHugvey();
},
unblockAll: function(){
let i = 0;
for(let hv of panopticon.hugveys.hugveys) {
setTimeout(function(){
if(hv.status == 'blocked') {
hv.status = "loading";
panopticon.unblock(hv.id)
}
}, i * 1000);
i++;
}
},
startAll: function(){
let i = 0;
for(let hv of panopticon.hugveys.hugveys) {
setTimeout(function(){
if(hv.status == 'available') {
hv.status = "loading";
panopticon.restart(hv.id)
}
}, i * 1000);
i++;
}
},
}

View file

@ -110,8 +110,9 @@ class Timeline{
for(let hv of msg['hugveys']){
console.log(hv['language'], hv['status']);
let evenOdd = parseInt(hv['id'])%2 ? 'odd': 'even';
let availableClass = hv['available'] ? 'is-available' : 'is-not-available'
this.dataGroups.update({id: parseInt(hv['id']), content: `<div class='title'>Hugvey #${hv['id']}</div><div class='times'><span>${hv['time_since_hugvey_spoke']}</span><span>${hv['time_since_visitor_spoke']}</span></div>`, className: `status-${hv['status']} ${availableClass} lang-${hv['language']} ${evenOdd}`})
let availableClass = hv['available'] ? 'is-available' : 'is-not-available';
let realHugveyId = hv['id'] == hv['light_id'] ? "" : `(#${hv['id']})`;
this.dataGroups.update({id: parseInt(hv['id']), content: `<div class='title'>Hugvey ${hv['light_id']} ${realHugveyId}</div><div class='times'><span class='${hv['time_since_hugvey_spoke_state']}'>${hv['time_since_hugvey_spoke']}</span><span class='${hv['time_since_visitor_spoke_state']}'>${hv['time_since_visitor_spoke']}</span></div>`, className: `status-${hv['status']} ${availableClass} lang-${hv['language']} ${evenOdd}`})
}
}