Add expand by default option to status page
If selected all of the patchset jobs will be visible by default rather than collapsed. Change-Id: Ib1be50924aee057201ee7a4b4937abac0b45d752
This commit is contained in:
parent
ace48891b2
commit
ae230f6aa1
|
@ -442,17 +442,40 @@
|
||||||
return $form_group;
|
return $form_group;
|
||||||
},
|
},
|
||||||
|
|
||||||
filter_form: function() {
|
expand_form_group: function() {
|
||||||
|
expand_by_default = (
|
||||||
|
read_cookie('zuul_expand_by_default', false) === 'true');
|
||||||
|
|
||||||
|
$checkbox = $('<input />')
|
||||||
|
.attr('type', 'checkbox')
|
||||||
|
.attr('id', 'expand_by_default')
|
||||||
|
.prop('checked', expand_by_default)
|
||||||
|
.change(zuul.handle_expand_by_default);
|
||||||
|
|
||||||
|
$label = $('<label />')
|
||||||
|
.css('padding-left', '1em')
|
||||||
|
.html('Expand by default: ')
|
||||||
|
.append($checkbox);
|
||||||
|
|
||||||
|
var $form_group = $('<div />')
|
||||||
|
.addClass('checkbox')
|
||||||
|
.append($label);
|
||||||
|
return $form_group;
|
||||||
|
},
|
||||||
|
|
||||||
|
control_form: function() {
|
||||||
// Build the filter form filling anything from cookies
|
// Build the filter form filling anything from cookies
|
||||||
|
|
||||||
$filter_form = $('<form />')
|
$control_form = $('<form />')
|
||||||
.attr('role', 'form')
|
.attr('role', 'form')
|
||||||
.addClass('form-inline')
|
.addClass('form-inline')
|
||||||
.submit(zuul.handle_filter_change);
|
.submit(zuul.handle_filter_change);
|
||||||
|
|
||||||
$filter_form.append(zuul.format.filter_form_group(
|
$control_form
|
||||||
current_filter));
|
.append(zuul.format.filter_form_group(current_filter))
|
||||||
return $filter_form;
|
.append(zuul.format.expand_form_group());
|
||||||
|
|
||||||
|
return $control_form;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -493,16 +516,16 @@
|
||||||
|
|
||||||
// See if we should hide the body/results
|
// See if we should hide the body/results
|
||||||
var $body = $panel.children(':not(.patchset-header)');
|
var $body = $panel.children(':not(.patchset-header)');
|
||||||
|
var expand_by_default = $('#expand_by_default').prop('checked');
|
||||||
var collapsed_index = zuul.collapsed_exceptions.indexOf(
|
var collapsed_index = zuul.collapsed_exceptions.indexOf(
|
||||||
$panel.attr('id'));
|
$panel.attr('id'));
|
||||||
if (collapsed_index == -1 ) {
|
if (expand_by_default && collapsed_index == -1 ||
|
||||||
// Currently not an exception
|
!expand_by_default && collapsed_index != -1) {
|
||||||
// we are hiding by default
|
// Expand by default, or is an exception
|
||||||
$body.hide();
|
$body.show(animate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Currently an exception
|
$body.hide(animate);
|
||||||
// Do nothing more (will display)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we should hide the whole panel
|
// Check if we should hide the whole panel
|
||||||
|
@ -553,6 +576,16 @@
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handle_expand_by_default: function(e) {
|
||||||
|
// Handle toggling expand by default
|
||||||
|
set_cookie('zuul_expand_by_default', e.target.checked);
|
||||||
|
zuul.collapsed_exceptions = [];
|
||||||
|
$('.zuul-change').each(function(index, obj) {
|
||||||
|
$panel = $(obj);
|
||||||
|
zuul.display_patchset($panel, 200);
|
||||||
|
})
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
current_filter = read_cookie('zuul_filter_string', current_filter);
|
current_filter = read_cookie('zuul_filter_string', current_filter);
|
||||||
|
@ -591,7 +624,7 @@
|
||||||
$queueEventsNum = $queueInfo.find('span').eq(0);
|
$queueEventsNum = $queueInfo.find('span').eq(0);
|
||||||
$queueResultsNum = $queueEventsNum.next();
|
$queueResultsNum = $queueEventsNum.next();
|
||||||
|
|
||||||
$filter_form = zuul.format.filter_form();
|
$control_form = zuul.format.control_form();
|
||||||
|
|
||||||
$pipelines = $('<div class="row"></div>');
|
$pipelines = $('<div class="row"></div>');
|
||||||
$zuulVersion = $('<p>Zuul version: <span id="zuul-version-span">' +
|
$zuulVersion = $('<p>Zuul version: <span id="zuul-version-span">' +
|
||||||
|
@ -600,7 +633,7 @@
|
||||||
'<span id="last-reconfigured-span"></span></p>');
|
'<span id="last-reconfigured-span"></span></p>');
|
||||||
|
|
||||||
$container = $('#zuul-container').append($msg, $indicator,
|
$container = $('#zuul-container').append($msg, $indicator,
|
||||||
$queueInfo, $filter_form,
|
$queueInfo, $control_form,
|
||||||
$pipelines, $zuulVersion,
|
$pipelines, $zuulVersion,
|
||||||
$lastReconf);
|
$lastReconf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue