[enh] plug apps page to jobs updates

This commit is contained in:
Laurent Peuch 2018-11-03 19:05:46 +01:00
parent 24c5eb63eb
commit 2e19f5471e
2 changed files with 13 additions and 1 deletions

2
run.py
View file

@ -453,7 +453,7 @@ async def ws_job(request, websocket, job_id):
@app.websocket('/apps-ws') @app.websocket('/apps-ws')
async def ws_apps(request, websocket): async def ws_apps(request, websocket):
# subscribe(websocket, f"job-{job.id}") subscribe(websocket, "jobs")
# I need to do this because peewee strangely fuck up on join and remove the # I need to do this because peewee strangely fuck up on join and remove the
# subquery fields which breaks everything # subquery fields which breaks everything

View file

@ -76,7 +76,19 @@
if (action == "init_apps") { if (action == "init_apps") {
app.apps = data; app.apps = data;
} else if (action == "update_job") {
for (var i = 0; i < app.apps.length; ++i) {
if (app.apps[i].job_id == data.id) {
Vue.set(app.apps[i], 'job_state', data.state);
Vue.set(app.apps[i], 'created_time', data.created_time);
Vue.set(app.apps[i], 'started_time', data.started_time);
Vue.set(app.apps[i], 'end_time', data.end_time);
}
}
} else if (action == "add_job") {
} }
}; };
})() })()
</script> </script>