Console changes
This commit is contained in:
parent
a4c02a062f
commit
0c1936126c
3 changed files with 34 additions and 14 deletions
|
@ -44,7 +44,7 @@
|
||||||
@click="showHugvey(hv)"
|
@click="showHugvey(hv)"
|
||||||
>
|
>
|
||||||
<h1>
|
<h1>
|
||||||
{{ hv.id }}
|
{{ hv.light_id }} <span v-if="hv.id != hv.light_id">(#{{hv.id}})</span>
|
||||||
</h1>
|
</h1>
|
||||||
<div class='status'>{{ hv.status }}</div>
|
<div class='status'>{{ hv.status }}</div>
|
||||||
<div v-if="hv.status != 'off' && hv.status != 'gone' && hv.status != 'loading'">
|
<div v-if="hv.status != 'off' && hv.status != 'gone' && hv.status != 'loading'">
|
||||||
|
|
|
@ -38,11 +38,22 @@ class Panopticon {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeLanguageForAvailable: function(code){
|
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);
|
let el = document.getElementById("change-lang-"+code);
|
||||||
el.classList.add('loading');
|
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) {
|
block: function(hv) {
|
||||||
hv.status = "loading";
|
hv.status = "loading";
|
||||||
|
@ -90,19 +101,27 @@ class Panopticon {
|
||||||
panopticon.updateSelectedHugvey();
|
panopticon.updateSelectedHugvey();
|
||||||
},
|
},
|
||||||
unblockAll: function(){
|
unblockAll: function(){
|
||||||
|
let i = 0;
|
||||||
for(let hv of panopticon.hugveys.hugveys) {
|
for(let hv of panopticon.hugveys.hugveys) {
|
||||||
if(hv.status == 'blocked') {
|
setTimeout(function(){
|
||||||
hv.status = "loading";
|
if(hv.status == 'blocked') {
|
||||||
panopticon.unblock(hv.id)
|
hv.status = "loading";
|
||||||
}
|
panopticon.unblock(hv.id)
|
||||||
|
}
|
||||||
|
}, i * 1000);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
startAll: function(){
|
startAll: function(){
|
||||||
|
let i = 0;
|
||||||
for(let hv of panopticon.hugveys.hugveys) {
|
for(let hv of panopticon.hugveys.hugveys) {
|
||||||
if(hv.status == 'available') {
|
setTimeout(function(){
|
||||||
hv.status = "loading";
|
if(hv.status == 'available') {
|
||||||
panopticon.restart(hv.id)
|
hv.status = "loading";
|
||||||
}
|
panopticon.restart(hv.id)
|
||||||
|
}
|
||||||
|
}, i * 1000);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,8 +110,9 @@ class Timeline{
|
||||||
for(let hv of msg['hugveys']){
|
for(let hv of msg['hugveys']){
|
||||||
console.log(hv['language'], hv['status']);
|
console.log(hv['language'], hv['status']);
|
||||||
let evenOdd = parseInt(hv['id'])%2 ? 'odd': 'even';
|
let evenOdd = parseInt(hv['id'])%2 ? 'odd': 'even';
|
||||||
let availableClass = hv['available'] ? 'is-available' : 'is-not-available'
|
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 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}`})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue