mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Add survey bits to summary fields on job templates.... change "title" to
"name" on survey metadata.
This commit is contained in:
parent
36ab9d98e0
commit
259e48df3e
@ -1244,6 +1244,12 @@ class JobTemplateSerializer(UnifiedJobTemplateSerializer, JobOptionsSerializer):
|
||||
res['survey_spec'] = reverse('api:job_template_survey_spec', args=(obj.pk,))
|
||||
return res
|
||||
|
||||
def get_summary_fields(self, obj):
|
||||
d = super(JobTemplateSerializer, self).get_summary_fields(obj)
|
||||
if obj.survey_enabled and ('name' in obj.survey_spec and 'description' in obj.survey_spec):
|
||||
d['survey'] = dict(title=obj.survey_spec['name'], description=obj.survey_spec['description'])
|
||||
return d
|
||||
|
||||
|
||||
class JobSerializer(UnifiedJobSerializer, JobOptionsSerializer):
|
||||
|
||||
|
@ -233,8 +233,8 @@ class JobTemplate(UnifiedJobTemplate, JobOptions):
|
||||
errors = []
|
||||
if not self.survey_enabled:
|
||||
return errors
|
||||
if 'title' not in self.survey_spec:
|
||||
errors.append("'title' missing from survey spec")
|
||||
if 'name' not in self.survey_spec:
|
||||
errors.append("'name' missing from survey spec")
|
||||
if 'description' not in self.survey_spec:
|
||||
errors.append("'description' missing from survey spec")
|
||||
for survey_element in self.survey_spec["spec"]:
|
||||
|
Loading…
Reference in New Issue
Block a user