Skip to content

Commit

Permalink
feat: assiocate pull request with issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsweet committed May 23, 2024
1 parent f276efc commit 9b27f62
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config-ui/src/components/block/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface Props {
title?: React.ReactNode;
description?: React.ReactNode;
required?: boolean;
children: React.ReactNode;
children?: React.ReactNode;
}

export const Block = ({ style, title, description, required, children }: Props) => {
Expand Down
40 changes: 35 additions & 5 deletions config-ui/src/routes/project/detail/settings-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { WarningOutlined } from '@ant-design/icons';
import { Flex, Space, Card, Modal, Input, Checkbox, Button, message } from 'antd';

import API from '@/api';
import { Block } from '@/components';
import { Block, HelpTooltip } from '@/components';
import { PATHS } from '@/config';
import { IProject } from '@/types';
import { operator } from '@/utils';
Expand All @@ -39,6 +39,8 @@ interface Props {
export const SettingsPanel = ({ project, onRefresh }: Props) => {
const [name, setName] = useState('');
const [enableDora, setEnableDora] = useState(false);
const [associatePrWithIssues, setAssociatePrWithIssues] = useState(false);
const [regexPrIssue, setRegexPrIssue] = useState('');
const [operating, setOperating] = useState(false);
const [open, setOpen] = useState(false);

Expand Down Expand Up @@ -107,10 +109,38 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
<Block title="Project Name" description="Edit your project name with letters, numbers, -, _ or /" required>
<Input style={{ width: 386 }} value={name} onChange={(e) => setName(e.target.value)} />
</Block>
<Block description="DORA metrics are four widely-adopted metrics for measuring software delivery performance.">
<Checkbox checked={enableDora} onChange={(e) => setEnableDora(e.target.checked)}>
Enable DORA Metrics
</Checkbox>
<Block
title={
<Checkbox checked={enableDora} onChange={(e) => setEnableDora(e.target.checked)}>
Enable DORA Metrics
</Checkbox>
}
description="DORA metrics are four widely-adopted metrics for measuring software delivery performance."
/>
<Block
title={
<Checkbox checked={associatePrWithIssues} onChange={(e) => setAssociatePrWithIssues(e.target.checked)}>
Associate pull requests with issues
</Checkbox>
}
description={
<span>
Parse the issue key with the regex from the title and description of the pull requests in this project.
<HelpTooltip
content={
<span>
The default regex will parse the issue key from the table.pull_requests where the description
contains "fix/close/.../resolved {'{'}issue_key{'}'}". The relationship between pull requests and
issues will be stored in the table.pull_request_issues
</span>
}
/>
</span>
}
>
{associatePrWithIssues && (
<Input style={{ width: 600 }} value={regexPrIssue} onChange={(e) => setRegexPrIssue(e.target.value)} />
)}
</Block>
<Block>
<Button type="primary" loading={operating} disabled={!name} onClick={handleUpdate}>
Expand Down

0 comments on commit 9b27f62

Please sign in to comment.