mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
Fixes contentLoading issue in PR and enables Launch on JT List
This commit is contained in:
@@ -51,7 +51,6 @@ class WorkflowJobTemplates extends Base {
|
|||||||
params
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default WorkflowJobTemplates;
|
export default WorkflowJobTemplates;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import FullPage from '@components/FullPage';
|
|||||||
import JobList from '@components/JobList';
|
import JobList from '@components/JobList';
|
||||||
import RoutedTabs from '@components/RoutedTabs';
|
import RoutedTabs from '@components/RoutedTabs';
|
||||||
import ScheduleList from '@components/ScheduleList';
|
import ScheduleList from '@components/ScheduleList';
|
||||||
|
import ContentLoading from '@components/ContentLoading';
|
||||||
import { WorkflowJobTemplatesAPI, CredentialsAPI } from '@api';
|
import { WorkflowJobTemplatesAPI, CredentialsAPI } from '@api';
|
||||||
import WorkflowJobTemplateDetail from './WorkflowJobTemplateDetail';
|
import WorkflowJobTemplateDetail from './WorkflowJobTemplateDetail';
|
||||||
import WorkflowJobTemplateEdit from './WorkflowJobTemplateEdit';
|
import WorkflowJobTemplateEdit from './WorkflowJobTemplateEdit';
|
||||||
@@ -51,12 +52,14 @@ class WorkflowJobTemplate extends Component {
|
|||||||
const {
|
const {
|
||||||
data: { webhook_key },
|
data: { webhook_key },
|
||||||
} = await WorkflowJobTemplatesAPI.readWebhookKey(id);
|
} = await WorkflowJobTemplatesAPI.readWebhookKey(id);
|
||||||
this.setState({ webHookKey: webhook_key });
|
this.setState({ webhook_key });
|
||||||
}
|
}
|
||||||
if (data?.summary_fields?.webhook_credential) {
|
if (data?.summary_fields?.webhook_credential) {
|
||||||
const {
|
const {
|
||||||
data: {
|
data: {
|
||||||
summary_fields: { credential_type: name },
|
summary_fields: {
|
||||||
|
credential_type: { name },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} = await CredentialsAPI.readDetail(
|
} = await CredentialsAPI.readDetail(
|
||||||
data.summary_fields.webhook_credential.id
|
data.summary_fields.webhook_credential.id
|
||||||
@@ -84,7 +87,7 @@ class WorkflowJobTemplate extends Component {
|
|||||||
contentError,
|
contentError,
|
||||||
hasContentLoading,
|
hasContentLoading,
|
||||||
template,
|
template,
|
||||||
webHookKey,
|
webhook_key,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
const tabsArray = [
|
const tabsArray = [
|
||||||
@@ -116,7 +119,9 @@ class WorkflowJobTemplate extends Component {
|
|||||||
if (location.pathname.endsWith('edit')) {
|
if (location.pathname.endsWith('edit')) {
|
||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
|
if (hasContentLoading) {
|
||||||
|
return <ContentLoading />;
|
||||||
|
}
|
||||||
if (!hasContentLoading && contentError) {
|
if (!hasContentLoading && contentError) {
|
||||||
return (
|
return (
|
||||||
<PageSection>
|
<PageSection>
|
||||||
@@ -151,7 +156,7 @@ class WorkflowJobTemplate extends Component {
|
|||||||
render={() => (
|
render={() => (
|
||||||
<WorkflowJobTemplateDetail
|
<WorkflowJobTemplateDetail
|
||||||
template={template}
|
template={template}
|
||||||
webHookKey={webHookKey}
|
webhook_key={webhook_key}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
@@ -163,7 +168,7 @@ class WorkflowJobTemplate extends Component {
|
|||||||
render={() => (
|
render={() => (
|
||||||
<WorkflowJobTemplateEdit
|
<WorkflowJobTemplateEdit
|
||||||
template={template}
|
template={template}
|
||||||
webHookKey={webHookKey}
|
webhook_key={webhook_key}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
@@ -200,7 +205,7 @@ class WorkflowJobTemplate extends Component {
|
|||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
)}
|
)}
|
||||||
{template && (
|
{template.id && (
|
||||||
<Route
|
<Route
|
||||||
path="/templates/:templateType/:id/schedules"
|
path="/templates/:templateType/:id/schedules"
|
||||||
render={() => (
|
render={() => (
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import LaunchButton from '@components/LaunchButton';
|
|||||||
import Sparkline from '@components/Sparkline';
|
import Sparkline from '@components/Sparkline';
|
||||||
import { toTitleCase } from '@util/strings';
|
import { toTitleCase } from '@util/strings';
|
||||||
|
|
||||||
function WorkflowJobTemplateDetail({ template, i18n, webHookKey }) {
|
function WorkflowJobTemplateDetail({ template, i18n, webhook_key }) {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
ask_inventory_on_launch,
|
ask_inventory_on_launch,
|
||||||
@@ -143,7 +143,7 @@ function WorkflowJobTemplateDetail({ template, i18n, webHookKey }) {
|
|||||||
value={`${urlOrigin}${template.related.webhook_receiver}`}
|
value={`${urlOrigin}${template.related.webhook_receiver}`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Detail label={i18n._(t`Webhook Key`)} value={webHookKey} />
|
<Detail label={i18n._(t`Webhook Key`)} value={webhook_key} />
|
||||||
{webhook_credential && (
|
{webhook_credential && (
|
||||||
<Detail
|
<Detail
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ describe('<WorkflowJobTemplateDetail/>', () => {
|
|||||||
component={() => (
|
component={() => (
|
||||||
<WorkflowJobTemplateDetail
|
<WorkflowJobTemplateDetail
|
||||||
template={template}
|
template={template}
|
||||||
webHookKey="Foo webhook key"
|
webhook_key="Foo webhook key"
|
||||||
hasContentLoading={false}
|
hasContentLoading={false}
|
||||||
onSetContentLoading={() => {}}
|
onSetContentLoading={() => {}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -4,14 +4,9 @@ import { useHistory } from 'react-router-dom';
|
|||||||
import { CardBody } from '@components/Card';
|
import { CardBody } from '@components/Card';
|
||||||
import { getAddedAndRemoved } from '@util/lists';
|
import { getAddedAndRemoved } from '@util/lists';
|
||||||
import { WorkflowJobTemplatesAPI, OrganizationsAPI } from '@api';
|
import { WorkflowJobTemplatesAPI, OrganizationsAPI } from '@api';
|
||||||
import ContentLoading from '@components/ContentLoading';
|
|
||||||
import { WorkflowJobTemplateForm } from '../shared';
|
import { WorkflowJobTemplateForm } from '../shared';
|
||||||
|
|
||||||
function WorkflowJobTemplateEdit({
|
function WorkflowJobTemplateEdit({ template, webhook_key }) {
|
||||||
template,
|
|
||||||
hasTemplateLoading,
|
|
||||||
webhook_key,
|
|
||||||
}) {
|
|
||||||
const [formSubmitError, setFormSubmitError] = useState();
|
const [formSubmitError, setFormSubmitError] = useState();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
@@ -65,9 +60,6 @@ function WorkflowJobTemplateEdit({
|
|||||||
history.push(`/templates`);
|
history.push(`/templates`);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hasTemplateLoading) {
|
|
||||||
return <ContentLoading />;
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<CardBody>
|
<CardBody>
|
||||||
|
|||||||
Reference in New Issue
Block a user