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:
softwarefactory-project-zuul[bot] 2020-08-20 16:30:29 +00:00 committed by GitHub
commit a659b9d994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,6 @@ import useRequest from '../../../util/useRequest';
import OptionsList from '../../OptionsList';
import ContentLoading from '../../ContentLoading';
import ContentError from '../../ContentError';
import { required } from '../../../util/validators';
const QS_CONFIG = getQSConfig('inventory', {
page: 1,
@ -20,7 +19,6 @@ const QS_CONFIG = getQSConfig('inventory', {
function InventoryStep({ i18n }) {
const [field, , helpers] = useField({
name: 'inventory',
validate: required(null, i18n),
});
const history = useHistory();

View File

@ -9,7 +9,11 @@ export default function useInventoryStep(config, resource, visitedSteps, i18n) {
const [stepErrors, setStepErrors] = useState({});
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 {};
}
const errors = {};

View File

@ -44,9 +44,7 @@ function TemplateListItem({
fetchTemplates,
}) {
const [isDisabled, setIsDisabled] = useState(false);
const labelId = `check-action-${template.id}`;
const canLaunch = template.summary_fields.user_capabilities.start;
const copyTemplate = useCallback(async () => {
if (template.type === 'job_template') {
@ -106,7 +104,7 @@ function TemplateListItem({
]}
/>
<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">
<LaunchButton resource={template}>
{({ handleLaunch }) => (