quick frontend: added progressIdHandler to managed progress id on action result + ignore meta_* action results

This commit is contained in:
Goffi 2015-11-20 01:57:16 +01:00
commit 51a5b7c56f

View file

@ -675,6 +675,10 @@ class QuickApp(object):
def dialogFailure(self, failure):
log.warning(u"Failure: {}".format(failure))
def progressIdHandler(self, progress_id, profile):
"""Callback used when an action result in a progress id"""
log.info(u"Progress ID received: {}".format(progress_id))
def updateAlertsCounter(self):
"""Update the over whole alerts counter
@ -722,6 +726,17 @@ class QuickApp(object):
else:
ui = self.xmlui.create(self, xml_data=xmlui, callback=callback, profile=profile)
ui.show()
try:
progress_id = action_data.pop('progress')
except KeyError:
pass
else:
self.progressIdHandler(progress_id, profile)
# we ignore metadata
action_data = {k:v for k,v in action_data.iteritems() if not k.startswith("meta_")}
if action_data:
raise exceptions.DataError(u"Not all keys in action_data are managed ({keys})".format(keys=', '.join(action_data.keys())))