kopia lustrzana https://github.com/OpenDroneMap/WebODM
Added some changes proposed by @mojodna
rodzic
955c9af4a6
commit
31e46bbfb9
|
@ -111,7 +111,7 @@ class TaskViewSet(viewsets.ViewSet):
|
|||
for file in filesList]
|
||||
|
||||
task = models.Task.create_from_images(files, project)
|
||||
if not task is None:
|
||||
if task is not None:
|
||||
return Response({"id": task.id}, status=status.HTTP_201_CREATED)
|
||||
else:
|
||||
raise exceptions.ValidationError(detail="Cannot create task, input provided is not valid.")
|
||||
|
|
|
@ -167,6 +167,7 @@ class ProjectListItem extends React.Component {
|
|||
this.setState({
|
||||
showTaskList: !this.state.showTaskList
|
||||
});
|
||||
console.log(this.props);
|
||||
}
|
||||
|
||||
closeUploadError(){
|
||||
|
@ -179,9 +180,6 @@ class ProjectListItem extends React.Component {
|
|||
|
||||
handleUpload(){
|
||||
this.resetUploadState();
|
||||
|
||||
// Hide task list
|
||||
// if (this.state.showTaskList) this.toggleTaskList();
|
||||
}
|
||||
|
||||
handleTaskSaved(taskInfo){
|
||||
|
|
|
@ -118,6 +118,33 @@ class TaskListItem extends React.Component {
|
|||
return [pad(h), pad(m), pad(s)].join(':');
|
||||
}
|
||||
|
||||
genActionApiCall(action){
|
||||
return () => {
|
||||
this.setState({actionButtonsDisabled: true});
|
||||
|
||||
$.post(`/api/projects/${this.state.task.project}/tasks/${this.state.task.id}/${action}/`,
|
||||
{
|
||||
uuid: this.state.task.uuid
|
||||
}
|
||||
).done(json => {
|
||||
if (json.success){
|
||||
this.refresh();
|
||||
}else{
|
||||
this.setState({
|
||||
actionError: json.error,
|
||||
actionButtonsDisabled: false
|
||||
});
|
||||
}
|
||||
})
|
||||
.fail(() => {
|
||||
this.setState({
|
||||
error: url + " is unreachable.",
|
||||
actionButtonsDisabled: false
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
let name = this.state.task.name !== null ? this.state.task.name : `Task #${this.state.task.id}`;
|
||||
|
||||
|
@ -133,36 +160,9 @@ class TaskListItem extends React.Component {
|
|||
className, icon, label, onClick
|
||||
});
|
||||
};
|
||||
const genActionApiCall = (action) => {
|
||||
return () => {
|
||||
this.setState({actionButtonsDisabled: true});
|
||||
|
||||
$.post(`/api/projects/${this.state.task.project}/tasks/${this.state.task.id}/${action}/`,
|
||||
{
|
||||
uuid: this.state.task.uuid
|
||||
}
|
||||
).done(json => {
|
||||
if (json.success){
|
||||
this.refresh();
|
||||
}else{
|
||||
this.setState({
|
||||
actionError: json.error,
|
||||
actionButtonsDisabled: false
|
||||
});
|
||||
}
|
||||
})
|
||||
.fail(() => {
|
||||
this.setState({
|
||||
error: url + " is unreachable.",
|
||||
actionButtonsDisabled: false
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
if ([statusCodes.QUEUED, statusCodes.RUNNING, null].indexOf(this.state.task.status) !== -1){
|
||||
addActionButton("Cancel", "btn-primary", "glyphicon glyphicon-remove-circle", genActionApiCall("cancel"));
|
||||
addActionButton("Cancel", "btn-primary", "glyphicon glyphicon-remove-circle", this.genActionApiCall("cancel"));
|
||||
}
|
||||
|
||||
// addActionButton("Restart", "btn-primary", "glyphicon glyphicon-play", genActionApiCall("cancel"));
|
||||
|
|
Ładowanie…
Reference in New Issue