diff --git a/app/api/processingnodes.py b/app/api/processingnodes.py
index f1d4eef5..0b1ea188 100644
--- a/app/api/processingnodes.py
+++ b/app/api/processingnodes.py
@@ -10,10 +10,14 @@ from nodeodm.models import ProcessingNode
class ProcessingNodeSerializer(serializers.ModelSerializer):
online = serializers.SerializerMethodField()
+ label = serializers.SerializerMethodField()
def get_online(self, obj):
return obj.is_online()
+ def get_label(self, obj):
+ return str(obj)
+
class Meta:
model = ProcessingNode
fields = '__all__'
@@ -30,7 +34,7 @@ class ProcessingNodeFilter(FilterSet):
class Meta:
model = ProcessingNode
- fields = ['has_available_options', 'id', 'hostname', 'port', 'api_version', 'queue_count', 'max_images', ]
+ fields = ['has_available_options', 'id', 'hostname', 'port', 'api_version', 'queue_count', 'max_images', 'label', ]
class ProcessingNodeViewSet(viewsets.ModelViewSet):
"""
diff --git a/app/static/app/js/components/EditTaskForm.jsx b/app/static/app/js/components/EditTaskForm.jsx
index fbffefcf..9a603621 100644
--- a/app/static/app/js/components/EditTaskForm.jsx
+++ b/app/static/app/js/components/EditTaskForm.jsx
@@ -108,7 +108,7 @@ class EditTaskForm extends React.Component {
return {
id: node.id,
key: node.id,
- label: `${node.hostname}:${node.port} (queue: ${node.queue_count})`,
+ label: `${node.label} (queue: ${node.queue_count})`,
options: node.available_options,
queue_count: node.queue_count,
enabled: node.online,
diff --git a/app/templates/app/processing_node.html b/app/templates/app/processing_node.html
index c76007c9..e8328c76 100644
--- a/app/templates/app/processing_node.html
+++ b/app/templates/app/processing_node.html
@@ -19,6 +19,10 @@
{% trans "API Version" %}
{{ processing_node.api_version }}
+
+ {% trans "ODM Version" %}
+ {{ processing_node.odm_version }}
+
{% trans "Queue Count" %}
{{ processing_node.queue_count }}
@@ -27,6 +31,10 @@
{% trans "Max Images Limit" %}
{{ processing_node.max_images }}
+
+ {% trans "Label" %}
+ {{ processing_node.label|default:"None" }}
+
{% trans "Last Refreshed" %}
{{ processing_node.last_refreshed|timesince }} {% trans 'ago' %} ({{ processing_node.last_refreshed|localtime }})
diff --git a/nodeodm/admin.py b/nodeodm/admin.py
index 4be2e9ba..ba8df199 100644
--- a/nodeodm/admin.py
+++ b/nodeodm/admin.py
@@ -4,6 +4,6 @@ from guardian.admin import GuardedModelAdmin
from .models import ProcessingNode
class ProcessingNodeAdmin(GuardedModelAdmin):
- fields = ('hostname', 'port', 'token')
+ fields = ('hostname', 'port', 'token', 'label', )
admin.site.register(ProcessingNode, ProcessingNodeAdmin)
diff --git a/nodeodm/migrations/0005_auto_20190115_1346.py b/nodeodm/migrations/0005_auto_20190115_1346.py
new file mode 100644
index 00000000..a6561cac
--- /dev/null
+++ b/nodeodm/migrations/0005_auto_20190115_1346.py
@@ -0,0 +1,23 @@
+# Generated by Django 2.0.3 on 2019-01-15 13:46
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('nodeodm', '0004_processingnode_max_images'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='processingnode',
+ name='label',
+ field=models.CharField(blank=True, default='', help_text='Optional label for this node. When set, this label will be shown instead of hostname:port.', max_length=255),
+ ),
+ migrations.AddField(
+ model_name='processingnode',
+ name='odm_version',
+ field=models.CharField(help_text='OpenDroneMap version used by the node.', max_length=32, null=True),
+ ),
+ ]
diff --git a/nodeodm/models.py b/nodeodm/models.py
index e6bef318..efd1d691 100644
--- a/nodeodm/models.py
+++ b/nodeodm/models.py
@@ -43,9 +43,14 @@ class ProcessingNode(models.Model):
available_options = fields.JSONField(default=dict(), help_text="Description of the options that can be used for processing")
token = models.CharField(max_length=1024, blank=True, default="", help_text="Token to use for authentication. If the node doesn't have authentication, you can leave this field blank.")
max_images = models.PositiveIntegerField(help_text="Maximum number of images accepted by this node.", blank=True, null=True)
+ odm_version = models.CharField(max_length=32, null=True, help_text="OpenDroneMap version used by the node")
+ label = models.CharField(max_length=255, default="", blank=True, help_text="Optional label for this node. When set, this label will be shown instead of the hostname:port name.")
def __str__(self):
- return '{}:{}'.format(self.hostname, self.port)
+ if self.label != "":
+ return self.label
+ else:
+ return '{}:{}'.format(self.hostname, self.port)
@staticmethod
def find_best_available_node():
@@ -79,6 +84,8 @@ class ProcessingNode(models.Model):
if 'maxImages' in info:
self.max_images = info['maxImages']
+ if 'odmVersion' in info:
+ self.odm_version = info['odmVersion']
options = api_client.options()
self.available_options = options
diff --git a/plugins/lightning/plugin.py b/plugins/lightning/plugin.py
index a997c345..20c0ac49 100644
--- a/plugins/lightning/plugin.py
+++ b/plugins/lightning/plugin.py
@@ -64,7 +64,7 @@ class Plugin(PluginBase):
matches = [n for n in nodes if n.hostname == hostname and n.port == port and n.token == token]
if len(matches) == 0:
# Add
- node = ProcessingNode.objects.create(hostname=hostname, port=port, token=token)
+ node = ProcessingNode.objects.create(hostname=hostname, port=port, token=token, label="Lightning")
assign_perm('view_processingnode', request.user, node)
assign_perm('change_processingnode', request.user, node)
assign_perm('delete_processingnode', request.user, node)
diff --git a/plugins/lightning/public/Dashboard.jsx b/plugins/lightning/public/Dashboard.jsx
index 5d9a30f6..09ea51c0 100644
--- a/plugins/lightning/public/Dashboard.jsx
+++ b/plugins/lightning/public/Dashboard.jsx
@@ -130,7 +130,7 @@ export default class Dashboard extends React.Component {
Resync
@@ -140,7 +140,7 @@ export default class Dashboard extends React.Component {
{nodes.length > 0 ?
-
You are all set! When creating a new task from the
Dashboard , select
{nodes[0].hostname}:{nodes[0].port} from the
Processing Node drop-down instead of Auto.
+
You are all set! When creating a new task from the
Dashboard , select
{nodes[0].label} from the
Processing Node drop-down instead of Auto.
: ""}