提交 aa79364f 编写于 作者: M mindless

[FIXED HUDSON-3055] Show Hudson upgrade status on manage page instead of

offering same upgrade again.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@26796 71c3de6d-444a-0410-be80-ed276b4c234a
上级 6f3893c2
......@@ -169,6 +169,19 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
return null;
}
/**
* Returns latest Hudson upgrade job.
* @return HudsonUpgradeJob or null if not found
*/
public HudsonUpgradeJob getHudsonJob() {
List<UpdateCenterJob> jobList = getJobs();
Collections.reverse(jobList);
for (UpdateCenterJob job : jobList)
if (job instanceof HudsonUpgradeJob)
return (HudsonUpgradeJob)job;
return null;
}
/**
* Returns the list of {@link UpdateSite}s to be used.
* This is a live list, whose change will be persisted automatically.
......@@ -759,6 +772,9 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
*/
public abstract class InstallationStatus {
public final int id = iota.incrementAndGet();
public boolean isSuccess() {
return false;
}
}
/**
......@@ -780,6 +796,9 @@ public class UpdateCenter extends AbstractModelObject implements Saveable {
* Indicates that the plugin was successfully installed.
*/
public class Success extends InstallationStatus {
@Override public boolean isSuccess() {
return true;
}
}
/**
......
......@@ -78,7 +78,7 @@ THE SOFTWARE.
<j:set var="lastCat" value="${thisCat}" />
</j:if>
<j:set var="installJob" value="${isUpdates ? app.updateCenter.getJob(p) : null}" />
<j:set var="installedOk" value="${installJob.status.class.name=='hudson.model.UpdateCenter$DownloadJob$Success'}" />
<j:set var="installedOk" value="${installJob.status.success}" />
<tr class="${installJob!=null ? 'already-upgraded' : null}">
<td class="pane" align="center" data="${thisCat}_">
<input type="checkbox" name="plugin.${p.name}.${p.sourceId}"
......
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -25,11 +25,22 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<div class="warning">
<j:set var="ucData" value="${it.data}" />
<form method="post" action="${rootURL}/updateCenter/upgrade">
${%NewVersionAvailable(ucData.core.version,ucData.core.url)}
<j:if test="${ucData.canUpgrade()}">
<f:submit value="${%Or Upgrade Automatically}"/>
</j:if>
</form>
<j:set var="upJob" value="${app.updateCenter.hudsonJob}" />
<j:choose>
<j:when test="${upJob.status.success}">
${%UpgradeComplete(ucData.core.version)}
</j:when>
<j:when test="${upJob!=null}">
${%UpgradeProgress(ucData.core.version,rootURL+'/updateCenter/')}
</j:when>
<j:otherwise>
<form method="post" action="${rootURL}/updateCenter/upgrade">
${%NewVersionAvailable(ucData.core.version,ucData.core.url)}
<j:if test="${ucData.canUpgrade()}">
<f:submit value="${%Or Upgrade Automatically}"/>
</j:if>
</form>
</j:otherwise>
</j:choose>
</div>
</j:jelly>
\ No newline at end of file
</j:jelly>
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
# Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
......@@ -20,4 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
NewVersionAvailable=New version of Hudson ({0}) is available for <a href="{1}">download</a> (<a href="http://hudson-ci.org/changelog.html">changelog</a>).
NewVersionAvailable=New version of Hudson ({0}) is available for <a href="{1}">download</a> \
(<a href="http://hudson-ci.org/changelog.html">changelog</a>).
UpgradeComplete=Upgrade to Hudson {0} is complete, awaiting restart.
UpgradeProgress=Upgrade to Hudson {0} is <a href="{1}">in progress or failed</a>.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册