Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Fix showing required for an optional field when registering a module #953

Merged
merged 23 commits into from
Mar 16, 2021

Conversation

luanecavalcantizup
Copy link
Contributor

@luanecavalcantizup luanecavalcantizup commented Mar 3, 2021

Signed-off-by: luanecavalcantizup luane.cavalcanti@zup.com.br

Issue Description

When registering a new module, an optional field is shown as required.

Solution

  • add a conditional that returns required object only when it is true, otherwise the returns null.
  • fix showing 'No whitespaces' in optional fields when it is empty.

Screenshots (before):

Screenshot 2021-03-01 at 13 57 44

Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
@boring-cyborg boring-cyborg bot added the ui Improvements/additions/fixes for ui module. label Mar 3, 2021
@luanecavalcantizup luanecavalcantizup changed the title Fix showing required field for an optional field when registering a module Fix showing required for an optional field when registering a module Mar 3, 2021
@luanecavalcantizup luanecavalcantizup added the bug Something isn't working label Mar 3, 2021
@luanecavalcantizup luanecavalcantizup self-assigned this Mar 3, 2021
@codecov
Copy link

codecov bot commented Mar 3, 2021

Codecov Report

Merging #953 (991afc8) into main (bc34260) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #953      +/-   ##
============================================
+ Coverage     77.43%   77.52%   +0.08%     
  Complexity     1978     1978              
============================================
  Files          1192     1192              
  Lines         16405    16403       -2     
  Branches       1491     1491              
============================================
+ Hits          12704    12716      +12     
+ Misses         3231     3216      -15     
- Partials        470      471       +1     
Flag Coverage Δ Complexity Δ
ui 80.55% <100.00%> (+0.18%) 0.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
ui/src/modules/Modules/Comparation/Form/index.tsx 93.18% <ø> (ø) 0.00 <0.00> (ø)
ui/src/core/utils/validations.ts 94.44% <100.00%> (ø) 0.00 <0.00> (ø)
ui/src/modules/Modules/Comparation/Form/helpers.ts 98.76% <100.00%> (+0.01%) 0.00 <0.00> (ø)
ui/src/modules/Main/Footer/index.tsx 83.33% <0.00%> (-2.39%) 0.00% <0.00%> (ø%)
ui/src/core/providers/base/index.ts 79.24% <0.00%> (-0.39%) 0.00% <0.00%> (ø%)
ui/src/modules/Main/constants.ts 100.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
ui/src/modules/Main/Footer/styled.ts 100.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
ui/src/modules/Settings/Credentials/index.tsx 91.17% <0.00%> (ø) 0.00% <0.00%> (ø%)
ui/src/modules/Modules/hooks/module.ts 72.97% <0.00%> (+2.70%) 0.00% <0.00%> (ø%)
...odules/Settings/Credentials/Sections/Git/index.tsx 70.58% <0.00%> (+70.58%) 0.00% <0.00%> (ø%)

Continue to review full report at Codecov.

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

luanecavalcantizup and others added 4 commits March 3, 2021 17:08
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
@luanecavalcantizup luanecavalcantizup marked this pull request as ready for review March 4, 2021 14:45
Copy link
Contributor

@ifdouglas ifdouglas left a comment

Choose a reason for hiding this comment

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

Removing the error prop will just mask the problem, I think this fields shouldn't be required.

Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
ifdouglas
ifdouglas previously approved these changes Mar 5, 2021
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
Signed-off-by: luanecavalcantizup <luane.cavalcanti@zup.com.br>
@monicaribeiro monicaribeiro merged commit 3197cbc into main Mar 16, 2021
@monicaribeiro monicaribeiro deleted the fix-modules-form-input branch March 16, 2021 20:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working TESTED QA ui Improvements/additions/fixes for ui module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants