From ace48891b26445274a5058c4b5fed58c483aa603 Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Sat, 22 Mar 2014 17:18:31 +1100 Subject: [PATCH] Add a filter box to status.html Allows filtering on the changeid, pipeline or project name similar to infra's status page Change-Id: I3f4c5b2de8654f67f5534f4b1e7c44bb5c4cf9e8 --- etc/status/public_html/app.js | 152 ++++++++++++++++++++++++++++++++-- 1 file changed, 143 insertions(+), 9 deletions(-) diff --git a/etc/status/public_html/app.js b/etc/status/public_html/app.js index a397121ff5..22c1ed7ba1 100644 --- a/etc/status/public_html/app.js +++ b/etc/status/public_html/app.js @@ -21,6 +21,7 @@ var $container, $msg, $indicator, $queueInfo, $queueEventsNum, $queueResultsNum, $pipelines, $jq; var xhr, zuul, + current_filter = '', demo = location.search.match(/[?&]demo=([^?&]*)/), source_url = location.search.match(/[?&]source_url=([^?&]*)/), source = demo ? @@ -28,6 +29,24 @@ 'status.json'; source = source_url ? source_url[1] : source; + function set_cookie(name, value) { + document.cookie = name + "=" + value + "; path=/"; + } + + function read_cookie(name, default_value) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for(var i=0;i < ca.length;i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') c = c.substring(1, c.length); + if (c.indexOf(nameEQ) == 0) { + return c.substring(nameEQ.length, c.length); + } + } + return default_value; + } + + zuul = { enabled: true, collapsed_exceptions: [], @@ -281,10 +300,13 @@ .append($change_progress_row_left) .append($change_progress_row_right) + $project_span = $('') + .addClass('change_project') + .text(change.project); + $left = $('
') .addClass('col-xs-8') - .html(change.project + '
') - .append($change_progress_row); + .append($project_span, $('
'), $change_progress_row); remaining_time = zuul.format.time(change.remaining_time, true); enqueue_time = zuul.format.enqueue_time(change.enqueue_time); @@ -333,7 +355,6 @@ .append(zuul.format.change_list(change.jobs)); $header.click(zuul.toggle_patchset); - zuul.display_patchset($panel); return $panel; }, @@ -371,12 +392,68 @@ ); } $.each(changes, function (changeNum, change) { - $html.append(zuul.format.change_panel(change)) + var $panel = zuul.format.change_panel(change); + $html.append($panel) + zuul.display_patchset($panel); }); }); }); return $html; - } + }, + + filter_form_group: function(default_text) { + // Update the filter form with a clear button if required + + var $label = $('