summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/jobs/components/log/log.vue
blob: 5db866afe5a5d202f8fd37f2fc9f6d101557791c (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
<script>
import { mapState, mapActions } from 'vuex';
import LogLine from './line.vue';
import LogLineHeader from './line_header.vue';

export default {
  components: {
    LogLine,
    LogLineHeader,
  },
  computed: {
    ...mapState(['traceEndpoint', 'trace']),
  },
  methods: {
    ...mapActions(['toggleCollapsibleLine']),
    handleOnClickCollapsibleLine(section) {
      this.toggleCollapsibleLine(section);
    },
  },
};
</script>
<template>
  <code class="job-log">
    <template v-for="(section, index) in trace">
      <template v-if="section.isHeader">
        <log-line-header
          :key="`collapsible-${index}`"
          :line="section.line"
          :path="traceEndpoint"
          :is-closed="section.isClosed"
          @toggleLine="handleOnClickCollapsibleLine(section)"
        />
        <template v-if="!section.isClosed">
          <log-line
            v-for="line in section.lines"
            :key="line.offset"
            :line="line"
            :path="traceEndpoint"
          />
        </template>
      </template>
      <log-line v-else :key="section.offset" :line="section" :path="traceEndpoint" />
    </template>
  </code>
</template>