11{% extends "base.html" %}
22
33{% block content %}
4- < h1 > Task Status</ h1 >
4+ < div class ="container mx-auto px-4 py-8 ">
5+ < h1 class ="text-3xl font-bold mb-6 "> Task Status</ h1 >
56
67 {% if error %}
7- < p style ="color: red; "> {{ error }}</ p >
8+ < div class ="alert alert-error ">
9+ < span > {{ error }}</ span >
10+ </ div >
811 {% else %}
9- < p > < strong > Task ID:</ strong > {{ task_id }}</ p >
10- < p > < strong > Status:</ strong > {{ status }}</ p >
12+ < div class ="flex flex-col items-center space-y-6 ">
13+ <!-- Radial Progress -->
14+ < div class ="radial-progress " style ="--value:{{ progress_value }}; " role ="progressbar " aria-valuenow ="{{ progress_value }} " aria-valuemin ="0 " aria-valuemax ="100 ">
15+ < span class ="text-lg font-bold "> {{ progress_value }}%</ span >
16+ </ div >
1117
12- {% if result %}
13- < p > < strong > Result:</ strong > {{ result }}</ p >
14- {% else %}
15- < p > Processing... Refresh the page to check status.</ p >
16- {% endif %}
18+ < div class ="text-center space-y-2 ">
19+ < p class ="text-lg "> < strong > Task ID:</ strong > {{ task_id }}</ p >
20+ < p class ="text-lg "> < strong > Status:</ strong > < span id ="status-text "> {{ status }}</ span > </ p >
21+ </ div >
22+
23+ {% if result %}
24+ < div class ="card bg-base-100 shadow-xl w-full max-w-2xl ">
25+ < div class ="card-body ">
26+ < h2 class ="card-title "> Result</ h2 >
27+ < p > {{ result }}</ p >
28+ </ div >
29+ </ div >
30+ {% else %}
31+ < p class ="text-lg "> Processing... Status will update automatically.</ p >
32+ {% endif %}
33+ </ div >
1734 {% endif %}
1835
19- < a href ="{% url 'playground_home' %} "> Submit another task</ a >
20- {% endblock%}
36+ < div class ="mt-8 text-center ">
37+ < a href ="{% url 'playground_home' %} " class ="btn btn-primary "> Submit another task</ a >
38+ </ div >
39+ </ div >
40+
41+ {% block extra_js %}
42+ < script >
43+ function updateProgress ( ) {
44+ const statusText = document . getElementById ( 'status-text' ) ;
45+ const radialProgress = document . querySelector ( '.radial-progress' ) ;
46+
47+ if ( statusText . textContent === 'PROCESSING' ) {
48+ // Increment progress by 5% every 2 seconds while processing
49+ const currentValue = parseInt ( radialProgress . style . getPropertyValue ( '--value' ) || '0' ) ;
50+ const newValue = Math . min ( currentValue + 5 , 95 ) ;
51+ radialProgress . style . setProperty ( '--value' , newValue ) ;
52+ radialProgress . setAttribute ( 'aria-valuenow' , newValue ) ;
53+ radialProgress . querySelector ( 'span' ) . textContent = `${ newValue } %` ;
54+ } else if ( statusText . textContent === 'COMPLETED' ) {
55+ radialProgress . style . setProperty ( '--value' , '100' ) ;
56+ radialProgress . setAttribute ( 'aria-valuenow' , '100' ) ;
57+ radialProgress . querySelector ( 'span' ) . textContent = '100%' ;
58+ }
59+ }
60+
61+ // Update progress every 2 seconds if status is PROCESSING
62+ setInterval ( updateProgress , 2000 ) ;
63+ </ script >
64+ {% endblock %}
65+ {% endblock %}
0 commit comments