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

Od/chore/casing for git provider #2901

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 4 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
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ function GithubIntegrationCopy({ integrationId }) {
return (
<p>
This account is configured via the GitHub App. You can manage the apps
repository integration on <A to={{ pageName: 'github' }}>Github.</A>
repository integration on <A to={{ pageName: 'github' }}>GitHub.</A>
</p>
)
return (
@@ -47,7 +47,7 @@ function GithubIntegrationSection() {

return (
<div className="flex flex-col gap-2">
<h2 className="text-lg font-semibold">Github Integration</h2>
<h2 className="text-lg font-semibold">GitHub Integration</h2>
<GithubIntegrationCopy integrationId={accountDetails?.integrationId} />
</div>
)
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ export default function AdminTable() {
if (!isLoading && !tableData?.length) {
return (
<p>
No admins yet. Note that admins in your Github organization are
No admins yet. Note that admins in your GitHub organization are
automatically considered admins.
</p>
)
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ describe('ManageAdminCard', () => {
render(<ManageAdminCard />, { wrapper })

const noAdmins = await screen.findByText(
/No admins yet. Note that admins in your Github organization are automatically considered admins./
/No admins yet. Note that admins in your GitHub organization are automatically considered admins./
)
expect(noAdmins).toBeInTheDocument()
})
@@ -129,7 +129,7 @@ describe('ManageAdminCard', () => {
render(<ManageAdminCard />, { wrapper })

const noAdmins = await screen.findByText(
/No admins yet. Note that admins in your Github organization are automatically considered admins./
/No admins yet. Note that admins in your GitHub organization are automatically considered admins./
)
expect(noAdmins).toBeInTheDocument()
})
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ const BotErrorHeading = () => {

if (ghWithApp) {
return (
<p className="font-semibold">There was an issue with the Github app</p>
<p className="font-semibold">There was an issue with the GitHub app</p>
)
}

Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ describe('BotErrorBanner', () => {
})

const title = await screen.findByText(
'There was an issue with the Github app'
'There was an issue with the GitHub app'
)
expect(title).toBeInTheDocument()
})
2 changes: 1 addition & 1 deletion src/pages/CommitDetailPage/Header/PullLabel/PullLabel.jsx
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ export default function PullLabel({ pullId, provider, providerPullUrl }) {
</span>
<A to={{ pageName: 'pullDetail', options: { pullId } }}>#{pullId}</A> (
<A href={providerPullUrl} hook="provider url" isExternal={true}>
{providerToName(provider)}
{providerToName(provider, true)}
</A>
)
</div>
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ describe('PullLabel', () => {
it('renders provider pull url', async () => {
render(<PullLabel {...mockValidProps} />, { wrapper })

const pullUrlLink = await screen.findByRole('link', { name: /Github/ })
const pullUrlLink = await screen.findByRole('link', { name: /GitHub/ })
expect(pullUrlLink).toBeInTheDocument()
expect(pullUrlLink).toHaveAttribute(
'href',
1 change: 0 additions & 1 deletion src/pages/LoginPage/LoginButton.jsx
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ import {

function LoginButton({ provider }) {
const { signIn } = useNavLinks()

const to = `${window.location.protocol}//${window.location.host}/${provider}`
const providerName = loginProviderToName(provider)
const providerImage = loginProviderImage(provider)
8 changes: 4 additions & 4 deletions src/pages/LoginPage/LoginButton.spec.jsx
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ describe('LoginButton', () => {
}),
})

const bitbucket = screen.getByText(/Login with Bitbucket/i)
const bitbucket = screen.getByText(/Login with Bitbucket/)
expect(bitbucket).toBeInTheDocument()
})
})
@@ -40,7 +40,7 @@ describe('LoginButton', () => {
}),
})

const github = screen.getByText(/Login with GitHub/i)
const github = screen.getByText(/Login with GitHub/)
expect(github).toBeInTheDocument()
})
})
@@ -54,7 +54,7 @@ describe('LoginButton', () => {
}),
})

const gitlab = screen.getByText(/Login with GitLab/i)
const gitlab = screen.getByText(/Login with GitLab/)
expect(gitlab).toBeInTheDocument()
})
})
@@ -68,7 +68,7 @@ describe('LoginButton', () => {
}),
})

