-
Notifications
You must be signed in to change notification settings - Fork 178
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): Add protocol file info page #2221
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pipette (P300 single) and module (magdeck) don't show up in the file info page, but do show up in pipette & modules page
Codecov Report
@@ Coverage Diff @@
## edge #2221 +/- ##
==========================================
- Coverage 30.62% 29.93% -0.69%
==========================================
Files 479 498 +19
Lines 7814 8057 +243
==========================================
+ Hits 2393 2412 +19
- Misses 5421 5645 +224
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested and works! left some code comments
const {name} = props | ||
|
||
let createdBy = 'Opentrons API' | ||
if (name.includes('json')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will probably be done upstream of this component and passed down as props (?) but instead of includes
you could do endsWith
or a regex /*.\.json$/
b/c dilute_from_json_data.ot2.py
or whatever will be seen as a JSON protocol, even though it ends with py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IanLondon yup, upcoming parse PR handles this in a selector using endsWith
<StatusIcon match={props.match}/> | ||
{props.mount && ( | ||
<span className={styles.mount_label}> | ||
{props.mount.toUpperCase()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might wanna guard props.mount && props.mount.toUpperCase()
in case mount really is undefined (I'm not sure why flow isn't failing here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 16 handles if props.mount
is undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d'oh
const labwareCount = countBy(labware, 'name') | ||
let labwareList = [] | ||
|
||
forEach(labwareCount, function (value, key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this use map
instead of forEach
, since it's pushing each time?
Separate issue: does it matter that since labwareCount
is an object, the iteration order (and thus the order of labwareList) is arbitrary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't matter that the order is arbitrary. I tried this with map and Object.entries and got some whacky results, hence the forEach.
Open to other working suggestions but this seemed the most straight forward after using _countBy to get the xN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @IanLondon was suggesting:
import map from 'lodash/map'
// ...
const labwareList = map(labwareCount, (count, type) => (
<tr key={type}>
<td>{type}</td>
<td>{count > 1 ? `x${count}` : ''</td>
</tr>
))
This would work too if we didn't want the lodash import:
const labwareList = Object.keys(labwareCount)map(type => (
<tr key={type}>
<td>{type}</td>
<td>{labwareCount[type] > 1 ? `x${labwareCount[type]}` : ''</td>
</tr>
))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌻
const labwareCount = countBy(labware, 'name') | ||
let labwareList = [] | ||
|
||
forEach(labwareCount, function (value, key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @IanLondon was suggesting:
import map from 'lodash/map'
// ...
const labwareList = map(labwareCount, (count, type) => (
<tr key={type}>
<td>{type}</td>
<td>{count > 1 ? `x${count}` : ''</td>
</tr>
))
This would work too if we didn't want the lodash import:
const labwareList = Object.keys(labwareCount)map(type => (
<tr key={type}>
<td>{type}</td>
<td>{labwareCount[type] > 1 ? `x${labwareCount[type]}` : ''</td>
</tr>
))
const {name} = props | ||
|
||
let createdBy = 'Opentrons API' | ||
if (name.includes('json')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IanLondon yup, upcoming parse PR handles this in a selector using endsWith
|
||
const actualModel = actualModules && actualModules.modules.find((m) => m.name === module.name) | ||
let modulesMatch = false | ||
if (actualModel && actualModel.name === module.name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could have done:
const modulesMatch = actualModel != null && actualModel.name === module.name
Regardless, we should explore moving this logic into a selector seeing as it's showing up in a few places now
overview
This PR addresses 95% of the UI in #2129.
For now, information section displays protocol name (as file name) and created by (based on file type). Author, last modified, and description will be added in the small follow up PR once @mcous finishes a separate PR that adds actual JSON protocol parsing to the app.
changelog
review requests
Upload a protocol with wrong/no pipettes attached on robot
Upload a protocol with wrong/no modules attached on robot
Upload a protocol with correct pipettes/modules attached/connected
Currently, clicking [Proceed to Calibrate] directes the user to tip probe by default.