Populate dropdowns with current build on pageload
This commit is contained in:
parent
f97939a791
commit
0b9cd0a1f6
2 changed files with 17 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
Build.state = null;
|
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.page_url = page_url;
|
||||||
this.build_url = build_url;
|
this.build_url = build_url;
|
||||||
this.build_status = build_status;
|
this.build_status = build_status;
|
||||||
|
@ -17,7 +17,12 @@
|
||||||
clearInterval(Build.interval);
|
clearInterval(Build.interval);
|
||||||
this.bp = Breakpoints.get();
|
this.bp = Breakpoints.get();
|
||||||
$('.js-build-sidebar').niceScroll();
|
$('.js-build-sidebar').niceScroll();
|
||||||
|
|
||||||
|
this.populateJobDropdown(build_stage);
|
||||||
|
this.updateStageDropdownText(build_stage);
|
||||||
|
this.updateJobDropdownText(build_name);
|
||||||
this.hideSidebar();
|
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);
|
$(document).on('click', '.stage-item', this.updateDropdown);
|
||||||
|
@ -139,10 +144,19 @@
|
||||||
$('.build-job[data-stage="' + stage + '"]').show();
|
$('.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) {
|
Build.prototype.updateDropdown = function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var stage = e.target.text;
|
var stage = e.target.text;
|
||||||
$('.stage-selection').text(stage);
|
this.updateStageDropdownText(stage);
|
||||||
this.populateJobDropdown(stage);
|
this.populateJobDropdown(stage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -82,4 +82,4 @@
|
||||||
= render "sidebar"
|
= render "sidebar"
|
||||||
|
|
||||||
:javascript
|
: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]}")
|
||||||
|
|
Loading…
Reference in a new issue