Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add issue trace configuration for project #7624

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading