-
Notifications
You must be signed in to change notification settings - Fork 993
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 #37013 - change the 'All hosts' menu item's url based on the new_host_page
setting
#9969
Fixes #37013 - change the 'All hosts' menu item's url based on the new_host_page
setting
#9969
Conversation
This (and |
I think we could store those settings in a constant, e.g: and check on successful setting update if it's one of those three to trigger refresh. The refresh itself is pretty quick and increases the user experience for using those settings. I was also a bit surprised when trying to use the new hosts page, and when going to that page I saw that nothing have changed. In addition, when you are already in the new hosts page, and trying to reload the page, you will not move to the new hosts page because the URL itself belong to the legacy hosts page. @MariaAga what do you think? |
Automatically refreshing a page can be bad. Also, if a user has multiple tabs open then they won't get it there. The experience may be inconsistent. The tab may even be on a different device or different user so you can't refresh those. Like @MariaAga I think we shouldn't refresh automatically, but make the user aware of it. Showing a warning after can be a good thing. |
@Ron-Lavi We discussed this at our meeting and the outcome was
@MariaAga @ares @MariSvirik if I missed anything, please comment here |
Thanks @jeremylenz and the team! |
@Ron-Lavi remember that the problem will still exist in other tabs or browsers of other users. AFAIK we don't have a mechanism to push a refresh or poll for new URLs. In the past we've talked about implementing ActionCable (also to remove polling for user notifications). Back then we were blocked on other issues in the stack, but those have long been resolved. Perhaps it makes sense to implement it as a more generic subscribe mechanism where notifications are one, but some broadcast about settings/menu links is another? You can argue about whether it's surprising the user (=bad) if their UI suddenly changes though. |
0d3409c
to
1abe167
Compare
new_host_page
setting
that will be great for many areas in our app indeed.
I think it's fine in case we are making things more accurate
Agree.. probably ActionCable is the way to go, but as for now we don't support those changes across multiple tabs unfortunately. |
1abe167
to
3999449
Compare
Ready for another review round @MariaAga @jeremylenz :) |
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.
Looks like the plugin tests are still failing on this:
TypeError: Cannot read property 'context' of undefined
at useForemanContext (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/Root/Context/ForemanContext.js:7:40)
at useForemanMetadata (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/Root/Context/ForemanContext.js:11:34)
at useForemanSettings (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/Root/Context/ForemanContext.js:14:41)
at Pagination (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/components/Pagination/index.js:32:63)
at renderWithHooks (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:14803:18)
at mountIndeterminateComponent (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:17482:13)
at beginWork (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:18596:16)
at HTMLUnknownElement.callCallback (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:188:14)
at invokeEventListeners (/home/runner/work/foreman/foreman/projects/plugin/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
at HTMLUnknownElementImpl._dispatch (/home/runner/work/foreman/foreman/projects/plugin/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
at HTMLUnknownElementImpl.dispatchEvent (/home/runner/work/foreman/foreman/projects/plugin/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
at HTMLUnknownElementImpl.dispatchEvent (/home/runner/work/foreman/foreman/projects/plugin/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
at HTMLUnknownElement.dispatchEvent (/home/runner/work/foreman/foreman/projects/plugin/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
at Object.invokeGuardedCallbackDev (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:237:16)
at invokeGuardedCallback (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:292:31)
at beginWork$1 (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:23203:7)
at performUnitOfWork (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:22157:12)
at workLoopSync (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:22130:22)
at performSyncWorkOnRoot (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:21756:9)
at /home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:11089:24
at unstable_runWithPriority (/home/runner/work/foreman/foreman/projects/foreman/node_modules/scheduler/cjs/scheduler.development.js:[653](https://github.com/theforeman/foreman/actions/runs/7472314844/job/20334243456?pr=9969#step:10:654):12)
at runWithPriority$1 (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:11039:10)
at flushSyncCallbackQueueImpl (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:11084:7)
at flushSyncCallbackQueue (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:11072:3)
at batchedUpdates$1 (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-dom/cjs/react-dom.development.js:21862:7)
at Object.notify (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-redux/lib/utils/Subscription.js:21:7)
at Object.notifyNestedSubs (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-redux/lib/utils/Subscription.js:92:15)
at handleChangeWrapper (/home/runner/work/foreman/foreman/projects/foreman/node_modules/react-redux/lib/utils/Subscription.js:97:20)
at next (/home/runner/work/foreman/foreman/projects/foreman/node_modules/redux/lib/redux.js:305:7)
at /home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/redux/API/APIMiddleware.js:13:10
at /home/runner/work/foreman/foreman/projects/foreman/node_modules/redux-thunk/lib/index.js:27:16
at dispatch (/home/runner/work/foreman/foreman/projects/foreman/node_modules/redux/lib/redux.js:699:28)
at call (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/redux/API/APIRequest.js:48:5)
at tryCatch (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/redux/API/APIRequest.js:2:1)
at Generator._invoke (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/redux/API/APIRequest.js:2:1)
at Generator.next (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/redux/API/APIRequest.js:2:1)
at asyncGeneratorStep (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/redux/API/APIRequest.js:2:1)
at _next (/home/runner/work/foreman/foreman/projects/foreman/webpack/assets/javascripts/react_app/redux/API/APIRequest.js:2:1)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at runNextTicks (internal/process/task_queues.js:64:3)
at processImmediate (internal/timers.js:437:9)
3999449
to
6fb869f
Compare
Looks like last commit fixed the failing Katello JS tests @jeremylenz |
@Ron-Lavi did you get to |
Hey @MariaAga, yes, verified with Jayant and it works for him. |
Should we remove the |
6fb869f
to
52e071f
Compare
Looks ok to me, @jeremylenz any requests? |
If that VCR test failure on Katello passes locally, let's ignore the error. It believe it's a super rare transient failure that I haven't seen in a long while. |
…ew_host_page` setting After changing the `new_host_page` setting, the layout navigation still has the wrong hosts page link (the one it got initially) and someone who wants to try this new functionallity can't access the page via the navigation. Using ForemanContext, in this PR we are updating the menu item based on the changed setting.
52e071f
to
c2e5596
Compare
Let's see if that test passes, before the last rebase it was green. |
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.
All green now. thanks @Ron-Lavi !
ACK 👍
After changing the
new_host_page
setting, the layout navigation still has the wrong hosts page link (the one it got initially)and someone who wants to try this new functionallity can't access the page via the navigation.
Using ForemanContext, in this PR we are updating the menu item based on the changed setting.