diff --git a/frontend/app/components/Session_/GraphQL/GQLDetails.js b/frontend/app/components/Session_/GraphQL/GQLDetails.js
index 4caba50a7..73eadb3ab 100644
--- a/frontend/app/components/Session_/GraphQL/GQLDetails.js
+++ b/frontend/app/components/Session_/GraphQL/GQLDetails.js
@@ -6,8 +6,6 @@ export default class GQLDetails extends React.PureComponent {
render() {
const {
gql: { variables, response, duration, operationKind, operationName },
- nextClick,
- prevClick,
first = false,
last = false,
} = this.props;
@@ -57,15 +55,6 @@ export default class GQLDetails extends React.PureComponent {
-
-
-
-
-
);
}
diff --git a/frontend/app/components/Session_/GraphQL/GraphQL.js b/frontend/app/components/Session_/GraphQL/GraphQL.js
deleted file mode 100644
index 323e3c4d4..000000000
--- a/frontend/app/components/Session_/GraphQL/GraphQL.js
+++ /dev/null
@@ -1,177 +0,0 @@
-import React from 'react';
-import { NoContent, Input, SlideModal, CloseButton, Button } from 'UI';
-import { getRE } from 'App/utils';
-import { connectPlayer, pause, jump } from 'Player';
-import BottomBlock from '../BottomBlock';
-import TimeTable from '../TimeTable';
-import GQLDetails from './GQLDetails';
-import { renderStart } from 'Components/Session_/Network/NetworkContent';
-
-function renderDefaultStatus() {
- return '2xx-3xx';
-}
-
-export function renderName(r) {
- return (
-
-
{r.operationName}
-
-
- );
-}
-
-@connectPlayer((state) => ({
- list: state.graphqlList,
- listNow: state.graphqlListNow,
- time: state.time,
- livePlay: state.livePlay,
-}))
-export default class GraphQL extends React.PureComponent {
- state = {
- filter: '',
- filteredList: this.props.list,
- filteredListNow: this.props.listNow,
- current: null,
- currentIndex: 0,
- showFetchDetails: false,
- hasNextError: false,
- hasPreviousError: false,
- lastActiveItem: 0,
- };
-
- static filterList(list, value) {
- const filterRE = getRE(value, 'i');
-
- return value
- ? list.filter(
- (r) =>
- filterRE.test(r.operationKind) ||
- filterRE.test(r.operationName) ||
- filterRE.test(r.variables)
- )
- : list;
- }
-
- onFilterChange = ({ target: { value } }) => {
- const { list } = this.props;
- const filtered = GraphQL.filterList(list, value);
- this.setState({ filter: value, filteredList: filtered, currentIndex: 0 });
- };
-
- setCurrent = (item, index) => {
- if (!this.props.livePlay) {
- pause();
- jump(item.time);
- }
- this.setState({ current: item, currentIndex: index });
- };
-
- closeModal = () => this.setState({ current: null, showFetchDetails: false });
-
- static getDerivedStateFromProps(nextProps, prevState) {
- const { list } = nextProps;
- if (nextProps.time) {
- const filtered = GraphQL.filterList(list, prevState.filter);
- let i = 0;
- filtered.forEach((item, index) => {
- if (item.time <= nextProps.time) {
- i = index;
- }
- });
-
- return {
- lastActiveItem: i,
- };
- }
- }
-
- render() {
- const { current, currentIndex, filteredList, lastActiveItem } = this.state;
-
- return (
-
-
- GraphQL
-
-
-
-
- }
- isDisplayed={current != null}
- content={
- current && (
-
- )
- }
- onClose={this.closeModal}
- />
-
-
- GraphQL
-
-
-
-
-
-
-
- {[
- {
- label: 'Start',
- width: 90,
- render: renderStart,
- },
- {
- label: 'Status',
- width: 70,
- render: renderDefaultStatus,
- },
- {
- label: 'Type',
- dataKey: 'operationKind',
- width: 60,
- },
- {
- label: 'Name',
- width: 240,
- render: renderName,
- },
- ]}
-
-
-
-
-
- );
- }
-}
diff --git a/frontend/app/components/Session_/GraphQL/GraphQL.tsx b/frontend/app/components/Session_/GraphQL/GraphQL.tsx
new file mode 100644
index 000000000..6f89a5ec1
--- /dev/null
+++ b/frontend/app/components/Session_/GraphQL/GraphQL.tsx
@@ -0,0 +1,174 @@
+import React, { useEffect } from 'react';
+import { NoContent, Input, SlideModal, CloseButton, Button } from 'UI';
+import { getRE } from 'App/utils';
+import BottomBlock from '../BottomBlock';
+import TimeTable from '../TimeTable';
+import GQLDetails from './GQLDetails';
+import { renderStart } from 'Components/Session_/Network/NetworkContent';
+import { PlayerContext } from 'App/components/Session/playerContext';
+import { observer } from 'mobx-react-lite';
+
+function renderDefaultStatus() {
+ return '2xx-3xx';
+}
+
+export function renderName(r: Record) {
+ const { player } = React.useContext(PlayerContext);
+
+ return (
+
+
{r.operationName}
+
+
+ );
+}
+
+function GraphQL() {
+ const { player, store } = React.useContext(PlayerContext);
+
+ const { graphqlList: list, graphqlListNow: listNow, time, livePlay } = store.get();
+
+ const defaultState = {
+ filter: '',
+ filteredList: list,
+ filteredListNow: listNow,
+ // @ts-ignore
+ current: null,
+ currentIndex: 0,
+ showFetchDetails: false,
+ hasNextError: false,
+ hasPreviousError: false,
+ lastActiveItem: 0,
+ };
+
+ const [state, setState] = React.useState(defaultState);
+
+ const filterList = (list: any, value: string) => {
+ const filterRE = getRE(value, 'i');
+
+ return value
+ ? list.filter(
+ (r: any) =>
+ filterRE.test(r.operationKind) ||
+ filterRE.test(r.operationName) ||
+ filterRE.test(r.variables)
+ )
+ : list;
+ };
+
+ const onFilterChange = ({ target: { value } }: React.ChangeEvent) => {
+ const filtered = filterList(list, value);
+ setState((prevState) => ({
+ ...prevState,
+ filter: value,
+ filteredList: filtered,
+ currentIndex: 0,
+ }));
+ };
+
+ const setCurrent = (item: any, index: number) => {
+ if (!livePlay) {
+ player.pause();
+ player.jump(item.time);
+ }
+ setState((prevState) => ({ ...prevState, current: item, currentIndex: index }));
+ };
+
+ const closeModal = () =>
+ setState((prevState) => ({ ...prevState, current: null, showFetchDetails: false }));
+
+ useEffect(() => {
+ const filtered = filterList(listNow, state.filter);
+ if (filtered.length !== lastActiveItem) {
+ setState((prevState) => ({ ...prevState, lastActiveItem: listNow.length }));
+ }
+ }, [time]);
+
+ const { current, currentIndex, filteredList, lastActiveItem } = state;
+
+ return (
+
+
+ GraphQL
+
+
+
+
+ }
+ isDisplayed={current != null}
+ content={
+ current && (
+
+ )
+ }
+ onClose={closeModal}
+ />
+
+
+ GraphQL
+
+
+
+
+
+
+
+ {[
+ {
+ label: 'Start',
+ width: 90,
+ render: renderStart,
+ },
+ {
+ label: 'Status',
+ width: 70,
+ render: renderDefaultStatus,
+ },
+ {
+ label: 'Type',
+ dataKey: 'operationKind',
+ width: 60,
+ },
+ {
+ label: 'Name',
+ width: 240,
+ render: renderName,
+ },
+ ]}
+
+
+
+
+
+ );
+}
+
+export default observer(GraphQL);
diff --git a/frontend/app/components/Session_/Network/Network.js b/frontend/app/components/Session_/Network/Network.DEPRECATED.js
similarity index 100%
rename from frontend/app/components/Session_/Network/Network.js
rename to frontend/app/components/Session_/Network/Network.DEPRECATED.js
diff --git a/frontend/app/components/Session_/Profiler/Profiler.js b/frontend/app/components/Session_/Profiler/Profiler.DEPRECATED.js
similarity index 100%
rename from frontend/app/components/Session_/Profiler/Profiler.js
rename to frontend/app/components/Session_/Profiler/Profiler.DEPRECATED.js
diff --git a/frontend/app/components/Session_/StackEvents/StackEvents.js b/frontend/app/components/Session_/StackEvents/StackEvents.DEPRECATED.js
similarity index 100%
rename from frontend/app/components/Session_/StackEvents/StackEvents.js
rename to frontend/app/components/Session_/StackEvents/StackEvents.DEPRECATED.js
diff --git a/frontend/app/components/ui/Button/Button.tsx b/frontend/app/components/ui/Button/Button.tsx
index dc73f9e60..35e3588fa 100644
--- a/frontend/app/components/ui/Button/Button.tsx
+++ b/frontend/app/components/ui/Button/Button.tsx
@@ -5,7 +5,7 @@ import { CircularLoader, Icon, Tooltip } from 'UI';
interface Props {
className?: string;
children?: React.ReactNode;
- onClick?: () => void;
+ onClick?: (e: React.MouseEvent) => void;
disabled?: boolean;
type?: 'button' | 'submit' | 'reset';
variant?: 'default' | 'primary' | 'text' | 'text-primary' | 'text-red' | 'outline' | 'green';