Skip to content

Commit

Permalink
Merge branch 'main' into fix-scroll-to-line-with-dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov authored Apr 29, 2024
2 parents 97a8915 + 5d72a31 commit 67363a1
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pages/RepoPage/ComponentsTab/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Header = ({
)

return (
<div className="flex flex-col justify-end divide-y divide-solid divide-ds-gray-secondary">
<div className="flex flex-col justify-end">
<div className="grid w-2/3 divide-y divide-solid divide-ds-gray-secondary sm:w-full sm:grid-cols-2 sm:divide-x sm:divide-y-0 md:grid-cols-4">
<BranchSelector isDisabled={controlsDisabled} />
<div className="flex flex-col justify-between gap-2 p-4 sm:py-0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const LoadingTable = () => {
</tr>
))}
</thead>
<tbody>
<br />
</tbody>
</table>
</div>
)
Expand Down Expand Up @@ -266,7 +269,6 @@ const ComponentTable = memo(function Table({
</tr>
))}
</thead>

<tbody data-testid="body-row">
{isLoading ? (
<tr>
Expand All @@ -285,6 +287,10 @@ const ComponentTable = memo(function Table({
</tr>
))
)}
{
/* Adds an extra line beneath the header row for the special case that the table is empty */
!tableData.length ? <br /> : null
}
</tbody>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ describe('useRepoComponentsTable', () => {
it('calls useRepoComponentsTable with correct query params', async () => {
const { requestFilters } = setup({
repoData: mockGetRepo,
useParamsValue: {
components: [],
historicalTrend: '',
},
})

renderHook(() => useRepoComponentsTable(true), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ function useRepoComponentsTable(isDesc = false) {
const isSearching = Boolean(params?.components?.length)
const { after, interval } = createMeasurementVariables(
// @ts-expect-error Need to type useLocationParams
params?.historicalTrend ?? TIME_OPTION_VALUES.LAST_3_MONTHS,
params?.historicalTrend
? // @ts-expect-error
params.historicalTrend
: TIME_OPTION_VALUES.LAST_3_MONTHS,
repoData?.repository?.oldestCommitAt ?? undefined
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ describe('useRepoFlagsTable', () => {
describe('historical trend', () => {
describe('when historical trend param is empty', () => {
beforeEach(() => {
setup({})
setup({
useParamsValue: {
historicalTrend: '',
},
})
})

it('calls useRepoFlagsTable with correct query params', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ function useRepoFlagsTable(isDesc: boolean) {
const isSearching = Boolean(params?.search)
const { afterDate, interval } = createMeasurementVariables(
// @ts-expect-errors, useLocation params needs to be updated to have full types
params?.historicalTrend ?? TIME_OPTION_VALUES.LAST_3_MONTHS,
params?.historicalTrend
? // @ts-expect-errors
params.historicalTrend
: TIME_OPTION_VALUES.LAST_3_MONTHS,
repoData?.repository?.oldestCommitAt ?? undefined
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Button from 'ui/Button'
import Icon from 'ui/Icon'

function ComponentsNotConfigured() {
return (
Expand All @@ -16,8 +17,10 @@ function ComponentsNotConfigured() {
variant="primary"
disabled={false}
to={{ pageName: 'components' }}
showExternalIcon={false}
>
Get started with components
<Icon name="externalLink" variant="solid" size="sm" />
</Button>
</div>
</div>
Expand Down

0 comments on commit 67363a1

Please sign in to comment.