fix loading issue
This commit is contained in:
@@ -49,6 +49,7 @@ class Job(db.Model):
|
|||||||
'in_progress': '🔄',
|
'in_progress': '🔄',
|
||||||
'passed': '✅',
|
'passed': '✅',
|
||||||
'failed': '❌',
|
'failed': '❌',
|
||||||
'aborted': '⚫'
|
'aborted': '⚫',
|
||||||
|
'error': '⚠️'
|
||||||
}
|
}
|
||||||
return icons.get(self.status, '⚪')
|
return icons.get(self.status, '⚪')
|
||||||
|
|||||||
@@ -517,6 +517,10 @@ def update_job_status_internal(job):
|
|||||||
r_data = r_resp.json()
|
r_data = r_resp.json()
|
||||||
for key, val in r_data.items():
|
for key, val in r_data.items():
|
||||||
if key.upper() == scenario.upper():
|
if key.upper() == scenario.upper():
|
||||||
|
# Transform file:/// link to web link
|
||||||
|
if isinstance(val, list) and len(val) > 1 and val[1].startswith('file:///'):
|
||||||
|
val[1] = val[1].replace('file:///home/asf/testarena/', 'http://asf-server.duckdns.org:8080/results/')
|
||||||
|
|
||||||
results[scenario] = val
|
results[scenario] = val
|
||||||
if val[0] == 'FAIL':
|
if val[0] == 'FAIL':
|
||||||
any_failed = True
|
any_failed = True
|
||||||
@@ -525,16 +529,26 @@ def update_job_status_internal(job):
|
|||||||
all_finished = False
|
all_finished = False
|
||||||
elif t_data.get('status') == 'Aborted':
|
elif t_data.get('status') == 'Aborted':
|
||||||
results[scenario] = ['ABORTED', '#']
|
results[scenario] = ['ABORTED', '#']
|
||||||
all_finished = True # Or handle as aborted
|
all_finished = True
|
||||||
|
elif t_data.get('status') == 'Error':
|
||||||
|
results[scenario] = ['ERROR', '#']
|
||||||
|
any_failed = True
|
||||||
|
all_finished = True
|
||||||
else:
|
else:
|
||||||
all_finished = False
|
all_finished = False
|
||||||
else:
|
else:
|
||||||
all_finished = False
|
all_finished = False
|
||||||
else:
|
else:
|
||||||
if results[scenario][0] == 'FAIL':
|
if results[scenario][0] in ['FAIL', 'ERROR']:
|
||||||
any_failed = True
|
any_failed = True
|
||||||
|
|
||||||
if all_finished and task_ids:
|
if all_finished and task_ids:
|
||||||
|
# If any task has ERROR, the job status could be 'error' or 'failed'
|
||||||
|
# User said "mark it in the dash board as error"
|
||||||
|
has_error = any(r[0] == 'ERROR' for r in results.values())
|
||||||
|
if has_error:
|
||||||
|
job.status = 'error'
|
||||||
|
else:
|
||||||
job.status = 'failed' if any_failed else 'passed'
|
job.status = 'failed' if any_failed else 'passed'
|
||||||
from app import db
|
from app import db
|
||||||
job.completed_at = db.session.query(db.func.now()).scalar()
|
job.completed_at = db.session.query(db.func.now()).scalar()
|
||||||
|
|||||||
@@ -186,7 +186,7 @@
|
|||||||
actions.style.display = 'flex';
|
actions.style.display = 'flex';
|
||||||
|
|
||||||
const btnAbort = document.getElementById('btn-abort');
|
const btnAbort = document.getElementById('btn-abort');
|
||||||
if (['passed', 'failed', 'aborted'].includes(job.status)) {
|
if (['passed', 'failed', 'aborted', 'error'].includes(job.status)) {
|
||||||
btnAbort.style.display = 'none';
|
btnAbort.style.display = 'none';
|
||||||
if (isPolling) clearInterval(pollingInterval);
|
if (isPolling) clearInterval(pollingInterval);
|
||||||
} else {
|
} else {
|
||||||
@@ -244,8 +244,8 @@
|
|||||||
let statusHtml = '⌛ Waiting';
|
let statusHtml = '⌛ Waiting';
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
const icon = result[0] === 'PASS' ? '✅' : (result[0] === 'FAIL' ? '❌' : '⚫');
|
const icon = result[0] === 'PASS' ? '✅' : (result[0] === 'FAIL' ? '❌' : (result[0] === 'ERROR' ? '⚠️' : '⚫'));
|
||||||
const color = result[0] === 'PASS' ? 'var(--success)' : (result[0] === 'FAIL' ? 'var(--danger)' : 'var(--gray)');
|
const color = result[0] === 'PASS' ? 'var(--success)' : (result[0] === 'FAIL' ? 'var(--danger)' : (result[0] === 'ERROR' ? 'var(--warning)' : 'var(--gray)'));
|
||||||
statusHtml = `<a href="${result[1]}" target="_blank" style="text-decoration: none; color: ${color}; font-weight: 600;">${icon} ${result[0]}</a>`;
|
statusHtml = `<a href="${result[1]}" target="_blank" style="text-decoration: none; color: ${color}; font-weight: 600;">${icon} ${result[0]}</a>`;
|
||||||
} else if (job.status === 'in_progress') {
|
} else if (job.status === 'in_progress') {
|
||||||
statusHtml = '🔄 Running';
|
statusHtml = '🔄 Running';
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
if (logElement) logElement.scrollTop = logElement.scrollHeight;
|
if (logElement) logElement.scrollTop = logElement.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!['passed', 'failed', 'aborted'].includes(job.status)) {
|
if (!['passed', 'failed', 'aborted', 'error'].includes(job.status)) {
|
||||||
fetch(`/jobs/${jobId}/status`)
|
fetch(`/jobs/${jobId}/status`)
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|||||||
Reference in New Issue
Block a user