fix: [CODE-2406] pr link in pr listing (#2740)

* fix: [CODE-2406] pr link in pr listing
This commit is contained in:
Ritik Kapoor 2024-09-25 11:58:35 +00:00 committed by Harness
parent 51020b71e7
commit 9f38e07bf3
2 changed files with 11 additions and 13 deletions

View File

@ -74,8 +74,9 @@ export const Label: React.FC<LabelProps> = props => {
<Tag <Tag
onClick={e => { onClick={e => {
if (onClick) { if (onClick) {
onClick() e.preventDefault()
e.stopPropagation() e.stopPropagation()
onClick()
} }
}} }}
className={cx(css.labelTag, className, { [css.removeBtnTag]: removeLabelBtn })}> className={cx(css.labelTag, className, { [css.removeBtnTag]: removeLabelBtn })}>
@ -154,8 +155,9 @@ export const Label: React.FC<LabelProps> = props => {
<Tag <Tag
onClick={e => { onClick={e => {
if (onClick) { if (onClick) {
onClick() e.preventDefault()
e.stopPropagation() e.stopPropagation()
onClick()
} }
}} }}
className={cx(css.labelTag, className, { [css.removeBtnTag]: removeLabelBtn })}> className={cx(css.labelTag, className, { [css.removeBtnTag]: removeLabelBtn })}>

View File

@ -28,7 +28,7 @@ import {
} from '@harnessio/uicore' } from '@harnessio/uicore'
import { Icon } from '@harnessio/icons' import { Icon } from '@harnessio/icons'
import { Color, FontVariation } from '@harnessio/design-system' import { Color, FontVariation } from '@harnessio/design-system'
import { useHistory } from 'react-router-dom' import { Link, useHistory } from 'react-router-dom'
import { useGet } from 'restful-react' import { useGet } from 'restful-react'
import type { CellProps, Column } from 'react-table' import type { CellProps, Column } from 'react-table'
import { Case, Match, Render, Truthy } from 'react-jsx-match' import { Case, Match, Render, Truthy } from 'react-jsx-match'
@ -236,16 +236,12 @@ export default function PullRequests() {
width: '100%', width: '100%',
Cell: ({ row }: CellProps<TypesPullReq>) => { Cell: ({ row }: CellProps<TypesPullReq>) => {
return ( return (
<Container <Link
className={css.rowLink} className={css.rowLink}
onClick={() => to={routes.toCODEPullRequest({
history.push(
routes.toCODEPullRequest({
repoPath: repoMetadata?.path as string, repoPath: repoMetadata?.path as string,
pullRequestId: String(row.original.number) pullRequestId: String(row.original.number)
}) })}>
)
}>
<Layout.Horizontal className={css.titleRow} spacing="medium"> <Layout.Horizontal className={css.titleRow} spacing="medium">
<PullRequestStateLabel iconSize={22} data={row.original} iconOnly /> <PullRequestStateLabel iconSize={22} data={row.original} iconOnly />
<Container padding={{ left: 'small' }}> <Container padding={{ left: 'small' }}>
@ -357,7 +353,7 @@ export default function PullRequests() {
{/* TODO: Pass proper state when check api is fully implemented */} {/* TODO: Pass proper state when check api is fully implemented */}
{/* <ExecutionStatusLabel data={{ state: 'success' }} /> */} {/* <ExecutionStatusLabel data={{ state: 'success' }} /> */}
</Layout.Horizontal> </Layout.Horizontal>
</Container> </Link>
) )
} }
} }