Show breadcrumbs again on selected Hugvey in interface

This commit is contained in:
Ruben van de Ven 2019-04-08 12:48:59 +02:00
parent c4f55c01c7
commit cc03473361
4 changed files with 11 additions and 11 deletions

View file

@ -100,7 +100,7 @@ class CentralCommand(object):
self.languages[lang['code']] = json.load(fp)
def getHugveyStatus(self, hv_id):
def getHugveyStatus(self, hv_id, isSelected = False):
status = {'id': hv_id}
if not hv_id in self.hugveys:
status['status'] = 'off'
@ -115,13 +115,13 @@ class CentralCommand(object):
status['language'] = hv.language_code
status['msg'] = hv.story.currentMessage.id if hv.story.currentMessage else None
status['finished'] = hv.story.isFinished()
status['history'] = {}
status['history'] = {} if isSelected is False else hv.story.getLogSummary()
# status['history'] = hv.story.getLogSummary() # disabled as it is a bit slow. We now have eventLog
status['counts'] = {t: len(a) for t, a in status['history'].items() if t != 'directions' }
return status
def getStatusSummary(self):
def getStatusSummary(self, selected_id = None):
status = {
'uptime': time.time() - self.start_time,
'languages': self.config['languages'],
@ -130,7 +130,7 @@ class CentralCommand(object):
}
for hv_id in self.hugvey_ids:
status['hugveys'].append(self.getHugveyStatus(hv_id))
status['hugveys'].append(self.getHugveyStatus(hv_id, selected_id == hv_id))
return status

View file

@ -201,7 +201,7 @@ class CommandHandler(object):
self.playPopen = None
if returnCode:
logger.warn("Had returncode on play: {}".format(returnCode))
logger.critical("Had returncode on play: {}".format(returnCode))
else:
logger.debug(
"Finished playback. Return code: {}".format(returnCode))

View file

@ -51,7 +51,7 @@ def getWebSocketHandler(central_command):
if msg['action'] == 'init':
self.msgInit()
elif msg['action'] == 'get_status':
self.msgStatus()
self.msgStatus(msg['selected_id'])
elif msg['action'] == 'resume':
self.msgResume(msg['hugvey'])
elif msg['action'] == 'pause':
@ -80,14 +80,14 @@ def getWebSocketHandler(central_command):
WebSocketHandler.connections.remove(self)
logger.info("Client disconnected")
def getStatusMsg(self):
msg = central_command.getStatusSummary()
def getStatusMsg(self, selected_id = False):
msg = central_command.getStatusSummary(selected_id)
msg['action'] = 'status'
return msg
def msgStatus(self):
self.send(self.getStatusMsg())
def msgStatus(self, selected_id = None):
self.send(self.getStatusMsg(selected_id))
def msgInit(self):
msg = self.getStatusMsg()

View file

@ -233,7 +233,7 @@ class Panopticon {
getStatus() {
// console.log('get status', this, panopticon);
panopticon.send( { action: 'get_status' } );
panopticon.send( { action: 'get_status', selected_id: panopticon.hugveys.selectedId } );
}
init() {