-
Notifications
You must be signed in to change notification settings - Fork 179
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): Show connect modules modal when session modules detected #1897
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #1897 +/- ##
==========================================
- Coverage 33.22% 33.12% -0.11%
==========================================
Files 401 403 +2
Lines 6562 6588 +26
==========================================
+ Hits 2180 2182 +2
- Misses 4382 4406 +24
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.
Going to push fixups directly to this branch
export type StateModule = { | ||
// resource ID | ||
_id: number, | ||
// slot module is installed in | ||
slot: Slot, | ||
// name identifier of the module | ||
type: 'magdeck' | 'tempdeck', | ||
name: ModuleType |
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.
👍
app/src/pages/Calibrate/Labware.js
Outdated
} | ||
|
||
// TODO (ka 2018-7-19): type this more specifically | ||
function getNames (array: Array<any> | []): Array<string> { |
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.
Would this work?
function getNames (array: ?Array<{name: string}>): Array<string> {
app/src/pages/Calibrate/Labware.js
Outdated
// TODO (ka 2018-7-19): type this more specifically | ||
function getNames (array: Array<any> | []): Array<string> { | ||
const names = array | ||
? array.map((m) => { return m.name }).sort() |
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.
Prefer m => m.name
to m => { return m.name }
and also is the sort
necessary?
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.
sort isnt neccesary, its left over from another half baked idea
app/src/pages/Calibrate/Labware.js
Outdated
return names | ||
} | ||
|
||
function compareNames (a: Array<StateModule>, b: Array<?Module> | null) { |
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.
Should the type for b
be ?Array<Module>
?
app/src/robot/types.js
Outdated
@@ -132,13 +132,15 @@ export type Labware = StateLabware & { | |||
|
|||
export type LabwareType = 'tiprack' | 'labware' | |||
|
|||
export type ModuleType = 'magdeck' | 'tempdeck' | |||
|
|||
export type StateModule = { |
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.
In hindsight, StateModule
is a bad name. We should probably rename it to SessionModule
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.
renaming now
@@ -4,11 +4,11 @@ import type {Module} from '../../http-api-client' | |||
import ModuleItem, {NoModulesMessage} from '../ModuleItem' | |||
|
|||
type Props = { | |||
modules: Array<Module>, | |||
modules: Array<?Module>, |
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 should be ?Array<Module>
. If the array exists, it is definitely comprised of Module
s, but the array may not exist.
(The type as written says the array definitely exists and is comprised of either Module
s or null
/undefineds
)
app/src/http-api-client/modules.js
Outdated
@@ -21,7 +21,7 @@ export type Module = { | |||
} | |||
|
|||
type FetchModulesResponse = { | |||
modules: Array<Module>, | |||
modules: Array<?Module>, |
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 change is incorrect and should be reverted. The API will never respond with [..., null, ...]
app/src/pages/Calibrate/Labware.js
Outdated
modules: Array<StateModule>, | ||
actualModules: ?Array<Module>, | ||
actualModules: Array<?Module>, |
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.
?Array<Module>
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.
works! couldn't break it
displayName: 'Magnetic Bead Module' | ||
} | ||
] | ||
// TODO(mc, 2018-07-19): remove this testing code when API returns modules |
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.
If this is gonna be toggled in development for much longer, maybe it should be under a feature flag instead of commented out?
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.
Thats a good idea! We can do that in an upcoming PR. This ones already too big
overview
This PR closes #1738 and checks of a few boxes in #1737
changelog
review requests
Modal prompt will only show if modules flag is true:
make dev OT_APP_MODULES=1
Modal Prompt will only show if
state.robot.session.modulesBySlot
containsSessionModule
object(s)app/src/robot/api-client/client.js
app/src/pages/Calibrate/Labware.js
const actualModules = [{name: 'magdeck'}]
or{name: 'tempdeck'}
or bothExpected behavior:
GET /modules
Todo in upcoming PR: show the deckmap in the module review modal