Welcome to mirror list, hosted at ThFree Co, Russian Federation.

code.vue « cells « notebook « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b4067d229aa22b866b45985cae3c71a19be0267c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<script>
import CodeCell from './code/index.vue';
import OutputCell from './output/index.vue';

export default {
  components: {
    'code-cell': CodeCell,
    'output-cell': OutputCell,
  },
  props: {
    cell: {
      type: Object,
      required: true,
    },
    codeCssClass: {
      type: String,
      required: false,
      default: '',
    },
  },
  computed: {
    rawInputCode() {
      if (this.cell.source) {
        return this.cell.source.join('');
      }

      return '';
    },
    hasOutput() {
      return this.cell.outputs.length;
    },
    output() {
      return this.cell.outputs[0];
    },
  },
};
</script>

<template>
  <div class="cell">
    <code-cell
      type="input"
      :raw-code="rawInputCode"
      :count="cell.execution_count"
      :code-css-class="codeCssClass" />
    <output-cell
      v-if="hasOutput"
      :count="cell.execution_count"
      :output="output"
      :code-css-class="codeCssClass" />
  </div>
</template>

<style scoped>
.cell {
  flex-direction: column;
}
</style>