From a66073c89f096418e4f6ee26fbf4157af316300c Mon Sep 17 00:00:00 2001 From: Nikita Manovich Date: Mon, 28 Jan 2019 18:53:28 +0300 Subject: [PATCH] Replaced /get/job by /api/v1/jobs/1 --- .../engine/static/engine/js/annotationUI.js | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/cvat/apps/engine/static/engine/js/annotationUI.js b/cvat/apps/engine/static/engine/js/annotationUI.js index 1b0d82e1dcbe..b729c5f6447e 100644 --- a/cvat/apps/engine/static/engine/js/annotationUI.js +++ b/cvat/apps/engine/static/engine/js/annotationUI.js @@ -10,12 +10,39 @@ function callAnnotationUI(jid) { initLogger(jid); let loadJobEvent = Logger.addContinuedEvent(Logger.EventType.loadJob); - serverRequest("/get/job/" + jid, function(job) { - serverRequest("get/annotation/job/" + jid, function(data) { - $('#loadingOverlay').remove(); - setTimeout(() => { - buildAnnotationUI(job, data, loadJobEvent); - }, 0); + serverRequest("/api/v1/jobs/" + jid, function(job) { + serverRequest("/api/v1/tasks/" + job.task_id, function(task) { + serverRequest("/api/v1/tasks/" + job.task_id + "/frames/meta", function(imageMetaCache) { + serverRequest("get/annotation/job/" + jid, function(data) { + $('#loadingOverlay').remove(); + setTimeout(() => { + // FIXME: code cloning + let spec = {"labels": {}, "attributes": {}}; + for (let label of task.labels) { + spec.labels[label.id] = label.name; + spec.attributes[label.id] = {}; + for (let attr of label.attributes) { + spec.attributes[label.id][attr.id] = attr.text; + } + } + // FIXME: patch job object to correspond to the new REST API + job.labels = spec.labels; + job.attributes = spec.attributes; + job.stop = job.stop_frame; + job.start = job.start_frame; + job.jobid = job.id; + job.taskid = task.id; + job.slug = task.name; + job.mode = task.mode; + job.overlap = task.overlap; + job.z_order = task.z_order; + job.flipped = task.flipped; + job.image_meta_data = imageMetaCache; + + buildAnnotationUI(job, data, loadJobEvent); + }, 0); + }); + }); }); }); }