Skip to content

Commit

Permalink
feat: add issue trace configuration for project (#7624)
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsweet committed Jun 14, 2024
1 parent 13b0b43 commit b6a537a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions config-ui/src/routes/project/detail/settings-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
enable: false,
prToIssueRegexp: '',
});
const [issueTrace, setIssueTrace] = useState({
enable: false,
});
const [operating, setOperating] = useState(false);
const [open, setOpen] = useState(false);

Expand All @@ -54,6 +57,7 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
useEffect(() => {
const dora = project.metrics.find((ms) => ms.pluginName === 'dora');
const linker = project.metrics.find((ms) => ms.pluginName === 'linker');
const issueTrace = project.metrics.find((ms) => ms.pluginName === 'issue_trace');

setName(project.name);
setDora({
Expand All @@ -63,6 +67,9 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
enable: linker?.enable ?? false,
prToIssueRegexp: linker?.pluginOption?.prToIssueRegexp ?? RegexPrIssueDefaultValue,
});
setIssueTrace({
enable: issueTrace?.enable ?? false,
});
}, [project]);

const handleUpdate = async () => {
Expand All @@ -89,6 +96,11 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
},
enable: linker.enable,
},
{
pluginName: 'issue_trace',
pluginOption: {},
enable: issueTrace.enable,
},
],
}),
{
Expand Down Expand Up @@ -174,6 +186,14 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
/>
)}
</Block>
<Block
title={
<Checkbox checked={issueTrace.enable} onChange={(e) => setIssueTrace({ enable: e.target.checked })}>
Enable Issue Trace
</Checkbox>
}
description=""
/>
<Block>
<Button type="primary" loading={operating} disabled={!name} onClick={handleUpdate}>
Save
Expand Down

0 comments on commit b6a537a

Please sign in to comment.