Read about our upcoming Code of Conduct on this issue

line_header.vue 1.22 KB
Newer Older
1
2
3
<script>
import Icon from '~/vue_shared/components/icon.vue';
import LineNumber from './line_number.vue';
4
import DurationBadge from './duration_badge.vue';
5
6
7
8
9

export default {
  components: {
    Icon,
    LineNumber,
10
    DurationBadge,
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  },
  props: {
    line: {
      type: Object,
      required: true,
    },
    isClosed: {
      type: Boolean,
      required: true,
    },
    path: {
      type: String,
      required: true,
    },
25
26
27
28
29
    duration: {
      type: String,
      required: false,
      default: '',
    },
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  },
  computed: {
    iconName() {
      return this.isClosed ? 'angle-right' : 'angle-down';
    },
  },
  methods: {
    handleOnClick() {
      this.$emit('toggleLine');
    },
  },
};
</script>

<template>
45
  <div
46
    class="log-line collapsible-line d-flex justify-content-between ws-normal"
47
48
49
50
    role="button"
    @click="handleOnClick"
  >
    <icon :name="iconName" class="arrow position-absolute" />
51
    <line-number :line-number="line.lineNumber" :path="path" />
52
53
54
55
56
57
58
    <span
      v-for="(content, i) in line.content"
      :key="i"
      class="line-text w-100 ws-pre-wrap"
      :class="content.style"
      >{{ content.text }}</span
    >
59
    <duration-badge v-if="duration" :duration="duration" />
60
61
  </div>
</template>