|
41 | 41 | height: 20px; |
42 | 42 | } |
43 | 43 |
|
44 | | - tr.data-row:hover { |
| 44 | + tr.data-row:hover, tr.data-row.highlight { |
45 | 45 | background-color: rgb(51, 51, 68); |
46 | 46 | color: white; |
47 | 47 | cursor: pointer; |
|
108 | 108 | <th class="left-aligned">Tables</th> |
109 | 109 | <th class="right-aligned">Num. Joins</th> |
110 | 110 | <th class="right-aligned">Execution Time (ms)</th> |
| 111 | + <th class="right-aligned">Num. Duplicates</th> |
111 | 112 | </tr> |
112 | 113 | {% for sql_query in items %} |
113 | 114 | <!-- TODO: Pretty grimy... --> |
114 | | - <tr class="data-row" onclick="window.location=' \ |
| 115 | + <tr |
| 116 | + class="data-row" |
| 117 | + data-duplicate-id="{{ sql_query.duplicate_id }}" |
| 118 | + onclick="window.location=' \ |
115 | 119 | {% if profile and silk_request %}\ |
116 | 120 | {% url "silk:request_and_profile_sql_detail" silk_request.id profile.id sql_query.id %}\ |
117 | 121 | {% elif profile %}\ |
|
124 | 128 | <td class="left-aligned">{{ sql_query.tables_involved|join:", " }}</td> |
125 | 129 | <td class="right-aligned">{{ sql_query.num_joins }}</td> |
126 | 130 | <td class="right-aligned">{{ sql_query.time_taken | floatformat:6 }}</td> |
| 131 | + <td class="right-aligned">{{ sql_query.num_duplicates }}</td> |
127 | 132 | </tr> |
128 | 133 | {% endfor %} |
129 | 134 |
|
|
151 | 156 | </div> |
152 | 157 | </div> |
153 | 158 |
|
154 | | - |
155 | | - |
| 159 | +<script> |
| 160 | + const rows = document.querySelectorAll('tr.data-row').forEach(function (row) { |
| 161 | + row.addEventListener('mouseenter', function () { |
| 162 | + document.querySelectorAll('tr[data-duplicate-id="' + row.dataset.duplicateId + '"]').forEach(function (e) { |
| 163 | + e.classList.add('highlight'); |
| 164 | + }); |
| 165 | + }); |
| 166 | + row.addEventListener('mouseleave', function () { |
| 167 | + document.querySelectorAll('tr[data-duplicate-id="' + row.dataset.duplicateId + '"]').forEach(function (e) { |
| 168 | + e.classList.remove('highlight'); |
| 169 | + }); |
| 170 | + }); |
| 171 | + }); |
| 172 | +</script> |
156 | 173 |
|
157 | 174 |
|
158 | 175 | {% endblock %} |
0 commit comments