fix(ui) uxt fixes

This commit is contained in:
nick-delirium 2023-12-07 16:58:53 +01:00
parent 1dfafa4a67
commit 1d7a71b640
5 changed files with 14 additions and 9 deletions

View file

@ -2,13 +2,14 @@ import React from 'react';
import { useStore } from 'App/mstore';
import { numberWithCommas } from 'App/utils';
import { Input } from 'antd';
import ReloadButton from "Shared/ReloadButton";
import ReloadButton from 'Shared/ReloadButton';
import SessionItem from 'Shared/SessionItem';
import { Pagination } from 'UI';
import { observer } from 'mobx-react-lite';
function LiveTestsModal({ testId, closeModal }: { testId: string, closeModal: () => void }) {
function LiveTestsModal({ testId, closeModal }: { testId: string; closeModal: () => void }) {
const [page, setPage] = React.useState(1);
const [isLoading, setIsLoading] = React.useState(false);
const [userId, setUserId] = React.useState('');
const { uxtestingStore } = useStore();
@ -17,8 +18,12 @@ function LiveTestsModal({ testId, closeModal }: { testId: string, closeModal: ()
}, []);
const refreshData = (page: number) => {
setIsLoading(true);
setPage(page);
uxtestingStore.getAssistSessions(testId, page, userId);
uxtestingStore
.getAssistSessions(testId, page, userId)
.then(() => setIsLoading(false))
.catch(() => setIsLoading(false));
};
return (

View file

@ -252,7 +252,7 @@ function SessionItem(props: RouteComponentProps & Props) {
<Icon name='circle-fill' size={3} className='mx-4' />
</>
)}
<div>{live ? <Counter startTime={startedAt} /> : formattedDuration}</div>
<div>{live || props.live ? <Counter startTime={startedAt} /> : formattedDuration}</div>
</div>
</div>
<div style={{ width: '30%' }} className='px-2 flex flex-col justify-between'>

View file

@ -247,14 +247,11 @@ export default class UxtestingStore {
};
getAssistSessions = async (testId: string, page: number, userId?: string) => {
this.setLoading(true);
try {
const sessions = await this.client.fetchTestSessions(testId, page, 10, true, userId);
this.setAssistSessions(sessions);
} catch (e) {
console.error(e);
} finally {
this.setLoading(false);
}
};

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "11.0.1-19",
"version": "11.0.1-20",
"keywords": [
"logging",
"replay"

View file

@ -708,7 +708,9 @@ export default class App {
}
this.restartAttempts = 0
this.uxtManager = new UserTestManager(this, uxtStorageKey)
this.uxtManager = this.uxtManager
? this.uxtManager
: new UserTestManager(this, uxtStorageKey)
let uxtId: number | undefined
const savedUxtTag = this.localStorage.getItem(uxtStorageKey)
if (savedUxtTag) {
@ -721,6 +723,7 @@ export default class App {
uxtId = qId ? parseInt(qId, 10) : undefined
}
}
if (uxtId && !this.uxtManager.isActive) {
this.uxtManager.getTest(uxtId, token, Boolean(savedUxtTag))
}