Skip to content

Commit

Permalink
Admin status page's current tab does not preserve (#4299)
Browse files Browse the repository at this point in the history
* handle a console warning about passing in string page options

* preserve selected tab in the location hash
  • Loading branch information
Omer Lachish authored Nov 11, 2019
1 parent e0e94d7 commit a0a32be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/app/components/admin/RQStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function WorkersTable({ loading, items }) {
dataSource={items}
pagination={{
defaultPageSize: 25,
pageSizeOptions: [10, 25, 50],
pageSizeOptions: ['10', '25', '50'],
showSizeChanger: true,
}}
/>
Expand Down
10 changes: 8 additions & 2 deletions client/app/pages/admin/Jobs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import moment from 'moment';

class Jobs extends React.Component {
state = {
activeTab: location.hash.replace('#', '') || null,
isLoading: true,
error: null,

Expand Down Expand Up @@ -76,7 +77,12 @@ class Jobs extends React.Component {
};

render() {
const { isLoading, error, queueCounters, startedJobs, overallCounters, workers } = this.state;
const { isLoading, error, queueCounters, startedJobs, overallCounters, workers, activeTab } = this.state;

const changeTab = (newTab) => {
location.replace(`${location.pathname}#${newTab}`);
this.setState({ activeTab: newTab });
};

return (
<Layout activeTab="jobs">
Expand All @@ -96,7 +102,7 @@ class Jobs extends React.Component {
</Grid.Col>
</Grid.Row>

<Tabs defaultActiveKey="queues" animated={false}>
<Tabs activeKey={activeTab || 'queues'} onTabClick={changeTab} animated={false}>
<Tabs.TabPane key="queues" tab="Queues">
<QueuesTable loading={isLoading} items={queueCounters} />
</Tabs.TabPane>
Expand Down

0 comments on commit a0a32be

Please sign in to comment.