import { Label, Icon, NoContent, Input, SlideModal, CloseButton } 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'; function renderDefaultStatus() { return "2xx-3xx"; } @connectPlayer(state => ({ list: state.graphqlListNow, livePlay: state.livePlay, })) export default class GraphQL extends React.PureComponent { state = { filter: "", filteredList: this.props.list, current: null, currentIndex: 0, showFetchDetails: false, hasNextError: false, hasPreviousError: false, } 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), }; } } render() { const { list } = this.props; const { current, currentIndex, filteredList } = this.state; return (

GraphQL

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

GraphQL

{[ { label: "Status", width: 70, render: renderDefaultStatus, }, { label: "Type", dataKey: "operationKind", width: 60, }, { label: "Name", width: 130, dataKey: "operationName", }, ]}
); } }