Merge pull request #498 from openreplay/hot-fixes
fix(ui) - sessions - stop reloading on site change
This commit is contained in:
commit
3bccd3b9a7
2 changed files with 15 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { setSiteId } from 'Duck/site';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { hasSiteId, siteChangeAvaliable } from 'App/routes';
|
||||
import { hasSiteId, siteChangeAvaliable, isRoute, sessions as sessionsRoute } from 'App/routes';
|
||||
import { STATUS_COLOR_MAP, GREEN } from 'Types/site';
|
||||
import { Icon, SlideModal } from 'UI';
|
||||
import { pushNewSite } from 'Duck/user'
|
||||
|
|
@ -15,6 +15,7 @@ import { fetchList as fetchAlerts } from 'Duck/alerts';
|
|||
import { fetchWatchdogStatus } from 'Duck/watchdogs';
|
||||
import { withStore } from 'App/mstore'
|
||||
|
||||
const SESSIONS_PATH = sessionsRoute();
|
||||
@withStore
|
||||
@withRouter
|
||||
@connect(state => ({
|
||||
|
|
@ -47,11 +48,11 @@ export default class SiteDropdown extends React.PureComponent {
|
|||
}
|
||||
|
||||
switchSite = (siteId) => {
|
||||
const { mstore } = this.props
|
||||
const { mstore, location } = this.props
|
||||
|
||||
|
||||
this.props.setSiteId(siteId);
|
||||
this.props.clearSearch();
|
||||
this.props.clearSearch(isRoute(SESSIONS_PATH, location.pathname));
|
||||
this.props.fetchIntegrationVariables();
|
||||
this.props.fetchAlerts();
|
||||
this.props.fetchWatchdogStatus();
|
||||
|
|
|
|||
|
|
@ -159,6 +159,11 @@ export const edit = reduceThenFetchResource((instance) => ({
|
|||
instance,
|
||||
}));
|
||||
|
||||
export const editDefault = (instance) => ({
|
||||
type: EDIT,
|
||||
instance,
|
||||
});
|
||||
|
||||
export const setActiveTab = reduceThenFetchResource((tab) => ({
|
||||
type: SET_ACTIVE_TAB,
|
||||
tab
|
||||
|
|
@ -188,8 +193,9 @@ export const updateCurrentPage = reduceThenFetchResource((page) => ({
|
|||
page,
|
||||
}));
|
||||
|
||||
export const applySavedSearch = (filter) => (dispatch, getState) => {
|
||||
dispatch(edit({ filters: filter ? filter.filter.filters : [] }));
|
||||
export const applySavedSearch = (filter, reload = true) => (dispatch, getState) => {
|
||||
const params = { filters: filter ? filter.filter.filters : [] };
|
||||
dispatch(reload ? edit(params) : editDefault(params));
|
||||
return dispatch({
|
||||
type: APPLY_SAVED_SEARCH,
|
||||
filter,
|
||||
|
|
@ -256,9 +262,9 @@ export function fetchFilterSearch(params) {
|
|||
};
|
||||
}
|
||||
|
||||
export const clearSearch = () => (dispatch, getState) => {
|
||||
dispatch(applySavedSearch(new SavedFilter({})));
|
||||
dispatch(edit(new Filter({ filters: [] })));
|
||||
export const clearSearch = (reload = true) => (dispatch, getState) => {
|
||||
dispatch(applySavedSearch(new SavedFilter({}), false));
|
||||
dispatch(reload ? edit(new Filter({ filters: [] })) : editDefault(new Filter({ filters: [] })));
|
||||
return dispatch({
|
||||
type: CLEAR_SEARCH,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue