-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Admin status page's current tab does not preserve #4299
Conversation
@@ -49,7 +49,7 @@ export function WorkersTable({ loading, items }) { | |||
dataSource={items} | |||
pagination={{ | |||
defaultPageSize: 25, | |||
pageSizeOptions: [10, 25, 50], | |||
pageSizeOptions: ['10', '25', '50'], |
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 unrelated to this PR, I was just bothered by the console warning.
const { isLoading, error, queueCounters, startedJobs, overallCounters, workers } = this.state; | ||
const { isLoading, error, queueCounters, startedJobs, overallCounters, workers, activeTab } = this.state; | ||
|
||
const changeTab = (newTab) => { |
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.
What do you mean by bringing in a router?
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.
Directly manipulating the location hash isn't such a good practice. The appropriate way would probably be to define routes for these sub-pages, using something like react-router
(which might not be an entirely bad idea, as it will open the door to more routing in the app, and, subsequently, the gate to hell)
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.
When we get rid of Angular we should look into having a separate URL for each of them, but right now it might prove to be tricky (without reloading all the data on every URL change).
But check how we handle hash navigation on the query page (we use it to direct link to specific visualizations) and see if it's not too complex. Or is it what you already do here?
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 you're referring to this, I think it'll be overkill as the admin page is almost entirely Angular-free. @kravets-levko WDYT?
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.
Oh, not that monstrosity. I'm not even sure why we need it there 😳 What you did is actually fine, let's roll with it.
Just to make sure: location.replace
won't make Angular trigger a reload or 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.
It doesn't trigger a page reload, but it does trigger a component remounting, which in turns fetches new information from the API (not sure if that's really a bad thing).
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.
I was hoping to avoid that, to keep switching tabs snappy. Otherwise we could just use separate URLs (/admin/rq/queues
, /admin/rq/workers
, etc) instead.
I guess that to avoid remounting, we have to move fetching one level up and pass it down to the tabs (or have a "service" class that provides this state).
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.
It still is snappy. It switches instantaneously, but it triggers a background reload of data, which means that when you switch to Workers, for example, you will see data immediately, and a few hundred milliseconds later that data may change.
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.
Oh, ok. Not ideal but let's move on.
When viewing the Celery/RQ admin status pages (at
/admin/queries/jobs
and/admin/queries/tasks
), there are several tabs (for Queues, Workers, Other Tasks) that are not part of the URL, so whenever you visit the page, it defaults to the first tab.