Merge lp:~joetalbott/qa-dashboard/eventstat_seconds into lp:qa-dashboard

Proposed by Joe Talbott
Status: Merged
Approved by: Paul Larson
Approved revision: 695
Merged at revision: 694
Proposed branch: lp:~joetalbott/qa-dashboard/eventstat_seconds
Merge into: lp:qa-dashboard
Diff against target: 179 lines (+48/-38)
3 files modified
common/static/js/graph.js (+44/-34)
eventstat/api.py (+0/-3)
qa_dashboard/settings.py (+4/-1)
To merge this branch: bzr merge lp:~joetalbott/qa-dashboard/eventstat_seconds
Reviewer Review Type Date Requested Status
Paul Larson Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+197634@code.launchpad.net

Commit message

eventstat - Don't show second Y axis if there is no duration column.

* also adds support for overriding STATIC_URL_BASE in local_settings.py

Description of the change

eventstat - Don't show second Y axis if there is no duration column.

* also adds support for overriding STATIC_URL_BASE in local_settings.py

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:695
http://s-jenkins.ubuntu-ci:8080/job/dashboard-ci/270/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/dashboard-ci/270/rebuild

review: Approve (continuous-integration)
Revision history for this message
Paul Larson (pwlars) wrote :

Looks ok to me, thanks for the speedy fix Joe!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'common/static/js/graph.js'
2--- common/static/js/graph.js 2013-10-17 20:23:04 +0000
3+++ common/static/js/graph.js 2013-12-04 02:59:31 +0000
4@@ -246,17 +246,18 @@
5 on: {
6 success: function (id, result) {
7 var data = Y.JSON.parse(result.responseText);
8+ var has_duration = false;
9
10 var values = Array();
11 var values_labels = Array();
12
13 var graphs = Array();
14
15+ var d = [values.length, null, null, null, null, null];
16 if (data.last_release_avg > 0) {
17- values.push([0, null, null, null, null, null, null, null]);
18- } else {
19- values.push([0, null, null, null, null, null, null]);
20+ d.push(null);
21 }
22+ values.push(d);
23 values_labels.push("");
24
25 for (x in data.image_data) {
26@@ -273,18 +274,21 @@
27 labels.push("");
28 }
29
30- row_data.push(record.duration);
31- labels.push("duration");
32+ if (record.hasOwnProperty('duration')) {
33+ has_duration = true;
34+ row_data.push(record.duration);
35+ labels.push("duration");
36+ }
37
38 values.push(row_data);
39 values_labels.push(record.build_number)
40 }
41
42+ d = [values.length, null, null, null, null, null];
43 if (data.last_release_avg > 0) {
44- values.push([values.length, null, null, null, null, null, null, null]);
45- } else {
46- values.push([values.length, null, null, null, null, null, null]);
47+ d.push(null);
48 }
49+ values.push(d);
50 values_labels.push("");
51
52 var width = 400;
53@@ -295,10 +299,7 @@
54 height = 400;
55 }
56
57- g = new Dygraph(
58- document.getElementById(div_id),
59- values,
60- {
61+ var graph_data = {
62 width: width,
63 height: height,
64 plotter: errorBarChartPlotter,
65@@ -310,15 +311,8 @@
66 drawXGrid: false,
67 drawYGrid: false,
68 ylabel: unit,
69- y2label: "seconds",
70 hideOverlayOnMouseOut: false,
71 legend: "always",
72- 'duration': {
73- axis: {
74- digitsAfterDecimal: 0,
75- valueRange: [0,1000]
76- }
77- },
78 unhighlightCallback: function(me, e) {
79 if (me.isZoomed('x')) return;
80 var range = me.xAxisRange();
81@@ -339,24 +333,40 @@
82 return "";
83 }
84 },
85- y2: {
86- ticker: function(min, max, pixels, opts, dygraph, vals) {
87- return [
88- {v:0, label:"0"},
89- {v:100, label:"100"},
90- {v:200, label:"200"},
91- {v:300, label:"300"},
92- {v:400, label:"400"},
93- {v:500, label:"500"},
94- {v:600, label:"600"},
95- {v:700, label:"700"},
96- {v:800, label:"800"},
97- {v:900, label:"900"}
98- ];
99- }
100+ }
101+ }
102+
103+ if (has_duration) {
104+ graph_data.y2label = "seconds";
105+ graph_data.duration = {
106+ axis: {
107+ digitsAfterDecimal: 0,
108+ valueRange: [0,1000]
109 }
110+ }
111+
112+ graph_data.axis.y2 = {
113+ ticker: function(min, max, pixels, opts, dygraph, vals) {
114+ return [
115+ {v:0, label:"0"},
116+ {v:100, label:"100"},
117+ {v:200, label:"200"},
118+ {v:300, label:"300"},
119+ {v:400, label:"400"},
120+ {v:500, label:"500"},
121+ {v:600, label:"600"},
122+ {v:700, label:"700"},
123+ {v:800, label:"800"},
124+ {v:900, label:"900"}
125+ ];
126 }
127 }
128+ }
129+
130+ g = new Dygraph(
131+ document.getElementById(div_id),
132+ values,
133+ graph_data
134 );
135
136 var rows = g.numRows();
137
138=== modified file 'eventstat/api.py'
139--- eventstat/api.py 2013-10-18 20:39:52 +0000
140+++ eventstat/api.py 2013-12-04 02:59:31 +0000
141@@ -90,7 +90,6 @@
142 max=metric.maximum,
143 avg=metric.average,
144 std=metric.stddev,
145- duration=0,
146 )
147 if method == "image":
148 image_info['build_number'] = metric.image.build_number
149@@ -142,7 +141,6 @@
150 max=t['maximum'],
151 avg=t['average'],
152 std=t['stddev'],
153- duration=0,
154 ),
155 )
156
157@@ -188,7 +186,6 @@
158 max=t['maximum'],
159 avg=t['average'],
160 std=t['stddev'],
161- duration=0,
162 ),
163 )
164
165
166=== modified file 'qa_dashboard/settings.py'
167--- qa_dashboard/settings.py 2013-12-02 20:29:32 +0000
168+++ qa_dashboard/settings.py 2013-12-04 02:59:31 +0000
169@@ -94,7 +94,10 @@
170 # Example: "/home/media/media.lawrence.com/static/"
171 STATIC_ROOT = 'www/static/'
172
173-STATIC_URL_BASE = '//assets.ubuntu.com/sites/dashboard/'
174+try:
175+ from local_settings import STATIC_URL_BASE
176+except ImportError:
177+ STATIC_URL_BASE = '//assets.ubuntu.com/sites/dashboard/'
178
179 from assets_revision import revision as assets_revision
180

Subscribers

People subscribed via source and target branches