-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIXED JENKINS-35410] Improve User Experience #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,20 @@ | |
import hudson.model.Cause.UpstreamCause; | ||
import hudson.model.CauseAction; | ||
import hudson.model.Descriptor; | ||
import hudson.model.Item; | ||
import hudson.model.ItemGroup; | ||
import hudson.model.Result; | ||
import hudson.model.Run; | ||
import hudson.tasks.BuildStepDescriptor; | ||
import hudson.tasks.BuildStepMonitor; | ||
import hudson.tasks.Notifier; | ||
import hudson.tasks.Publisher; | ||
import hudson.util.FormValidation; | ||
import hudson.util.ListBoxModel; | ||
import jenkins.model.Jenkins; | ||
import net.sf.json.JSONObject; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
import org.kohsuke.stapler.AncestorInPath; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.QueryParameter; | ||
|
@@ -139,6 +143,29 @@ public ListBoxModel doFillTaskItems(@QueryParameter String project, @AncestorInP | |
} | ||
return r; | ||
} | ||
|
||
@Restricted(NoExternalUse.class) | ||
public FormValidation doCheckProject(@QueryParameter String project) { | ||
if (project.startsWith("/")) { | ||
return FormValidation.warning(Messages.BatchTaskInvoker_ForwardSlash()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it should be an error |
||
} | ||
Jenkins jenkins = Jenkins.getInstance(); | ||
if (jenkins != null) { | ||
Item item = jenkins.getItemByFullName(project); | ||
if (item == null) { | ||
return FormValidation.warning(Messages.BatchTaskInvoker_NoSuchProject(project)); | ||
} | ||
} | ||
return FormValidation.ok(); | ||
} | ||
|
||
@Restricted(NoExternalUse.class) | ||
public FormValidation doCheckTask(@QueryParameter String project, @QueryParameter String task) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
if (!project.isEmpty() && task.isEmpty()) { | ||
return FormValidation.warning(Messages.BatchTaskInvoker_NoBatchTaskExists(task)); | ||
} | ||
return FormValidation.ok(); | ||
} | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div> | ||
The <strong>Full project name</strong> | ||
|
||
<p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No closing tags. 🐜 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it has been fixed |
||
For jobs inside a folder it is always a path like <strong>foo/bar</strong> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: maybe makes sense to reference other use-cases: E.g. multibranch projects, etc. |
||
</p> | ||
|
||
<p> | ||
In Jenkins <strong>Full project name</strong> cannot start by "/" | ||
</p> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: missing line break |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div> | ||
List of tasks contained on the Project. | ||
|
||
<p> | ||
Empty means there is not any task on the selected Project. | ||
</p> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good practice: add line breaks to last lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add Restricted(NoExternalUse) to such new validation hooks.
It prevents compatibility issues when you upgrade the stuff