| 33 | |
| 34 | @observer |
| 35 | export class PythonFrame extends Component<PythonFrameProps, ConsoleState> { |
| 36 | private frameRef: React.RefObject<HTMLIFrameElement> |
| 37 | private termRef: React.RefObject<HTMLDivElement> |
| 38 | private term: Terminal |
| 39 | private terminalFitAddon: FitAddon |
| 40 | private resolveActiveInput?: (s: string) => void |
| 41 | private wasmTty: WasmTTY |
| 42 | private pasteLinesBuffer: string[] |
| 43 | private resizeObserver: ResizeObserver |
| 44 | |
| 45 | constructor(props: PythonFrameProps) { |
| 46 | super(props) |
| 47 | this.frameRef = React.createRef() |
| 48 | this.termRef = React.createRef() |
| 49 | this.resolveActiveInput = null |
| 50 | this.wasmTty = null |
| 51 | this.pasteLinesBuffer = [] |
| 52 | this.resizeObserver = new ResizeObserver((entries) => { |
| 53 | this.handleResize() |
| 54 | }) |
| 55 | |
| 56 | const runType = this.props.runtimeContextManager.runSettings.runType |
| 57 | this.state = { |
| 58 | frameSrc: this.getFrameSrc(runType), |
| 59 | responseData: null, |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | render() { |
| 64 | const { runtimeContextManager } = this.props |
| 65 | const ready = runtimeContextManager.ready |
| 66 | const running = runtimeContextManager.running |
| 67 | const runSettings = runtimeContextManager.runSettings |
| 68 | |
| 69 | const iframeClass = runSettings.runType === RunType.STREAMLIT ? 'streamlit-frame' : 'view-python-frame' |
| 70 | |
| 71 | if (runSettings.runType === RunType.STREAMLIT) { |
| 72 | return ( |
| 73 | <div id="python-frame-container"> |
| 74 | <iframe ref={this.frameRef} className={iframeClass} src={this.state.frameSrc} allow="cross-origin-isolated" /> |
| 75 | <Box pl="3" pt="3" height={'100%'} backgroundColor="#040810"> |
| 76 | <Box id="terminal" ref={this.termRef}></Box> |
| 77 | </Box> |
| 78 | </div> |
| 79 | ) |
| 80 | } |
| 81 | |
| 82 | return ( |
| 83 | <div id="python-frame-container"> |
| 84 | <div id="terminal-container"> |
| 85 | <Box className="terminal-menu" px="3"> |
| 86 | <ButtonGroup size="md" my={1} height={8}> |
| 87 | {runSettings.runType === RunType.HTTP_REQUEST ? ( |
| 88 | <Select |
| 89 | size="sm" |
| 90 | variant={'filled'} |
| 91 | backgroundColor="gray.800" |
| 92 | value={runtimeContextManager.selectedHTTPScenarioID || ''} |
nothing calls this directly
no test coverage detected