summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/events.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2017-01-04 13:23:07 +0100
committerOliver Poignant <oliver@poignant.se>2017-01-04 13:23:07 +0100
commitc81d62005871d006c4d1feb0c27c15a469f60a35 (patch)
tree1424cc06fb36d47712829687a90a95b2c15644b8 /gitautodeploy/events.py
parent64b5ecd076710fdf0ed0f86fa7fb185caa183ddb (diff)
downloadGit-Auto-Deploy-c81d62005871d006c4d1feb0c27c15a469f60a35.zip
Git-Auto-Deploy-c81d62005871d006c4d1feb0c27c15a469f60a35.tar.gz
Git-Auto-Deploy-c81d62005871d006c4d1feb0c27c15a469f60a35.tar.bz2
Real time updates in web ui when webhooks are processed
Diffstat (limited to 'gitautodeploy/events.py')
-rw-r--r--gitautodeploy/events.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/gitautodeploy/events.py b/gitautodeploy/events.py
index cf777a6..8bbaaa1 100644
--- a/gitautodeploy/events.py
+++ b/gitautodeploy/events.py
@@ -97,9 +97,13 @@ class WebhookAction(SystemEvent):
class StartupEvent(SystemEvent):
- def __init__(self, address=None, port=None):
- self.address = address
- self.port = port
+ def __init__(self, http_address=None, http_port=None, ws_address=None, ws_port=None):
+ self.http_address = http_address
+ self.http_port = http_port
+ self.http_started = False
+ self.ws_address = ws_address
+ self.ws_port = ws_port
+ self.ws_started = False
super(StartupEvent, self).__init__()
def __repr__(self):
@@ -107,8 +111,12 @@ class StartupEvent(SystemEvent):
def dict_repr(self):
data = super(StartupEvent, self).dict_repr()
- data['address'] = self.address
- data['port'] = self.port
+ data['http-address'] = self.http_address
+ data['http-port'] = self.http_port
+ data['http-started'] = self.http_started
+ data['ws-address'] = self.ws_address
+ data['ws-port'] = self.ws_port
+ data['ws-started'] = self.ws_started
return data
@@ -130,12 +138,12 @@ class EventStore(object):
for observer in self.observers:
observer.update(*args, **kwargs)
- def register_action(self, action):
- action.set_id(self.next_id)
- action.register_hub(self)
+ def register_action(self, event):
+ event.set_id(self.next_id)
+ event.register_hub(self)
self.next_id = self.next_id + 1
- self.actions.append(action)
- self.update_observers(action)
+ self.actions.append(event)
+ self.update_observers(event=event)
# Store max 100 actions
if len(self.actions) > 100:
@@ -144,8 +152,8 @@ class EventStore(object):
def notify(self, event):
self.update_observers(event=event)
- def update_action(self, action, message=None):
- self.update_observers(action, message)
+ def update_action(self, event, message=None):
+ self.update_observers(event=event, message=message)
def dict_repr(self):
action_repr = []