[FIXED HUDSON-1879] don't allow renaming a job while a build is running.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@18628 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
mindless committed 2009-06-01 02:48:58 +00:00
1 parent 8c1e7a0e5a
commit f00979aea4
4 files changed
+37 -19

No files matched your search

@@ -605,14 +605,6 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return Hudson.getInstance().getQueue().getItem(this);
}
/**
* Returns true if a build of this project is in progress.
*/
public boolean isBuilding() {
R b = getLastBuild();
return b!=null && b.isBuilding();
}
/**
* Gets the JDK that this project is configured with, or null.
*/
+14
View File
@@ -210,6 +210,14 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
return null;
}
/**
* Returns true if a build of this project is in progress.
*/
public boolean isBuilding() {
RunT b = getLastBuild();
return b!=null && b.isBuilding();
}
/**
* Get the term used in the UI to represent this kind of
* {@link AbstractProject}. Must start with a capital letter.
@@ -1195,6 +1203,12 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
return;
}
if (isBuilding()) {
// redirect to page explaining that we can't rename now
rsp.sendRedirect("rename?newName=" + newName);
return;
}
renameTo(newName);
// send to the new job page
// note we can't use getUrl() because that would pick up old name in the