-
Notifications
You must be signed in to change notification settings - Fork 23
App selections should update current auth states #220
Conversation
This breaks lots of tests in index.test.jsx because now you cannot update auth We need to come up with a way to apply changes to this object after getAuth() is called. Maybe we need to merge changes made to the form with the oas files
Two issues with this for the next time @domharrington and I talk about this (forgetting we've done this twice now):
|
getAuth()
to pass in selected app@@ -353,7 +356,6 @@ Doc.propTypes = { | |||
}), | |||
auth: PropTypes.shape({}).isRequired, | |||
baseUrl: PropTypes.string, | |||
changeGroup: PropTypes.func.isRequired, |
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.
Renamed this throughout so it's clearer that this is intended for an onChange
event.
packages/api-logs/index.jsx
Outdated
@@ -88,7 +88,7 @@ class Logs extends React.Component { | |||
} | |||
|
|||
onSelect(event) { | |||
this.changeGroup(event.target.value); | |||
this.onGroupChange(event.target.value, event.target.options[event.target.selectedIndex].text); |
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.
Since getAuth
asks for a selectedApp
param, it makes more sense to push back the group name as well instead of only the group ID/api key to the explorer.
@domharrington @mjcuva I'm working on adding some more unit tests, but this is ready for review. @rafegoldberg We might want to change the font color of the dropdown in the |
With multiple securities on an operation, it kind of looks like garbage. @madisonyocum @mjcuva @rafegoldberg ideas? Also changing those dropdowns right now in that example updates both securities. That seems wrong. |
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 code for this looks sound, but I've not tested.
What does this do when there's no logged in user?
Not sure what to do about the multiple schemes thing either. I think in your example it's worse because they're named the same thing, would it be any better if they were different?
Is there value in showing both the and the dropdown? Maybe just showing the dropdown is enough, since they'd see the API key in the code sample?
Is the disabled right now when it's coming from one of these dropdown values?
{ | ||
...oas.components.securitySchemes[scheme], | ||
_key: scheme, | ||
selectedApp, |
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.
Is this needed?
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, getSingle
needs to know the current app so it can pick out the right key.
packages/api-logs/index.jsx
Outdated
@@ -88,7 +88,7 @@ class Logs extends React.Component { | |||
} | |||
|
|||
onSelect(event) { | |||
this.changeGroup(event.target.value); | |||
this.onGroupChange(event.target.value, event.target.options[event.target.selectedIndex].text); |
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.
Can the group name be inferred from the value higher up the stack? Or does it make sense to always have to pass in the pair here?
Talked offline with @mjcuva about the dupe dropdown issue and we're going to play with moving the dropdown into the top right of the authbox and only show it once. |
Co-Authored-By: domharrington <domharrington@users.noreply.github.com>
@domharrington @rafegoldberg @mjcuva @madisonyocum This is good for review again. The design has slightly changed per our conversation last week to move the groups dropdown up into the first auth header: Functionality remains the same though, and changing a group in there will swap out the auth state in the app and update both inputs. |
@madisonyocum how about something like this? |
I really, really, really like that. The toggle on the auth scheme entry should probably only show up if there's more than one though. |
@rafegoldberg @madisonyocum That dropdown isn't going to be present for logged out users, so we should take that into consideration. |
- restructure markup and add classes - move in to AuthBox/ directory; add stylesheet
Moved the |
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 locally; e'erything runs well and looks good on my end. Only question I have is whether the group selector will/should be visible in the auth box if there's only a single project? (Couldn't quite figure out how to test this locally...) But it's nothing to hold your merge over!
@rafegoldberg We definitely shouldn't show the dropdown if they just have a single project. That looks to be the current behavior in This all looks great, though on endpoints with only a single auth scheme, there's a scrollbar that shows up: |
only show the dropdown when `props.groups.length` is greater than 1
@erunion fixed the erroneous scrollbars and moved the |
Looks good! |
input[type=password]
inputs.🚧 Revised design