217 lines
7.4 KiB
JavaScript
Raw Normal View History

// Copyright (c) 2014 VMware, Inc.
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
// Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
// this regex matches the hash part of review pages
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var hashRegex = /^\#\/c\/[\/\d]+$/;
// this regex matches CI comments
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ciRegex = /^(.* CI|Jenkins)$/;
// this regex matches "Patch set #"
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var psRegex = /^<p>(Uploaded patch set|Patch Set) (\d+)(:|\.)/;
// this regex matches merge failure messages
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var mergeFailedRegex = /Merge Failed\./;
// this regex matches the name of CI systems we trust to report merge failures
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var trustedCIRegex = /^(OpenStack CI|Jenkins)$/;
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_parse_psnum = function($panel) {
var match = psRegex.exec($panel.html());
if (match !== null) {
return parseInt(match[2]);
}
return 0;
};
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_parse_is_merge_conflict = function($panel) {
return (mergeFailedRegex.exec($panel.html()) !== null);
};
var ci_parse_results = function($panel) {
var result_list = [];
var test_results = $panel.find("li.comment_test");
if (test_results !== null) {
test_results.each(function(i, li) {
var result = {};
result["name"] = $(li).find("span.comment_test_name").find("a")[0].innerHTML;
result["link"] = $(li).find("span.comment_test_name").find("a")[0];
result["result"] = $(li).find("span.comment_test_result")[0];
result_list.push(result);
});
}
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
return result_list;
};
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_parse_comments = function() {
var comments = [];
$(".commentPanel").each(function() {
var comment = {};
comment.name = $(this).attr("name");
comment.email = $(this).attr("email");
comment.date = $(this).find(".commentPanelDateCell").attr("title");
var comment_panel = $(this).find(".commentPanelMessage");
comment.psnum = ci_parse_psnum(comment_panel);
comment.merge_conflict = ci_parse_is_merge_conflict(comment_panel);
comment.results = ci_parse_results(comment_panel);
comment.is_ci = (ciRegex.exec(comment.name) !== null);
comment.is_trusted_ci = (trustedCIRegex.exec(comment.name) !== null);
comment.ref = this;
comments.push(comment);
});
return comments;
};
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_latest_patchset = function(comments) {
var psnum = 0;
for (var i = 0; i < comments.length; i++) {
psnum = Math.max(psnum, comments[i].psnum);
}
return psnum;
};
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_is_merge_conflict = function(comments) {
var latest = ci_latest_patchset(comments);
var conflict = false;
for (var i = 0; i < comments.length; i++) {
var comment = comments[i];
// only if we are actually talking about the latest patch set
if (comment.psnum == latest) {
if (comment.is_trusted_ci) {
conflict = comment.merge_conflict;
}
}
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
}
return conflict;
};
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_prepare_results_table = function() {
// Create a table and insert it after the approval table
var table = $("table.test_result_table")[0];
if (!table) {
table = document.createElement("table");
$(table).addClass("test_result_table");
$(table).addClass("infoTable").css({"margin-top":"1em", "margin-bottom":"1em"});
var approval_table = $("div.approvalTable");
if (approval_table.length) {
var outer_table = document.createElement("table");
$(outer_table).insertBefore(approval_table);
var outer_table_row = document.createElement("tr");
$(outer_table).append(outer_table_row);
var td = document.createElement("td");
$(outer_table_row).append(td);
$(td).css({"vertical-align":"top"});
$(td).append(approval_table);
td = document.createElement("td");
$(outer_table_row).append(td);
$(td).css({"vertical-align":"top"});
$(td).append(table);
} else {
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var big_table_row = $("div.screen>div>div>table>tbody>tr");
var td = $(big_table_row).children()[1];
$(td).append(table);
}
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
} else {
$(table).empty();
}
return table;
};
var ci_display_results = function(comments) {
var table = ci_prepare_results_table();
if (ci_is_merge_conflict(comments)) {
var mc_header = $("<tr>").append($('<td class="merge_conflict" colpsan="2">Patch in Merge Conflict</td>'));
mc_header.css('width', '400');
mc_header.css('font-weight', 'bold');
mc_header.css('color', 'red');
mc_header.css('padding-left', '2em');
$(table).append(mc_header);
return;
}
var current = ci_latest_patchset(comments);
for (var i = 0; i < comments.length; i++) {
var comment = comments[i];
if ((comment.psnum == current) && comment.is_ci && (comment.results.length > 0)) {
var header = $("<tr>").append($('<td class="header">' + comment.name + '</td>'));
header.append('<td class="header ci_date">' + comment.date + '</td>');
$(table).append(header);
for (var j = 0; j < comment.results.length; j++) {
var result = comment.results[j];
var tr = $("<tr>");
tr.append($("<td>").append($(result["link"]).clone()));
tr.append($("<td>").append($(result["result"]).clone()));
$(table).append(tr);
}
}
}
};
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_toggle_visibility = function(comments) {
if (!comments) {
comments = ci_parse_comments();
}
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
$.each(comments, function(i, comment) {
if (comment.is_ci) {
$(comment.ref).toggle();
}
});
};
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_hide_ci_comments = function(comments) {
if (!comments) {
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
comments = ci_parse_comments();
}
$.each(comments, function(i, comment) {
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
if (comment.is_ci) {
$(comment.ref).hide();
}
});
};
refactor of hideci for readability and modularity This is a refactors the hideci code into much smaller functions, making the whole thing a bit more readable for fixing this going forward. This was done in order to add a couple of new features. The smaller functions should also make this code much easier to review. After the refactor we now do a top down parsing of all comments in a review, classifying them as 'is_ci' and 'is_trusted_ci' so that we can more easily compute the results we want going forward. In the process a few additional features were added. 1) CI results are only shown for the latest patch set, even if no CI system has reported on it. This is accomplished via ci_latest_patchset. 2) If CI system is in merge conflict, that's displayed in the results box. 3) Test results records are lifted in total to the test results display panel, and each set of test results includes the date that we got it from. This means that for patches that get 'rechecked' a lot, you'll see the whole history of test results on current patch. You will also be able to quickly realize that the current test results are older than the last recheck comment. The UX for part 3 is different, and may need tweaking going forward, however the merge of results from different runs was creating a lot of confusion to reviewers, so this errors on the side of more clarity. Because of the largely inconvenient workflow for development (the fact that you basically need to copy / paste function definitions into chrome dev console) this isn't broken up as smaller patches. This should, hopefully, make future patches much easier on this code though. Change-Id: I3f128a449756fd6988f3810863cd1d49c476b0dd
2014-09-28 09:32:51 -04:00
var ci_page_loaded = function() {
if (hashRegex.test(window.location.hash)) {
$("#toggleci").show();
var comments = ci_parse_comments();
ci_display_results(comments);
ci_hide_ci_comments(comments);
} else {
$("#toggleci").hide();
}
};
window.onload = function() {
var input = document.createElement("input");
input.id = "toggleci";
input.type = "button";
input.className = "gwt-Button";
input.value = "Toggle CI";
input.onclick = function() { ci_toggle_visibility(null); };
document.body.appendChild(input);
MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
var observer = new MutationObserver(function(mutations, observer) {
var span = $("span.rpcStatus");
$.each(mutations, function(i, mutation) {
if (mutation.target === span[0] &&
(!(span.is(":visible:")))) {
ci_page_loaded();
}
});
});
observer.observe(document, {
subtree: true,
attributes: true
});
};