Merge branch 'main' of github.com:openreplay/openreplay into custom-metrics-improvements

This commit is contained in:
Shekar Siri 2022-03-02 10:28:23 +01:00
commit fd9f4bc0d3
35 changed files with 92 additions and 91 deletions

View file

@ -36,8 +36,7 @@ def get_session2(projectId: int, sessionId: Union[int, str], context: schemas.Cu
include_fav_viewed=True, group_metadata=True)
if data is None:
return {"errors": ["session not found"]}
if not data.get("live"):
sessions_favorite_viewed.view_session(project_id=projectId, user_id=context.user_id, session_id=sessionId)
sessions_favorite_viewed.view_session(project_id=projectId, user_id=context.user_id, session_id=sessionId)
return {
'data': data
}

View file

@ -10,7 +10,7 @@ import (
)
func getTimeoutContext() context.Context {
ctx, _ := context.WithTimeout(context.Background(), time.Duration(time.Second*10))
ctx, _ := context.WithTimeout(context.Background(), time.Duration(time.Second*30))
return ctx
}

View file

@ -156,7 +156,7 @@ def update(tenant_id, user_id, changes):
(SELECT role_id FROM roles WHERE tenant_id = %(tenant_id)s AND name != 'Owner' LIMIT 1)))""")
else:
sub_query_users.append(f"{helper.key_to_snake_case(key)} = %({key})s")
changes["role_id"] = changes.get("roleId", changes.get("role_id"))
with pg_client.PostgresClient() as cur:
if len(sub_query_users) > 0:
cur.execute(

View file

@ -21,6 +21,10 @@ import Header from 'Components/Header/Header';
import FunnelDetails from 'Components/Funnels/FunnelDetails';
import FunnelIssueDetails from 'Components/Funnels/FunnelIssueDetails';
import { fetchList as fetchIntegrationVariables } from 'Duck/customField';
import { fetchList as fetchSiteList } from 'Duck/site';
import { fetchList as fetchAnnouncements } from 'Duck/announcements';
import { fetchList as fetchAlerts } from 'Duck/alerts';
import { fetchWatchdogStatus } from 'Duck/watchdogs';
import APIClient from './api_client';
import * as routes from './routes';
@ -80,7 +84,14 @@ const ONBOARDING_REDIRECT_PATH = routes.onboarding(OB_DEFAULT_TAB);
onboarding: state.getIn([ 'user', 'onboarding' ])
};
}, {
fetchUserInfo, fetchTenants, setSessionPath, fetchIntegrationVariables
fetchUserInfo,
fetchTenants,
setSessionPath,
fetchIntegrationVariables,
fetchSiteList,
fetchAnnouncements,
fetchAlerts,
fetchWatchdogStatus,
})
class Router extends React.Component {
state = {
@ -93,6 +104,14 @@ class Router extends React.Component {
props.fetchUserInfo().then(() => {
props.fetchIntegrationVariables()
}),
props.fetchSiteList().then(() => {
setTimeout(() => {
props.fetchAnnouncements();
props.fetchAlerts();
props.fetchWatchdogStatus();
}, 100);
}),
// props.fetchAnnouncements(),
])
// .then(() => this.onLoginLogout());
}

View file

@ -18,9 +18,9 @@ class Notifications extends React.Component {
constructor(props) {
super(props);
setTimeout(() => {
props.fetchList();
}, 1000);
// setTimeout(() => {
// props.fetchList();
// }, 1000);
setInterval(() => {
props.fetchList();

View file

@ -10,11 +10,7 @@ import { withRouter } from 'react-router-dom';
@withToggle('visible', 'toggleVisisble')
@withRouter
class Announcements extends React.Component {
constructor(props) {
super(props);
props.fetchList();
}
navigateToUrl = url => {
if (url) {
if (url.startsWith(window.ENV.ORIGIN)) {

View file

@ -4,14 +4,11 @@ import withPageTitle from 'HOCs/withPageTitle';
import {
fetchFavoriteList as fetchFavoriteSessionList
} from 'Duck/sessions';
import { countries } from 'App/constants';
import { applyFilter, clearEvents, addAttribute } from 'Duck/filters';
import { fetchList as fetchFunnelsList } from 'Duck/funnels';
import { defaultFilters, preloadedFilters } from 'Types/filter';
import { KEYS } from 'Types/filter/customFilter';
import SessionList from './SessionList';
import stl from './bugFinder.css';
import { fetchList as fetchSiteList } from 'Duck/site';
import withLocationHandlers from "HOCs/withLocationHandlers";
import { fetch as fetchFilterVariables } from 'Duck/sources';
import { fetchSources } from 'Duck/customField';
@ -68,7 +65,6 @@ const allowedQueryKeys = [
fetchSources,
clearEvents,
setActiveTab,
fetchSiteList,
fetchFunnelsList,
resetFunnel,
resetFunnelFilters,
@ -81,7 +77,6 @@ export default class BugFinder extends React.PureComponent {
state = {showRehydratePanel: false}
constructor(props) {
super(props);
// props.fetchFavoriteSessionList();
// TODO should cache the response
// props.fetchSources().then(() => {
@ -115,29 +110,6 @@ export default class BugFinder extends React.PureComponent {
this.setState({ showRehydratePanel: !this.state.showRehydratePanel })
}
// fetchPreloadedFilters = () => {
// this.props.fetchFilterVariables('filterValues').then(function() {
// const { filterValues } = this.props;
// const keys = [
// {key: KEYS.USER_OS, label: 'OS'},
// {key: KEYS.USER_BROWSER, label: 'Browser'},
// {key: KEYS.USER_DEVICE, label: 'Device'},
// {key: KEYS.REFERRER, label: 'Referrer'},
// {key: KEYS.USER_COUNTRY, label: 'Country'},
// ]
// if (filterValues && filterValues.size != 0) {
// keys.forEach(({key, label}) => {
// const _keyFilters = filterValues.get(key)
// if (key === KEYS.USER_COUNTRY) {
// preloadedFilters.push(_keyFilters.map(item => ({label, type: key, key, value: item, actualValue: countries[item], isFilter: true})));
// } else {
// preloadedFilters.push(_keyFilters.map(item => ({label, type: key, key, value: item, isFilter: true})));
// }
// })
// }
// }.bind(this));
// }
setActiveTab = tab => {
this.props.setActiveTab(tab);
}

View file

@ -10,7 +10,7 @@ import DateRangeDropdown from 'Shared/DateRangeDropdown';
})
export default class DateRange extends React.PureComponent {
onDateChange = (e) => {
this.props.fetchFunnelsList(e.rangeValue)
// this.props.fetchFunnelsList(e.rangeValue)
this.props.applyFilter(e)
}
render() {

View file

@ -22,9 +22,9 @@ function SessionsMenu(props) {
}
}
useEffect(() => {
fetchWatchdogStatus()
}, [])
// useEffect(() => {
// fetchWatchdogStatus()
// }, [])
const capturingAll = props.captureRate && props.captureRate.get('captureAll');

View file

@ -3,7 +3,6 @@ import { withRouter } from 'react-router-dom';
import { Switch, Route, Redirect } from 'react-router';
import { CLIENT_TABS, client as clientRoute } from 'App/routes';
import { fetchList as fetchMemberList } from 'Duck/member';
import { fetchList as fetchSiteList } from 'Duck/site';
import ProfileSettings from './ProfileSettings';
import Integrations from './Integrations';
@ -21,7 +20,6 @@ import Roles from './Roles';
appearance: state.getIn([ 'user', 'account', 'appearance' ]),
}), {
fetchMemberList,
fetchSiteList,
})
@withRouter
export default class Client extends React.PureComponent {

View file

@ -66,10 +66,6 @@ const Header = (props) => {
}
}, [showTrackingModal])
useEffect(() => {
fetchSiteList()
}, [])
return (
<div className={ cn(styles.header, showTrackingModal ? styles.placeOnTop : '') }>
<NavLink to={ withSiteId(SESSIONS_PATH, siteId) }>

View file

@ -11,6 +11,8 @@ import cn from 'classnames';
import NewSiteForm from '../Client/Sites/NewSiteForm';
import { clearSearch } from 'Duck/search';
import { fetchList as fetchIntegrationVariables } from 'Duck/customField';
import { fetchList as fetchAlerts } from 'Duck/alerts';
import { fetchWatchdogStatus } from 'Duck/watchdogs';
@withRouter
@connect(state => ({
@ -23,13 +25,15 @@ import { fetchList as fetchIntegrationVariables } from 'Duck/customField';
init,
clearSearch,
fetchIntegrationVariables,
fetchAlerts,
fetchWatchdogStatus,
})
export default class SiteDropdown extends React.PureComponent {
state = { showProductModal: false }
componentDidMount() {
this.props.fetchIntegrationVariables();
}
// componentDidMount() {
// this.props.fetchIntegrationVariables();
// }
closeModal = (e, newSite) => {
this.setState({ showProductModal: false })
@ -44,6 +48,8 @@ export default class SiteDropdown extends React.PureComponent {
this.props.setSiteId(siteId);
this.props.clearSearch();
this.props.fetchIntegrationVariables();
this.props.fetchAlerts();
this.props.fetchWatchdogStatus();
}
render() {

View file

@ -16,11 +16,11 @@ const SESSIONS_ROUTE = sessionsRoute();
function Session({
sessionId,
loading,
hasErrors,
hasErrors,
session,
fetchSession,
fetchSlackList,
hasSessionsPath
fetchSlackList,
hasSessionsPath
}) {
usePageTitle("OpenReplay Session Player");
useEffect(() => {
@ -51,7 +51,7 @@ function Session({
<Loader className="flex-1" loading={ loading || sessionId !== session.sessionId }>
{ session.isIOS
? <IOSPlayer session={session} />
: (session.live && !hasSessionsPath ? <LivePlayer /> : <WebPlayer />)
: <WebPlayer />
}
</Loader>
</NoContent>

View file

@ -10,13 +10,15 @@ export default connect(state => ({
metadata: state.getIn([ 'sessions', 'current', 'metadata' ]),
}))(function Metadata ({ metadata }) {
const [ visible, setVisible ] = useState(false);
const toggle = useCallback(() => metadata.length > 0 && setVisible(v => !v), []);
const metaLenth = Object.keys(metadata).length;
const toggle = useCallback(() => metaLenth > 0 && setVisible(v => !v), []);
return (
<>
<Popup
trigger={
<IconButton
className={cn("w-full", { 'opacity-25' : metadata.length === 0 })}
className={cn("w-full", { 'opacity-25' : metaLenth === 0 })}
onClick={ toggle }
icon="id-card"
plain
@ -33,17 +35,17 @@ export default connect(state => ({
</div>
}
on="click"
disabled={metadata.length > 0}
disabled={metaLenth > 0}
size="tiny"
inverted
position="top center"
/>
{ visible &&
<div className={ stl.modal } >
<NoContent show={ metadata.size === 0 } size="small">
{ metadata.map((i) => {
const key = Object.keys(i)[0]
const value = i[key]
<NoContent show={ metaLenth === 0 } size="small">
{ Object.keys(metadata).map((key) => {
// const key = Object.keys(i)[0]
const value = metadata[key]
return <MetadataItem item={ { value, key } } key={ key } />
}) }
</NoContent>

View file

@ -49,7 +49,7 @@ export default class extends React.PureComponent {
content={ open && <SessionList similarSessions={ similarSessions } loading={ loading } /> }
onClose={ open ? this.switchOpen : () => null }
/>
<div className={ cn("flex justify-between items-center p-3", stl.field) } >
<div className={ cn("flex justify-between items-center p-3 capitalize", stl.field) } >
<div>
<div className={ stl.key }>{ item.key }</div>
<TextEllipsis

View file

@ -115,7 +115,7 @@ const HeapTooltip = ({ active, payload}) => {
}
const NodesCountTooltip = ({ active, payload} ) => {
if (!active || payload.length === 0) return null;
if (!active || !payload || payload.length === 0) return null;
return (
<div className={ stl.tooltipWrapper } >
<p>

View file

@ -1,18 +1,25 @@
import React from 'react'
import React, { useEffect } from 'react'
import { Icon } from 'UI'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom';
import { onboarding as onboardingRoute } from 'App/routes'
import { withSiteId } from 'App/routes';
import { isGreaterOrEqualVersion } from 'App/utils'
const TrackerUpdateMessage= (props) => {
// const { site } = props;
const { site, sites, match: { params: { siteId } } } = props;
const [needUpdate, setNeedUpdate] = React.useState(false)
const { sites, match: { params: { siteId } } } = props;
const activeSite = sites.find(s => s.id == siteId);
const hasSessions = !!activeSite && !activeSite.recorded;
const appVersionInt = parseInt(window.ENV.TRACKER_VERSION.split(".").join(""))
const trackerVersionInt = site.trackerVersion ? parseInt(site.trackerVersion.split(".").join("")) : 0
const needUpdate = !hasSessions && appVersionInt > trackerVersionInt;
useEffect(() => {
if (!activeSite || !activeSite.trackerVersion) return;
const isLatest = isGreaterOrEqualVersion(activeSite.trackerVersion, window.ENV.TRACKER_VERSION);
if (!isLatest && activeSite.recorded) {
setNeedUpdate(true)
}
}, [activeSite])
return needUpdate ? (
<>
{(

View file

@ -103,7 +103,7 @@ export default class AssistManager {
if (document.hidden && getState().calling === CallingState.NoCall) {
this.socket?.close()
}
}, 15000)
}, 30000)
} else {
inactiveTimeout && clearTimeout(inactiveTimeout)
this.socket?.open()

View file

@ -226,4 +226,10 @@ export const iceServerConfigFromString = (str) => {
return server
}
})
}
export const isGreaterOrEqualVersion = (version, compareTo) => {
const [major, minor, patch] = version.split("-")[0].split('.');
const [majorC, minorC, patchC] = compareTo.split("-")[0].split('.');
return (major > majorC) || (major === majorC && minor > minorC) || (major === majorC && minor === minorC && patch >= patchC);
}

View file

@ -13,7 +13,7 @@ const oss = {
ORIGIN: () => 'window.location.origin',
API_EDP: () => 'window.location.origin + "/api"',
ASSETS_HOST: () => 'window.location.origin + "/assets"',
VERSION: '1.5.1',
VERSION: '1.5.2',
SOURCEMAP: true,
MINIO_ENDPOINT: process.env.MINIO_ENDPOINT,
MINIO_PORT: process.env.MINIO_PORT,

View file

@ -15,7 +15,7 @@ fatal()
exit 1
}
version="v1.5.1"
version="v1.5.2"
usr=`whoami`
# Installing k3s

View file

@ -22,4 +22,4 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
# Ref: https://github.com/helm/helm/issues/7858#issuecomment-608114589
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -21,4 +21,4 @@ version: 0.1.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
AppVersion: "v1.5.1"
AppVersion: "v1.5.2"

View file

@ -1,4 +1,4 @@
fromVersion: "v1.5.1"
fromVersion: "v1.5.2"
# Databases specific variables
postgresql: &postgres
# For generating passwords

View file

@ -161,7 +161,7 @@ module.exports = {
wsRouter,
start: (server) => {
io = _io(server, {
maxHttpBufferSize: 1e6,
maxHttpBufferSize: 5e6,
cors: {
origin: "*",
methods: ["GET", "POST", "PUT"]