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

feat: Update files explorer tab with components selector #2450

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

RulaKhaled
Copy link
Contributor

Description

Adding the selector to PR files explorer

Notable Changes

  • Add the selector component
  • Support filters in the hook

Screenshots

Screen.Recording.2023-12-12.at.4.00.13.PM.mov

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Copy link

@codecov codecov bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed changes seem to be fine overall. In these changes, a new component called 'ComponentsSelector' is added to the 'FileExplorer'. It also updates the related files and test cases. However, a couple of improvement points are to be considered to ensure code integrity, clearness, for better validation and error handling.

searchValue={params?.search}
setSearchValue={(search) => updateParams({ search })}
/>
<div className="flex gap-2">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have added a new component (ComponentsSelector) but did not provide any prop. Please make sure to add necessary props and validate them using propTypes in the 'ComponentsSelector' component. This will increase type safety and avoid possible issues in the future.

describe('when rendered', () => {
it('renders ComponentsSelector', async () => {
setup()
render(<FileExplorer />, { wrapper: wrapper() })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that you have handled potential exceptions and erroneous cases by writing negative test cases as well, not just happy path scenarios. This will greatly boost the confidence in the correctness of the code.

@@ -153,7 +153,7 @@ const sortingParameter = Object.freeze({
lines: 'LINES',
})

const getQueryFilters = ({ params, sortBy, flags }) => {
const getQueryFilters = ({ params, sortBy, flags, components }) => {
Copy link

@codecov codecov bot Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check that the 'components' parameter is incorporated correctly into the 'getQueryFilters' function.

@@ -177,6 +178,8 @@ export function useRepoPullContentsTable() {
depth: 1,
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query parameters should be validated before use. Improper or lack of validation could lead to potential security vulnerabilities such as Injections, and Denial of Service(DoS) if the input is not what's expected.

repo: 'test-repo',
path: '',
})
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if you have any memory leaks in your hooks especially those containing listeners or subscriptions.

Copy link

netlify bot commented Dec 12, 2023

Deploy Preview for gazebo-staging ready!

Name Link
🔨 Latest commit a03fd6b
🔍 Latest deploy log https://app.netlify.com/sites/gazebo-staging/deploys/657887b457275b0008fbc07a
😎 Deploy Preview https://deploy-preview-2450--gazebo-staging.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@codecov codecov bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodecovAI submitted a new review for a03fd6b

@@ -13,6 +13,8 @@ import Spinner from 'ui/Spinner'

import { useRepoPullContentsTable } from './hooks'

import ComponentsSelector from '../ComponentsSelector'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that 'ComponentsSelector' is properly exported from its module, as it is being imported here.

@@ -187,7 +190,7 @@ export function useRepoPullContentsTable() {
repo,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the code according to the new data structure introduced on line 75, considering the 'components' filter as well.

@@ -258,6 +258,63 @@ describe('useRepoPullContentsTable', () => {
})
})

describe('when called with a selected components', () => {
it('makes a gql request with the list param', async () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate that new unit tests are working properly that handle additional parameter 'components'.

})
})

describe('when called with a selected flags and components', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate that new unit tests are working properly that handle both parameters 'flags' and 'components'.

placeholder="Search for files"
searchValue={params?.search}
setSearchValue={(search) => updateParams({ search })}
/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep an eye on CSS to make sure that the combination of the 'ComponentsSelector' and the 'SearchField' within the flex container looks good in all main browsers.

@@ -194,6 +196,16 @@ describe('FileExplorer', () => {
})
})

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a more explicit test for 'renders ComponentsSelector' to ensure that it contributes to the component and its behaviors as expected.

@codecov-qa
Copy link

codecov-qa bot commented Dec 12, 2023

Codecov Report

Merging #2450 (a03fd6b) into main (cb9eae4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2450   +/-   ##
=======================================
  Coverage   98.07%   98.07%           
=======================================
  Files         763      763           
  Lines        9699     9701    +2     
  Branches     2443     2444    +1     
=======================================
+ Hits         9512     9514    +2     
  Misses        185      185           
  Partials        2        2           
Files Coverage Δ
...RequestPage/subroute/FileExplorer/FileExplorer.jsx 100.00% <100.00%> (ø)
...ute/FileExplorer/hooks/useRepoPullContentsTable.js 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 97.30% <ø> (ø)
Pages 98.92% <100.00%> (+<0.01%) ⬆️
Services 99.43% <ø> (ø)
Shared 99.81% <ø> (ø)
UI 94.32% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb9eae4...a03fd6b. Read the comment docs.

Copy link

codecov-public-qa bot commented Dec 12, 2023

Codecov Report

Merging #2450 (a03fd6b) into main (cb9eae4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2450   +/-   ##
=======================================
  Coverage   98.07%   98.07%           
=======================================
  Files         763      763           
  Lines        9699     9701    +2     
  Branches     2448     2444    -4     
=======================================
+ Hits         9512     9514    +2     
  Misses        185      185           
  Partials        2        2           
Files Coverage Δ
...RequestPage/subroute/FileExplorer/FileExplorer.jsx 100.00% <100.00%> (ø)
...ute/FileExplorer/hooks/useRepoPullContentsTable.js 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 97.30% <ø> (ø)
Pages 98.92% <100.00%> (+<0.01%) ⬆️
Services 99.43% <ø> (ø)
Shared 99.81% <ø> (ø)
UI 94.32% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb9eae4...a03fd6b. Read the comment docs.

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Merging #2450 (a03fd6b) into main (cb9eae4) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #2450   +/-   ##
=====================================
  Coverage   98.07   98.07           
=====================================
  Files        763     763           
  Lines       9699    9701    +2     
  Branches    2448    2444    -4     
=====================================
+ Hits        9512    9514    +2     
  Misses       185     185           
  Partials       2       2           
Files Coverage Δ
...RequestPage/subroute/FileExplorer/FileExplorer.jsx 100.00% <100.00%> (ø)
...ute/FileExplorer/hooks/useRepoPullContentsTable.js 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 97.30% <ø> (ø)
Pages 98.92% <100.00%> (+<0.01%) ⬆️
Services 99.43% <ø> (ø)
Shared 99.81% <ø> (ø)
UI 94.32% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb9eae4...a03fd6b. Read the comment docs.

@RulaKhaled RulaKhaled merged commit b337038 into main Dec 12, 2023
49 checks passed
@RulaKhaled RulaKhaled deleted the file-explorer-selector branch December 12, 2023 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants