Selecting stage updates builds dropdown
This commit is contained in:
parent
5bfca3b16d
commit
f97939a791
2 changed files with 19 additions and 14 deletions
|
@ -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();
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -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…
Reference in a new issue