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 {
|
export default class TaskView extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
task: PropTypes.object.isRequired,
|
folderUrl: PropTypes.string.isRequired,
|
||||||
apiURL: 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() {
|
render() {
|
||||||
const {
|
const {
|
||||||
folderUrl,
|
folderUrl,
|
||||||
} = this.state;
|
} = this.props;
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{folderUrl ?
|
{folderUrl ?
|
||||||
|
|
|
@ -12,9 +12,17 @@ PluginsAPI.Dashboard.addNewTaskButton(
|
||||||
PluginsAPI.Dashboard.addTaskActionButton(
|
PluginsAPI.Dashboard.addTaskActionButton(
|
||||||
["cloudimport/build/TaskView.js"],
|
["cloudimport/build/TaskView.js"],
|
||||||
function(args, ImportView) {
|
function(args, ImportView) {
|
||||||
|
$.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, {
|
return React.createElement(ImportView, {
|
||||||
task: args.task,
|
folderUrl: data.folder_url,
|
||||||
apiURL: "{{ api_url }}",
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Ładowanie…
Reference in New Issue