Skip to content

Commit 33110ca

Browse files
Soluminrchen152
authored andcommitted
Make it obvious which query in the table is currently active.
PiperOrigin-RevId: 515479028
1 parent d7b2fe2 commit 33110ca

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pytype/tools/debugger/visualizer.html.jinja2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
background-color: lightsteelblue;
105105
}
106106
107+
tr.datarow.selected-row {
108+
background-color: lightsteelblue;
109+
}
110+
107111
table, th, td {
108112
border: 1px solid;
109113
border-collapse: collapse;
@@ -147,7 +151,7 @@
147151
<th>Description</th> <!-- Query Description -->
148152
</tr>
149153
{%- for query in query_table %}
150-
<tr class=datarow onclick="vis.setup_query({{loop.index0}})" onmouseover="vis.highlight_cfgnode({{query.start_node}})" onmouseout="vis.unhighlight_cfgnode({{query.start_node}})">
154+
<tr id="query_row{{loop.index0}}" class=datarow onclick="select_query({{loop.index0}})" onmouseover="vis.highlight_cfgnode({{query.start_node}})" onmouseout="vis.unhighlight_cfgnode({{query.start_node}})">
151155
<td>{{query.solver_idx}}</td>
152156
<td>{{query.from_cache}}</td>
153157
<td>{{query.shortcircuited}}</td>

pytype/tools/debugger/visualizer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@
1313
* more complex than that.
1414
*/
1515

16+
/**
17+
* Highlights the selected query table row and starts the query.
18+
* @param {number} query_id the id of the query, corresponding to the row in the
19+
* query table.
20+
*/
21+
function select_query(query_id) {
22+
for (const elem of document.getElementsByClassName("datarow")) {
23+
elem.classList.remove("selected-row");
24+
}
25+
document.getElementById("query_row"+query_id).classList.add("selected-row");
26+
vis.setup_query(query_id);
27+
}
28+
1629
/**
1730
* Visualizer handles manipulating the Cytoscape instance using the pytype
1831
* program data.

0 commit comments

Comments
 (0)