Skip to content

Commit

Permalink
Merge pull request #2825 from kzantow/JENKINS-41778-setup-wizard-edge…
Browse files Browse the repository at this point in the history
…-cases

[FIX JENKINS-41778] - setup wizard issues when failures
  • Loading branch information
oleg-nenashev committed Apr 15, 2017
2 parents e0017ae + a3bf6a9 commit ee82f61
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
5 changes: 4 additions & 1 deletion core/src/main/java/hudson/model/UpdateCenter.java
Expand Up @@ -1927,8 +1927,11 @@ protected boolean wasInstalled() {
throw new RuntimeException(e);
}
}
// Must check for success, otherwise may have failed installation
if (ij.status instanceof Success) {
return true;
}
}
return true;
}
}
}
Expand Down
42 changes: 34 additions & 8 deletions war/src/main/js/pluginSetupWizardGui.js
Expand Up @@ -461,9 +461,34 @@ var createPluginSetupWizard = function(appendTarget) {
setPanel(pluginSuccessPanel, { installingPlugins : installingPlugins, failedPlugins: true });
return;
}


var attachScrollEvent = function() {
var $c = $('.install-console-scroll');
if (!$c.length) {
setTimeout(attachScrollEvent, 50);
return;
}
var events = $._data($c[0], "events");
if (!events || !events.scroll) {
$c.on('scroll', function() {
if (!$c.data('wasAutoScrolled')) {
var top = $c[0].scrollHeight - $c.height();
if ($c.scrollTop() === top) {
// resume auto-scroll
$c.data('userScrolled', false);
} else {
// user scrolled up
$c.data('userScrolled', true);
}
} else {
$c.data('wasAutoScrolled', false);
}
});
}
};

initInstallingPluginList();
setPanel(progressPanel, { installingPlugins : installingPlugins });
setPanel(progressPanel, { installingPlugins : installingPlugins }, attachScrollEvent);

// call to the installStatus, update progress bar & plugin details; transition on complete
var updateStatus = function() {
Expand Down Expand Up @@ -491,8 +516,8 @@ var createPluginSetupWizard = function(appendTarget) {
$('.progress-bar').css({width: ((100.0 * complete)/total) + '%'});

// update details
var $c = $('.install-text');
$c.children().remove();
var $txt = $('.install-text');
$txt.children().remove();

for(i = 0; i < jobs.length; i++) {
j = jobs[i];
Expand Down Expand Up @@ -538,7 +563,7 @@ var createPluginSetupWizard = function(appendTarget) {
else {
$div.addClass('dependent');
}
$c.append($div);
$txt.append($div);

var $itemProgress = $('.selected-plugin[id="installing-' + jenkins.idIfy(j.name) + '"]');
if($itemProgress.length > 0 && !$itemProgress.is('.'+state)) {
Expand All @@ -547,13 +572,14 @@ var createPluginSetupWizard = function(appendTarget) {
}
}

$c = $('.install-console-scroll');
if($c.is(':visible')) {
var $c = $('.install-console-scroll');
if($c && $c.is(':visible') && !$c.data('userScrolled')) {
$c.data('wasAutoScrolled', true);
$c.scrollTop($c[0].scrollHeight);
}

// keep polling while install is running
if(complete < total || data.state === 'INITIAL_PLUGINS_INSTALLING') {
if(complete < total && data.state === 'INITIAL_PLUGINS_INSTALLING') {
setPanel(progressPanel, { installingPlugins : installingPlugins });
// wait a sec
setTimeout(updateStatus, 250);
Expand Down

0 comments on commit ee82f61

Please sign in to comment.