refator_comm1
This commit is contained in:
@@ -18,6 +18,16 @@ export const api = {
|
||||
const body = { sid, action }; if (target) body.target = target;
|
||||
return fetch('/api/vm-action', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify(body)}).then(r=>r.json());
|
||||
},
|
||||
taskStatus: (upid, node) => fetch(`/api/task-status?upid=${encodeURIComponent(upid)}&node=${encodeURIComponent(node)}`).then(r=>r.json()),
|
||||
taskLog: (upid, node, start=0) => fetch(`/api/task-log?upid=${encodeURIComponent(upid)}&node=${encodeURIComponent(node)}&start=${start}`).then(r=>r.json())
|
||||
|
||||
wsTaskURL: (upid, node) => {
|
||||
const proto = (location.protocol === 'https:') ? 'wss' : 'ws';
|
||||
return `${proto}://${location.host}/ws/task?upid=${encodeURIComponent(upid)}&node=${encodeURIComponent(node)}`;
|
||||
},
|
||||
// NEW:
|
||||
wsObserveURL: (sid) => {
|
||||
const proto = (location.protocol === 'https:') ? 'wss' : 'ws';
|
||||
return `${proto}://${location.host}/ws/observe?sid=${encodeURIComponent(sid)}`;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user