Commit c236ee4d authored by Jacob Schatz's avatar Jacob Schatz Committed by Ruben Davila

Merge branch '18516-collapse-build-tabs' into 'master'

Collapse build tabs that don't fit

## What does this MR do?
* Orders tests from `failed` > `pending` > `running` > `canceled` > `skipped` > `success`
* Put stages in one dropdown
* Once stage is selected, second dropdown shows all builds/jobs for that stage

## Are there points in the code the reviewer needs to double check?

## Why was this MR needed?
So many tests!   
<img src="/uploads/d581b2670588121c6d64823f61906a1a/Screen_Shot_2016-08-01_at_9.52.50_AM.png" width="600px">

## What are the relevant issue numbers?
Closes #18516    
Part of #19982

## Screenshots (if relevant)
![Screen_Shot_2016-08-17_at_1.14.20_PM](/uploads/fa183361ed13137257caf20a6afc4ef1/Screen_Shot_2016-08-17_at_1.14.20_PM.png)
![Screen_Shot_2016-08-17_at_1.14.39_PM](/uploads/f568cac463abf5c625cf31912ddbd00a/Screen_Shot_2016-08-17_at_1.14.39_PM.png)

See merge request !5595
parent 26730316
...@@ -101,6 +101,7 @@ v 8.11.0 (unreleased) ...@@ -101,6 +101,7 @@ v 8.11.0 (unreleased)
- Make error pages responsive (Takuya Noguchi) - Make error pages responsive (Takuya Noguchi)
- The performance of the project dropdown used for moving issues has been improved - The performance of the project dropdown used for moving issues has been improved
- Fix skip_repo parameter being ignored when destroying a namespace - Fix skip_repo parameter being ignored when destroying a namespace
- Add all builds into stage/job dropdowns on builds page
- Change requests_profiles resource constraint to catch virtually any file - Change requests_profiles resource constraint to catch virtually any file
- Bump gitlab_git to lazy load compare commits - Bump gitlab_git to lazy load compare commits
- Reduce number of queries made for merge_requests/:id/diffs - Reduce number of queries made for merge_requests/:id/diffs
......
...@@ -6,19 +6,26 @@ ...@@ -6,19 +6,26 @@
Build.state = null; Build.state = null;
function Build(page_url, build_url, build_status, state1) { function Build(options) {
this.page_url = page_url; this.page_url = options.page_url;
this.build_url = build_url; this.build_url = options.build_url;
this.build_status = build_status; this.build_status = options.build_status;
this.state = state1; this.state = options.state1;
this.build_stage = options.build_stage;
this.hideSidebar = bind(this.hideSidebar, this); this.hideSidebar = bind(this.hideSidebar, this);
this.toggleSidebar = bind(this.toggleSidebar, this); this.toggleSidebar = bind(this.toggleSidebar, this);
this.updateDropdown = bind(this.updateDropdown, this);
clearInterval(Build.interval); clearInterval(Build.interval);
this.bp = Breakpoints.get(); this.bp = Breakpoints.get();
this.hideSidebar();
$('.js-build-sidebar').niceScroll(); $('.js-build-sidebar').niceScroll();
this.populateJobs(this.build_stage);
this.updateStageDropdownText(this.build_stage);
this.hideSidebar();
$(document).off('click', '.js-sidebar-build-toggle').on('click', '.js-sidebar-build-toggle', this.toggleSidebar); $(document).off('click', '.js-sidebar-build-toggle').on('click', '.js-sidebar-build-toggle', this.toggleSidebar);
$(window).off('resize.build').on('resize.build', this.hideSidebar); $(window).off('resize.build').on('resize.build', this.hideSidebar);
$(document).off('click', '.stage-item').on('click', '.stage-item', this.updateDropdown);
this.updateArtifactRemoveDate(); this.updateArtifactRemoveDate();
if ($('#build-trace').length) { if ($('#build-trace').length) {
this.getInitialBuildTrace(); this.getInitialBuildTrace();
...@@ -132,6 +139,22 @@ ...@@ -132,6 +139,22 @@
} }
}; };
Build.prototype.populateJobs = function(stage) {
$('.build-job').hide();
$('.build-job[data-stage="' + stage + '"]').show();
};
Build.prototype.updateStageDropdownText = function(stage) {
$('.stage-selection').text(stage);
};
Build.prototype.updateDropdown = function(e) {
e.preventDefault();
var stage = e.currentTarget.text;
this.updateStageDropdownText(stage);
this.populateJobs(stage);
};
return Build; return Build;
})(); })();
......
...@@ -222,3 +222,7 @@ header.header-pinned-nav { ...@@ -222,3 +222,7 @@ header.header-pinned-nav {
padding-right: $sidebar_collapsed_width; padding-right: $sidebar_collapsed_width;
} }
} }
.right-sidebar {
border-left: 1px solid $border-color;
}
...@@ -53,14 +53,6 @@ ...@@ -53,14 +53,6 @@
left: 70px; left: 70px;
} }
} }
.nav-links {
svg {
position: relative;
top: 2px;
margin-right: 3px;
}
}
} }
.build-header { .build-header {
...@@ -108,24 +100,98 @@ ...@@ -108,24 +100,98 @@
} }
.right-sidebar.build-sidebar { .right-sidebar.build-sidebar {
padding-top: $gl-padding; padding: $gl-padding 0;
padding-bottom: $gl-padding;
&.right-sidebar-collapsed { &.right-sidebar-collapsed {
display: none; display: none;
} }
.blocks-container {
padding: $gl-padding;
}
.block { .block {
width: 100%; width: 100%;
} }
.build-sidebar-header { .build-sidebar-header {
padding-top: 0; padding: 0 $gl-padding $gl-padding;
.gutter-toggle { .gutter-toggle {
margin-top: 0; margin-top: 0;
} }
} }
.stage-item {
cursor: pointer;
&:hover {
color: $gl-text-color;
}
}
.build-dropdown {
padding: 0 $gl-padding;
.dropdown-menu-toggle {
margin-top: 8px;
}
.dropdown-menu {
right: $gl-padding;
left: $gl-padding;
width: auto;
}
}
.builds-container {
margin-top: $gl-padding;
background-color: $white-light;
border-top: 1px solid $border-color;
border-bottom: 1px solid $border-color;
max-height: 300px;
overflow: scroll;
svg {
position: relative;
top: 2px;
margin-right: 3px;
height: 13px;
}
a {
display: block;
padding: $gl-padding 10px $gl-padding 40px;
width: 270px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&:hover {
background-color: $row-hover;
color: $gl-text-color;
}
}
.build-job {
position: relative;
.fa {
position: absolute;
left: 15px;
top: 20px;
display: none;
}
&.active {
font-weight: bold;
.fa {
display: block;
}
}
}
}
} }
.build-detail-row { .build-detail-row {
......
...@@ -11,98 +11,133 @@ ...@@ -11,98 +11,133 @@
%p.build-detail-row %p.build-detail-row
#{@build.coverage}% #{@build.coverage}%
- if can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?) - builds = @build.pipeline.builds.latest.to_a
.block{ class: ("block-first" if !@build.coverage) } - statuses = ["failed", "pending", "running", "canceled", "success", "skipped"]
.title - if builds.size > 1
Build artifacts .dropdown.build-dropdown
- if @build.artifacts_expired? .build-light-text Stage
%p.build-detail-row %button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'}
The artifacts were removed %span.stage-selection More
#{time_ago_with_tooltip(@build.artifacts_expire_at)} = icon('caret-down')
- elsif @build.artifacts_expire_at %ul.dropdown-menu
%p.build-detail-row - builds.map(&:stage).uniq.each do |stage|
The artifacts will be removed in %li
%span.js-artifacts-remove= @build.artifacts_expire_at %a.stage-item= stage
- if @build.artifacts? .builds-container
.btn-group.btn-group-justified{ role: :group } - statuses.each do |build_status|
- if @build.artifacts_expire_at - builds.select{|build| build.status == build_status}.each do |build|
= link_to keep_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post do .build-job{class: ('active' if build == @build), data: {stage: build.stage}}
Keep = link_to namespace_project_build_path(@project.namespace, @project, build) do
= icon('check')
= ci_icon_for_status(build.status)
%span
- if build.name
= build.name
- else
= build.id
= link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do - if @build.retried?
Download %li.active
%a
Build ##{@build.id}
&middot;
%i.fa.fa-warning
This build was retried.
- if @build.artifacts_metadata? .blocks-container
= link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do - if can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?)
Browse .block{ class: ("block-first" if !@build.coverage) }
.title
Build artifacts
- if @build.artifacts_expired?
%p.build-detail-row
The artifacts were removed
#{time_ago_with_tooltip(@build.artifacts_expire_at)}
- elsif @build.artifacts_expire_at
%p.build-detail-row
The artifacts will be removed in
%span.js-artifacts-remove= @build.artifacts_expire_at
.block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) } - if @build.artifacts?
.title .btn-group.btn-group-justified{ role: :group }
Build details - if @build.artifacts_expire_at
- if can?(current_user, :update_build, @build) && @build.retryable? = link_to keep_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post do
= link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right', method: :post Keep
- if @build.merge_request
%p.build-detail-row = link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
%span.build-light-text Merge Request: Download
= link_to "#{@build.merge_request.to_reference}", merge_request_path(@build.merge_request)
- if @build.duration
%p.build-detail-row
%span.build-light-text Duration:
= time_interval_in_words(@build.duration)
- if @build.finished_at
%p.build-detail-row
%span.build-light-text Finished:
#{time_ago_with_tooltip(@build.finished_at)}
- if @build.erased_at
%p.build-detail-row
%span.build-light-text Erased:
#{time_ago_with_tooltip(@build.erased_at)}
%p.build-detail-row
%span.build-light-text Runner:
- if @build.runner && current_user && current_user.admin
= link_to "##{@build.runner.id}", admin_runner_path(@build.runner.id)
- elsif @build.runner
\##{@build.runner.id}
.btn-group.btn-group-justified{ role: :group }
- if @build.has_trace?
= link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default'
- if @build.active?
= link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post
- if can?(current_user, :update_build, @project) && @build.erasable?
= link_to erase_namespace_project_build_path(@project.namespace, @project, @build),
class: "btn btn-sm btn-default", method: :post,
data: { confirm: "Are you sure you want to erase this build?" } do
Erase
- if @build.trigger_request - if @build.artifacts_metadata?
.build-widget = link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do
%h4.title Browse
Trigger
%p .block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) }
%span.build-light-text Token: .title
#{@build.trigger_request.trigger.short_token} Build details
- if can?(current_user, :update_build, @build) && @build.retryable?
= link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right', method: :post
- if @build.merge_request
%p.build-detail-row
%span.build-light-text Merge Request:
= link_to "#{@build.merge_request.to_reference}", merge_request_path(@build.merge_request)
- if @build.duration
%p.build-detail-row
%span.build-light-text Duration:
= time_interval_in_words(@build.duration)
- if @build.finished_at
%p.build-detail-row
%span.build-light-text Finished:
#{time_ago_with_tooltip(@build.finished_at)}
- if @build.erased_at
%p.build-detail-row
%span.build-light-text Erased:
#{time_ago_with_tooltip(@build.erased_at)}
%p.build-detail-row
%span.build-light-text Runner:
- if @build.runner && current_user && current_user.admin
= link_to "##{@build.runner.id}", admin_runner_path(@build.runner.id)
- elsif @build.runner
\##{@build.runner.id}
.btn-group.btn-group-justified{ role: :group }
- if @build.has_trace?
= link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default'
- if @build.active?
= link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post
- if can?(current_user, :update_build, @project) && @build.erasable?
= link_to erase_namespace_project_build_path(@project.namespace, @project, @build),
class: "btn btn-sm btn-default", method: :post,
data: { confirm: "Are you sure you want to erase this build?" } do
Erase
- if @build.trigger_request
.build-widget
%h4.title
Trigger
- if @build.trigger_request.variables
%p %p
%span.build-light-text Variables: %span.build-light-text Token:
#{@build.trigger_request.trigger.short_token}
- if @build.trigger_request.variables
%p
%span.build-light-text Variables:
- @build.trigger_request.variables.each do |key, value|
%code
#{key}=#{value}
.block - @build.trigger_request.variables.each do |key, value|
.title %code
Commit title #{key}=#{value}
%p.build-light-text.append-bottom-0
#{@build.pipeline.git_commit_title}
- if @build.tags.any?
.block .block
.title .title
Tags Commit title
- @build.tag_list.each do |tag| %p.build-light-text.append-bottom-0
%span.label.label-primary #{@build.pipeline.git_commit_title}
= tag
- if @build.tags.any?
.block
.title
Tags
- @build.tag_list.each do |tag|
%span.label.label-primary
= tag
...@@ -5,26 +5,6 @@ ...@@ -5,26 +5,6 @@
.build-page .build-page
= render "header" = render "header"
- builds = @build.pipeline.builds.latest.to_a
- if builds.size > 1
%ul.nav-links.no-top.no-bottom
- builds.each do |build|
%li{class: ('active' if build == @build) }
= link_to namespace_project_build_path(@project.namespace, @project, build) do
= ci_icon_for_status(build.status)
%span
- if build.name
= build.name
- else
= build.id
- if @build.retried?
%li.active
%a
Build ##{@build.id}
&middot;
%i.fa.fa-warning
This build was retried.
- if @build.stuck? - if @build.stuck?
- unless @build.any_runners_online? - unless @build.any_runners_online?
.bs-callout.bs-callout-warning .bs-callout.bs-callout-warning
...@@ -67,4 +47,10 @@ ...@@ -67,4 +47,10 @@
= render "sidebar" = render "sidebar"
:javascript :javascript
new Build("#{namespace_project_build_url(@project.namespace, @project, @build)}", "#{namespace_project_build_url(@project.namespace, @project, @build, :json)}", "#{@build.status}", "#{trace_with_state[:state]}") new Build({
page_url: "#{namespace_project_build_url(@project.namespace, @project, @build)}",
build_url: "#{namespace_project_build_url(@project.namespace, @project, @build, :json)}",
build_status: "#{@build.status}",
build_stage: "#{@build.stage}",
state1: "#{trace_with_state[:state]}"
})
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