kopia lustrzana https://github.com/OpenDroneMap/WebODM
Remove auto as a processing node option
rodzic
7d191e3a8c
commit
8fb5569b67
|
@ -53,6 +53,7 @@ class EditTaskForm extends React.Component {
|
||||||
|
|
||||||
this.handleNameChange = this.handleNameChange.bind(this);
|
this.handleNameChange = this.handleNameChange.bind(this);
|
||||||
this.handleSelectNode = this.handleSelectNode.bind(this);
|
this.handleSelectNode = this.handleSelectNode.bind(this);
|
||||||
|
this.firstEnabledNode = this.firstEnabledNode.bind(this);
|
||||||
this.loadProcessingNodes = this.loadProcessingNodes.bind(this);
|
this.loadProcessingNodes = this.loadProcessingNodes.bind(this);
|
||||||
this.retryLoad = this.retryLoad.bind(this);
|
this.retryLoad = this.retryLoad.bind(this);
|
||||||
this.selectNodeByKey = this.selectNodeByKey.bind(this);
|
this.selectNodeByKey = this.selectNodeByKey.bind(this);
|
||||||
|
@ -84,6 +85,13 @@ class EditTaskForm extends React.Component {
|
||||||
if (this.props.onFormLoaded && this.formReady()) this.props.onFormLoaded();
|
if (this.props.onFormLoaded && this.formReady()) this.props.onFormLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstEnabledNode(){
|
||||||
|
for (let i = 0; i < this.state.processingNodes.length; i++){
|
||||||
|
if (this.state.processingNodes[i].enabled) return this.state.processingNodes[i];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
loadProcessingNodes(){
|
loadProcessingNodes(){
|
||||||
const failed = () => {
|
const failed = () => {
|
||||||
this.setState({error: _("Could not load list of processing nodes. Are you connected to the internet?")});
|
this.setState({error: _("Could not load list of processing nodes. Are you connected to the internet?")});
|
||||||
|
@ -117,15 +125,6 @@ class EditTaskForm extends React.Component {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
let autoNode = null;
|
|
||||||
|
|
||||||
// If the user has selected auto, and a processing node has been assigned
|
|
||||||
// we need attempt to find the "auto" node to be the one that has been assigned
|
|
||||||
if (this.props.task && this.props.task.processing_node && this.props.task.auto_processing_node){
|
|
||||||
autoNode = nodes.find(node => node.id === this.props.task.processing_node);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!autoNode){
|
|
||||||
// Find a node with lowest queue count
|
// Find a node with lowest queue count
|
||||||
let minQueueCount = Math.min(...nodes.filter(node => node.enabled).map(node => node.queue_count));
|
let minQueueCount = Math.min(...nodes.filter(node => node.enabled).map(node => node.queue_count));
|
||||||
let minQueueCountNodes = nodes.filter(node => node.enabled && node.queue_count === minQueueCount);
|
let minQueueCountNodes = nodes.filter(node => node.enabled && node.queue_count === minQueueCount);
|
||||||
|
@ -136,16 +135,7 @@ class EditTaskForm extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose at random
|
// Choose at random
|
||||||
autoNode = minQueueCountNodes[~~(Math.random() * minQueueCountNodes.length)];
|
let lowestQueueNode = minQueueCountNodes[~~(Math.random() * minQueueCountNodes.length)];
|
||||||
}
|
|
||||||
|
|
||||||
nodes.unshift({
|
|
||||||
id: autoNode.id,
|
|
||||||
key: "auto",
|
|
||||||
label: "Auto",
|
|
||||||
options: autoNode.options,
|
|
||||||
enabled: true
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
processingNodes: nodes,
|
processingNodes: nodes,
|
||||||
|
@ -155,14 +145,14 @@ class EditTaskForm extends React.Component {
|
||||||
// Have we specified a node?
|
// Have we specified a node?
|
||||||
if (this.props.task && this.props.task.processing_node){
|
if (this.props.task && this.props.task.processing_node){
|
||||||
if (this.props.task.auto_processing_node){
|
if (this.props.task.auto_processing_node){
|
||||||
this.selectNodeByKey("auto");
|
this.selectNodeByKey(lowestQueueNode.key);
|
||||||
}else{
|
}else{
|
||||||
this.selectNodeByKey(this.props.task.processing_node);
|
this.selectNodeByKey(this.props.task.processing_node);
|
||||||
}
|
}
|
||||||
}else if (this.props.selectedNode){
|
}else if (this.props.selectedNode){
|
||||||
this.selectNodeByKey(this.props.selectedNode);
|
this.selectNodeByKey(this.props.selectedNode);
|
||||||
}else{
|
}else{
|
||||||
this.selectNodeByKey("auto");
|
this.selectNodeByKey(lowestQueueNode.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.notifyFormLoaded();
|
this.notifyFormLoaded();
|
||||||
|
@ -328,8 +318,11 @@ class EditTaskForm extends React.Component {
|
||||||
let node = this.state.processingNodes.find(node => node.key == key);
|
let node = this.state.processingNodes.find(node => node.key == key);
|
||||||
if (node) this.setState({selectedNode: node});
|
if (node) this.setState({selectedNode: node});
|
||||||
else{
|
else{
|
||||||
console.warn(`Node ${key} does not exist, selecting auto`);
|
console.log(`Node ${key} does not exist, selecting first enabled`);
|
||||||
this.selectNodeByKey("auto");
|
const n = this.firstEnabledNode();
|
||||||
|
if (n){
|
||||||
|
this.selectNodeByKey(n.key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,6 @@ export default class ShareButton extends React.Component{
|
||||||
url: `/api/plugins/dronedb/tasks/${task.id}/status`,
|
url: `/api/plugins/dronedb/tasks/${task.id}/status`,
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(taskInfo => {
|
}).done(taskInfo => {
|
||||||
console.log(taskInfo);
|
|
||||||
debugger;
|
|
||||||
this.setState({taskInfo});
|
this.setState({taskInfo});
|
||||||
if (taskInfo.error && showErrors) this.setState({error: taskInfo.error});
|
if (taskInfo.error && showErrors) this.setState({error: taskInfo.error});
|
||||||
}).fail(error => {
|
}).fail(error => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "WebODM",
|
"name": "WebODM",
|
||||||
"version": "1.9.15",
|
"version": "1.9.16",
|
||||||
"description": "User-friendly, extendable application and API for processing aerial imagery.",
|
"description": "User-friendly, extendable application and API for processing aerial imagery.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Ładowanie…
Reference in New Issue