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(app): Enable pipette config modal and form #3202

Merged
merged 5 commits into from
Mar 13, 2019

Conversation

Kadee80
Copy link
Contributor

@Kadee80 Kadee80 commented Mar 12, 2019

overview

This PR removes feature flag and enables pipette config for up to date robots (robots which return a response from /settings/pipettes)

This PR also renders validates and submits hidden fields when new feature flag --internalDev.allPipetteConfig is true.

closes #3112

changelog

  • feat(app): Enable pipette config modal and form
  • feat(app): Render hidden config fields behind new feat flag

review requests

note: I gave a build to support so I will hold off on merging this until they give me feedback on functionality

make -C app dev

  • pipette config settings button renders for robots with up to date software (returns data from pipette config endpoint)
  • pipette config settings button does not render for mounts with no pipette, or for robots without the latest robot software
  • [settings] button opens modal with config form for the correct pipette
  • validation works as expected
  • form submit works as expected
  • reset all works as expected
  • clearing a value resets to placeholder/default
  • non default saved values (returned from robot) render as editable text
  • [save] is disabled when validation errors exist
  • [save] button submits form and closes modal
  • reopening modal renders updated pipette config values

make -C app dev OT_APP_DEV_INTERNAL__ALL_PIPETTE_CONFIG=1

  • all default settings listed above work as expected
  • hidden fields render
  • hidden fields validate as expected
  • hidden fields update config on submit

Render hidden config fields behind new feat flag

closes #3112
@Kadee80 Kadee80 added feature Ticket is a feature request / PR introduces a feature app Affects the `app` project ready for review labels Mar 12, 2019
@Kadee80 Kadee80 requested review from mcous and IanLondon March 12, 2019 19:38
@codecov
Copy link

codecov bot commented Mar 12, 2019

Codecov Report

Merging #3202 into edge will decrease coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##             edge    #3202      +/-   ##
==========================================
- Coverage   53.17%   53.14%   -0.03%     
==========================================
  Files         691      691              
  Lines       20403    20413      +10     
==========================================
  Hits        10849    10849              
- Misses       9554     9564      +10
Impacted Files Coverage Δ
...rc/components/InstrumentSettings/InstrumentInfo.js 0% <ø> (ø) ⬆️
app/src/config/index.js 55.55% <ø> (ø) ⬆️
...ponents/InstrumentSettings/AttachedPipettesCard.js 0% <ø> (ø) ⬆️
app/src/components/ConfigurePipette/ConfigForm.js 0% <0%> (ø) ⬆️
app/src/components/ConfigurePipette/index.js 0% <0%> (ø) ⬆️
...src/components/AppSettings/AdvancedSettingsCard.js 0% <0%> (ø) ⬆️

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 47973a3...bcbe0d7. Read the comment docs.

Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

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

Some code organization thoughts before I go into testing. None of this feels blocking to me

@@ -64,6 +67,14 @@ export default class ConfigForm extends React.Component<Props> {
])
}

getHiddenFields = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Two things:

  • hiddenFields feels a little confusing for fields that are displayed and visible
    • In my head I was treating these as "known fields" and "unknown fields"
  • Rather than add this new method, does it make sense to move this logic to getVisibleFields?

@@ -84,7 +95,9 @@ export default class ConfigForm extends React.Component<Props> {

validate = (values: FormValues) => {
const errors = {}
const fields = this.getVisibleFields()
const fields = this.props.showHiddenFields
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is duplicated here and in render and should probably be moved to getVisibleFields

Copy link
Contributor

Choose a reason for hiding this comment

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

This line change should be reverted with the update to getVisibleFields

Copy link
Contributor

@IanLondon IanLondon left a comment

Choose a reason for hiding this comment

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

Small weirdness: any whitespace ' ' gets cast to 0. When it goes out to the PATCH, it's 0 so it shouldn't be able to cause anything weird to happen. Also this is only possible to do in plunger fields since the others have minimum greater than zero

❌ With make -C app dev OT_APP_DEV_INTERNAL__ALL_PIPETTE_CONFIG=1, tipLength reports a min and max but the form doesn't validate the range (the API does though). That seems wrong b/c defaultAspirateFlowRate and defaultDispenseFlowRate look the same coming from GET /settings/pipettes/{pipetteId}, but the front end is validating them correctly. I'm not sure why...

} else if (min && max && (parsed < min || value > max)) {
} else if (
typeof min === 'number' &&
max &&
Copy link
Contributor

Choose a reason for hiding this comment

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

this should probably get the same typeof ... 'number' treatment, it's possible a max could be zero

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@Kadee80 Kadee80 requested review from IanLondon and mcous March 13, 2019 17:10
Copy link
Contributor

@IanLondon IanLondon left a comment

Choose a reason for hiding this comment

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

⛏️

Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

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

Looks great but missed one little thing in the fixups

@@ -84,7 +95,9 @@ export default class ConfigForm extends React.Component<Props> {

validate = (values: FormValues) => {
const errors = {}
const fields = this.getVisibleFields()
const fields = this.props.showHiddenFields
Copy link
Contributor

Choose a reason for hiding this comment

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

This line change should be reverted with the update to getVisibleFields

Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

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

🛋️

@Kadee80 Kadee80 merged commit 49c1fe9 into edge Mar 13, 2019
@Kadee80 Kadee80 deleted the app_pip-config-remove-flag branch March 13, 2019 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app Affects the `app` project feature Ticket is a feature request / PR introduces a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pipette Config: Run App can render arbitrary fields from API
3 participants