change(ui) - errors nav and other route changes

This commit is contained in:
Shekar Siri 2022-01-03 15:37:49 +05:30
parent 236db3eb7f
commit 549258d047
6 changed files with 68 additions and 39 deletions

View file

@ -24,6 +24,7 @@ import * as routes from './routes';
import { OB_DEFAULT_TAB } from 'App/routes';
import Signup from './components/Signup/Signup';
import { fetchTenants } from 'Duck/user';
import { setSessionPath } from 'Duck/sessions';
const BugFinder = withSiteIdUpdater(BugFinderPure);
const Dashboard = withSiteIdUpdater(DashboardPure);
@ -73,7 +74,7 @@ const ONBOARDING_REDIRECT_PATH = routes.onboarding(OB_DEFAULT_TAB);
onboarding: state.getIn([ 'user', 'onboarding' ])
};
}, {
fetchUserInfo, fetchTenants
fetchUserInfo, fetchTenants, setSessionPath
})
class Router extends React.Component {
state = {
@ -96,6 +97,7 @@ class Router extends React.Component {
}
componentDidUpdate(prevProps, prevState) {
this.props.setSessionPath(prevProps.location.pathname)
if (prevProps.email !== this.props.email && !this.props.email) {
this.props.fetchTenants();
}

View file

@ -2,7 +2,7 @@ import cn from 'classnames';
import { connect } from 'react-redux';
import { Set, List as ImmutableList } from "immutable";
import { NoContent, Loader, Checkbox, LoadMoreButton, IconButton, Input, DropdownPlain } from 'UI';
import { merge, resolve,unresolve,ignore } from "Duck/errors";
import { merge, resolve, unresolve, ignore, updateCurrentPage } from "Duck/errors";
import { applyFilter } from 'Duck/filters';
import { IGNORED, RESOLVED, UNRESOLVED } from 'Types/errorInfo';
import SortDropdown from 'Components/BugFinder/Filters/SortDropdown';
@ -30,18 +30,19 @@ const sortOptions = Object.entries(sortOptionsMap)
state.getIn(["errors", "unresolve", "loading"]),
ignoreLoading: state.getIn([ "errors", "ignore", "loading" ]),
mergeLoading: state.getIn([ "errors", "merge", "loading" ]),
currentPage: state.getIn(["errors", "currentPage"]),
}), {
merge,
resolve,
unresolve,
ignore,
applyFilter
applyFilter,
updateCurrentPage,
})
export default class List extends React.PureComponent {
state = {
checkedAll: false,
checkedIds: Set(),
showPages: 1,
sort: {}
}
@ -106,7 +107,7 @@ export default class List extends React.PureComponent {
this.applyToAllChecked(this.props.ignore);
}
addPage = () => this.setState({ showPages: this.state.showPages + 1 })
addPage = () => this.props.updateCurrentPage(this.props.currentPage + 1)
writeOption = (e, { name, value }) => {
const [ sort, order ] = value.split('-');
@ -123,16 +124,16 @@ export default class List extends React.PureComponent {
resolveToggleLoading,
mergeLoading,
onFilterChange,
currentPage,
} = this.props;
const {
checkedAll,
checkedIds,
showPages,
sort
} = this.state;
const someLoading = loading || ignoreLoading || resolveToggleLoading || mergeLoading;
const currentCheckedIds = this.currentCheckedIds();
const displayedCount = Math.min(showPages * PER_PAGE, list.size);
const displayedCount = Math.min(currentPage * PER_PAGE, list.size);
let _list = sort.sort ? list.sortBy(i => i[sort.sort]) : list;
_list = sort.order === 'desc' ? _list.reverse() : _list;

View file

@ -71,13 +71,17 @@ export default withRequest({
dataName: 'assistCredendials',
loadingName: 'loadingCredentials',
})(withPermissions(['SESSION_REPLAY', 'ASSIST_LIVE'], '', true)(connect(
state => ({
session: state.getIn([ 'sessions', 'current' ]),
showAssist: state.getIn([ 'sessions', 'showChatWindow' ]),
jwt: state.get('jwt'),
fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]),
hasSessionsPath: state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions'),
isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee',
}),
state => {
const isAssist = state.getIn(['sessions', 'activeTab']).type === 'live';
const hasSessioPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions');
return {
session: state.getIn([ 'sessions', 'current' ]),
showAssist: state.getIn([ 'sessions', 'showChatWindow' ]),
jwt: state.get('jwt'),
fullscreen: state.getIn([ 'components', 'player', 'fullscreen' ]),
hasSessionsPath: hasSessioPath && !isAssist,
isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee',
}
},
{ toggleFullscreen, closeBottomBlock },
)(WebPlayer)));

View file

