fix: update PR building status
This commit is contained in:
parent
eed44e81be
commit
defa6ff6e8
@ -119,6 +119,7 @@
|
|||||||
return 'error';
|
return 'error';
|
||||||
} finally {
|
} finally {
|
||||||
numberOfGetStatus--;
|
numberOfGetStatus--;
|
||||||
|
status = status
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function restartPreview(preview: any) {
|
async function restartPreview(preview: any) {
|
||||||
@ -143,11 +144,23 @@
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
loadBuildingStatusInterval = setInterval(() => {
|
loadBuildingStatusInterval = setInterval(() => {
|
||||||
application.previewApplication.forEach(async (preview: any) => {
|
application.previewApplication.forEach(async (preview: any) => {
|
||||||
if (status[id] === 'building') {
|
const { applicationId, pullmergeRequestId } = preview;
|
||||||
await getStatus(preview);
|
if (status[preview.id] === 'building') {
|
||||||
|
const response = await get(
|
||||||
|
`/applications/${applicationId}/previews/${pullmergeRequestId}/status`
|
||||||
|
);
|
||||||
|
if (response.isBuilding) {
|
||||||
|
status[preview.id] = 'building';
|
||||||
|
} else if (response.isRunning) {
|
||||||
|
status[preview.id] = 'running';
|
||||||
|
return 'running';
|
||||||
|
} else {
|
||||||
|
status[preview.id] = 'stopped';
|
||||||
|
return 'stopped';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 3000);
|
}, 2000);
|
||||||
try {
|
try {
|
||||||
loading.init = true;
|
loading.init = true;
|
||||||
loading.restart = true;
|
loading.restart = true;
|
||||||
@ -279,8 +292,8 @@
|
|||||||
<div class="w-full rounded p-5 bg-coolgray-200 indicator">
|
<div class="w-full rounded p-5 bg-coolgray-200 indicator">
|
||||||
{#await getStatus(preview)}
|
{#await getStatus(preview)}
|
||||||
<span class="indicator-item badge bg-yellow-500 badge-sm" />
|
<span class="indicator-item badge bg-yellow-500 badge-sm" />
|
||||||
{:then status}
|
{:then}
|
||||||
{#if status === 'running'}
|
{#if status[preview.id] === 'running'}
|
||||||
<span class="indicator-item badge bg-success badge-sm" />
|
<span class="indicator-item badge bg-success badge-sm" />
|
||||||
{:else}
|
{:else}
|
||||||
<span class="indicator-item badge bg-error badge-sm" />
|
<span class="indicator-item badge bg-error badge-sm" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user