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): Add protocol file info page #2221

Merged
merged 14 commits into from
Sep 12, 2018
Merged

feat(app): Add protocol file info page #2221

merged 14 commits into from
Sep 12, 2018

Conversation

Kadee80
Copy link
Contributor

@Kadee80 Kadee80 commented Sep 11, 2018

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.

screen shot 2018-09-11 at 3 59 20 pm

screen shot 2018-09-11 at 3 59 34 pm

changelog

  • feat(app): Add protocol file info page

review requests

Upload a protocol with wrong/no pipettes attached on robot

  • required pipettes list renders (no check icon for wrong/missing pipettes)
  • warning text and button linking to attach pipettes renders

Upload a protocol with wrong/no modules attached on robot

  • required modules list renders (no check icon for wrong/missing modules)
  • warning text and button linking to attach modules renders

Upload a protocol with correct pipettes/modules attached/connected

  • required pipettes list renders with check icon
  • required modules list renders with check icon
  • no warning or button/link to attach instruments render when correct instruments are attached

Currently, clicking [Proceed to Calibrate] directes the user to tip probe by default.

@Kadee80 Kadee80 self-assigned this Sep 11, 2018
@Kadee80 Kadee80 requested review from b-cooper and IanLondon and removed request for b-cooper and IanLondon September 11, 2018 19:08
@Kadee80 Kadee80 added feature Ticket is a feature request / PR introduces a feature app Affects the `app` project ready for review labels Sep 11, 2018
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.

Pipette (P300 single) and module (magdeck) don't show up in the file info page, but do show up in pipette & modules page

@codecov
Copy link

codecov bot commented Sep 11, 2018

Codecov Report

Merging #2221 into edge will decrease coverage by 0.68%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
app/src/components/UploadPanel/index.js 0% <ø> (ø) ⬆️
app/src/http-api-client/modules.js 45.45% <ø> (ø) ⬆️
app/src/components/FileInfo/ProtocolLabwareCard.js 0% <0%> (ø)
app/src/components/FileInfo/InstrumentWarning.js 0% <0%> (ø)
app/src/components/FileInfo/Continue.js 0% <0%> (ø)
app/src/components/FileInfo/InstrumentItem.js 0% <0%> (ø)
app/src/components/FileInfo/index.js 0% <0%> (ø)
app/src/components/FileInfo/LabwareTable.js 0% <0%> (ø)
app/src/components/layout/SectionContentHalf.js 0% <0%> (ø)
app/src/components/layout/index.js 0% <0%> (ø) ⬆️
... and 46 more

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 4a8ebbe...7ec1e0a. Read the comment docs.

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.

tested and works! left some code comments

const {name} = props

let createdBy = 'Opentrons API'
if (name.includes('json')) {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

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()}
Copy link
Contributor

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)

Copy link
Contributor Author

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

Copy link
Contributor

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) {
Copy link
Contributor

@IanLondon IanLondon Sep 11, 2018

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?

Copy link
Contributor Author

@Kadee80 Kadee80 Sep 11, 2018

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

Copy link
Contributor

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>
))

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.

🌻

const labwareCount = countBy(labware, 'name')
let labwareList = []

forEach(labwareCount, function (value, key) {
Copy link
Contributor

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')) {
Copy link
Contributor

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) {
Copy link
Contributor

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

@mcous mcous merged commit e861365 into edge Sep 12, 2018
@mcous mcous deleted the app_file-info-page branch September 12, 2018 15:23
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.

3 participants