-
Notifications
You must be signed in to change notification settings - Fork 991
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
Fixes #29792 - Add current taxonomies and user in react context #7655
Conversation
app/helpers/application_helper.rb
Outdated
UISettings: ui_settings, version: SETTINGS[:version].short, docUrl: documentation_url, | ||
location: Location.current&.id, | ||
organization: Organization.current&.id, | ||
user: User.current&.id |
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.
nit: How about locationId
, organizationId
, userId
for the keys?
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 we make these into objects that also contain the taxonomy label or the user full name so they can be used for display purposes?
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.
makes sense
Looks good, I just added one comment. |
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.
How will we handle changing the current taxonomy in the UI (right now it won't be a problem due to triggering full page reload, but as pages change to react it might), as well as impersonation?
what's the status here @amirfefer ? |
@amirfefer needs rebase :( |
@tbrisker, @xprazak2, rebased, plus I added a few changes.
Changing a taxonomy triggers a full-page reload, including impersonation, so the context is updated. |
app/helpers/application_helper.rb
Outdated
{ | ||
UISettings: ui_settings, version: SETTINGS[:version].short, docUrl: documentation_url, | ||
location: Location.current.attributes.slice('id', 'title'), | ||
organization: Organization.current.attributes.slice('id', 'title'), |
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.
Needs a check if current loc/org is set, otherwise fails on undefined method when in 'Any Context'.
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.
Thanks @xprazak2, should work now
Thanks! |
current loc / org and user-id should be a single source of truth across core and plugins and react context may be the place.
The need for this PR has been raised here:
https://github.com/theforeman/foreman_plugin_template/pull/32/files#diff-2ee0f3275ce16ab586fcec80d0b2124cR11