change(ui): fetch meta list when session list is open
This commit is contained in:
parent
2dbccf2a7d
commit
9793e1e07a
1 changed files with 7 additions and 4 deletions
|
|
@ -7,6 +7,7 @@ import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG';
|
|||
import { fetchSessions, addFilterByKeyAndValue, updateCurrentPage, setScrollPosition } from 'Duck/search';
|
||||
import useTimeout from 'App/hooks/useTimeout';
|
||||
import { numberWithCommas } from 'App/utils';
|
||||
import { fetchListActive as fetchMetadata } from 'Duck/customField';
|
||||
|
||||
const AUTOREFRESH_INTERVAL = 5 * 60 * 1000;
|
||||
const PER_PAGE = 10;
|
||||
|
|
@ -23,6 +24,7 @@ interface Props {
|
|||
updateCurrentPage: (page: number) => void;
|
||||
setScrollPosition: (scrollPosition: number) => void;
|
||||
fetchSessions: (filters: any, force: boolean) => void;
|
||||
fetchMetadata: () => void;
|
||||
activeTab: any;
|
||||
isEnterprise?: boolean;
|
||||
}
|
||||
|
|
@ -53,8 +55,8 @@ function SessionList(props: Props) {
|
|||
useTimeout(() => {
|
||||
props.fetchSessions(null, true);
|
||||
}, AUTOREFRESH_INTERVAL);
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// handle scroll position
|
||||
const { scrollY } = props;
|
||||
|
|
@ -62,7 +64,8 @@ function SessionList(props: Props) {
|
|||
if (total === 0) {
|
||||
props.fetchSessions(null, true);
|
||||
}
|
||||
|
||||
props.fetchMetadata()
|
||||
|
||||
return () => {
|
||||
props.setScrollPosition(window.scrollY);
|
||||
};
|
||||
|
|
@ -148,5 +151,5 @@ export default connect(
|
|||
activeTab: state.getIn(['search', 'activeTab']),
|
||||
isEnterprise: state.getIn(['user', 'account', 'edition']) === 'ee',
|
||||
}),
|
||||
{ updateCurrentPage, addFilterByKeyAndValue, setScrollPosition, fetchSessions }
|
||||
{ updateCurrentPage, addFilterByKeyAndValue, setScrollPosition, fetchSessions, fetchMetadata }
|
||||
)(SessionList);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue