aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/workflow/forms.py')
-rw-r--r--src/workflow/forms.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/workflow/forms.py b/src/workflow/forms.py
index a8d3413..4220dea 100644
--- a/src/workflow/forms.py
+++ b/src/workflow/forms.py
@@ -24,6 +24,7 @@ from resource_inventory.models import (
Installer,
Scenario,
)
+from resource_inventory.resource_manager import ResourceManager
from booking.lib import get_user_items, get_user_field_opts
@@ -286,7 +287,7 @@ class MultipleSelectFilterField(forms.Field):
class FormUtils:
@staticmethod
- def getLabData(multiple_hosts=False):
+ def getLabData(multiple_hosts=False, user=None):
"""
Get all labs and thier host profiles, returns a serialized version the form can understand.
@@ -319,7 +320,7 @@ class FormUtils:
neighbors[lab_node['id']] = []
labs[lab_node['id']] = lab_node
- for template in lab.resourcetemplates.all():
+ for template in ResourceManager.getInstance().getAvailableResourceTemplates(lab, user):
resource_node = {
'form': {"name": "host_name", "type": "text", "placeholder": "hostname"},
'id': "resource_" + str(template.id),
@@ -353,9 +354,9 @@ class FormUtils:
class HardwareDefinitionForm(forms.Form):
- def __init__(self, *args, **kwargs):
+ def __init__(self, user, *args, **kwargs):
super(HardwareDefinitionForm, self).__init__(*args, **kwargs)
- attrs = FormUtils.getLabData(multiple_hosts=True)
+ attrs = FormUtils.getLabData(multiple_hosts=True, user=user)
self.fields['filter_field'] = MultipleSelectFilterField(
widget=MultipleSelectFilterWidget(**attrs)
)
@@ -391,7 +392,7 @@ class NetworkConfigurationForm(forms.Form):
class HostSoftwareDefinitionForm(forms.Form):
- host_name = forms.CharField(max_length=200, disabled=True, required=False)
+ host_name = forms.CharField(max_length=200, disabled=False, required=True)
headnode = forms.BooleanField(required=False, widget=forms.HiddenInput)
def __init__(self, *args, **kwargs):