Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions config-ui/src/components/tooltip/help-tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import { QuestionCircleOutlined } from '@ant-design/icons';
import type { TooltipProps } from 'antd';
import { Tooltip } from 'antd';

import styled from 'styled-components';
Expand All @@ -30,10 +31,10 @@ interface Props {
style?: React.CSSProperties;
}

export const HelpTooltip = ({ content, style }: Props) => {
export const HelpTooltip = ({ content, style, ...props }: Props & TooltipProps) => {
return (
<Wrapper style={style}>
<Tooltip title={content} placement="top">
<Tooltip title={content} placement="top" {...props}>
<QuestionCircleOutlined />
</Tooltip>
</Wrapper>
Expand Down
27 changes: 21 additions & 6 deletions config-ui/src/routes/project/detail/settings-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { validName } from '../utils';

import * as S from './styled';

const RegexPrIssueDefaultValue = '(?mi)(Closes)[\\s]*.*(((and )?#\\d+[ ]*)+)';

interface Props {
project: IProject;
onRefresh: () => void;
Expand Down Expand Up @@ -60,7 +62,7 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
});
setLinker({
enable: linker?.enable ?? false,
prToIssueRegexp: linker?.pluginOption?.prToIssueRegexp ?? '',
prToIssueRegexp: linker?.pluginOption?.prToIssueRegexp ?? RegexPrIssueDefaultValue,
});
}, [project]);

Expand Down Expand Up @@ -145,19 +147,32 @@ export const SettingsPanel = ({ project, onRefresh }: Props) => {
<span>
Parse the issue key with the regex from the title and description of the pull requests in this project.
<HelpTooltip
overlayInnerStyle={{ width: 500 }}
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>
<>
<div>
Example 1 - If your PR title or description contains a Jira issue key in the format 'Closes
[DI-123](www.yourdomain.atlassian.net/browse/di-123)', please use the following regex template:{' '}
{'{'}
(?mi)(fix|close|resolve|fixes|closes|resolves|fixed|closed|resolved)[\s]*.*(((and)?https://\S+.atlassian.net/browse/\S+[
]*)+){'}'}
</div>
<div>
Example 2 - If your PR title or description contains a GitHub issue key in the format 'Resolves
www.github.com/namespace/repo_name/issues/123)', please use the following regex template: {'{'}
(?mi)(fix|close|resolve|fixes|closes|resolves|fixed|closed|resolved)[\s]*.*(((and)?https://github.com/%s/issues/\d+[
]*)+){'}'}
</div>
</>
}
/>
</span>
}
>
{linker.enable && (
<Input
style={{ width: 600 }}
placeholder={RegexPrIssueDefaultValue}
value={linker.prToIssueRegexp}
onChange={(e) => setLinker({ ...linker, prToIssueRegexp: e.target.value })}
/>
Expand Down