diff --git a/coreplugins/dronedb/api_views.py b/coreplugins/dronedb/api_views.py index 8acf29a0..af0e300e 100644 --- a/coreplugins/dronedb/api_views.py +++ b/coreplugins/dronedb/api_views.py @@ -273,7 +273,17 @@ def ddb_cleanup(sender, task_id, **kwargs): # When a task is re-processed, make sure we can re-share it if we shared a task previously logger.info("Cleaning up DroneDB datastore for task {}".format(str(task_id))) - #ds.del_key(get_key_for(task_id, "status")) + + task = models.Task.objects.get(id=task_id) + project_pk = task.project.id + + datastore = get_current_plugin().get_global_data_store() + combined_id = "{}_{}_ddb".format(project_pk, task_id) + + logger.info("Info task {0}, project {1} ({2})".format(str(task_id), str(project_pk), combined_id)) + + datastore.del_key(combined_id) + # task.project class StatusTaskView(TaskView): def get(self, request, project_pk, pk): @@ -390,7 +400,7 @@ def share_to_ddb(project_pk, pk, settings, files): res = ddb.share_commit(share_token) - status['status'] = 1 + status['status'] = 3 # Done status['shareUrl'] = registry_url + res['url'] logger.info("Shared on url " + status['shareUrl']) diff --git a/coreplugins/dronedb/public/ShareButton.jsx b/coreplugins/dronedb/public/ShareButton.jsx index ea261a54..462f8000 100644 --- a/coreplugins/dronedb/public/ShareButton.jsx +++ b/coreplugins/dronedb/public/ShareButton.jsx @@ -63,9 +63,6 @@ export default class ShareButton extends React.Component{ url: `/api/plugins/dronedb/projects/${task.project}/tasks/${task.id}/status`, contentType: 'application/json' }).done(taskInfo => { - - console.log(taskInfo); - this.setState({taskInfo}); if (taskInfo.error && showErrors) this.setState({error: taskInfo.error}); }).fail(error => { @@ -99,28 +96,17 @@ export default class ShareButton extends React.Component{ this.state.intervalId = setInterval(() => { this.updateTaskInfo(true); - if (this.state.taskInfo.status == STATE_DONE || this.state.taskInfo.status == STATE_ERROR) { + if (this.state.error != null || this.state.taskInfo.status == STATE_DONE || this.state.taskInfo.status == STATE_ERROR) { clearInterval(this.state.intervalId); } - }, 3000); - - //this.monitorProgress(); + }, 3000); + }); } - /* - monitorProgress = () => { - if (this.state.taskInfo.sharing){ - // Monitor progress - this.monitorTimeout = setTimeout(() => { - this.updateTaskInfo(true).always(this.monitorProgress); - }, 3000); - } - }*/ handleClick = e => { - console.log("Clicked"); if (this.state.taskInfo.status == STATE_IDLE){ this.shareToDdb();