diff options
author | Phil Hughes <me@iamphill.com> | 2019-03-28 10:07:06 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-03-28 10:07:06 +0000 |
commit | a624f160ad2e4a1037ced6cba05c00e144f3fe71 (patch) | |
tree | eb61f8ba9977cfa80cc81445a82d1430e031c627 | |
parent | 406d3ee69b0a38821526def246d502d5cb46c21a (diff) | |
parent | f620c69acc12074128c3f2f50e4a26f9d3c2df1c (diff) | |
download | gitlab-ce-a624f160ad2e4a1037ced6cba05c00e144f3fe71.tar.gz |
Merge branch '59079-fix-jupyter-render-loop' into 'master'
Fix jupyter rendering bug that ended in an infinite loop
Closes #59079
See merge request gitlab-org/gitlab-ce!26667
-rw-r--r-- | app/assets/javascripts/notebook/cells/output/index.vue | 29 | ||||
-rw-r--r-- | changelogs/unreleased/59079-fix-jupyter-render-loop.yml | 5 |
2 files changed, 20 insertions, 14 deletions
diff --git a/app/assets/javascripts/notebook/cells/output/index.vue b/app/assets/javascripts/notebook/cells/output/index.vue index c5ae7e7ee10..b59ddd0d57a 100644 --- a/app/assets/javascripts/notebook/cells/output/index.vue +++ b/app/assets/javascripts/notebook/cells/output/index.vue @@ -20,12 +20,20 @@ export default { required: true, }, }, - data() { - return { - outputType: '', - }; - }, methods: { + outputType(output) { + if (output.text) { + return 'text/plain'; + } else if (output.data['image/png']) { + return 'image/png'; + } else if (output.data['text/html']) { + return 'text/html'; + } else if (output.data['image/svg+xml']) { + return 'image/svg+xml'; + } + + return 'text/plain'; + }, dataForType(output, type) { let data = output.data[type]; @@ -39,20 +47,13 @@ export default { if (output.text) { return CodeOutput; } else if (output.data['image/png']) { - this.outputType = 'image/png'; - return ImageOutput; } else if (output.data['text/html']) { - this.outputType = 'text/html'; - return HtmlOutput; } else if (output.data['image/svg+xml']) { - this.outputType = 'image/svg+xml'; - return HtmlOutput; } - this.outputType = 'text/plain'; return CodeOutput; }, rawCode(output) { @@ -60,7 +61,7 @@ export default { return output.text.join(''); } - return this.dataForType(output, this.outputType); + return this.dataForType(output, this.outputType(output)); }, }, }; @@ -73,7 +74,7 @@ export default { v-for="(output, index) in outputs" :key="index" type="output" - :output-type="outputType" + :output-type="outputType(output)" :count="count" :index="index" :raw-code="rawCode(output)" diff --git a/changelogs/unreleased/59079-fix-jupyter-render-loop.yml b/changelogs/unreleased/59079-fix-jupyter-render-loop.yml new file mode 100644 index 00000000000..29264b33dfa --- /dev/null +++ b/changelogs/unreleased/59079-fix-jupyter-render-loop.yml @@ -0,0 +1,5 @@ +--- +title: Fix jupyter rendering bug that ended in an infinite loop +merge_request: 26656 +author: ROSPARS Benoit +type: fixed |