const sentry = screen.getByText(/Login with Sentry/i)
const sentry = screen.getByText(/Login with Sentry/)
expect(sentry).toBeInTheDocument()
})
})
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ function ActionsBilling() {
<div className="flex flex-col gap-4 border-ds-gray-secondary">
<hr />
<div className="flex gap-4">
<img className="h-8 w-8" alt="Github" src={githubLogo} />
<img className="h-8 w-8" alt="GitHub" src={githubLogo} />
<p className="text-sm">
Your account is configured via GitHub Marketplace
</p>
12 changes: 6 additions & 6 deletions src/pages/SyncProviderPage/SyncButton.spec.tsx
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ describe('SyncButton', () => {
it('renders sync button', () => {
render(<SyncButton provider="gh" />, { wrapper })

const link = screen.getByRole('link', { name: /Sync with Github/ })
const link = screen.getByRole('link', { name: /Sync with GitHub/ })

const expectedRedirect = encodeURIComponent('http://localhost/gh')
expect(link).toBeInTheDocument()
@@ -26,7 +26,7 @@ describe('SyncButton', () => {
it('renders sync button', () => {
render(<SyncButton provider="gl" />, { wrapper })

const link = screen.getByRole('link', { name: /Sync with Gitlab/ })
const link = screen.getByRole('link', { name: /Sync with GitLab/ })

const expectedRedirect = encodeURIComponent('http://localhost/gl')
expect(link).toBeInTheDocument()
@@ -38,7 +38,7 @@ describe('SyncButton', () => {
it('renders sync button', () => {
render(<SyncButton provider="bb" />, { wrapper })

const link = screen.getByRole('link', { name: /Sync with BitBucket/ })
const link = screen.getByRole('link', { name: /Sync with Bitbucket/ })

const expectedRedirect = encodeURIComponent('http://localhost/bb')
expect(link).toBeInTheDocument()
@@ -51,7 +51,7 @@ describe('SyncButton', () => {
render(<SyncButton provider="ghe" />, { wrapper })

const link = screen.getByRole('link', {
name: /Sync with Github Enterprise/,
name: /Sync with GitHub Enterprise/,
})

const expectedRedirect = encodeURIComponent('http://localhost/ghe')
@@ -65,7 +65,7 @@ describe('SyncButton', () => {
render(<SyncButton provider="gle" />, { wrapper })

const link = screen.getByRole('link', {
name: /Sync with Gitlab Enterprise/,
name: /Sync with GitLab Enterprise/,
})

const expectedRedirect = encodeURIComponent('http://localhost/gle')
@@ -79,7 +79,7 @@ describe('SyncButton', () => {
render(<SyncButton provider="bbs" />, { wrapper })

const link = screen.getByRole('link', {
name: /Sync with BitBucket Server/,
name: /Sync with Bitbucket Server/,
})

const expectedRedirect = encodeURIComponent('http://localhost/bbs')
4 changes: 2 additions & 2 deletions src/pages/SyncProviderPage/SyncButton.tsx
Original file line number Diff line number Diff line change
@@ -17,11 +17,11 @@ const SyncButton: React.FC<SyncButtonProps> = ({ provider }) => {
data-cy={'login-button'}
>
<img
alt={`Logo of ${providerToName(provider)}`}
alt={`Logo of ${providerToName(provider, true)}`}
className="mx-4 block h-6 w-6"
src={providerImage(provider)}
/>
Sync with {providerToName(provider)}
Sync with {providerToName(provider, true)}
</a>
</div>
)
4 changes: 2 additions & 2 deletions src/pages/SyncProviderPage/SyncProviderPage.spec.tsx
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@ describe('SyncProviderPage', () => {
setup()
render(<SyncProviderPage />, { wrapper })

const githubSyncButton = await screen.findByText(/Sync with Github/)
const githubSyncButton = await screen.findByText(/Sync with GitHub/)
expect(githubSyncButton).toBeInTheDocument()
})

@@ -138,7 +138,7 @@ describe('SyncProviderPage', () => {
render(<SyncProviderPage />, { wrapper })

const gheSyncButton = await screen.findByText(
/Sync with Gitlab Enterprise/
/Sync with GitLab Enterprise/
)
expect(gheSyncButton).toBeInTheDocument()
})
8 changes: 4 additions & 4 deletions src/services/navigation/useNavLinks/useStaticNavLinks.js
Original file line number Diff line number Diff line change
@@ -168,13 +168,13 @@ export function useStaticNavLinks() {
codecovGithubApp: {
path: () => 'https://github.com/apps/codecov',
isExternalLink: true,
text: 'Codecov Github App',
text: 'Codecov GitHub App',
openNewTab: true,
},
codecovGithubAppSelectTarget: {
path: () => 'https://github.com/apps/codecov/installations/select_target',
isExternalLink: true,
text: 'Codecov Github App',
text: 'Codecov GitHub App',
openNewTab: true,
},
teamBot: {
@@ -366,14 +366,14 @@ export function useStaticNavLinks() {
openNewTab: true,
},
codecovExampleWorkflow: {
text: 'Github Codecov Example workflow',
text: 'GitHub Codecov Example workflow',
path: () =>
'https://github.com/codecov/example-python/blob/main/.github/workflows/ci.yml',
isExternalLink: true,
openNewTab: true,
},
codecovActionRepo: {
text: 'Github Codecov Action Repo',
text: 'GitHub Codecov Action Repo',
path: () => 'https://github.com/codecov/codecov-action',
isExternalLink: true,
openNewTab: true,
31 changes: 19 additions & 12 deletions src/shared/utils/loginProviders.ts
Original file line number Diff line number Diff line change
@@ -78,18 +78,18 @@ export function loginProviderToShortName(loginProvider?: string) {
}

export const LOGIN_PROVIDER_NAMES = {
gh: 'Github',
bb: 'BitBucket',
gl: 'Gitlab',
ghe: 'Github Enterprise',
gle: 'Gitlab Enterprise',
bbs: 'BitBucket Server',
github: 'Github',
bitbucket: 'BitBucket',
gitlab: 'Gitlab',
github_enterprise: 'Github Enterprise',
gitlab_enterprise: 'Gitlab Enterprise',
bitbucket_server: 'BitBucket Server',
gh: 'GitHub',
bb: 'Bitbucket',
gl: 'GitLab',
ghe: 'GitHub Enterprise',
gle: 'GitLab Enterprise',
bbs: 'Bitbucket Server',
github: 'GitHub',
bitbucket: 'Bitbucket',
gitlab: 'GitLab',
github_enterprise: 'GitHub Enterprise',
gitlab_enterprise: 'GitLab Enterprise',
bitbucket_server: 'Bitbucket Server',
sentry: 'Sentry',
okta: 'Okta',
} as const
@@ -115,11 +115,18 @@ export function loginProviderToName(loginProvider?: string) {

export const LOGIN_PROVIDER_IMAGES = {
Github: githubLogo,
GitHub: githubLogo,
Gitlab: gitlabLogo,
GitLab: gitlabLogo,
BitBucket: bitbucketLogo,
Bitbucket: bitbucketLogo,
'Github Enterprise': githubLogo,
'GitHub Enterprise': githubLogo,
'Gitlab Enterprise': gitlabLogo,
'GitLab Enterprise': gitlabLogo,
'BitBucket Server': bitbucketLogo,
'Bitbucket Server': bitbucketLogo,

Sentry: sentryLogo,
Okta: oktaLogo,
} as const
26 changes: 13 additions & 13 deletions src/shared/utils/provider.js
Original file line number Diff line number Diff line change
@@ -5,20 +5,20 @@ import bitbucketLogo from 'assets/providers/bitbucket-icon.svg'
import githubLogo from 'assets/providers/github-icon.svg'
import gitlabLogo from 'assets/providers/gitlab-icon.svg'

export function providerToName(provider) {
export function providerToName(provider, forRender = false) {
return {
gh: 'Github',
bb: 'BitBucket',
gl: 'Gitlab',
ghe: 'Github Enterprise',
gle: 'Gitlab Enterprise',
bbs: 'BitBucket Server',
github: 'Github',
bitbucket: 'BitBucket',
gitlab: 'Gitlab',
github_enterprise: 'Github Enterprise',
gitlab_enterprise: 'Gitlab Enterprise',
bitbucket_server: 'BitBucket Server',
gh: forRender ? 'GitHub' : 'Github',
bb: forRender ? 'Bitbucket' : 'BitBucket',
gl: forRender ? 'GitLab' : 'Gitlab',
ghe: forRender ? 'GitHub Enterprise' : 'Github Enterprise',
gle: forRender ? 'GitLab Enterprise' : 'Gitlab Enterprise',
bbs: forRender ? 'Bitbucket Server' : 'BitBucket Server',
github: forRender ? 'GitHub' : 'Github',
bitbucket: forRender ? 'Bitbucket' : 'BitBucket',
gitlab: forRender ? 'GitLab' : 'Gitlab',
github_enterprise: forRender ? 'GitHub Enterprise' : 'Github Enterprise',
gitlab_enterprise: forRender ? 'GitLab Enterprise' : 'Gitlab Enterprise',
bitbucket_server: forRender ? 'Bitbucket Server' : 'BitBucket Server',
}[provider.toLowerCase()]
}

Loading
Oops, something went wrong.
Loading
Oops, something went wrong.