kopia lustrzana https://github.com/OpenDroneMap/WebODM
* Handle errors coming from /api/plugins/openaerialmap/task/{id}/info endpoint
rodzic
ce543be57f
commit
8b51413c9c
|
@ -2,7 +2,7 @@
|
|||
"name": "OpenAerialMap",
|
||||
"webodmMinVersion": "0.6.0",
|
||||
"description": "A plugin to upload orthophotos to OpenAerialMap",
|
||||
"version": "0.9.0",
|
||||
"version": "0.9.1",
|
||||
"author": "Piero Toffanin",
|
||||
"email": "pt@masseranolabs.com",
|
||||
"repository": "https://github.com/OpenDroneMap/WebODM",
|
||||
|
@ -10,4 +10,4 @@
|
|||
"homepage": "https://github.com/OpenDroneMap/WebODM",
|
||||
"experimental": true,
|
||||
"deprecated": false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ export default class ShareButton extends React.Component{
|
|||
}
|
||||
|
||||
updateTaskInfo = (showErrors) => {
|
||||
const { task } = this.props;
|
||||
const { task } = this.props;
|
||||
return $.ajax({
|
||||
type: 'GET',
|
||||
url: `/api/plugins/openaerialmap/task/${task.id}/info`,
|
||||
|
@ -49,7 +49,7 @@ export default class ShareButton extends React.Component{
|
|||
this.setState({taskInfo, loading: false});
|
||||
if (taskInfo.error && showErrors) this.setState({error: taskInfo.error});
|
||||
}).fail(error => {
|
||||
this.setState({error, loading: false});
|
||||
this.setState({error: error.statusText, loading: false});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -108,17 +108,19 @@ export default class ShareButton extends React.Component{
|
|||
}
|
||||
|
||||
render(){
|
||||
const { loading, taskInfo } = this.state;
|
||||
const { loading, taskInfo, error } = this.state;
|
||||
|
||||
const getButtonIcon = () => {
|
||||
if (loading || taskInfo.sharing) return "fa fa-circle-notch fa-spin fa-fw";
|
||||
else return "oam-icon fa";
|
||||
else if (error) return "fa fa-exclamation-triangle";
|
||||
else return "fa oam-icon";
|
||||
};
|
||||
|
||||
const getButtonLabel = () => {
|
||||
if (loading) return "";
|
||||
else if (taskInfo.sharing) return " Sharing...";
|
||||
else if (taskInfo.shared) return " View In OAM";
|
||||
else if (error) return " OAM Plugin Error";
|
||||
else return " Share To OAM";
|
||||
}
|
||||
|
||||
|
@ -126,13 +128,13 @@ export default class ShareButton extends React.Component{
|
|||
<ErrorMessage bind={[this, "error"]} />,
|
||||
<button
|
||||
onClick={this.handleClick}
|
||||
disabled={loading || taskInfo.sharing}
|
||||
disabled={loading || taskInfo.sharing || error}
|
||||
className="btn btn-sm btn-primary">
|
||||
{[<i className={getButtonIcon()}></i>, getButtonLabel()]}
|
||||
</button>];
|
||||
|
||||
if (taskInfo.sensor !== undefined){
|
||||
result.unshift(<ShareDialog
|
||||
result.unshift(<ShareDialog
|
||||
ref={(domNode) => { this.shareDialog = domNode; }}
|
||||
task={this.props.task}
|
||||
taskInfo={taskInfo}
|
||||
|
@ -142,4 +144,4 @@ export default class ShareButton extends React.Component{
|
|||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue