Skip to content

Commit 7bf60ce

Browse files
Merge branch 'main' into rvinnakota/bulk-download
2 parents 95d3b4f + 819dcd9 commit 7bf60ce

File tree

116 files changed

+1605
-1066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1605
-1066
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,50 @@ jobs:
334334
# The head sha aligns with how the sha used in prod builds
335335
GAZEBO_SHA: ${{ github.event.pull_request.head.sha }}
336336

337+
overwatch:
338+
name: Run Overwatch
339+
runs-on: ubuntu-latest
340+
needs: install
341+
steps:
342+
- name: Checkout
343+
uses: actions/checkout@v4
344+
345+
- name: Setup Node
346+
uses: actions/setup-node@v4
347+
with:
348+
node-version: 20
349+
350+
- name: Cache node_modules
351+
id: cache-node-modules
352+
uses: actions/cache@v4
353+
env:
354+
cache-name: cache-gazebo-node-modules
355+
with:
356+
path: |
357+
node_modules
358+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
359+
restore-keys: |
360+
${{ runner.os }}-${{ env.cache-name }}-
361+
362+
- name: Install Build Dependencies
363+
run: |
364+
sudo apt-get update
365+
# Install libssl1.1 from Ubuntu 20.04 repositories
366+
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
367+
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
368+
369+
- name: Install Overwatch CLI
370+
run: |
371+
curl -o overwatch-cli https://overwatch.codecov.io/linux/cli
372+
chmod +x overwatch-cli
373+
374+
- name: Run Overwatch CLI
375+
run: |
376+
./overwatch-cli \
377+
--auth-token ${{ secrets.SENTRY_AUTH_TOKEN }} \
378+
--organization-slug codecov \
379+
javascript --package-manager yarn
380+
337381
storybook:
338382
name: Run storybook
339383
runs-on: ubuntu-latest

docker/start-nginx.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ then
2121
sed -i "s/${SCHEME_BASE}:\/\/${WEB_BASE}/${SCHEME}:\/\/${CODECOV_BASE_HOST}/g" /var/www/app/gazebo/assets/*.js
2222
if [[ -n "${GHE_BASE}" ]]; then
2323
echo "Replacing GHE ${GHE_SCHEME_BASE}://${GHE_BASE}"
24-
sed -i -r "s/r\.[a-zA-Z]+\.GHE_URL/\"${GHE_SCHEME_BASE}:\/\/${GHE_BASE}\"/g" /var/www/app/gazebo/assets/*.js
24+
sed -i -r "s/[a-zA-Z]+\.GHE_URL/\"${GHE_SCHEME_BASE}:\/\/${GHE_BASE}\"/g" /var/www/app/gazebo/assets/*.js
2525
fi
2626
if [[ -n "${GLE_BASE}" ]]; then
2727
echo "Replacing GLE ${GLE_SCHEME_BASE}://${GLE_BASE}"
28-
sed -i -r "s/r\.[a-zA-Z]+\.GLE_URL/\"${GLE_SCHEME_BASE}:\/\/${GLE_BASE}\"/g" /var/www/app/gazebo/assets/*.js
28+
sed -i -r "s/[a-zA-Z]+\.GLE_URL/\"${GLE_SCHEME_BASE}:\/\/${GLE_BASE}\"/g" /var/www/app/gazebo/assets/*.js
2929
fi
3030
if [[ -n "${BBS_BASE}" ]]; then
3131
echo "Replacing BBS ${BBS_SCHEME_BASE}://${BBS_BASE}"
32-
sed -i -r "s/r\.[a-zA-Z]+\.BBS_URL/\"${BBS_SCHEME_BASE}:\/\/${BBS_BASE}\"/g" /var/www/app/gazebo/assets/*.js
32+
sed -i -r "s/[a-zA-Z]+\.BBS_URL/\"${BBS_SCHEME_BASE}:\/\/${BBS_BASE}\"/g" /var/www/app/gazebo/assets/*.js
3333
fi
3434

3535
export DOLLAR='$'

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import BaseLayout from 'layouts/BaseLayout'
1212
import EnterpriseLoginLayout from 'layouts/EnterpriseLoginLayout'
1313
import LoginLayout from 'layouts/LoginLayout'
1414
import { useLocationParams } from 'services/navigation/useLocationParams'
15-
import { ToastNotificationProvider } from 'services/toastNotification'
15+
import { ToastNotificationProvider } from 'services/toastNotification/context'
1616
import { useInternalUser, useUser } from 'services/user'
1717
import { isProvider } from 'shared/api/helpers'
1818
import 'ui/Table/Table.css'

src/layouts/BaseLayout/BaseLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { RepoBreadcrumbProvider } from 'pages/RepoPage/context'
1414
import TermsOfService from 'pages/TermsOfService'
1515
import { useEventContext } from 'services/events/hooks'
1616
import { useImpersonate } from 'services/impersonate/useImpersonate'
17-
import { useTracking } from 'services/tracking'
17+
import { useTracking } from 'services/tracking/useTracking'
1818
import GlobalBanners from 'shared/GlobalBanners'
1919
import GlobalTopBanners from 'shared/GlobalTopBanners'
2020
import LoadingLogo from 'ui/LoadingLogo'

src/layouts/Header/components/GuestHeader/GuestHeader.test.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
22
import { render, screen } from '@testing-library/react'
3+
import qs from 'qs'
34
import React from 'react'
45
import { MemoryRouter, Route } from 'react-router-dom'
56

@@ -47,6 +48,7 @@ describe('GuestHeader', () => {
4748
expect(link).toHaveAttribute('href', 'https://about.codecov.io')
4849
})
4950
})
51+
5052
describe('why test code link', () => {
5153
it('directs user to what is code coverage page', async () => {
5254
render(<GuestHeader />, {
@@ -61,6 +63,7 @@ describe('GuestHeader', () => {
6163
)
6264
})
6365
})
66+
6467
describe('Get a demo link', () => {
6568
it('directs user to demo page', async () => {
6669
render(<GuestHeader />, {
@@ -72,6 +75,7 @@ describe('GuestHeader', () => {
7275
expect(link).toHaveAttribute('href', 'https://about.codecov.io/demo')
7376
})
7477
})
78+
7579
describe('pricing link', () => {
7680
it('directs user to pricing page', async () => {
7781
render(<GuestHeader />, {
@@ -83,17 +87,20 @@ describe('GuestHeader', () => {
8387
expect(link).toHaveAttribute('href', 'https://about.codecov.io/pricing')
8488
})
8589
})
90+
8691
describe('login link', () => {
87-
it('directs user to login page', async () => {
92+
it('directs user to login page with redirect to path', async () => {
8893
render(<GuestHeader />, {
8994
wrapper,
9095
})
9196

97+
const queryString = qs.stringify({ to: '/gh' })
9298
const link = await screen.findByTestId('login-link')
9399
expect(link).toBeInTheDocument()
94-
expect(link).toHaveAttribute('href', '/login')
100+
expect(link).toHaveAttribute('href', `/login?${queryString}`)
95101
})
96102
})
103+
97104
describe('start trial link', () => {
98105
it('directs user to start trial page', async () => {
99106
render(<GuestHeader />, {
@@ -128,18 +135,21 @@ describe('GuestHeader', () => {
128135
const pricing = screen.queryByText('Pricing')
129136
expect(pricing).not.toBeInTheDocument()
130137
})
138+
131139
it('does not render start free trial link', () => {
132140
render(<GuestHeader />, { wrapper })
133141

134142
const startFreeTrial = screen.queryByText('Start Free Trial')
135143
expect(startFreeTrial).not.toBeInTheDocument()
136144
})
137-
it('renders a login button', () => {
145+
146+
it('renders a login button with redirect to path', () => {
138147
render(<GuestHeader />, { wrapper })
139148

149+
const queryString = qs.stringify({ to: '/gh' })
140150
const login = screen.queryByText('Login')
141151
expect(login).toBeInTheDocument()
142-
expect(login).toHaveAttribute('href', '/')
152+
expect(login).toHaveAttribute('href', `/?${queryString}`)
143153
})
144154
})
145155
})

src/layouts/Header/components/GuestHeader/GuestHeader.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useLocation } from 'react-router'
2+
13
import config from 'config'
24

35
import { CodecovIcon } from 'assets/svg/codecov'
@@ -26,6 +28,7 @@ const LogoButton = () => {
2628

2729
function GuestHeader() {
2830
const isSelfHosted = config.IS_SELF_HOSTED
31+
const location = useLocation()
2932

3033
return (
3134
<div className="border-b">
@@ -69,7 +72,7 @@ function GuestHeader() {
6972
<ThemeToggle />
7073
{isSelfHosted ? (
7174
<Button
72-
to={{ pageName: 'login' }}
75+
to={{ pageName: 'login', options: { to: location.pathname } }}
7376
variant="primary"
7477
activeClassName="hidden"
7578
exact={true}
@@ -86,7 +89,7 @@ function GuestHeader() {
8689
className="mx-2 flex items-center justify-between gap-4 md:mx-0"
8790
>
8891
<A
89-
to={{ pageName: 'login' }}
92+
to={{ pageName: 'login', options: { to: location.pathname } }}
9093
variant="guestHeader"
9194
activeClassName="hidden"
9295
isExternal={false}

src/layouts/ToastNotifications/NotificationItem.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import PropType from 'prop-types'
22
import { useCallback, useEffect } from 'react'
33

44
import Message from 'old_ui/Message'
5-
import { notificationPropType } from 'services/toastNotification'
5+
import { notificationPropType } from 'services/toastNotification/propTypes'
66

77
function NotificationItem({ notification, removeNotification }) {
88
const close = useCallback(() => {

src/layouts/ToastNotifications/ToastNotifications.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
useNotifications,
33
useRemoveNotification,
4-
} from 'services/toastNotification'
4+
} from 'services/toastNotification/context'
55

66
import NotificationItem from './NotificationItem'
77

src/layouts/ToastNotifications/ToastNotifications.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { vi } from 'vitest'
44
import {
55
useNotifications,
66
useRemoveNotification,
7-
} from 'services/toastNotification'
7+
} from 'services/toastNotification/context'
88

99
import ToastNotifications from './ToastNotifications'
1010

@@ -23,7 +23,7 @@ const notifications = [
2323
},
2424
]
2525

26-
vi.mock('services/toastNotification')
26+
vi.mock('services/toastNotification/context')
2727

2828
describe('ToastNotifications', () => {
2929
const removeNotification = vi.fn()

src/layouts/shared/NetworkErrorBoundary/NetworkErrorBoundary.jsx

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { useQueryClient } from '@tanstack/react-query'
22
import cs from 'classnames'
33
import PropTypes from 'prop-types'
44
import { Component, useEffect } from 'react'
5-
import { useHistory } from 'react-router-dom'
5+
import { useHistory, useLocation } from 'react-router-dom'
66

77
import config from 'config'
88

9+
import { useUser } from 'services/user'
910
import A from 'ui/A'
1011
import Button from 'ui/Button'
1112

@@ -67,11 +68,11 @@ const graphQLErrorToUI = {
6768
},
6869
}
6970

70-
export const NetworkErrorMessage = () => {
71+
export const DocErrorMessage = ({ capitalize = true }) => {
7172
if (config.IS_SELF_HOSTED) {
7273
return (
73-
<p className="my-4 px-3 sm:px-0">
74-
Please see{' '}
74+
<>
75+
{capitalize ? 'Please' : 'please'} see{' '}
7576
<A
7677
rel="noreferrer"
7778
className="text-ds-blue-default"
@@ -82,13 +83,13 @@ export const NetworkErrorMessage = () => {
8283
our docs
8384
</A>{' '}
8485
for common support.
85-
</p>
86+
</>
8687
)
8788
}
8889

8990
return (
90-
<p className="my-4 px-3 sm:px-0">
91-
Check on{' '}
91+
<>
92+
{capitalize ? 'Check' : 'check'} on{' '}
9293
<A
9394
rel="noreferrer"
9495
className="text-ds-blue-default"
@@ -109,13 +110,40 @@ export const NetworkErrorMessage = () => {
109110
our docs
110111
</A>{' '}
111112
for common support.
113+
</>
114+
)
115+
}
116+
117+
DocErrorMessage.propTypes = {
118+
capitalize: PropTypes.bool,
119+
}
120+
121+
export const NetworkErrorMessage = ({ statusCode }) => {
122+
if (statusCode === 404) {
123+
return (
124+
<p className="my-4 max-w-2xl px-3 text-center sm:px-0">
125+
To view private repositories ensure you are logged in, you can also{' '}
126+
<DocErrorMessage capitalize={false} />
127+
</p>
128+
)
129+
}
130+
131+
return (
132+
<p className="my-4 max-w-2xl px-3 text-center sm:px-0">
133+
<DocErrorMessage capitalize={true} />
112134
</p>
113135
)
114136
}
115137

116-
function ResetHandler({ logoutUser = false, reset }) {
138+
NetworkErrorMessage.propTypes = {
139+
statusCode: PropTypes.number,
140+
}
141+
142+
function ResetHandler({ logoutUser = false, reset, statusCode }) {
117143
const queryClient = useQueryClient()
118144
const history = useHistory()
145+
const location = useLocation()
146+
const { data: user } = useUser()
119147

120148
useEffect(() => {
121149
let unMounted = false
@@ -148,17 +176,27 @@ function ResetHandler({ logoutUser = false, reset }) {
148176
}
149177

150178
return (
151-
<div className="my-4">
179+
<div className="my-4 flex items-center gap-2">
152180
<Button onClick={logoutUser ? handleSignOut : handleReset}>
153181
{logoutUser ? 'Return to login' : 'Return to previous page'}
154182
</Button>
183+
{/* if the user is logged in, we don't want to show the login button */}
184+
{statusCode === 404 && !user ? (
185+
<Button
186+
variant="primary"
187+
to={{ pageName: 'login', options: { to: location.pathname } }}
188+
>
189+
Login
190+
</Button>
191+
) : null}
155192
</div>
156193
)
157194
}
158195

