Skip to content

Commit 94d8e3c

Browse files
committed
allow up to two environments on timeline and other smaller fixes
1 parent 3e55b90 commit 94d8e3c

6 files changed

Lines changed: 267 additions & 133 deletions

File tree

codespeed/static/css/main.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ div.about_content { text-align: left; }
234234
.boxbody input { margin-left: 0; vertical-align: top; }
235235
#options li { margin-bottom: 0.8em; }
236236
.seriescolor { float: right; margin-top: 2px; height: 13px; width: 14px; }
237+
.envlinecolor { float: right; font-size: 12px; line-height: 18px; color: #555; }
237238
.compplot-wrap { display: inline-block; }
238239
a.togglefold { font-size: normal; color: #000000; }
239240
a.togglefold::before {

codespeed/static/js/changes.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ function updateRevisionMarkers(env_id) {
9393
});
9494
$("#revision").html(options);
9595
$("#revision").val(current);
96+
if (!$("#revision").val()) {
97+
$("#revision").prop('selectedIndex', 0);
98+
}
9699
}
97100

98101
function refreshContent() {
@@ -123,8 +126,19 @@ function changeRevisions() {
123126
selected_project = projectmatrix[executable];
124127

125128
if (selected_project !== currentproject) {
129+
var oldRevs = revisiondata[currentproject] || [];
130+
var oldEntry = oldRevs.find(function(r) { return r[1] === $("#revision").val(); });
131+
var oldDate = oldEntry ? new Date(oldEntry[0].slice(0, 19)) : null;
126132
currentproject = selected_project;
127133
updateRevisionMarkers($("input[name='environment']:checked").val());
134+
if (oldDate) {
135+
var newRevs = revisiondata[currentproject] || [];
136+
var best = newRevs.reduce(function(bi, r, i) {
137+
return Math.abs(new Date(r[0].slice(0, 19)) - oldDate) <
138+
Math.abs(new Date(newRevs[bi][0].slice(0, 19)) - oldDate) ? i : bi;
139+
}, 0);
140+
$("#revision").prop('selectedIndex', best);
141+
}
128142

129143
//Give visual cue that the select box has changed
130144
var bgc = $("#revision").parent().parent().css("backgroundColor");

0 commit comments

Comments
 (0)