kopia lustrzana https://github.com/OpenDroneMap/WebODM
Added online field on processing nodes, which fixes #107
rodzic
0fa38e310b
commit
6276ebbe18
|
@ -10,6 +10,11 @@ from nodeodm.models import ProcessingNode
|
||||||
|
|
||||||
|
|
||||||
class ProcessingNodeSerializer(serializers.ModelSerializer):
|
class ProcessingNodeSerializer(serializers.ModelSerializer):
|
||||||
|
online = serializers.SerializerMethodField()
|
||||||
|
|
||||||
|
def get_online(self, obj):
|
||||||
|
return obj.is_online()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ProcessingNode
|
model = ProcessingNode
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
|
@ -76,16 +76,13 @@ class EditTaskForm extends React.Component {
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
|
|
||||||
let nodes = json.map(node => {
|
let nodes = json.map(node => {
|
||||||
let last_refreshed = new Date(node.last_refreshed);
|
|
||||||
let enabled = (now - last_refreshed) < 1000 * 60 * 5; // 5 minutes
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: node.id,
|
id: node.id,
|
||||||
key: node.id,
|
key: node.id,
|
||||||
label: `${node.hostname}:${node.port} (queue: ${node.queue_count})`,
|
label: `${node.hostname}:${node.port} (queue: ${node.queue_count})`,
|
||||||
options: node.available_options,
|
options: node.available_options,
|
||||||
queue_count: node.queue_count,
|
queue_count: node.queue_count,
|
||||||
enabled: enabled,
|
enabled: node.online,
|
||||||
url: `http://${node.hostname}:${node.port}`
|
url: `http://${node.hostname}:${node.port}`
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -321,6 +321,11 @@ class TestApi(BootTestCase):
|
||||||
self.assertEqual(res.status_code, status.HTTP_200_OK)
|
self.assertEqual(res.status_code, status.HTTP_200_OK)
|
||||||
self.assertTrue(res.data["hostname"] == "localhost")
|
self.assertTrue(res.data["hostname"] == "localhost")
|
||||||
|
|
||||||
|
# Verify online field exists
|
||||||
|
self.assertTrue("online" in res.data)
|
||||||
|
|
||||||
|
# Should be set to false
|
||||||
|
self.assertFalse(res.data['online'])
|
||||||
|
|
||||||
# Cannot delete a processing node as normal user
|
# Cannot delete a processing node as normal user
|
||||||
res = client.delete('/api/processingnodes/{}/'.format(pnode.id))
|
res = client.delete('/api/processingnodes/{}/'.format(pnode.id))
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
|
"online": true,
|
||||||
"hostname": "nodeodm.masseranolabs.com",
|
"hostname": "nodeodm.masseranolabs.com",
|
||||||
"port": 80,
|
"port": 80,
|
||||||
"api_version": "1.0.1",
|
"api_version": "1.0.1",
|
||||||
|
@ -27,6 +28,7 @@ take care of processing input images. Processing nodes are computers or virtual
|
||||||
Field | Type | Description
|
Field | Type | Description
|
||||||
----- | ---- | -----------
|
----- | ---- | -----------
|
||||||
id | int | Unique Identifier
|
id | int | Unique Identifier
|
||||||
|
online | bool | Whether the processing node could be reached in the last 5 minutes
|
||||||
hostname | string | Hostname/IP address
|
hostname | string | Hostname/IP address
|
||||||
port | int | Port
|
port | int | Port
|
||||||
api_version | string | Version of node-OpenDroneMap currently running
|
api_version | string | Version of node-OpenDroneMap currently running
|
||||||
|
|
Ładowanie…
Reference in New Issue