aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow/forms.py
diff options
context:
space:
mode:
authorSawyer Bergeron <sawyerbergeron@gmail.com>2018-12-14 16:05:47 -0500
committerSawyer Bergeron <sawyerbergeron@gmail.com>2019-01-03 10:34:13 -0500
commitf27e25c199c3c5c9433463732b776ae9b4357cf8 (patch)
treed684ed4b89355db5050021b4aaaf505d4de70bc8 /src/workflow/forms.py
parente26a8259dbe879d722d5e619f9d6efe0b113d1cd (diff)
Implement Segmented Workflows
A major source of bugs has been how we've approached inlining workflows. We no longer inline them as of this commit, and instead use a stack structure. This commits the result of workflows to the database before other workflows try to read them, so we don't have to maintain a code path for when something is or isn't committed to db. This patchset allows for workflows to pass limited information to preset selections Change-Id: I3d040c7f3024c7420017ae4ec66a23219303dcb6 Signed-off-by: Sawyer Bergeron <sawyerbergeron@gmail.com>
Diffstat (limited to 'src/workflow/forms.py')
-rw-r--r--src/workflow/forms.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/workflow/forms.py b/src/workflow/forms.py
index feb32f2..f781663 100644
--- a/src/workflow/forms.py
+++ b/src/workflow/forms.py
@@ -41,6 +41,7 @@ class SearchableSelectMultipleWidget(widgets.SelectMultiple):
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)
@@ -61,7 +62,8 @@ class SearchableSelectMultipleWidget(widgets.SelectMultiple):
'initial': self.initial,
'default_entry': self.default_entry,
'edit': self.edit,
- 'wf_type': self.wf_type
+ 'wf_type': self.wf_type,
+ 'incompatible': self.incompatible
}
@@ -101,13 +103,6 @@ class ResourceSelectorForm(forms.Form):
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",
@@ -159,13 +154,15 @@ class SWConfigSelectorForm(forms.Form):
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,
@@ -177,7 +174,8 @@ class SWConfigSelectorForm(forms.Form):
'placeholder': "config",
'initial': chosen,
'edit': edit,
- 'wf_type': 2
+ 'wf_type': 2,
+ 'incompatible': incompatible_choice
}
return attrs