debian-mirror-gitlab/app/assets/javascripts/notebook/cells/code.vue

52 lines
940 B
Vue
Raw Normal View History

2017-08-17 22:00:37 +05:30
<script>
2019-03-02 22:35:43 +05:30
import CodeOutput from './code/index.vue';
2017-08-17 22:00:37 +05:30
import OutputCell from './output/index.vue';
export default {
2019-03-02 22:35:43 +05:30
name: 'CodeCell',
2017-08-17 22:00:37 +05:30
components: {
2019-03-02 22:35:43 +05:30
CodeOutput,
OutputCell,
2017-08-17 22:00:37 +05:30
},
props: {
cell: {
type: Object,
required: true,
},
},
computed: {
rawInputCode() {
2020-04-22 19:07:51 +05:30
if (this.cell.source && Array.isArray(this.cell.source)) {
2017-08-17 22:00:37 +05:30
return this.cell.source.join('');
}
2020-04-22 19:07:51 +05:30
return this.cell.source || '';
2017-08-17 22:00:37 +05:30
},
hasOutput() {
return this.cell.outputs.length;
},
2019-03-02 22:35:43 +05:30
outputs() {
return this.cell.outputs;
2017-08-17 22:00:37 +05:30
},
},
};
</script>
2018-03-17 18:26:18 +05:30
<template>
<div class="cell">
2022-10-11 01:57:18 +05:30
<code-output :raw-code="rawInputCode" :count="cell.execution_count" type="input" />
2018-03-17 18:26:18 +05:30
<output-cell
v-if="hasOutput"
:count="cell.execution_count"
2019-03-02 22:35:43 +05:30
:outputs="outputs"
2019-12-21 20:55:43 +05:30
:metadata="cell.metadata"
2019-02-15 15:39:39 +05:30
/>
2018-03-17 18:26:18 +05:30
</div>
</template>
2017-08-17 22:00:37 +05:30
<style scoped>
.cell {
flex-direction: column;
}
</style>