summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone <annabel.dunstone@gmail.com>2016-08-03 15:40:10 -0500
committerAnnabel Dunstone <annabel.dunstone@gmail.com>2016-08-17 11:18:53 -0500
commit0b9cd0a1f635d1e3751aa1279d52292d23a0a9dc (patch)
treee34ea0db03d376eb0a89173ed78fbbeeff9008e8
parentf97939a791ae1e71f8e9d366cdfe106decb9545e (diff)
downloadgitlab-ce-0b9cd0a1f635d1e3751aa1279d52292d23a0a9dc.tar.gz
Populate dropdowns with current build on pageload
-rw-r--r--app/assets/javascripts/build.js18
-rw-r--r--app/views/projects/builds/show.html.haml2
2 files changed, 17 insertions, 3 deletions
diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js
index baa91e221e8..2725ddcf465 100644
--- a/app/assets/javascripts/build.js
+++ b/app/assets/javascripts/build.js
@@ -6,7 +6,7 @@
Build.state = null;
- function Build(page_url, build_url, build_status, state1) {
+ 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;
@@ -17,7 +17,12 @@
clearInterval(Build.interval);
this.bp = Breakpoints.get();
$('.js-build-sidebar').niceScroll();
+
+ this.populateJobDropdown(build_stage);
+ this.updateStageDropdownText(build_stage);
+ this.updateJobDropdownText(build_name);
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);
@@ -139,10 +144,19 @@
$('.build-job[data-stage="' + stage + '"]').show();
};
+ Build.prototype.updateStageDropdownText = function(stage) {
+ $('.stage-selection').text(stage);
+ this.updateJobDropdownText('-');
+ };
+
+ Build.prototype.updateJobDropdownText = function(name) {
+ $('.build-selection').text(name);
+ };
+
Build.prototype.updateDropdown = function(e) {
e.preventDefault();
var stage = e.target.text;
- $('.stage-selection').text(stage);
+ this.updateStageDropdownText(stage);
this.populateJobDropdown(stage);
};
diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml
index 2302aa2d1e7..5f7c66e4dd2 100644
--- a/app/views/projects/builds/show.html.haml
+++ b/app/views/projects/builds/show.html.haml
@@ -82,4 +82,4 @@
= render "sidebar"
: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("#{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]}")