+ STATES = [
+ 'initial',
+ 'loading',
+ 'failed',
+ {
+ 'name': 'loaded',
+ 'children': ['running']
+ }
+ ]
+
+ TRANSITIONS = [
+ {
+ 'trigger': 'load',
+ 'source': 'initial',
+ 'dest': 'loading'
+ },
+ {
+ 'trigger': 'fail',
+ 'source': 'loading',
+ 'dest': 'failed',
+ 'after': 'poll_loaded'
+ },
+ {
+ 'trigger': 'success',
+ 'source': 'loading',
+ 'dest': 'loaded',
+ 'after': 'poll_loaded'
+ },
+ {
+ 'trigger': 'run',
+ 'source': 'loaded',
+ 'dest': 'loaded_running',
+ 'after': 'finish_action',
+ # if a child has no transitions, then it is bubbled to the parent,
+ # and we don't want that. Not useful in that machine precisely.
+ 'conditions': ['is_loaded']
+ },
+ {
+ 'trigger': 'finish_action',
+ 'source': 'loaded_running',
+ 'dest': 'loaded'
+ }
+ ]
+