mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[mod] rename 'target' to 'action' in websocket protocol
This commit is contained in:
parent
412fa588cd
commit
6d85d76746
2 changed files with 6 additions and 6 deletions
6
run.py
6
run.py
|
@ -114,7 +114,7 @@ async def jobs_dispatcher():
|
|||
|
||||
async def run_job(worker, job):
|
||||
await broadcast({
|
||||
"target": "job",
|
||||
"action": "job",
|
||||
"data": model_to_dict(job),
|
||||
}, "jobs")
|
||||
|
||||
|
@ -143,7 +143,7 @@ async def run_job(worker, job):
|
|||
worker.save()
|
||||
|
||||
await broadcast({
|
||||
"target": "update_job",
|
||||
"action": "update_job",
|
||||
"id": job.id,
|
||||
"data": model_to_dict(job),
|
||||
}, "jobs")
|
||||
|
@ -172,7 +172,7 @@ async def index_ws(request, websocket):
|
|||
subscribe(websocket, "jobs")
|
||||
|
||||
await websocket.send(ujson.dumps({
|
||||
"target": "init_jobs",
|
||||
"action": "init_jobs",
|
||||
"data": map(model_to_dict, Job.select()),
|
||||
}))
|
||||
|
||||
|
|
|
@ -44,11 +44,11 @@
|
|||
ws.onmessage = function (event) {
|
||||
var message = JSON.parse(event.data);
|
||||
var data = message.data;
|
||||
var target = message.target;
|
||||
var action = message.action;
|
||||
|
||||
if (target == "init_jobs") {
|
||||
if (action == "init_jobs") {
|
||||
app.jobs = data;
|
||||
} else if (target == "update_job") {
|
||||
} else if (action == "update_job") {
|
||||
for (var i = 0; i < app.jobs.length; ++i) {
|
||||
if (app.jobs[i].id == data.id) {
|
||||
Vue.set(app.jobs, i, data);
|
||||
|
|
Loading…
Add table
Reference in a new issue