kopia lustrzana https://github.com/OpenDroneMap/WebODM
Load task button only if folderUrl is set
rodzic
0000cb988c
commit
8b4c81a3b8
|
@ -5,25 +5,13 @@ import GoToFolderButton from "./components/GoToFolderButton";
|
|||
|
||||
export default class TaskView extends Component {
|
||||
static propTypes = {
|
||||
task: PropTypes.object.isRequired,
|
||||
apiURL: PropTypes.string.isRequired,
|
||||
}
|
||||
folderUrl: PropTypes.string.isRequired,
|
||||
}
|
||||
|
||||
state = {
|
||||
folderUrl: null,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
$.getJSON(`${this.props.apiURL}/projects/${this.props.task.project}/tasks/${this.props.task.id}/checkforurl`)
|
||||
.done(data => {
|
||||
this.setState({folderUrl: data.folder_url});
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
folderUrl,
|
||||
} = this.state;
|
||||
} = this.props;
|
||||
return (
|
||||
<Fragment>
|
||||
{folderUrl ?
|
||||
|
|
|
@ -12,9 +12,17 @@ PluginsAPI.Dashboard.addNewTaskButton(
|
|||
PluginsAPI.Dashboard.addTaskActionButton(
|
||||
["cloudimport/build/TaskView.js"],
|
||||
function(args, ImportView) {
|
||||
return React.createElement(ImportView, {
|
||||
task: args.task,
|
||||
apiURL: "{{ api_url }}",
|
||||
});
|
||||
$.ajax({
|
||||
url: `{{ api_url }}/projects/${args.task.project}/tasks/${args.task.id}/checkforurl`,
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if (data.folder_url) {
|
||||
return React.createElement(ImportView, {
|
||||
folderUrl: data.folder_url,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
Ładowanie…
Reference in New Issue