mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 21:49:27 -02:30
Merge pull request #6194 from jakemcdermott/6191-fix-unnecessary-panel-reload
Fix panel loading and clean up unneeded code Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -47,7 +47,7 @@ class WorkflowJobTemplate extends Component {
|
|||||||
const { setBreadcrumb, match } = this.props;
|
const { setBreadcrumb, match } = this.props;
|
||||||
const { id } = match.params;
|
const { id } = match.params;
|
||||||
|
|
||||||
this.setState({ contentError: null, hasContentLoading: true });
|
this.setState({ contentError: null });
|
||||||
try {
|
try {
|
||||||
const { data } = await WorkflowJobTemplatesAPI.readDetail(id);
|
const { data } = await WorkflowJobTemplatesAPI.readDetail(id);
|
||||||
if (data?.related?.webhook_key) {
|
if (data?.related?.webhook_key) {
|
||||||
@@ -113,22 +113,17 @@ class WorkflowJobTemplate extends Component {
|
|||||||
tab.id = n;
|
tab.id = n;
|
||||||
});
|
});
|
||||||
|
|
||||||
let cardHeader = hasContentLoading ? null : (
|
|
||||||
<TabbedCardHeader>
|
|
||||||
<RoutedTabs tabsArray={tabsArray} />
|
|
||||||
<CardActions>
|
|
||||||
<CardCloseButton linkTo="/templates" />
|
|
||||||
</CardActions>
|
|
||||||
</TabbedCardHeader>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (location.pathname.endsWith('edit')) {
|
|
||||||
cardHeader = null;
|
|
||||||
}
|
|
||||||
if (hasContentLoading) {
|
if (hasContentLoading) {
|
||||||
return <ContentLoading />;
|
return (
|
||||||
|
<PageSection>
|
||||||
|
<Card>
|
||||||
|
<ContentLoading />
|
||||||
|
</Card>
|
||||||
|
</PageSection>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!hasContentLoading && contentError) {
|
|
||||||
|
if (contentError) {
|
||||||
return (
|
return (
|
||||||
<PageSection>
|
<PageSection>
|
||||||
<Card>
|
<Card>
|
||||||
@@ -145,10 +140,19 @@ class WorkflowJobTemplate extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cardHeader = (
|
||||||
|
<TabbedCardHeader>
|
||||||
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
|
<CardActions>
|
||||||
|
<CardCloseButton linkTo="/templates" />
|
||||||
|
</CardActions>
|
||||||
|
</TabbedCardHeader>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageSection>
|
<PageSection>
|
||||||
<Card>
|
<Card>
|
||||||
{cardHeader}
|
{location.pathname.endsWith('edit') ? null : cardHeader}
|
||||||
<Switch>
|
<Switch>
|
||||||
<Redirect
|
<Redirect
|
||||||
from="/templates/workflow_job_template/:id"
|
from="/templates/workflow_job_template/:id"
|
||||||
@@ -201,7 +205,7 @@ class WorkflowJobTemplate extends Component {
|
|||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
)}
|
)}
|
||||||
{template.id && (
|
{template?.id && (
|
||||||
<Route
|
<Route
|
||||||
path="/templates/:templateType/:id/schedules"
|
path="/templates/:templateType/:id/schedules"
|
||||||
render={() => (
|
render={() => (
|
||||||
@@ -215,19 +219,17 @@ class WorkflowJobTemplate extends Component {
|
|||||||
<Route
|
<Route
|
||||||
key="not-found"
|
key="not-found"
|
||||||
path="*"
|
path="*"
|
||||||
render={() =>
|
render={() => (
|
||||||
!hasContentLoading && (
|
<ContentError isNotFound>
|
||||||
<ContentError isNotFound>
|
{match.params.id && (
|
||||||
{match.params.id && (
|
<Link
|
||||||
<Link
|
to={`/templates/workflow_job_template/${match.params.id}/details`}
|
||||||
to={`/templates/workflow_job_template/${match.params.id}/details`}
|
>
|
||||||
>
|
{i18n._(`View Template Details`)}
|
||||||
{i18n._(`View Template Details`)}
|
</Link>
|
||||||
</Link>
|
)}
|
||||||
)}
|
</ContentError>
|
||||||
</ContentError>
|
)}
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user