Commit d3cd603b authored by Annabel Dunstone's avatar Annabel Dunstone

Hide dropdown if all tests fit on one line; add counter to dropdown

parent 283c1dc3
...@@ -135,12 +135,20 @@ ...@@ -135,12 +135,20 @@
Build.prototype.displayTestStatuses = function() { Build.prototype.displayTestStatuses = function() {
$jobTopPosition = $('.build-job').first().offset().top; $jobTopPosition = $('.build-job').first().offset().top;
$dropdownCounter = [];
$('.build-job').each(function() { $('.build-job a').each(function() {
if ($(this).offset().top > $jobTopPosition) { if ($(this).offset().top > $jobTopPosition) {
$dropdownCounter.push($(this));
$('.overflow-jobs > li').append($(this)); $('.overflow-jobs > li').append($(this));
} }
}) })
$('.more-tests').text('More (' + $dropdownCounter.length + ')');
if ($('.overflow-jobs > li > a').length == 0) {
$('.overflow-jobs-dropdown').hide();
}
}; };
return Build; return Build;
......
...@@ -61,6 +61,16 @@ ...@@ -61,6 +61,16 @@
margin-right: 3px; margin-right: 3px;
} }
} }
.overflow-jobs-dropdown {
float: right;
padding: 7px 0 7px 5px;
.dropdown-menu-toggle {
width: auto;
border: none;
}
}
} }
.build-header { .build-header {
......
...@@ -7,24 +7,24 @@ ...@@ -7,24 +7,24 @@
- builds = @build.pipeline.builds.latest.to_a - builds = @build.pipeline.builds.latest.to_a
- if builds.size > 1 - if builds.size > 1
.dropdown.overflow-jobs-dropdown
%button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'}
%span.more-tests More
= icon('caret-down')
%ul.dropdown-menu.dropdown-menu-align-right.overflow-jobs
%li
%ul.nav-links.no-top.no-bottom %ul.nav-links.no-top.no-bottom
- statuses = ["failed", "pending", "running", "canceled", "skipped", "success"] - statuses = ["failed", "pending", "running", "canceled", "skipped", "success"]
- statuses.each do |build_status| - statuses.each do |build_status|
- builds.select{|build| build.status == build_status}.each do |build| - builds.select{|build| build.status == build_status}.each do |build|
%li{class: ('active' if build == @build) } %li.build-job{class: ('active' if build == @build) }
= link_to namespace_project_build_path(@project.namespace, @project, build), class: 'build-job' do = link_to namespace_project_build_path(@project.namespace, @project, build) do
= ci_icon_for_status(build.status) = ci_icon_for_status(build.status)
%span %span
- if build.name - if build.name
= build.name = build.name
- else - else
= build.id = build.id
.dropdown
%button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'}
%span Test Name
= icon('chevron-down')
%ul.dropdown-menu.overflow-jobs
%li
- if @build.retried? - if @build.retried?
%li.active %li.active
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment