2019-12-04 20:38:33 +05:30
|
|
|
<script>
|
|
|
|
import { mapState, mapActions } from 'vuex';
|
2020-07-28 23:09:34 +05:30
|
|
|
import CollapsibleLogSection from './collapsible_section.vue';
|
2019-12-04 20:38:33 +05:30
|
|
|
import LogLine from './line.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2020-07-28 23:09:34 +05:30
|
|
|
CollapsibleLogSection,
|
2019-12-04 20:38:33 +05:30
|
|
|
LogLine,
|
|
|
|
},
|
2022-08-13 15:12:31 +05:30
|
|
|
props: {
|
|
|
|
searchResults: {
|
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
},
|
2019-12-04 20:38:33 +05:30
|
|
|
computed: {
|
2019-12-26 22:10:19 +05:30
|
|
|
...mapState([
|
2021-11-18 22:05:49 +05:30
|
|
|
'jobLogEndpoint',
|
|
|
|
'jobLog',
|
|
|
|
'isJobLogComplete',
|
|
|
|
'isScrolledToBottomBeforeReceivingJobLog',
|
2019-12-26 22:10:19 +05:30
|
|
|
]),
|
|
|
|
},
|
|
|
|
updated() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.handleScrollDown();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.handleScrollDown();
|
|
|
|
});
|
2019-12-04 20:38:33 +05:30
|
|
|
},
|
|
|
|
methods: {
|
2019-12-26 22:10:19 +05:30
|
|
|
...mapActions(['toggleCollapsibleLine', 'scrollBottom']),
|
2019-12-04 20:38:33 +05:30
|
|
|
handleOnClickCollapsibleLine(section) {
|
|
|
|
this.toggleCollapsibleLine(section);
|
|
|
|
},
|
2019-12-26 22:10:19 +05:30
|
|
|
/**
|
|
|
|
* The job log is sent in HTML, which means we need to use `v-html` to render it
|
|
|
|
* Using the updated hook with $nextTick is not enough to wait for the DOM to be updated
|
|
|
|
* in this case because it runs before `v-html` has finished running, since there's no
|
|
|
|
* Vue binding.
|
|
|
|
* In order to scroll the page down after `v-html` has finished, we need to use setTimeout
|
|
|
|
*/
|
|
|
|
handleScrollDown() {
|
2021-11-18 22:05:49 +05:30
|
|
|
if (this.isScrolledToBottomBeforeReceivingJobLog) {
|
2019-12-26 22:10:19 +05:30
|
|
|
setTimeout(() => {
|
|
|
|
this.scrollBottom();
|
|
|
|
}, 0);
|
|
|
|
}
|
|
|
|
},
|
2019-12-04 20:38:33 +05:30
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
2020-03-13 15:44:24 +05:30
|
|
|
<code class="job-log d-block" data-qa-selector="job_log_content">
|
2021-11-18 22:05:49 +05:30
|
|
|
<template v-for="(section, index) in jobLog">
|
2020-07-28 23:09:34 +05:30
|
|
|
<collapsible-log-section
|
2019-12-21 20:55:43 +05:30
|
|
|
v-if="section.isHeader"
|
|
|
|
:key="`collapsible-${index}`"
|
|
|
|
:section="section"
|
2021-11-18 22:05:49 +05:30
|
|
|
:job-log-endpoint="jobLogEndpoint"
|
2022-08-13 15:12:31 +05:30
|
|
|
:search-results="searchResults"
|
2019-12-21 20:55:43 +05:30
|
|
|
@onClickCollapsibleLine="handleOnClickCollapsibleLine"
|
|
|
|
/>
|
2022-08-13 15:12:31 +05:30
|
|
|
<log-line
|
|
|
|
v-else
|
|
|
|
:key="section.offset"
|
|
|
|
:line="section"
|
|
|
|
:path="jobLogEndpoint"
|
|
|
|
:search-results="searchResults"
|
|
|
|
/>
|
2019-12-04 20:38:33 +05:30
|
|
|
</template>
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
<div v-if="!isJobLogComplete" class="js-log-animation loader-animation pt-3 pl-3">
|
2019-12-04 20:38:33 +05:30
|
|
|
<div class="dot"></div>
|
|
|
|
<div class="dot"></div>
|
|
|
|
<div class="dot"></div>
|
|
|
|
</div>
|
|
|
|
</code>
|
|
|
|
</template>
|