159196
ResetHandler.propTypes = {
160197
reset: PropTypes.func,
161198
logoutUser: PropTypes.bool,
199+
statusCode: PropTypes.number,
162200
}
163201

164202
class NetworkErrorBoundary extends Component {
@@ -211,8 +249,11 @@ class NetworkErrorBoundary extends Component {
211249
src={illustration}
212250
/>
213251
<h1 className="mt-6 text-2xl">{title}</h1>
214-
<NetworkErrorMessage />
215-
<ResetHandler reset={this.resetErrorBoundary} />
252+
<NetworkErrorMessage statusCode={this.state.error.status} />
253+
<ResetHandler
254+
reset={this.resetErrorBoundary}
255+
statusCode={this.state.error.status}
256+
/>
216257
</article>
217258
)
218259
}
@@ -230,13 +271,14 @@ class NetworkErrorBoundary extends Component {
230271
/>
231272
<h1 className="mt-6 text-2xl">{title}</h1>
232273
{description ? <p className="mt-2">{description(data)}</p> : null}
233-
{showDocs ? <NetworkErrorMessage /> : null}
274+
{showDocs ? <NetworkErrorMessage statusCode={status} /> : null}
234275
<p>
235276
<strong>Error {status}</strong>
236277
</p>
237278
<ResetHandler
238279
logoutUser={status === 429}
239280
reset={this.resetErrorBoundary}
281+
statusCode={status}
240282
/>
241283
</article>
242284
)

0 commit comments

Comments
 (0)