diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js index c54d8fc2267a836da476e73660e34515b0f9b054..0d7d29bb0d0272934685ec09289359ab08620e75 100644 --- a/app/assets/javascripts/build.js +++ b/app/assets/javascripts/build.js @@ -6,11 +6,12 @@ Build.state = null; - function Build(page_url, build_url, build_status, build_stage, build_name, state1) { - this.page_url = page_url; - this.build_url = build_url; - this.build_status = build_status; - this.state = state1; + function Build(options) { + this.page_url = options.page_url; + this.build_url = options.build_url; + this.build_status = options.build_status; + this.state = options.state1; + this.build_stage = options.build_stage; this.hideSidebar = bind(this.hideSidebar, this); this.toggleSidebar = bind(this.toggleSidebar, this); this.updateDropdown = bind(this.updateDropdown, this); @@ -18,13 +19,13 @@ this.bp = Breakpoints.get(); $('.js-build-sidebar').niceScroll(); - this.populateJobs(build_stage); - this.updateStageDropdownText(build_stage); + 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); $(window).off('resize.build').on('resize.build', this.hideSidebar); - $(document).on('click', '.stage-item', this.updateDropdown); + $(document).off('click', '.stage-item').on('click', '.stage-item', this.updateDropdown); this.updateArtifactRemoveDate(); if ($('#build-trace').length) { this.getInitialBuildTrace(); @@ -149,7 +150,7 @@ Build.prototype.updateDropdown = function(e) { e.preventDefault(); - var stage = e.target.text; + var stage = e.currentTarget.text; this.updateStageDropdownText(stage); this.populateJobs(stage); }; diff --git a/app/assets/stylesheets/pages/builds.scss b/app/assets/stylesheets/pages/builds.scss index d910ec0ccc97d9d01b8cdb1b69ca069ebfe068c4..81fce55853c0d76d3d7e789cbf26e9de071f8a49 100644 --- a/app/assets/stylesheets/pages/builds.scss +++ b/app/assets/stylesheets/pages/builds.scss @@ -136,6 +136,12 @@ .dropdown-menu-toggle { margin-top: 8px; } + + .dropdown-menu { + right: $gl-padding; + left: $gl-padding; + width: auto; + } } .builds-container { diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml index 70e02cb2d13ca7b947e6d60d0fd1478b670a5c18..e4d41288aa6f34aef495e01eef019acc8e9c0cc2 100644 --- a/app/views/projects/builds/show.html.haml +++ b/app/views/projects/builds/show.html.haml @@ -47,4 +47,10 @@ = render "sidebar" :javascript - new Build("#{namespace_project_build_url(@project.namespace, @project, @build)}", "#{namespace_project_build_url(@project.namespace, @project, @build, :json)}", "#{@build.status}", "#{@build.stage}", "#{@build.name}", "#{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]}" + })