- Import KBH

- Import BeerXML
- Import REST API
- Migration DB
- Set Default Screen after Start
- Cleanup
This commit is contained in:
Manuel83
2017-07-02 23:52:18 +02:00
parent c2aa5d8141
commit 291f09dcd1
30 changed files with 6519 additions and 120 deletions
+3 -12
View File
@@ -66,16 +66,14 @@ class Step(DBModel):
class StepView(BaseView):
model = Step
def pre_post_callback(self, data):
def _pre_post_callback(self, data):
order = self.model.get_max_order()
data["order"] = 1 if order is None else order + 1
data["state"] = "I"
@route('/sort', methods=["POST"])
def sort_steps(self):
Step.sort(request.json)
cbpi.emit("UPDATE_ALL_STEPS", self.model.get_all())
return ('', 204)
@@ -87,16 +85,12 @@ class StepView(BaseView):
@route('/action/<method>', methods=["POST"])
def action(self, method):
cbpi.cache["active_step"].__getattribute__(method)()
return ('', 204)
@route('/reset', methods=["POST"])
def reset(self):
self.model.reset_all_steps()
#db.session.commit()
self.stop_step()
cbpi.emit("UPDATE_ALL_STEPS", self.model.get_all())
return ('', 204)
@@ -133,7 +127,6 @@ class StepView(BaseView):
return ('', 204)
def init_step(self, step):
cbpi.log_action("Start Step %s" % step.name)
type_cfg = cbpi.cache.get("step_types").get(step.type)
if type_cfg is None:
@@ -146,7 +139,6 @@ class StepView(BaseView):
cfg.update(dict(name=step.name, api=cbpi, id=step.id, timer_end=None, managed_fields=get_manged_fields_as_array(type_cfg)))
instance = type_cfg.get("class")(**cfg)
instance.init()
# set step instance to ache
cbpi.cache["active_step"] = instance
@@ -204,7 +196,6 @@ def init_after_startup():
# step type not found. cant restart step
return
print "STEP SATE......", step.stepstate
cfg = step.stepstate.copy()
cfg.update(dict(api=cbpi, id=step.id, managed_fields=get_manged_fields_as_array(type_cfg)))
instance = type_cfg.get("class")(**cfg)
@@ -213,7 +204,7 @@ def init_after_startup():
@cbpi.initalizer(order=2000)
def init(cbpi):
print "INITIALIZE STEPS MODULE"
StepView.register(cbpi.app, route_base='/api/step')
def get_all():
@@ -225,7 +216,7 @@ def init(cbpi):
cbpi.add_cache_callback("steps", get_all)
@cbpi.backgroundtask(key="step_task", interval=0.1)
def execute_step():
def execute_step(api):
'''
Background job which executes the step
:return: