Need help in developing a macro in which I want to insert a select list in a column of a table by Forge. Is there any solution/workaround to achieve this?
Here is the code which I tried but this is giving me empty result.
import ForgeUI, { useConfig, render, Macro, Text, useProductContext, Table, Head, Cell, Row, Fragment, MacroConfig, Select, Option } from "@forge/ui";
const issues =
[
{
Jira: '',
owner:'The document author',
contributors: 'The collaborators of the document',
Technical : 'Yes or No'
}
]
const Fig = () => {
const config = useConfig() || defaultConfig;
return (
<Text> Client Impact: {config.milestone}
</Text>
)
};
const Config = () => {
return (
<Fragment>
<MacroConfig>
<Select label="Client Impact" name="milestone">
<Option defaultSelected label="None" value="None" />
<Option label="RS2SP" value="RS2SP" />
</Select>
</MacroConfig>
</Fragment>
)}
export const config = render(<Config />);
const App = () => (
<Table>
<Head>
<Cell>
<Text>JIRA Number</Text>
</Cell>
<Cell>
<Text>Document status</Text>
</Cell>
<Cell>
<Text>Document owner</Text>
</Cell>
<Cell>
<Text>Document contributors</Text>
</Cell>
<Cell>
<Text>Technical Analysis Document Required?</Text>
</Cell>
</Head>
{issues.map(issue => (
<Row>
<Cell>
<Text>{issue.Jira}</Text>
</Cell>
<Cell>
<Text>{Fig.milestone}</Text>
</Cell>
<Cell>
<Text>{issue.owner}</Text>
</Cell>
<Cell>
<Text>{issue.contributors}</Text>
</Cell>
<Cell>
<Text>{issue.Technical}</Text>
</Cell>
</Row>
))}
</Table>
);
export const run = render(
<Macro
app={<App />}
/>
);
const ExportIt = () => {
const productContext = useProductContext();
console.log("product context ", productContext);
return (<Text>Table will not be exported</Text>);
};
export const exportMacro = render(<ExportIt />);
Attached is the screenshot of output.
Thanks
Asha