This commit is contained in:
wxiaoguang 2022-10-02 10:34:05 +08:00 committed by Jason Song
parent c623e9a279
commit c73dbab6e5

View File

@ -69,7 +69,7 @@
<script> <script>
import {SvgIcon} from '../svg.js'; import {SvgIcon} from '../svg.js';
import Vue from 'vue'; import Vue, {createApp} from 'vue';
import AnsiToHTML from `ansi-to-html`; import AnsiToHTML from `ansi-to-html`;
const sfc = { const sfc = {
@ -135,6 +135,9 @@ const sfc = {
// show/hide the step logs for a step // show/hide the step logs for a step
toggleStepLogs(idx) { toggleStepLogs(idx) {
this.currentJobStepsStates[idx].expanded = !this.currentJobStepsStates[idx].expanded; this.currentJobStepsStates[idx].expanded = !this.currentJobStepsStates[idx].expanded;
if (this.currentJobStepsStates[idx].expanded) {
this.loadJobData();
}
}, },
formatDuration(d) { formatDuration(d) {
@ -275,7 +278,7 @@ const sfc = {
// sync the currentJobStepsStates to store the job step states // sync the currentJobStepsStates to store the job step states
for (let i = 0; i < this.currentJobSteps.length; i++) { for (let i = 0; i < this.currentJobSteps.length; i++) {
if (!this.currentJobStepsStates[i]) { if (!this.currentJobStepsStates[i]) {
this.$set(this.currentJobStepsStates, i, {cursor: null, expanded: false}); // array must use $set this.currentJobStepsStates[i] = {cursor: null, expanded: false};
} }
} }
// append logs to the UI // append logs to the UI
@ -298,10 +301,8 @@ export function initRepositoryBuildView() {
const el = document.getElementById('repo-build-view'); const el = document.getElementById('repo-build-view');
if (!el) return; if (!el) return;
const View = Vue.extend({ const view = createApp(sfc);
render: (createElement) => createElement(sfc), view.mount(el);
});
new View().$mount(el);
} }
</script> </script>