Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup pull request page to pass around selected flags #2282

Merged
Merged
Show file tree
Hide file tree
Changes from 5 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
8 changes: 4 additions & 4 deletions src/pages/CommitDetailPage/CommitDetailPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ function CommitErrorBanners() {
}

function CommitDetailPage() {
const { provider, owner, repo, commit: commitSHA } = useParams()
const shortSHA = commitSHA?.slice(0, 7)
const { provider, owner, repo, commit: commitSha } = useParams()
const shortSHA = commitSha?.slice(0, 7)

// reset cache when user navigates to the commit detail page
const queryClient = useQueryClient()
Expand All @@ -55,7 +55,7 @@ function CommitDetailPage() {
provider,
owner,
repo,
commitId: commitSHA,
commitId: commitSha,
})

if (
Expand All @@ -75,7 +75,7 @@ function CommitDetailPage() {
{ pageName: 'commits', text: 'commits' },
{
pageName: 'commit',
options: { commitSHA },
options: { commitSha },
readOnly: true,
text: shortSHA,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const Loader = () => (
)

function CommitDetailPageContent() {
const { provider, owner, repo, commit: commitSHA } = useParams()
const { provider, owner, repo, commit: commitSha } = useParams()

const { data: commitData } = useCommit({
provider,
owner,
repo,
commitid: commitSHA,
commitid: commitSha,
})

const { erroredUploads } = extractUploads({
Expand All @@ -52,7 +52,7 @@ function CommitDetailPageContent() {
return (
<>
<CommitPageTabs
commitSHA={commitSHA}
commitSha={commitSha}
indirectChangedFilesCount={indirectChangedFilesCount}
directChangedFilesCount={directChangedFilesCount}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ToggleHeader from 'ui/FileViewer/ToggleHeader'
import TabNavigation from 'ui/TabNavigation'

function CommitDetailPageTabs({
commitSHA,
commitSha,
indirectChangedFilesCount,
directChangedFilesCount,
}) {
Expand All @@ -28,17 +28,17 @@ function CommitDetailPageTabs({
}

const blobPath = location.pathname.includes(
`/${provider}/${commitFileviewString({ owner, repo, commitSHA })}`
`/${provider}/${commitFileviewString({ owner, repo, commitSha })}`
)

const filePath = location.pathname.includes(
`/${provider}/${commitTreeviewString({ owner, repo, commitSHA })}`
`/${provider}/${commitTreeviewString({ owner, repo, commitSha })}`
)

let customLocation = undefined
if (blobPath || filePath) {
customLocation = {
pathname: `/${provider}/${owner}/${repo}/commit/${commitSHA}/tree`,
pathname: `/${provider}/${owner}/${repo}/commit/${commitSha}/tree`,
}
}

Expand All @@ -53,12 +53,12 @@ function CommitDetailPageTabs({
<sup className="text-xs">{directChangedFilesCount}</sup>
</>
),
options: { commit: commitSHA, queryParams },
options: { commit: commitSha, queryParams },
exact: true,
},
{
pageName: 'commitIndirectChanges',
options: { commit: commitSHA, queryParams },
options: { commit: commitSha, queryParams },
children: (
<>
Indirect changes
Expand All @@ -69,7 +69,7 @@ function CommitDetailPageTabs({
{
pageName: 'commitTreeView',
children: 'File explorer',
options: { commit: commitSHA, queryParams },
options: { commit: commitSha, queryParams },
location: customLocation,
},
]}
Expand All @@ -79,7 +79,7 @@ function CommitDetailPageTabs({
}

CommitDetailPageTabs.propTypes = {
commitSHA: PropTypes.string,
commitSha: PropTypes.string,
indirectChangedFilesCount: PropTypes.number,
directChangedFilesCount: PropTypes.number,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const wrapper =
describe('CommitDetailPageTabs', () => {
describe('on base route', () => {
it('highlights files changed tab', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(),
})

Expand All @@ -36,7 +36,7 @@ describe('CommitDetailPageTabs', () => {
})

it('does not highlight files tab', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(),
})

Expand All @@ -48,7 +48,7 @@ describe('CommitDetailPageTabs', () => {

describe('on indirect changes route', () => {
it('highlights indirect changes tab', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper([
'/gh/codecov/cool-repo/commit/sha256/indirect-changes',
]),
Expand All @@ -60,7 +60,7 @@ describe('CommitDetailPageTabs', () => {
})

it('does not highlight files changed tab', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper([
'/gh/codecov/cool-repo/commit/sha256/indirect-changes',
]),
Expand All @@ -75,7 +75,7 @@ describe('CommitDetailPageTabs', () => {
describe('on files route', () => {
describe('on tree route', () => {
it('highlights files tab', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(['/gh/codecov/cool-repo/commit/sha256/tree']),
})

Expand All @@ -85,7 +85,7 @@ describe('CommitDetailPageTabs', () => {
})

it('does not highlight files changed tab', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(['/gh/codecov/cool-repo/commit/sha256/tree']),
})

Expand All @@ -97,7 +97,7 @@ describe('CommitDetailPageTabs', () => {

describe('on a blob route', () => {
it('highlights files tab', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper([
'/gh/codecov/cool-repo/commit/sha256/blob/index.js',
]),
Expand All @@ -109,7 +109,7 @@ describe('CommitDetailPageTabs', () => {
})

it('does not highlight files changed tab', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(['/gh/codecov/cool-repo/commit/sha256/tree']),
})

Expand All @@ -122,7 +122,7 @@ describe('CommitDetailPageTabs', () => {

describe('rendering toggle header', () => {
it('renders uncovered legend', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(),
})

Expand All @@ -131,7 +131,7 @@ describe('CommitDetailPageTabs', () => {
})

it('renders partial legend', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(),
})

Expand All @@ -140,7 +140,7 @@ describe('CommitDetailPageTabs', () => {
})

it('renders covered legend', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(),
})

Expand All @@ -149,7 +149,7 @@ describe('CommitDetailPageTabs', () => {
})

it('renders hit count legend', () => {
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper(),
})

Expand All @@ -167,7 +167,7 @@ describe('CommitDetailPageTabs', () => {
{ flags: ['flag-1'] },
{ addQueryPrefix: true }
)
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper([`/gh/codecov/cool-repo/commit/sha256${queryString}`]),
})

Expand All @@ -184,7 +184,7 @@ describe('CommitDetailPageTabs', () => {
{ flags: ['flag-1'] },
{ addQueryPrefix: true }
)
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper([`/gh/codecov/cool-repo/commit/sha256${queryString}`]),
})

Expand All @@ -203,7 +203,7 @@ describe('CommitDetailPageTabs', () => {
{ flags: ['flag-1'] },
{ addQueryPrefix: true }
)
render(<CommitDetailPageTabs commitSHA="sha256" />, {
render(<CommitDetailPageTabs commitSha="sha256" />, {
wrapper: wrapper([`/gh/codecov/cool-repo/commit/sha256${queryString}`]),
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export function getCommitDataForSummary({
}

export function useCommitForSummary() {
const { provider, owner, repo, commit: commitSHA } = useParams()
const { provider, owner, repo, commit: commitSha } = useParams()

const { data } = useCommit({
provider,
owner,
repo,
commitid: commitSHA,
commitid: commitSha,
})

const compareWithParent = data?.commit?.compareWithParent
Expand Down
8 changes: 4 additions & 4 deletions src/pages/CommitDetailPage/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { useCommitHeaderData } from './hooks'
import PullLabel from './PullLabel'

function Header() {
const { provider, owner, repo, commit: commitSHA } = useParams()
const shortSHA = commitSHA?.slice(0, 7)
const { provider, owner, repo, commit: commitSha } = useParams()
const shortSHA = commitSha?.slice(0, 7)

const { data: headerData } = useCommitHeaderData({
provider,
owner,
repo,
commitId: commitSHA,
commitId: commitSha,
})

const providerPullUrl = getProviderPullURL({
Expand All @@ -32,7 +32,7 @@ function Header() {
provider,
owner,
repo,
commit: commitSHA,
commit: commitSha,
})

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ RenderSubComponent.propTypes = {
}

function FilesChangedTable() {
const { provider, owner, repo, commit: commitSHA } = useParams()
const { provider, owner, repo, commit: commitSha } = useParams()

const { data: commitData, isLoading } = useCommit({
provider,
owner,
repo,
commitid: commitSHA,
commitid: commitSha,
filters: {
hasUnintendedChanges: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ RenderSubComponent.propTypes = {
}

function IndirectChangesTable() {
const { provider, owner, repo, commit: commitSHA } = useParams()
const { provider, owner, repo, commit: commitSha } = useParams()

const { data: commitData, isLoading } = useCommit({
provider,
owner,
repo,
commitid: commitSHA,
commitid: commitSha,
filters: {
hasUnintendedChanges: true,
},
Expand Down
Loading