From d35732c4b7bbffd1711fbb919403924f4e1daeb4 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Thu, 17 Dec 2020 09:15:10 -0500 Subject: [PATCH 1/2] Add missing slash to routing key --- awx/ui_next/src/screens/Template/Templates.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui_next/src/screens/Template/Templates.jsx b/awx/ui_next/src/screens/Template/Templates.jsx index fbc9e237af..167d458141 100644 --- a/awx/ui_next/src/screens/Template/Templates.jsx +++ b/awx/ui_next/src/screens/Template/Templates.jsx @@ -35,7 +35,7 @@ function Templates({ i18n }) { [`${templatePath}/notifications`]: i18n._(t`Notifications`), [`${templatePath}/completed_jobs`]: i18n._(t`Completed Jobs`), [surveyPath]: i18n._(t`Survey`), - [`${surveyPath}add`]: i18n._(t`Add Question`), + [`${surveyPath}/add`]: i18n._(t`Add Question`), [`${surveyPath}/edit`]: i18n._(t`Edit Question`), [schedulesPath]: i18n._(t`Schedules`), [`${schedulesPath}/add`]: i18n._(t`Create New Schedule`), From 19f855717d4ce2143197c8ed04b6d4dc0a35cb79 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Thu, 17 Dec 2020 09:16:54 -0500 Subject: [PATCH 2/2] Don't build redirect until data available --- awx/ui_next/src/screens/Job/JobTypeRedirect.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/awx/ui_next/src/screens/Job/JobTypeRedirect.jsx b/awx/ui_next/src/screens/Job/JobTypeRedirect.jsx index bf36a1a14c..599fc402a9 100644 --- a/awx/ui_next/src/screens/Job/JobTypeRedirect.jsx +++ b/awx/ui_next/src/screens/Job/JobTypeRedirect.jsx @@ -18,8 +18,11 @@ function JobTypeRedirect({ id, path, view, i18n }) { request: loadJob, } = useRequest( useCallback(async () => { - const { data } = await UnifiedJobsAPI.read({ id }); - return { job: data }; + const { + data: { results }, + } = await UnifiedJobsAPI.read({ id }); + const [item] = results; + return { job: item }; }, [id]), { job: {} } ); @@ -42,7 +45,7 @@ function JobTypeRedirect({ id, path, view, i18n }) { ); } - if (isLoading) { + if (isLoading || !job?.id) { // TODO show loading state return
Loading...
; }