Add OPTIONAL_UI_URL_PREFIX (#15506) (#6694)

# Add a postfix to the UI URL patterns for UI URL generated by the API
# example if set to '' UI URL generated by the API for jobs would be $TOWER_URL/jobs
# example if set to 'execution' UI URL generated by the API for jobs would be $TOWER_URL/execution/jobs

Co-authored-by: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com>
This commit is contained in:
Peter Braun
2024-09-13 20:06:40 +02:00
committed by GitHub
parent 96ec709e90
commit f799376b3d
5 changed files with 10 additions and 5 deletions

View File

@@ -628,7 +628,7 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin, TaskMana
return reverse('api:job_detail', kwargs={'pk': self.pk}, request=request)
def get_ui_url(self):
return urljoin(settings.TOWER_URL_BASE, "/#/jobs/playbook/{}".format(self.pk))
return urljoin(settings.TOWER_URL_BASE, "{}/jobs/playbook/{}".format(settings.OPTIONAL_UI_URL_PREFIX, self.pk))
def _set_default_dependencies_processed(self):
"""
@@ -1275,7 +1275,7 @@ class SystemJob(UnifiedJob, SystemJobOptions, JobNotificationMixin):
return reverse('api:system_job_detail', kwargs={'pk': self.pk}, request=request)
def get_ui_url(self):
return urljoin(settings.TOWER_URL_BASE, "/#/jobs/system/{}".format(self.pk))
return urljoin(settings.TOWER_URL_BASE, "{}/jobs/system/{}".format(settings.OPTIONAL_UI_URL_PREFIX, self.pk))
@property
def event_class(self):