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,
|
|
|
|
},
|
2021-11-18 22:05:49 +05:30
|
|
|
jobLogEndpoint: {
|
2019-12-21 20:55:43 +05:30
|
|
|
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"
|
2021-11-18 22:05:49 +05:30
|
|
|
:path="jobLogEndpoint"
|
2019-12-21 20:55:43 +05:30
|
|
|
: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"
|
2021-11-18 22:05:49 +05:30
|
|
|
:job-log-endpoint="jobLogEndpoint"
|
2021-09-30 23:02:18 +05:30
|
|
|
@onClickCollapsibleLine="handleOnClickCollapsibleLine"
|
|
|
|
/>
|
2021-11-18 22:05:49 +05:30
|
|
|
<log-line v-else :key="line.offset" :line="line" :path="jobLogEndpoint" />
|
2021-09-30 23:02:18 +05:30
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<log-line
|
|
|
|
v-for="line in section.lines"
|
|
|
|
:key="line.offset"
|
|
|
|
:line="line"
|
2021-11-18 22:05:49 +05:30
|
|
|
:path="jobLogEndpoint"
|
2021-09-30 23:02:18 +05:30
|
|
|
/>
|
|
|
|
</template>
|
2019-12-21 20:55:43 +05:30
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</template>
|