|
83 | 83 | padding: 8px; |
84 | 84 | width: auto; |
85 | 85 | flex: 1; |
86 | | - overflow: scroll; |
87 | 86 | margin: 0; |
88 | 87 | border: none; |
89 | 88 | display: none; |
|
153 | 152 | sandbox="allow-same-origin allow-pointer-lock allow-scripts allow-downloads allow-forms" |
154 | 153 | allow="cross-origin-isolated; clipboard-read; clipboard-write;" |
155 | 154 | ></iframe> |
156 | | - <pre id="stdout"></pre> |
157 | | - <div class="alert-error" id="error"> |
158 | | - <span class="error-icon"> |
159 | | - <svg |
160 | | - width="1em" |
161 | | - height="1em" |
162 | | - viewBox="0 0 24 24" |
163 | | - fill="none" |
164 | | - xmlns="http://www.w3.org/2000/svg" |
165 | | - aria-hidden="true" |
166 | | - focusable="false" |
167 | | - class="" |
168 | | - > |
169 | | - <path |
170 | | - fill-rule="evenodd" |
171 | | - clip-rule="evenodd" |
172 | | - d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm-1 2v2h2v-2h-2z" |
173 | | - fill="currentColor" |
174 | | - ></path> |
175 | | - </svg> |
176 | | - </span> |
177 | | - <div> |
178 | | - <b id="error-description"></b> |
179 | | - <div id="error-stack"></div> |
| 155 | + <div style="overflow: scroll"> |
| 156 | + <div class="alert-error" id="error"> |
| 157 | + <span class="error-icon"> |
| 158 | + <svg |
| 159 | + width="1em" |
| 160 | + height="1em" |
| 161 | + viewBox="0 0 24 24" |
| 162 | + fill="none" |
| 163 | + xmlns="http://www.w3.org/2000/svg" |
| 164 | + aria-hidden="true" |
| 165 | + focusable="false" |
| 166 | + class="" |
| 167 | + > |
| 168 | + <path |
| 169 | + fill-rule="evenodd" |
| 170 | + clip-rule="evenodd" |
| 171 | + d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm-1 2v2h2v-2h-2z" |
| 172 | + fill="currentColor" |
| 173 | + ></path> |
| 174 | + </svg> |
| 175 | + </span> |
| 176 | + <div> |
| 177 | + <b id="error-description"></b> |
| 178 | + <div id="error-stack"></div> |
| 179 | + </div> |
180 | 180 | </div> |
| 181 | + <pre id="stdout"></pre> |
181 | 182 | </div> |
182 | 183 | </div> |
183 | 184 | <div class="details"> |
|
259 | 260 | setOutputHtml(html) { |
260 | 261 | var cl = document.getElementById("output").classList; |
261 | 262 | cl.remove("spinner"); |
262 | | - cl.remove("stdout"); |
263 | | - cl.remove("error"); |
264 | 263 | cl.add("html"); |
265 | 264 |
|
266 | 265 | const frameEl = document.getElementById("frame"); |
|
331 | 330 | setStdout(stdout) { |
332 | 331 | var cl = document.getElementById("output").classList; |
333 | 332 | cl.remove("spinner"); |
334 | | - cl.remove("html"); |
335 | | - cl.remove("error"); |
336 | 333 | cl.add("stdout"); |
337 | 334 |
|
338 | 335 | document.getElementById("stdout").innerText = stdout; |
|
341 | 338 | setError(message, stack) { |
342 | 339 | var cl = document.getElementById("output").classList; |
343 | 340 | cl.remove("spinner"); |
344 | | - cl.remove("html"); |
345 | | - cl.remove("stdout"); |
346 | 341 | cl.add("error"); |
347 | 342 |
|
348 | 343 | document.getElementById("error-description").innerText = |
|
400 | 395 | page.setError( |
401 | 396 | `SyntaxError: invalid syntax (hello.py, line 10)`, |
402 | 397 | `SyntaxError: invalid syntax (hello.py, line 9) |
403 | | -Traceback <span style="color:#0AA">(most recent call last)</span>: |
| 398 | + Traceback <span style="color:#0AA">(most recent call last)</span>: |
404 | 399 |
|
405 | | - File <b><span style="color:#0A0">"/databricks/python/lib/python3.9/site-packages/IPython/core/interactiveshell.py"</span></b>, line <b><span style="color:#0A0">3524</span></b>, in <b><span style="color:#A0A">run_code</span></b> |
406 | | - exec(code_obj, self.user_global_ns, self.user_ns) |
| 400 | + File <b><span style="color:#0A0">"/databricks/python/lib/python3.9/site-packages/IPython/core/interactiveshell.py"</span></b>, line <b><span style="color:#0A0">3524</span></b>, in <b><span style="color:#A0A">run_code</span></b> |
| 401 | + exec(code_obj, self.user_global_ns, self.user_ns) |
407 | 402 |
|
408 | | -<span style="color:#0AA"> File </span><span style="color:#0A0">"<command--1>"</span><span style="color:#0AA">, line </span><span style="color:#0A0">8</span><span style="color:#0AA">, in </span><span style="color:#A0A"><cell line: 7></span><span style="color:#0AA"></span> |
409 | | -<span style="color:#A00"> exec(compile(f.read(), filename, 'exec'))</span> |
| 403 | + <span style="color:#0AA"> File </span><span style="color:#0A0">"<command--1>"</span><span style="color:#0AA">, line </span><span style="color:#0A0">8</span><span style="color:#0AA">, in </span><span style="color:#A0A"><cell line: 7></span><span style="color:#0AA"></span> |
| 404 | + <span style="color:#A00"> exec(compile(f.read(), filename, 'exec'))</span> |
410 | 405 |
|
411 | | -<span style="color:#0AA"> File </span><span style="color:#0A0">"/Workspace/Repos/fabian.jakobs@databricks.com/ide-best-practices/jobs/hello.py"</span><span style="color:#0AA">, line </span><span style="color:#0A0">9</span> |
412 | | -<span style="color:#A00"> pr int("Hi Deco")</span> |
413 | | - ^ |
414 | | -<span style="color:#A00">SyntaxError</span><span style="color:#A00">:</span> invalid syntax` |
| 406 | + <span style="color:#0AA"> File </span><span style="color:#0A0">"/Workspace/Repos/fabian.jakobs@databricks.com/ide-best-practices/jobs/hello.py"</span><span style="color:#0AA">, line </span><span style="color:#0A0">9</span> |
| 407 | + <span style="color:#A00"> pr int("Hi Deco")</span> |
| 408 | + ^ |
| 409 | + <span style="color:#A00">SyntaxError</span><span style="color:#A00">:</span> invalid syntax` |
415 | 410 | ); |
416 | | - stop(); |
| 411 | + |
| 412 | + let stdout = ""; |
| 413 | + for (let i = 0; i < 100; i++) { |
| 414 | + stdout += `Hello World ${i}\n`; |
| 415 | + } |
| 416 | + page.setStdout(stdout); |
417 | 417 | }, 3000); |
418 | 418 |
|
419 | 419 | setTimeout(() => { |
420 | 420 | page.setOutputHtml( |
421 | 421 | `<html><body><h1>Hello World</h1><p>This is a test</p></body></html>` |
422 | 422 | ); |
423 | | - stop(); |
424 | 423 | }, 5000); |
425 | 424 | } |
426 | 425 | </script> |
|
0 commit comments