fix mistral dashbaord workflow execution form bug

fix a bug that when a workflow has no input params, execution form
will has a requried field with empty label

Close-bug:#1786723
Change-Id: I49b2125ef649e94e210ff5df739684626c175172
This commit is contained in:
privaterookie 2018-08-13 09:44:15 +08:00
parent 04c32537f7
commit 9f35dca96f

View File

@ -45,15 +45,16 @@ class ExecuteForm(forms.SelfHandlingForm):
for entry in list.split(","): for entry in list.split(","):
label, _, default = entry.partition("=") label, _, default = entry.partition("=")
label = label.strip() label = label.strip()
self.workflow_parameters.append(label) if label != '':
if default == "None": self.workflow_parameters.append(label)
default = None if default == "None":
required = False default = None
else: required = False
required = True else:
self.fields[label] = forms.CharField(label=label, required = True
required=required, self.fields[label] = forms.CharField(label=label,
initial=default) required=required,
initial=default)
def handle(self, request, data): def handle(self, request, data):
try: try: