Hello,
It would be nice to use FormCondition in MacroConfig component (not only inside a Form
).
FormCondition allows to guide the user step by step to fill in a form in MacroConfig.
My personal use case is:
Step 1: In MacroConfig panel, the user select a Jira project in a select
field
Step 2: Depend of value selected on step 1, the user select a issue type (eg: Requirement) in a second select
field
So for my use-case it doesn’t make sense if the user starts with step 2.
My code look like :
// Function that defines the configuration UI
const Config = () => {
const [projects] = useState(fetchProjects); //Get jira project list
const [issueTypes] = useState(fetchIssueTypes(10001)); // /!\ Static value . How to get Issue type depend of jira project selected ?
return (
<MacroConfig>
<Select label="Project" name="projectKey">
{projects.map(project => {
return (
<Option label={`${project.name} (${project.key})`} value={project.Id} />
)
})
}
</Select>
<FormCondition when="projectKey" is={not null}>
<Select label="Issue Type" name="issueType">
{
issueTypes.issueTypes.map(issueType => {
return (
<Option label={`${issueType.name}`} value={issueType.Id} />
)
})
}
</Select>
</FormCondition>
</MacroConfig>
);
};
For information FormCondition
is described : FormCondition documentation
Looking forward to reading you