aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow/forms.py
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2020-03-16 17:54:09 +0000
committerGerrit Code Review <gerrit@opnfv.org>2020-03-16 17:54:09 +0000
commit0db3a84d9d9ed213983a517efd35c339537ef472 (patch)
treea6d7ac7ba2f2d70e18cb984bda4020c736082c62 /src/workflow/forms.py
parent176ec9aacbc87e6077e8807c60f95a1ccbbc26e3 (diff)
parent064f145f218385a6401fa6be2ccbbc462e915c26 (diff)
Merge "Test resource templates now use the same lab as the image generated alongside it."
Diffstat (limited to 'src/workflow/forms.py')
-rw-r--r--src/workflow/forms.py37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/workflow/forms.py b/src/workflow/forms.py
index f7a20eb..37bc390 100644
--- a/src/workflow/forms.py
+++ b/src/workflow/forms.py
@@ -300,7 +300,7 @@ class FormUtils:
else:
multiple_hosts = false
labs = {}
- hosts = {}
+ resources = {}
items = {}
neighbors = {}
for lab in Lab.objects.all():
@@ -311,24 +311,21 @@ class FormUtils:
'description': lab.description,
'selected': false,
'selectable': true,
- 'follow': false,
+ 'follow': multiple_hosts,
'multiple': false,
'class': 'lab'
}
- if multiple_hosts:
- # "follow" this lab node to discover more hosts if allowed
- lab_node['follow'] = true
items[lab_node['id']] = lab_node
neighbors[lab_node['id']] = []
labs[lab_node['id']] = lab_node
- for host in lab.hostprofiles.all():
- host_node = {
+ for template in lab.resourcetemplates.all():
+ resource_node = {
'form': {"name": "host_name", "type": "text", "placeholder": "hostname"},
- 'id': "host_" + str(host.id),
- 'model_id': host.id,
- 'name': host.name,
- 'description': host.description,
+ 'id': "resource_" + str(template.id),
+ 'model_id': template.id,
+ 'name': template.name,
+ 'description': template.description,
'selected': false,
'selectable': true,
'follow': false,
@@ -336,15 +333,15 @@ class FormUtils:
'class': 'host'
}
if multiple_hosts:
- host_node['values'] = [] # place to store multiple values
- items[host_node['id']] = host_node
- neighbors[lab_node['id']].append(host_node['id'])
- if host_node['id'] not in neighbors:
- neighbors[host_node['id']] = []
- neighbors[host_node['id']].append(lab_node['id'])
- hosts[host_node['id']] = host_node
-
- display_objects = [("lab", labs.values()), ("host", hosts.values())]
+ resource_node['values'] = [] # place to store multiple values
+ items[resource_node['id']] = resource_node
+ neighbors[lab_node['id']].append(resource_node['id'])
+ if resource_node['id'] not in neighbors:
+ neighbors[resource_node['id']] = []
+ neighbors[resource_node['id']].append(lab_node['id'])
+ resources[resource_node['id']] = resource_node
+
+ display_objects = [("lab", labs.values()), ("resource", resources.values())]
context = {
'display_objects': display_objects,