fix: [code-1991]: fix latest approval (#2130)

This commit is contained in:
Calvin Lee 2024-06-24 05:28:07 +00:00 committed by Harness
parent 8b454426a7
commit a2e3a3e90a
4 changed files with 27 additions and 3 deletions

View File

@ -111,6 +111,10 @@
font-size: 16px !important; font-size: 16px !important;
line-height: 24px !important; line-height: 24px !important;
} }
.widthContainer {
max-width: 220px !important;
min-width: min-content !important;
}
.dateText { .dateText {
font-size: 12px !important; font-size: 12px !important;
line-height: 18px !important; line-height: 18px !important;

View File

@ -60,4 +60,5 @@ export declare const unchecked: string
export declare const unmergeable: string export declare const unmergeable: string
export declare const verticalContainer: string export declare const verticalContainer: string
export declare const viewDetailsBtn: string export declare const viewDetailsBtn: string
export declare const widthContainer: string
export declare const widthContent: string export declare const widthContent: string

View File

@ -536,7 +536,9 @@ const MergeInfo: React.FC<{ pullRequestMetadata: TypesPullReq }> = ({ pullReques
<Container padding={{ left: 'small', right: 'small' }}> <Container padding={{ left: 'small', right: 'small' }}>
<strong className={cx(css.boldText, css.purpleContainer)}> <strong className={cx(css.boldText, css.purpleContainer)}>
<Icon name={CodeIcon.Merged} size={16} color={Color.PURPLE_700} /> <Icon name={CodeIcon.Merged} size={16} color={Color.PURPLE_700} />
{pullRequestMetadata.source_branch} <Text className={cx(css.boldText, css.widthContainer)} lineClamp={1}>
{pullRequestMetadata?.source_branch}
</Text>
</strong> </strong>
</Container> </Container>
), ),
@ -544,7 +546,9 @@ const MergeInfo: React.FC<{ pullRequestMetadata: TypesPullReq }> = ({ pullReques
<Container padding={{ left: 'small', right: 'small' }}> <Container padding={{ left: 'small', right: 'small' }}>
<strong className={cx(css.boldText, css.purpleContainer)}> <strong className={cx(css.boldText, css.purpleContainer)}>
<Icon name={CodeIcon.Merged} size={16} color={Color.PURPLE_700} /> <Icon name={CodeIcon.Merged} size={16} color={Color.PURPLE_700} />
{pullRequestMetadata.target_branch} <Text className={cx(css.boldText, css.widthContainer)} lineClamp={1}>
{pullRequestMetadata?.target_branch}
</Text>
</strong> </strong>
</Container> </Container>
), ),

View File

@ -158,7 +158,9 @@ const ChangesSection = (props: ChangesSectionProps) => {
statusIcon = 'warning-icon' statusIcon = 'warning-icon'
} else if ( } else if (
(codeOwnerPendingEntries && codeOwnerPendingEntries?.length > 0 && reqCodeOwnerLatestApproval) || (codeOwnerPendingEntries && codeOwnerPendingEntries?.length > 0 && reqCodeOwnerLatestApproval) ||
(latestCodeOwnerApprovalArr?.length < minReqLatestApproval && reqCodeOwnerLatestApproval) (!isEmpty(latestCodeOwnerApprovalArr) &&
latestCodeOwnerApprovalArr?.length < minReqLatestApproval &&
reqCodeOwnerLatestApproval)
) { ) {
title = getString('changesSection.pendingAppFromCodeOwners') title = getString('changesSection.pendingAppFromCodeOwners')
statusMessage = getString('changesSection.pendingLatestApprovalCodeOwners') statusMessage = getString('changesSection.pendingLatestApprovalCodeOwners')
@ -333,6 +335,19 @@ const ChangesSection = (props: ChangesSectionProps) => {
) )
} }
if (codeOwnerApprovalEntries?.length > 0) { if (codeOwnerApprovalEntries?.length > 0) {
if (reqCodeOwnerLatestApproval && latestCodeOwnerApprovalArr.length < minReqLatestApproval) {
return (
<Layout.Horizontal>
<Container padding={{ left: 'large' }}>
<img alt="emptyStatus" width={16} height={16} src={emptyStatus} />
</Container>
<Text padding={{ left: 'medium' }} className={css.sectionSubheader}>
{getString('changesSection.latestChangesPendingReqRev')}
</Text>
</Layout.Horizontal>
)
}
return ( return (
<Text <Text
icon={'tick-circle'} icon={'tick-circle'}