fix: [code-1991]: fix commit message (#2097)

ui/offscreen-diff-contents
Calvin Lee 2024-06-12 06:11:43 +00:00 committed by Harness
parent 8e8bb98208
commit 21607267c1
4 changed files with 16 additions and 5 deletions

View File

@ -113,3 +113,9 @@
padding: 0 var(--spacing-xsmall) !important;
margin-left: var(--spacing-small) !important;
}
.popover {
z-index: 99999;
padding: var(--spacing-small) !important;
background: var(--primary-bg);
}

View File

@ -24,6 +24,7 @@ export declare const historyBtnLayout: string
export declare const label: string
export declare const layout: string
export declare const noCopy: string
export declare const popover: string
export declare const refreshIcon: string
export declare const row: string
export declare const rowText: string

View File

@ -119,7 +119,11 @@ export function CommitsView({
width: 'calc(60% - 100px)',
Cell: ({ row }: CellProps<TypesCommit>) => {
return (
<Text color={Color.BLACK} lineClamp={1} className={css.rowText}>
<Text
tooltipProps={{ popoverClassName: css.popover }}
color={Color.BLACK}
lineClamp={1}
className={css.rowText}>
{renderPullRequestLinkFromCommitMessage(repoMetadata, routes, row.original.message)}
</Text>
)
@ -286,12 +290,10 @@ function renderPullRequestLinkFromCommitMessage(
commitMessage = ''
) {
let message: string | JSX.Element = commitMessage
const match = message.match(/\(#\d+\)$/)
const match = message.match(/\(#\d+\)(\n|$)/)
if (match?.length) {
message = message.replace(match[0], '({URL})')
const pullRequestId = match[0].replace('(#', '').replace(')', '')
message = (
<StringSubstitute
str={message}

View File

@ -98,6 +98,7 @@ export const PullRequestActionsBox: React.FC<PullRequestActionsBoxProps> = ({
const handleSubmit = useMemo(() => {
return () => {
if (inlineMergeRef.current) {
setPrMerged(true)
inlineMergeRef.current.handleSubmit()
}
}
@ -233,7 +234,7 @@ export const PullRequestActionsBox: React.FC<PullRequestActionsBoxProps> = ({
messageTitle =
mergeOption.method === MergeStrategy.SQUASH
? `${commit.title} (#${pullReqMetadata?.number})`
: `Merge branch ${pullReqMetadata?.source_branch} of ${repoMetadata?.path} (#${pullReqMetadata?.number}})`
: `Merge branch ${pullReqMetadata?.source_branch} of ${repoMetadata?.path} (#${pullReqMetadata?.number})`
})
}
return {
@ -442,6 +443,7 @@ export const PullRequestActionsBox: React.FC<PullRequestActionsBoxProps> = ({
<Button
type="submit"
onClick={handleSubmit}
disabled={prMerged}
variation={ButtonVariation.PRIMARY}
text={getString('confirmStrat', { strat: mergeOption.title })}
/>