debian-mirror-gitlab/app/assets/javascripts/jobs/components/log/collapsible_section.vue

73 lines
1.9 KiB
Vue
Raw Normal View History

2019-12-21 20:55:43 +05:30
<script>
2021-09-30 23:02:18 +05:30
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { INFINITELY_NESTED_COLLAPSIBLE_SECTIONS_FF } from '../../constants';
2019-12-21 20:55:43 +05:30
import LogLine from './line.vue';
import LogLineHeader from './line_header.vue';
export default {
2020-07-28 23:09:34 +05:30
name: 'CollapsibleLogSection',
2019-12-21 20:55:43 +05:30
components: {
LogLine,
LogLineHeader,
2021-09-30 23:02:18 +05:30
CollapsibleLogSection: () => import('./collapsible_section.vue'),
2019-12-21 20:55:43 +05:30
},
2021-09-30 23:02:18 +05:30
mixins: [glFeatureFlagsMixin()],
2019-12-21 20:55:43 +05:30
props: {
section: {
type: Object,
required: true,
},
traceEndpoint: {
type: String,
required: true,
},
},
computed: {
badgeDuration() {
return this.section.line && this.section.line.section_duration;
},
2021-09-30 23:02:18 +05:30
infinitelyCollapsibleSectionsFlag() {
return this.glFeatures?.[INFINITELY_NESTED_COLLAPSIBLE_SECTIONS_FF];
},
2019-12-21 20:55:43 +05:30
},
methods: {
handleOnClickCollapsibleLine(section) {
this.$emit('onClickCollapsibleLine', section);
},
},
};
</script>
<template>
<div>
<log-line-header
:line="section.line"
:duration="badgeDuration"
:path="traceEndpoint"
:is-closed="section.isClosed"
@toggleLine="handleOnClickCollapsibleLine(section)"
/>
<template v-if="!section.isClosed">
2021-09-30 23:02:18 +05:30
<template v-if="infinitelyCollapsibleSectionsFlag">
<template v-for="line in section.lines">
<collapsible-log-section
v-if="line.isHeader"
:key="line.line.offset"
:section="line"
:trace-endpoint="traceEndpoint"
@onClickCollapsibleLine="handleOnClickCollapsibleLine"
/>
<log-line v-else :key="line.offset" :line="line" :path="traceEndpoint" />
</template>
</template>
<template v-else>
<log-line
v-for="line in section.lines"
:key="line.offset"
:line="line"
:path="traceEndpoint"
/>
</template>
2019-12-21 20:55:43 +05:30
</template>
</div>
</template>