aboutsummaryrefslogtreecommitdiffstats
path: root/src/dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'src/dashboard')
-rw-r--r--src/dashboard/testing_utils.py6
-rw-r--r--src/dashboard/views.py7
2 files changed, 11 insertions, 2 deletions
diff --git a/src/dashboard/testing_utils.py b/src/dashboard/testing_utils.py
index b7272ea..d7a346e 100644
--- a/src/dashboard/testing_utils.py
+++ b/src/dashboard/testing_utils.py
@@ -178,6 +178,9 @@ def make_vlan_manager(vlans=None, block_size=20, allow_overlapping=False, reserv
def make_lab(user=None, name="Test_Lab_Instance",
status=LabStatus.UP, vlan_manager=None,
pub_net_count=5):
+ if Lab.objects.filter(name=name).exists():
+ return Lab.objects.get(name=name)
+
if not vlan_manager:
vlan_manager = make_vlan_manager()
@@ -207,6 +210,9 @@ resource_inventory instantiation section for permanent resources
def make_resource_profile(lab, name="test_hostprofile"):
+ if ResourceProfile.objects.filter(name=name).exists():
+ return ResourceProfile.objects.get(name=name)
+
resource_profile = ResourceProfile.objects.create(
name=name,
description='test resourceprofile instance'
diff --git a/src/dashboard/views.py b/src/dashboard/views.py
index 498bd9d..2ace2d4 100644
--- a/src/dashboard/views.py
+++ b/src/dashboard/views.py
@@ -15,7 +15,7 @@ from django.shortcuts import render
from account.models import Lab
-from resource_inventory.models import Image, ResourceProfile
+from resource_inventory.models import Image, ResourceProfile, ResourceQuery
from workflow.workflow_manager import ManagerTracker
@@ -37,14 +37,17 @@ def lab_detail_view(request, lab_name):
if user:
images = images | Image.objects.filter(from_lab=lab).filter(owner=user)
+ hosts = ResourceQuery.filter(lab=lab)
+
return render(
request,
"dashboard/lab_detail.html",
{
'title': "Lab Overview",
'lab': lab,
- 'hostprofiles': lab.hostprofiles.all(),
+ 'hostprofiles': ResourceProfile.objects.filter(labs=lab),
'images': images,
+ 'hosts': hosts
}
)