Skip to content
Snippets Groups Projects
Commit f97939a7 authored by Annabel Dunstone's avatar Annabel Dunstone
Browse files

Selecting stage updates builds dropdown

parent 5bfca3b1
No related branches found
No related tags found
No related merge requests found
Loading
@@ -13,13 +13,14 @@
Loading
@@ -13,13 +13,14 @@
this.state = state1; this.state = state1;
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();
this.displayTestStatuses();
$('.js-build-sidebar').niceScroll(); $('.js-build-sidebar').niceScroll();
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).on('click', '.stage-item', this.updateDropdown);
this.updateArtifactRemoveDate(); this.updateArtifactRemoveDate();
if ($('#build-trace').length) { if ($('#build-trace').length) {
this.getInitialBuildTrace(); this.getInitialBuildTrace();
Loading
@@ -133,12 +134,16 @@
Loading
@@ -133,12 +134,16 @@
} }
}; };
   
Build.prototype.displayTestStatuses = function() { Build.prototype.populateJobDropdown = function(stage) {
$jobs = $('.build-job'); $('.build-job').hide();
jobjects = $jobs.map(function () { $('.build-job[data-stage="' + stage + '"]').show();
return $(this).data(); };
});
console.log(jobjects); Build.prototype.updateDropdown = function(e) {
e.preventDefault();
var stage = e.target.text;
$('.stage-selection').text(stage);
this.populateJobDropdown(stage);
}; };
   
return Build; return Build;
Loading
Loading
Loading
@@ -6,25 +6,25 @@
Loading
@@ -6,25 +6,25 @@
= render "header" = render "header"
   
- builds = @build.pipeline.builds.latest.to_a - builds = @build.pipeline.builds.latest.to_a
- statuses = ["failed", "pending", "running", "canceled", "skipped", "success"]
- if builds.size > 1 - if builds.size > 1
.dropdown.stage .dropdown.stage
%button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'} %button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'}
%span.more-tests More %span.stage-selection More
= icon('caret-down') = icon('caret-down')
%ul.dropdown-menu.overflow-jobs %ul.dropdown-menu.overflow-jobs
- builds.each do |build| - builds.map(&:stage).uniq.each do |stage|
%li %li
%a= build.stage %a.stage-item= stage
   
- statuses = ["failed", "pending", "running", "canceled", "skipped", "success"]
.dropdown.jobs-dropdown .dropdown.jobs-dropdown
%button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'} %button.dropdown-menu-toggle{type: 'button', 'data-toggle' => 'dropdown'}
%span.more-tests More %span.build-selection More
= icon('caret-down') = icon('caret-down')
%ul.dropdown-menu.overflow-jobs %ul.dropdown-menu.overflow-jobs
- 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.build-job{class: ('active' if build == @build), data: {id: build.id, name: build.name, status: build.status}} %li.build-job{class: ('active' if build == @build), data: {id: build.id, name: build.name, stage: build.stage}}
= link_to namespace_project_build_path(@project.namespace, @project, build) 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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment