mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 11:41:08 -03:30
Add survey bits to summary fields on job templates.... change "title" to
"name" on survey metadata.
This commit is contained in:
@@ -1244,6 +1244,12 @@ class JobTemplateSerializer(UnifiedJobTemplateSerializer, JobOptionsSerializer):
|
|||||||
res['survey_spec'] = reverse('api:job_template_survey_spec', args=(obj.pk,))
|
res['survey_spec'] = reverse('api:job_template_survey_spec', args=(obj.pk,))
|
||||||
return res
|
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):
|
class JobSerializer(UnifiedJobSerializer, JobOptionsSerializer):
|
||||||
|
|
||||||
|
|||||||
@@ -233,8 +233,8 @@ class JobTemplate(UnifiedJobTemplate, JobOptions):
|
|||||||
errors = []
|
errors = []
|
||||||
if not self.survey_enabled:
|
if not self.survey_enabled:
|
||||||
return errors
|
return errors
|
||||||
if 'title' not in self.survey_spec:
|
if 'name' not in self.survey_spec:
|
||||||
errors.append("'title' missing from survey spec")
|
errors.append("'name' missing from survey spec")
|
||||||
if 'description' not in self.survey_spec:
|
if 'description' not in self.survey_spec:
|
||||||
errors.append("'description' missing from survey spec")
|
errors.append("'description' missing from survey spec")
|
||||||
for survey_element in self.survey_spec["spec"]:
|
for survey_element in self.survey_spec["spec"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user