diff --git a/frontend/app/components/Session_/Fetch/Fetch.js b/frontend/app/components/Session_/Fetch/Fetch.js index 2db36f76f..dd3c79711 100644 --- a/frontend/app/components/Session_/Fetch/Fetch.js +++ b/frontend/app/components/Session_/Fetch/Fetch.js @@ -127,10 +127,6 @@ export default class Fetch extends React.PureComponent {

Fetch

- {/*
-
Prev
-
Next
-
*/} -
- { variables && variables !== "{}" && -
-
-
{ 'Variables'}
- { jsonVars === undefined - ?
{ variables }
- : - } +
+
{ 'Operation Name'}
+
{ operationName }
+ +
+
+
Operation Kind
+
{operationKind}
+
+
+
Duration
+
{parseInt(duration)} ms
+
+
+ +
+
{ 'Response' }
+
+
+ { variables && variables !== "{}" && +
+
+
{ 'Variables'}
+ { jsonVars === undefined + ?
{ variables }
+ : + } +
+
-
-
- } -
-
-
{ 'Response' }
-
- { jsonResponse === undefined - ?
{ response }
- : } +
+ { jsonResponse === undefined + ?
{ response }
+ : + } +
+
+ +
+ +
); diff --git a/frontend/app/components/Session_/GraphQL/GraphQL.js b/frontend/app/components/Session_/GraphQL/GraphQL.js index 0fedbb85e..0b2765b58 100644 --- a/frontend/app/components/Session_/GraphQL/GraphQL.js +++ b/frontend/app/components/Session_/GraphQL/GraphQL.js @@ -1,8 +1,6 @@ -//import cn from 'classnames'; -import { Icon, NoContent, Input, SlideModal } from 'UI'; +import { Label, Icon, NoContent, Input, SlideModal, CloseButton } from 'UI'; import { getRE } from 'App/utils'; -import { connectPlayer } from 'Player'; -import Autoscroll from '../Autoscroll'; +import { connectPlayer, pause, jump } from 'Player'; import BottomBlock from '../BottomBlock'; import TimeTable from '../TimeTable'; import GQLDetails from './GQLDetails'; @@ -10,60 +8,105 @@ import GQLDetails from './GQLDetails'; function renderDefaultStatus() { return "2xx-3xx"; } - @connectPlayer(state => ({ list: state.graphqlListNow, + livePlay: state.livePlay, })) export default class GraphQL extends React.PureComponent { state = { - filter: "", + filter: "", + filteredList: this.props.list, current: null, + currentIndex: 0, + showFetchDetails: false, + hasNextError: false, + hasPreviousError: false, } - onFilterChange = (e, { value }) => this.setState({ filter: value }) - setCurrent = (item) => { - this.setState({ current: item }); + onFilterChange = (e, { value }) => { + const { list } = this.props; + const filterRE = getRE(value, 'i'); + const filtered = list + .filter((r) => filterRE.test(r.name) || filterRE.test(r.url) || filterRE.test(r.method) || filterRE.test(r.status)); + this.setState({ filter: value, filteredList: value ? filtered : list, 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 { filteredList } = prevState; + if (nextProps.timelinePointer) { + let activeItem = filteredList.find((r) => r.time >= nextProps.timelinePointer.time); + activeItem = activeItem || filteredList[filteredList.length - 1]; + return { + current: activeItem, + currentIndex: filteredList.indexOf(activeItem), + }; + } } - closeModal = () => this.setState({ current: null}) render() { const { list } = this.props; - const { filter, current } = this.state; - const filterRE = getRE(filter, 'i'); - const filtered = list - .filter(({ operationName = "", operationKind = "" }) => filterRE.test(operationName) || filterRE.test(operationKind)); - + const { current, currentIndex, filteredList } = this.state; + return ( {current.operationKind} {current.operationName} } + right + title = { +
+

GraphQL

+
+ +
+
+ } isDisplayed={ current != null } content={ current && - + } onClose={ this.closeModal } /> - +

GraphQL

+
+ +
{[ {