mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 06:29:31 -02:30
Merge pull request #7851 from mabashian/5910-workflow-prompt
Support workflow prompting on launch Reviewed-by: Jake McDermott <yo@jakemcdermott.me> https://github.com/jakemcdermott
This commit is contained in:
@@ -9,7 +9,6 @@ import useRequest from '../../../util/useRequest';
|
|||||||
import OptionsList from '../../OptionsList';
|
import OptionsList from '../../OptionsList';
|
||||||
import ContentLoading from '../../ContentLoading';
|
import ContentLoading from '../../ContentLoading';
|
||||||
import ContentError from '../../ContentError';
|
import ContentError from '../../ContentError';
|
||||||
import { required } from '../../../util/validators';
|
|
||||||
|
|
||||||
const QS_CONFIG = getQSConfig('inventory', {
|
const QS_CONFIG = getQSConfig('inventory', {
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -20,7 +19,6 @@ const QS_CONFIG = getQSConfig('inventory', {
|
|||||||
function InventoryStep({ i18n }) {
|
function InventoryStep({ i18n }) {
|
||||||
const [field, , helpers] = useField({
|
const [field, , helpers] = useField({
|
||||||
name: 'inventory',
|
name: 'inventory',
|
||||||
validate: required(null, i18n),
|
|
||||||
});
|
});
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ export default function useInventoryStep(config, resource, visitedSteps, i18n) {
|
|||||||
const [stepErrors, setStepErrors] = useState({});
|
const [stepErrors, setStepErrors] = useState({});
|
||||||
|
|
||||||
const validate = values => {
|
const validate = values => {
|
||||||
if (!config.ask_inventory_on_launch) {
|
if (
|
||||||
|
!config.ask_inventory_on_launch ||
|
||||||
|
(['workflow_job', 'workflow_job_template'].includes(resource.type) &&
|
||||||
|
!resource.inventory)
|
||||||
|
) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const errors = {};
|
const errors = {};
|
||||||
|
|||||||
@@ -44,9 +44,7 @@ function TemplateListItem({
|
|||||||
fetchTemplates,
|
fetchTemplates,
|
||||||
}) {
|
}) {
|
||||||
const [isDisabled, setIsDisabled] = useState(false);
|
const [isDisabled, setIsDisabled] = useState(false);
|
||||||
|
|
||||||
const labelId = `check-action-${template.id}`;
|
const labelId = `check-action-${template.id}`;
|
||||||
const canLaunch = template.summary_fields.user_capabilities.start;
|
|
||||||
|
|
||||||
const copyTemplate = useCallback(async () => {
|
const copyTemplate = useCallback(async () => {
|
||||||
if (template.type === 'job_template') {
|
if (template.type === 'job_template') {
|
||||||
@@ -106,7 +104,7 @@ function TemplateListItem({
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<DataListAction aria-label="actions" aria-labelledby={labelId}>
|
<DataListAction aria-label="actions" aria-labelledby={labelId}>
|
||||||
{canLaunch && template.type === 'job_template' && (
|
{template.summary_fields.user_capabilities.start && (
|
||||||
<Tooltip content={i18n._(t`Launch Template`)} position="top">
|
<Tooltip content={i18n._(t`Launch Template`)} position="top">
|
||||||
<LaunchButton resource={template}>
|
<LaunchButton resource={template}>
|
||||||
{({ handleLaunch }) => (
|
{({ handleLaunch }) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user