summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone <annabel.dunstone@gmail.com>2016-08-17 13:43:28 -0500
committerAnnabel Dunstone <annabel.dunstone@gmail.com>2016-08-17 14:23:14 -0500
commitcc7b3db5a2d9a04d976c3db95059e3163a01ec70 (patch)
tree1e6f9453da1a5a86eaac494437380dea2fb21ffc
parentb6c670cf9c1e86748aa0a97decdd5ed9014f4f97 (diff)
downloadgitlab-ce-cc7b3db5a2d9a04d976c3db95059e3163a01ec70.tar.gz
Remove params from build; general refactor
-rw-r--r--app/assets/javascripts/build.js19
-rw-r--r--app/assets/stylesheets/pages/builds.scss6
-rw-r--r--app/views/projects/builds/show.html.haml8
3 files changed, 23 insertions, 10 deletions
diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js
index c54d8fc2267..0d7d29bb0d0 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 d910ec0ccc9..81fce55853c 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 70e02cb2d13..e4d41288aa6 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]}"
+ })