You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/05/23 09:44:51 UTC
(incubator-devlake) 01/01: feat: assiocate pull request with issue
This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch feat-7241
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 9b27f621b3d0d637d00c6ba79e1c8f873f200681
Author: mintsweet <0x...@gmail.com>
AuthorDate: Thu May 23 21:44:36 2024 +1200
feat: assiocate pull request with issue
---
config-ui/src/components/block/index.tsx | 2 +-
.../src/routes/project/detail/settings-panel.tsx | 40 +++++++++++++++++++---
2 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/config-ui/src/components/block/index.tsx b/config-ui/src/components/block/index.tsx
index 068c64935..2df536879 100644
--- a/config-ui/src/components/block/index.tsx
+++ b/config-ui/src/components/block/index.tsx
@@ -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) => {
diff --git a/config-ui/src/routes/project/detail/settings-panel.tsx b/config-ui/src/routes/project/detail/settings-panel.tsx
index 535c824ec..8a217e06a 100644
--- a/config-ui/src/routes/project/detail/settings-panel.tsx
+++ b/config-ui/src/routes/project/detail/settings-panel.tsx
@@ -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';
@@ -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);
@@ -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}>