Permalink
Browse files

fixed some bugs, cleaned up docs

  • Loading branch information...
1 parent 2e55d55 commit 55d3b084b63a1ce41e9406a016ff7025ce29d7d4 @jeads jeads committed Dec 6, 2012
@@ -8,6 +8,10 @@
This specifies the number of days ago to use as the start
date range for this response."""
+REQUIRE_PRODUCT_NAME = """Invalid Request: Require product parameter.
+ This specifies the name of the product to retrieve data
+ for (Firefox, Fennec etc...)"""
+
REQUIRE_TEST_NAME = """Invalid Request: Require test_name parameter.
This specifies the name of the test."""
@@ -21,6 +25,7 @@ def get_testdata(request, project, branch, revision):
Apply data filters and return all test data objects associated with the
revision.
"""
+ product_name = request.GET.get("product", None)
os_name = request.GET.get("os_name", None)
os_version = request.GET.get("os_version", None)
branch_version = request.GET.get("branch_version", None)
@@ -34,6 +39,7 @@ def get_testdata(request, project, branch, revision):
project,
branch,
revision,
+ product_name=product_name,
os_name=os_name,
os_version=os_version,
branch_version=branch_version,
@@ -147,15 +153,17 @@ def get_metrics_pushlog(request, project, branch, revision):
#are allowed
maximum_pushes = 1000
- pushes_before = 10
+ #cast pushes_before/pushes_after to an int to scrub user
+ #supplied data
+ pushes_before =5
try:
- pushes_before = int(request.GET.get("pushes_before", 10))
+ pushes_before = int(request.GET.get("pushes_before", pushes_before))
except ValueError:
pass
- pushes_after = 10
+ pushes_after = 5
try:
- pushes_after = int(request.GET.get("pushes_after", 10))
+ pushes_after = int(request.GET.get("pushes_after", pushes_after))
except ValueError:
pass
Oops, something went wrong.
@@ -175,7 +175,8 @@ div.su-grid-column {
text-align:center;
float: left;
width:30px;
- height:25px;
+ height:15px;
+ margin-bottom:10px;
}
div.su-grid-row {
float: left;
@@ -313,7 +314,7 @@ div.su-datum-desc-value {
white-space:nowrap;
position:absolute;
left:135px;
- margin-top:150px;
+ margin-top:160px;
}
div.su-wordwrap {
white-space: pre-wrap; /* CSS3 */
@@ -236,6 +236,7 @@ var MetricDashboardView = new Class({
$(option).val(
JSON.stringify(
{ 'product':data.products[i].product,
+ 'branch':data.products[i].branch,
'version':data.products[i].version }
)
);
@@ -254,12 +255,16 @@ var MetricDashboardView = new Class({
$(this.revisionProductsSel).change(
_.bind( function(event){
var selectedOption = $(event.target).find(':selected');
-
var value = $(selectedOption).val();
var productData = JSON.parse(value);
- var uri = MS_PAGE.urlObj.attr.path +
- '?product=' + productData.product +
+ //Substitute the selected branch
+ var uri = MS_PAGE.urlObj.attr.path.replace(
+ /(summary\/)(.*?)\//g,
+ "$1" + productData.branch + "/"
+ );
+
+ uri += '?product=' + productData.product +
'&branch_version=' + productData.version;
if(MS_PAGE.urlObj.param.query.test){
@@ -35,16 +35,7 @@ var MetricGridComponent = new Class({
}else{
this.view.initializeGrid(data);
}
- },
- dataLoadError: function(data, textStatus, jqXHR){
-
- var messageText = 'Ohhh no, something has gone horribly wrong! ';
-
- messageText += ' HTTP status:' + data.status + ', ' + textStatus +
- ', ' + data.statusText;
-
}
-
});
var MetricGridView = new Class({
@@ -66,6 +57,8 @@ var MetricGridView = new Class({
this.gridRowHeaderClass = 'su-grid-row';
this.gridValueClass = 'su-grid-value';
+ this.guidearrowClassSel = '.su-guidearrow-box';
+
//Data attributes
this.dataTitlesAttr = 'data-titles';
@@ -74,6 +67,9 @@ var MetricGridView = new Class({
this.gridRowHeaderClassSel = '.su-row-headers';
this.gridValuesClassSel = '.su-grid-values';
+ this.tableContainerSel = '#su_table_container';
+ this.gridContainerSel = '#su_grid_container';
+
this.gridScrollMultiplier = 1.5;
this.gridScrollContainer = '#su_grid_scroll_container';
this.gridScrollBoundary = '#su_boundry';
@@ -105,17 +101,54 @@ var MetricGridView = new Class({
$(this.gridSpinnerSel).css('display', 'none');
+ var columns, rows = [];
+
if(data){
- $(this.testSuiteDashboardContainerSel).css('display', 'block');
- }
- var columns = this.getAlphabeticalSortKeys(
- data.summary_by_platform
- );
+ columns = this.getAlphabeticalSortKeys(
+ data.summary_by_platform
+ );
+
+ rows = this.getAlphabeticalSortKeys(
+ data.summary_by_test
+ );
+
+ $(this.testSuiteDashboardContainerSel).css(
+ 'display', 'block'
+ );
+
+ if( (columns.length === 1) && (rows.length === 1) ){
+ //If there's only one column and one row there's no need
+ //for the grid. Expand the table to 100% of the panel
+ $(this.gridContainerSel).css('display', 'none');
+ $(this.gridSel).css('display', 'none');
+ $(this.gridScrollContainer).css('display', 'none');
+ $(this.guidearrowClassSel).css('display', 'none');
+
+ //Expand table
+ MS_PAGE.testPagesComponent.view.expandTable();
+
+ var initializeValue = "";
+
+ if(data.tests[test] && data.tests[test][platform]){
+ initializeValue = data.tests[ rows[0] ][ columns[0] ]['pass']['percent'];
+ }
+
+ var initializeCell = this.getValueCell(
+ columns[0],
+ rows[0],
+ initializeValue
+ );
+
+ //Trigger initialize event for the one column/row
+ this._triggerEvent(
+ this.gridMouseoverEvent, initializeCell
+ );
+
+ return;
+ }
+ }
- var rows = this.getAlphabeticalSortKeys(
- data.summary_by_test
- );
var columnTitle, rowTitle = "";
@@ -128,24 +161,28 @@ var MetricGridView = new Class({
}
- var valueRowWidth = columns.length*30 + columns.length;
+ var cellWidth = parseInt(
+ $('.' + this.gridColumnHeaderClass).css('width')
+ );
+ //Calculate the width based on total numbers of columns
+ //and width of an individual cell
+ var valueRowWidth = columns.length*cellWidth + columns.length;
+
+ //Set width of container of individual cells
$(this.gridValuesClassSel).css('width', valueRowWidth);
+ //Set width of container of column labels
+ $(this.gridColumnHeaderClassSel).css('width', valueRowWidth);
- var scrollWidth = parseInt(
- $('#su_grid_scroll_container').css('width')
+ var headerWidth = parseInt(
+ $(this.gridRowHeaderClassSel).css('width')
);
- if( (scrollWidth - 60) <= valueRowWidth ){
- $(this.gridScrollContainer).css(
- 'width', valueRowWidth*this.gridScrollMultiplier
- );
- $(this.gridScrollBoundary).css(
- 'width', valueRowWidth*this.gridScrollMultiplier
- );
- }
-
- $(this.gridColumnHeaderClassSel).css('width', valueRowWidth);
+ //The width of the scroll container needs to be set dynamically
+ //based on the width of all of the rows, row headers, and cell width
+ $(this.gridScrollContainer).css(
+ 'width', cellWidth + valueRowWidth + headerWidth
+ );
for(var r=0; r<rows.length; r++){
@@ -192,6 +192,16 @@ var TestPagesView = new Class({
}
}
},
+ expandTable: function(){
+
+ //This is called when there is no grid to display
+ //when there only one test suite and platform
+ //combination are present.
+ $(this.tableContainerSel).css('width', '100%');
+ $(this.tableContainerSel).css('margin-top', 0);
+ $(this.tableContainerSel).css('margin-bottom', 10);
+
+ },
_adaptData: function(datatableOptions, data){
var adaptedData = [];
@@ -214,8 +224,12 @@ var TestPagesView = new Class({
this.defaultRowCbSel = '#' + key;
}
- //page name
+ //row is an associative array required by datatables.js where
+ //the key is the index of the displayed row array and the value
+ //is the value to place at that location in the table
var row = {};
+
+ //Build input box with data-pagename parameter
row['0'] = '<input id="' + key +
'" type="checkbox" data-pagename="' + bars[i] + '" />';
Oops, something went wrong.
@@ -93,19 +93,23 @@
<span class="ui-icon ui-icon-help"></span>
</a>
- <div style="width:250px; position:absolute; left:170px; top:460px; opacity:0.6;" class="ui-widget ui-corner-all arrow_box">
- <div style="margin-top:10px; margin-bottom:10px; margin-left:10px; margin-right:10px;">Tip: Mouse over grid to load a test suite table. Click a cell to lock.</div>
- </div>
+ <div id="su_grid_container">
+
+ <div style="width:250px; position:absolute; left:170px; top:460px; opacity:0.6;" class="ui-widget ui-corner-all arrow_box">
+ <div style="margin-top:10px; margin-bottom:10px; margin-left:10px; margin-right:10px;">Tip: Mouse over grid to load a test suite table. Click a cell to lock.</div>
+ </div>
- <div id="su_grid" style="margin-top:80px;" class="su-light-text css-left">
- <div id="su_boundary" style="width:430px;">
- <div class="su-column-headers"></div>
- <div id="su_grid_scroll_container" style="width:430px; height:175px; overflow-y:auto;" class="css-left">
- <div class="su-row-headers"></div>
- <div class="su-grid-values"></div>
+ <div id="su_grid" style="margin-top:80px;" class="su-light-text css-left">
+ <div id="su_boundary" style="width:430px;">
+ <div class="su-column-headers"></div>
+ <div id="su_grid_scroll_container" style="width:430px; height:230px; overflow-y:auto;" class="css-left">
+ <div class="su-row-headers"></div>
+ <div class="su-grid-values"></div>
+ </div>
</div>
</div>
</div>
+
<div id="su_table_container" style="width:42%; height:380px; margin-top:25px;" class="css-right">
<div class="su-large-text css-left"><span class="su-light-text2">Test Suite:</span><span id="su_test_suite" class="su-light-text"></span><span style="margin-left:15px;" class="su-light-text2">Platform:</span><span id="su_platform" class="su-light-text"></span></div>
<table id="su_test_pages" cellpadding="0" cellspacing="0" border="0" class="display"></table>
@@ -191,6 +195,8 @@ <h2 style="margin-left:185px;">Revision Pushlog</h2>
{% else %}
<script type="text/javascript" src="/static/js/metric_summary/metric-summary-min.js"></script>
+
+<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="/static/js/plugins/flot-0.7/excanvas.min.js"></script><![endif]-->
{% endif %}
Oops, something went wrong.

0 comments on commit 55d3b08

Please sign in to comment.