Merge lp:~joetalbott/ubuntu-ci-services-itself/webui_ticket_ordering into lp:ubuntu-ci-services-itself

Proposed by Joe Talbott
Status: Needs review
Proposed branch: lp:~joetalbott/ubuntu-ci-services-itself/webui_ticket_ordering
Merge into: lp:ubuntu-ci-services-itself
Diff against target: 212 lines (+81/-27)
3 files modified
webui/webui.js (+74/-20)
webui/webui_complete.js (+6/-6)
webui/webui_ticket_list.js (+1/-1)
To merge this branch: bzr merge lp:~joetalbott/ubuntu-ci-services-itself/webui_ticket_ordering
Reviewer Review Type Date Requested Status
Vincent Ladeuil (community) we-need-that-feature Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+211359@code.launchpad.net

Commit message

webui - Update tables to include ticket ID and update date and add sorting.

Description of the change

webui - Update tables to include ticket ID and update date and add sorting.

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

PASSED: Continuous integration, rev:395
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/447/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/447/rebuild

review: Approve (continuous-integration)
Revision history for this message
Joe Talbott (joetalbott) wrote :

You can see it here: http://15.125.83.231/

396. By Joe Talbott

webui - Add support for multiple tables and fix for missing tables.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:396
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/450/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/450/rebuild

review: Approve (continuous-integration)
Revision history for this message
Joe Talbott (joetalbott) wrote :

BTW, that link is already out-dated. :)

397. By Joe Talbott

webui - Make side-by-side divs the same height.

398. By Joe Talbott

webui - long line fix

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:398
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/452/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/452/rebuild

review: Approve (continuous-integration)
Revision history for this message
Vincent Ladeuil (vila) wrote :

So, I can't see it live (thanks for mentioning that in the comments !), but I encountered the issue this MP is solving: tickets in undefined order. That was even more confusing because I had several tickets with the same description.

review: Approve (we-need-that-feature)

Unmerged revisions

398. By Joe Talbott

webui - long line fix

397. By Joe Talbott

webui - Make side-by-side divs the same height.

396. By Joe Talbott

webui - Add support for multiple tables and fix for missing tables.

395. By Joe Talbott

merge with trunk

394. By Joe Talbott

webui - Table updates.

* Add separate tables for 'Completed' and 'Failed' tickets.
* Add ordering by Workflow Step (asc.) and update date (desc.)
* Add ticket ID and update date to tables (requested by asac)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'webui/webui.js'
2--- webui/webui.js 2014-03-14 21:32:56 +0000
3+++ webui/webui.js 2014-03-17 22:08:36 +0000
4@@ -179,6 +179,7 @@
5 elem.setHTML(new_div);
6 }
7 new_div = null;
8+ Y.webui.last_thing();
9
10 },
11 failure: function (tx, r, e) {
12@@ -248,7 +249,9 @@
13 make_subticket: function (data) {
14 var div = Y.Node.create("<div class='subticket'></div>"),
15 table = div.appendChild(Y.Node.create("<table>")),
16- hidden_fields = Y.Array(['id', 'resource_uri', 'current_workflow_step', 'status', 'source_package_upload']),
17+ hidden_fields = Y.Array(
18+ ['id', 'resource_uri', 'current_workflow_step', 'status', 'source_package_upload'],
19+ ),
20 key,
21 value,
22 tmp_th,
23@@ -410,10 +413,10 @@
24 description_p.appendChild(Y.Node.create('<pre>' + description + '</pre>'));
25 workflow_wrapper.appendChild("<h3>Landing Progress</h3>");
26
27- workflow_inner_div = workflow_wrapper.appendChild(Y.Node.create("<div class='workflow'></div>"));
28+ workflow_inner_div = workflow_wrapper.appendChild(Y.Node.create("<div class='workflow equal_height'></div>"));
29
30 ticket_wrapper.appendChild('<h3>Ticket Details</h3>');
31- ticket_div = ticket_wrapper.appendChild(Y.Node.create("<div class='ticket'></div>"));
32+ ticket_div = ticket_wrapper.appendChild(Y.Node.create("<div class='ticket equal_height'></div>"));
33
34 table = ticket_div.appendChild(Y.Node.create("<table></table>"));
35
36@@ -652,21 +655,27 @@
37 },
38 check_statuses: function () {
39 var ticket_id_map = {},
40- table_data = Y.webui.main_table.get('data').toJSON(),
41- i,
42+ table_data,
43+ i, j,
44 record,
45+ table_names = ['main_table', 'completed_table'],
46 ticket_id,
47 ticket_ids,
48 ids;
49
50- for (i = 0; i < table_data.length; i += 1) {
51- record = table_data[i];
52-
53- ticket_id = record.ticket_id;
54-
55- if (record.status !== 'Completed' && record.current_workflow_step !== 'Completed') {
56- if (ticket_id) {
57- ticket_id_map[ticket_id] = true;
58+ for (j = 0; j < table_names.length; j += 1) {
59+ if (Y.webui[table_names[j]]) {
60+ table_data = Y.webui[table_names[j]].get('data').toJSON();
61+ for (i = 0; i < table_data.length; i += 1) {
62+ record = table_data[i];
63+
64+ ticket_id = record.ticket_id;
65+
66+ if (record.status !== 'Completed' && record.current_workflow_step !== 'Completed') {
67+ if (ticket_id) {
68+ ticket_id_map[ticket_id] = true;
69+ }
70+ }
71 }
72 }
73 }
74@@ -768,21 +777,33 @@
75 },
76 add_item: function (item) {
77 var entry = item,
78- table = Y.webui.main_table,
79+ table,
80 id;
81
82 id = entry.id;
83
84+ if (entry.current_workflow_step === "Completed") {
85+ table = Y.webui.completed_table;
86+ } else if (entry.current_workflow_step === "Queued") {
87+ table = Y.webui.main_table;
88+ } else if (entry.current_workflow_step === "Failed") {
89+ table = Y.webui.failed_table;
90+ } else {
91+ table = Y.webui.main_table;
92+ }
93+
94 if (table) {
95 table.addRow({
96 title: entry.title,
97 current_workflow_step: entry.current_workflow_step,
98 status: entry.status,
99- ticket_id: id
100+ ticket_id: id,
101+ id: id,
102+ updated: entry.updated
103 });
104 }
105 },
106- make_main_table: function (div_id) {
107+ make_table: function (div_id) {
108
109 var link_it = function (o) {
110 return '<a class="row_link" href="/ticket.html?ticket_id=' +
111@@ -794,9 +815,11 @@
112 return link_it(o);
113 },
114 columns = [
115- {key: 'title', label: 'Title', formatter: format_id, allowHTML: true},
116- {key: 'current_workflow_step', label: 'Landing Progress', formatter: link_it, allowHTML: true},
117- {key: 'status', label: 'Status', formatter: link_it, allowHTML: true}
118+ {key: 'id', label: 'ID', formatter: link_it, allowHTML: true, sortable: true},
119+ {key: 'title', label: 'Title', formatter: format_id, allowHTML: true, sortable: true},
120+ {key: 'updated', label: 'Updated', formatter: link_it, allowHTML: true, sortable: true},
121+ {key: 'current_workflow_step', label: 'Landing Progress', formatter: link_it, allowHTML: true, sortable: true},
122+ {key: 'status', label: 'Status', formatter: link_it, allowHTML: true, sortable: true}
123 ],
124 data = [],
125 main_table;
126@@ -806,9 +829,40 @@
127 recordset: data
128 });
129
130+ main_table.sort(['current_workflow_step', 'updated']);
131+ main_table.toggleSort('updated');
132 main_table.render(div_id);
133
134- Y.webui.main_table = main_table;
135+ return main_table;
136+ },
137+ make_main_table: function (div_id) {
138+ Y.webui.main_table = Y.webui.make_table(div_id);
139+ },
140+ make_completed_table: function (div_id) {
141+ Y.webui.completed_table = Y.webui.make_table(div_id);
142+ },
143+ make_failed_table: function (div_id) {
144+ Y.webui.failed_table = Y.webui.make_table(div_id);
145+ },
146+ make_queued_table: function (div_id) {
147+ Y.webui.queued_table = Y.webui.make_table(div_id);
148+ },
149+ last_thing: function () {
150+ var cols = Y.Node.all('div.equal_height'),
151+ max_height = 0,
152+ i,
153+ col_height;
154+
155+ for (i = 0; i < cols.size(); i++) {
156+ col_height = parseInt(cols.item(i).getComputedStyle('height'), 10);
157+ if (col_height > max_height) {
158+ max_height = col_height;
159+ }
160+ }
161+
162+ for (i = 0; i < cols.size(); i++) {
163+ cols.item(i).setStyle('height', max_height);
164+ }
165 }
166 };
167
168
169=== modified file 'webui/webui_complete.js'
170--- webui/webui_complete.js 2014-03-17 03:13:14 +0000
171+++ webui/webui_complete.js 2014-03-17 22:08:36 +0000
172@@ -1,8 +1,8 @@
173 YUI().use('io', 'jsonp', 'webui', 'datatable-mutable', function(Y) {
174
175- var table = new Y.webui.make_main_table('#table');
176- if (Y.webui.main_table) {
177- Y.webui.main_table.showMessage("loading data...");
178+ var table = new Y.webui.make_completed_table('#table');
179+ if (Y.webui.completed_table) {
180+ Y.webui.completed_table.showMessage("loading data...");
181 }
182
183 Y.io(Y.webui.url_prefix + "ticketstatus/?current_workflow_step=1000", {
184@@ -15,7 +15,7 @@
185 try {
186 data = Y.JSON.parse(r.responseText);
187 } catch (e) {
188- Y.webui.main_table.showMessage(json_error_msg);
189+ Y.webui.completed_table.showMessage(json_error_msg);
190 return;
191 }
192
193@@ -27,8 +27,8 @@
194 }
195 Y.webui.check_statuses();
196 }
197- if (Y.webui.main_table.data.size() === 0) {
198- Y.webui.main_table.showMessage("No results found");
199+ if (Y.webui.completed_table.data.size() === 0) {
200+ Y.webui.completed_table.showMessage("No results found");
201 }
202 Y.webui.done_loading = true;
203 },
204
205=== modified file 'webui/webui_ticket_list.js'
206--- webui/webui_ticket_list.js 2014-03-14 18:27:36 +0000
207+++ webui/webui_ticket_list.js 2014-03-17 22:08:36 +0000
208@@ -1,4 +1,4 @@
209-YUI().use('event', 'node', 'datatable-mutable', 'webui', function(Y) {
210+YUI().use('event', 'node', 'datatable-mutable', 'datatable-sort', 'webui', function(Y) {
211
212 Y.webui.make_main_table('#table');
213

Subscribers

People subscribed via source and target branches