From a5afac62caa0b9bf8b57e749aa83400494ba0edd Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Thu, 5 Mar 2020 15:21:01 -0500 Subject: [PATCH] Fix panel reloading and clean up unneeded code --- .../screens/Template/WorkflowJobTemplate.jsx | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx index 6c63e16ab0..e3e3783287 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplate.jsx @@ -46,7 +46,7 @@ class WorkflowJobTemplate extends Component { const { setBreadcrumb, match } = this.props; const { id } = match.params; - this.setState({ contentError: null, hasContentLoading: true }); + this.setState({ contentError: null }); try { const { data } = await WorkflowJobTemplatesAPI.readDetail(id); if (data?.related?.webhook_key) { @@ -107,22 +107,17 @@ class WorkflowJobTemplate extends Component { tab.id = n; }); - let cardHeader = hasContentLoading ? null : ( - - - - - - - ); - - if (location.pathname.endsWith('edit')) { - cardHeader = null; - } if (hasContentLoading) { - return ; + return ( + + + + + + ); } - if (!hasContentLoading && contentError) { + + if (contentError) { return ( @@ -139,10 +134,19 @@ class WorkflowJobTemplate extends Component { ); } + const cardHeader = ( + + + + + + + ); + return ( - {cardHeader} + {location.pathname.endsWith('edit') ? null : cardHeader} )} - {template.id && ( + {template?.id && ( ( @@ -206,19 +210,17 @@ class WorkflowJobTemplate extends Component { - !hasContentLoading && ( - - {match.params.id && ( - - {i18n._(`View Template Details`)} - - )} - - ) - } + render={() => ( + + {match.params.id && ( + + {i18n._(`View Template Details`)} + + )} + + )} />