@ -60,12 +60,14 @@ function Session({
export default withPermissions(['SESSION_REPLAY'], '', true)(connect((state, props) => {
const { match: { params: { sessionId } } } = props;
const isAssist = state.getIn(['sessions', 'activeTab']).type === 'live';
const hasSessiosPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions');
return {
sessionId,
loading: state.getIn([ 'sessions', 'loading' ]),
hasErrors: !!state.getIn([ 'sessions', 'errors' ]),
session: state.getIn([ 'sessions', 'current' ]),
hasSessionsPath: state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions'),
hasSessionsPath: hasSessiosPath && !isAssist,
};
}, {
fetchSession,

View file

@ -28,18 +28,23 @@ function capitalise(str) {
live: state.live,
loading: state.cssLoading || state.messagesLoading,
}))
@connect((state, props) => ({
session: state.getIn([ 'sessions', 'current' ]),
loading: state.getIn([ 'sessions', 'toggleFavoriteRequest', 'loading' ]),
disabled: state.getIn([ 'components', 'targetDefiner', 'inspectorMode' ]) || props.loading,
jiraConfig: state.getIn([ 'issues', 'list' ]).first(),
issuesFetched: state.getIn([ 'issues', 'issuesFetched' ]),
local: state.getIn(['sessions', 'timezone']),
funnelRef: state.getIn(['funnels', 'navRef']),
siteId: state.getIn([ 'user', 'siteId' ]),
funnelPage: state.getIn(['sessions', 'funnelPage']),
hasSessionsPath: state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions'),
}), {
@connect((state, props) => {
const isAssist = state.getIn(['sessions', 'activeTab']).type === 'live';
const hasSessioPath = state.getIn([ 'sessions', 'sessionPath' ]).includes('/sessions');
return {
session: state.getIn([ 'sessions', 'current' ]),
sessionPath: state.getIn([ 'sessions', 'sessionPath' ]),
loading: state.getIn([ 'sessions', 'toggleFavoriteRequest', 'loading' ]),
disabled: state.getIn([ 'components', 'targetDefiner', 'inspectorMode' ]) || props.loading,
jiraConfig: state.getIn([ 'issues', 'list' ]).first(),
issuesFetched: state.getIn([ 'issues', 'issuesFetched' ]),
local: state.getIn(['sessions', 'timezone']),
funnelRef: state.getIn(['funnels', 'navRef']),
siteId: state.getIn([ 'user', 'siteId' ]),
funnelPage: state.getIn(['sessions', 'funnelPage']),
hasSessionsPath: hasSessioPath && !isAssist,
}
}, {
toggleFavorite, fetchListIntegration, setSessionPath
})
@withRouter
@ -56,16 +61,22 @@ export default class PlayerBlockHeader extends React.PureComponent {
);
backHandler = () => {
const { history, siteId, funnelPage } = this.props;
const funnelId = funnelPage && funnelPage.get('funnelId');
const issueId = funnelPage && funnelPage.get('issueId');
if (funnelId || issueId) {
if (issueId) {
history.push(withSiteId(funnelIssueRoute(funnelId, issueId), siteId))
} else
history.push(withSiteId(funnelRoute(funnelId), siteId));
} else
const { history, siteId, funnelPage, sessionPath } = this.props;
// alert(sessionPath)
if (sessionPath === history.location.pathname) {
history.push(withSiteId(SESSIONS_ROUTE), siteId);
} else {
history.push(sessionPath ? sessionPath : withSiteId(SESSIONS_ROUTE, siteId));
}
// const funnelId = funnelPage && funnelPage.get('funnelId');
// const issueId = funnelPage && funnelPage.get('issueId');
// if (funnelId || issueId) {
// if (issueId) {
// history.push(withSiteId(funnelIssueRoute(funnelId, issueId), siteId))
// } else
// history.push(withSiteId(funnelRoute(funnelId), siteId));
// } else
// history.push(withSiteId(SESSIONS_ROUTE), siteId);
}
toggleFavorite = () => {

View file

@ -17,6 +17,7 @@ const IGNORE = "errors/IGNORE";
const MERGE = "errors/MERGE";
const TOGGLE_FAVORITE = "errors/TOGGLE_FAVORITE";
const FETCH_TRACE = "errors/FETCH_TRACE";
const UPDATE_CURRENT_PAGE = "errors/UPDATE_CURRENT_PAGE";
function chartWrapper(chart = []) {
return chart.map(point => ({ ...point, count: Math.max(point.count, 0) }));
@ -33,7 +34,8 @@ const initialState = Map({
instance: ErrorInfo(),
instanceTrace: List(),
stats: Map(),
sourcemapUploaded: true
sourcemapUploaded: true,
currentPage: 1,
});
@ -67,7 +69,8 @@ function reducer(state = initialState, action = {}) {
return state.update("list", list => list.filter(e => !ids.includes(e.errorId)));
case success(FETCH_NEW_ERRORS_COUNT):
return state.set('stats', action.data);
case UPDATE_CURRENT_PAGE:
return state.set('currentPage', action.page);
}
return state;
}
@ -166,3 +169,9 @@ export function fetchNewErrorsCount(params = {}) {
}
}
export function updateCurrentPage(page) {
return {
type: 'errors/UPDATE_CURRENT_PAGE',
page,
};
}