File size: 2,780 Bytes
810bb77
 
 
 
 
 
 
 
 
 
 
 
43cb187
810bb77
 
 
 
 
 
 
 
 
 
 
 
 
6cec40e
afcea37
 
6cec40e
 
 
 
810bb77
 
 
 
 
 
 
 
 
 
 
 
 
eef3b3a
 
 
2fb5c70
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<div id="results-table">
    <h2 class="text-2xl font-bold text-blue-400 mb-4">Parsed Results: {{ filename }}</h2>
    <div class="table-container">
        <table class="w-full border-collapse text-sm">
            <thead>
                <tr class="bg-gray-700 text-blue-300">
                    <th class="p-4 text-left font-semibold">Part</th>
                    <th class="p-4 text-left font-semibold">Category</th>
                    <th class="p-4 text-left font-semibold">Node ID</th>
                    <th class="p-4 text-left font-semibold">Parent Path</th>
                    <th class="p-4 text-left font-semibold">Level</th>
                    <th class="p-4 text-left font-semibold">Location</th>
                    <th class="p-4 text-left font-semibold">Variable Role</th>
                    <th class="p-4 text-left font-semibold">Vector</th>
                    <th class="p-4 text-left font-semibold">Source</th>
                </tr>
            </thead>
            <tbody>
                {% for part in parts %}
                <tr class="border-b border-gray-700 hover:bg-gray-600 transition-colors">
                    <td class="p-4">{{ part.index }}</td>
                    <td class="p-4">{{ part.category }}</td>
                    <td class="p-4">{{ part.node_id }}</td>
                    <td class="p-4">{{ part.parent_path }}</td>
                    <td class="p-4">{{ part.level }}</td>
                    <td class="p-4">Lines {{ part.location[0] }} to {{ part.location[1] }}</td>
                    <td class="p-4">
                        {% if part.category in ['input_variable', 'assigned_variable', 'returned_variable'] %}
                            {{ part.category.replace('_variable', '') | capitalize }}
                        {% else %}
                            -
                        {% endif %}
                    </td>
                    <td class="p-4">[{{ part.vector|join(', ') }}]</td>
                    <td class="p-4">
                        <pre class="text-xs text-gray-300" style="margin-left: {{ part.level * 1.5 }}rem;">{{ part.source }}</pre>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    <div class="mt-8">
        <h3 class="text-xl font-bold text-blue-400 mb-2">Reconstructed Code</h3>
        <pre class="bg-gray-900 p-4 rounded-lg text-gray-300 text-sm">{{ reconstructed_code }}</pre>
    </div>
    <div class="mt-4 space-x-4">
        <button hx-post="/export_json" hx-headers='{"Content-Type": "application/json"}' hx-swap="none" hx-vals='{"parts": {{ parts|tojson|safe }}}' class="bg-green-500 text-white py-2 px-4 rounded-lg hover:bg-green-600 transition">Export to JSON</button>
    </div>
</div>