self.default_entry = attrs.get("default_entry", "")
self.edit = attrs.get("edit", False)
self.wf_type = attrs.get("wf_type")
+ self.incompatible = attrs.get("incompatible", "false")
super(SearchableSelectMultipleWidget, self).__init__(attrs)
'initial': self.initial,
'default_entry': self.default_entry,
'edit': self.edit,
- 'wf_type': self.wf_type
+ 'wf_type': self.wf_type,
+ 'incompatible': self.incompatible
}
displayable['id'] = res.id
resources[res.id] = displayable
- if bundle:
- displayable = {}
- displayable['small_name'] = bundle.name
- displayable['expanded_name'] = "Current bundle"
- displayable['string'] = bundle.description
- displayable['id'] = "repo bundle"
- resources["repo bundle"] = displayable
attrs = {
'set': resources,
'show_from_noentry': "true",
displayable['id'] = config.id
configs[config.id] = displayable
- if bundle:
+ incompatible_choice = "false"
+ if bundle and bundle.id not in configs:
displayable = {}
displayable['small_name'] = bundle.name
- displayable['expanded_name'] = "Current configuration"
+ displayable['expanded_name'] = bundle.owner.username
displayable['string'] = bundle.description
- displayable['id'] = "repo bundle"
- configs['repo bundle'] = displayable
+ displayable['id'] = bundle.id
+ configs[bundle.id] = displayable
+ incompatible_choice = "true"
attrs = {
'set': configs,
'placeholder': "config",
'initial': chosen,
'edit': edit,
- 'wf_type': 2
+ 'wf_type': 2,
+ 'incompatible': incompatible_choice
}
return attrs
class FormUtils:
@staticmethod
- def getLabData():
+ def getLabData(multiple_selectable_hosts):
"""
Gets all labs and thier host profiles and returns a serialized version the form can understand.
Should be rewritten with a related query to make it faster
slab['selected'] = 0
slab['selectable'] = 1
slab['follow'] = 1
+ if not multiple_selectable_hosts:
+ slab['follow'] = 0
slab['multiple'] = 0
items[slab['id']] = slab
mapping[slab['id']] = []
shost['selected'] = 0
shost['selectable'] = 1
shost['follow'] = 0
- shost['multiple'] = 1
+ shost['multiple'] = multiple_selectable_hosts
items[shost['id']] = shost
mapping[slab['id']].append(shost['id'])
if shost['id'] not in mapping:
context = {
'filter_objects': filter_objects,
'mapping': mapping,
- 'items': items
+ 'filter_items': items
}
return context
def __init__(self, *args, **kwargs):
selection_data = kwargs.pop("selection_data", False)
super(HardwareDefinitionForm, self).__init__(*args, **kwargs)
- attrs = FormUtils.getLabData()
+ attrs = FormUtils.getLabData(1)
attrs['selection_data'] = selection_data
self.fields['filter_field'] = MultipleSelectFilterField(
widget=MultipleSelectFilterWidget(
class SnapshotMetaForm(forms.Form):
name = forms.CharField()
- description = forms.CharField()
+ description = forms.CharField(widget=forms.Textarea)
class ConfirmationForm(forms.Form):