-
Notifications
You must be signed in to change notification settings - Fork 176
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 wifi disconnect #5028
Conversation
395ef20
to
7997770
Compare
Codecov Report
@@ Coverage Diff @@
## edge #5028 +/- ##
==========================================
+ Coverage 68.86% 69.10% +0.24%
==========================================
Files 1082 1090 +8
Lines 36045 36158 +113
==========================================
+ Hits 24822 24988 +166
+ Misses 11223 11170 -53
Continue to review full report at Codecov.
|
2e43469
to
14ac643
Compare
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.
Batch of comments. Haven't gotten to the big components yet, so more incoming tomorrow
...rc/components/RobotSettings/SelectNetwork/SelectNetworkModal/ConnectDisconnectModal/index.js
Outdated
Show resolved
Hide resolved
...rc/components/RobotSettings/SelectNetwork/SelectNetworkModal/ConnectDisconnectModal/index.js
Outdated
Show resolved
Hide resolved
...rc/components/RobotSettings/SelectNetwork/SelectNetworkModal/ConnectDisconnectModal/utils.js
Outdated
Show resolved
Hide resolved
...rc/components/RobotSettings/SelectNetwork/SelectNetworkModal/ConnectDisconnectModal/utils.js
Outdated
Show resolved
Hide resolved
...rc/components/RobotSettings/SelectNetwork/SelectNetworkModal/ConnectDisconnectModal/utils.js
Outdated
Show resolved
Hide resolved
2442de2
to
27ee539
Compare
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.
Lot of comments in this one, but the only two that are important to tackle in this PR before merging are:
- "Join other" and "Disconnect" need to be in groups to get group separators
- "Disconnect" should not be an option if the robot isn't on Wi-Fi
The rest of my comments are important, but addressing them before we switch to the better actions / state will result in unnecessary churn, so please resist the temptation
} | ||
|
||
const SELECT_ACTIONS_OPTIONS = [ | ||
{ value: JOIN_OTHER_VALUE }, |
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 (showWifiDisconnect) { | ||
return list | ||
.map(({ ssid }) => ({ value: ssid })) | ||
.concat(SELECT_ACTIONS_OPTIONS) |
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.
failure, | ||
modalOpen, | ||
ssid, | ||
previousSsid, |
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.
previousSsid
seems entirely redundant with the presence of networkingType
or am I missing something?
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.
yeah, it can go away once we fix up the handler, which will be made even easier by splitting up the onChange
work
const [networkingType, setNetworkingType] = useState<NetworkingType | null>( | ||
null | ||
) | ||
const [securityType, setSecurityType] = useState<WifiSecurityType | 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.
This is only a concern when joining an unknown network; I don't think it needs to be up here
const [securityType, setSecurityType] = useState<WifiSecurityType | null>( | ||
null | ||
) | ||
const [modalOpen, setModalOpen] = useState<boolean>(false) |
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 seems redundant when networkingType
is a thing
getActiveSsid(): ?string { | ||
const activeNetwork = find(this.props.list, 'active') | ||
return activeNetwork && activeNetwork.ssid | ||
setSsid(currentSsid) |
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.
The fact that one handler sets all these different things is a red flag. At most I think we need two pieces of state:
- Current action: connect, disconnect, join other, null (close modal)
- Network to join (if action is connect)
Disconnect needs to hang on to the active network so it can display proper copy after it's no longer marked "active" in state, but that should be local to whatever DisconnectModal we write
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.
💯
add wifi disconnect feature to robot settings screen closes #4849
96a2d09
to
a9cf07d
Compare
overview
Refactors select network functionality on robot settings screen. Handles disconnect, connect, and joining of wifi networks.
changelog
review requests