mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-21 21:05:18 +02:00
make RepoBuildView loadJobData work correctly, avoid concurrency requests.
This commit is contained in:
parent
62798f67c8
commit
e6ad1b3233
@ -104,7 +104,10 @@ const sfc = {
|
|||||||
// TODO: the parent element's full height doesn't work well now
|
// TODO: the parent element's full height doesn't work well now
|
||||||
const elBodyDiv = document.querySelector('body > div.full.height');
|
const elBodyDiv = document.querySelector('body > div.full.height');
|
||||||
elBodyDiv.style.height = '100%';
|
elBodyDiv.style.height = '100%';
|
||||||
|
|
||||||
|
// load job data and then auto-reload periodically
|
||||||
this.loadJobData();
|
this.loadJobData();
|
||||||
|
setInterval(() => this.loadJobData(), 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@ -140,7 +143,7 @@ const sfc = {
|
|||||||
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) {
|
if (this.currentJobStepsStates[idx].expanded) {
|
||||||
this.loadJobData(true);
|
this.loadJobData(); // try to load the data immediately instead of waiting for next timer interval
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -260,7 +263,7 @@ const sfc = {
|
|||||||
return await resp.json();
|
return await resp.json();
|
||||||
},
|
},
|
||||||
|
|
||||||
async loadJobData(once) {
|
async loadJobData() {
|
||||||
if (this.loading) return;
|
if (this.loading) return;
|
||||||
try {
|
try {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@ -297,9 +300,6 @@ const sfc = {
|
|||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (!once) {
|
|
||||||
setTimeout(() => this.loadJobData(), 1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user