Skip to content

Commit

Permalink
add jobName validation
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoli Kalbasin <[email protected]>
  • Loading branch information
callbacksin committed Sep 25, 2024
1 parent 2351c29 commit 107ebd4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main/kotlin/org/zowe/zdevops/classic/steps/SubmitJobStep.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/*
* Copyright (c) 2024 IBA Group.
*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright IBA Group 2022
* Contributors:
* IBA Group
* Zowe Community
*/

package org.zowe.zdevops.classic.steps
Expand All @@ -15,12 +19,15 @@ import hudson.Extension
import hudson.Launcher
import hudson.model.AbstractBuild
import hudson.model.BuildListener
import hudson.util.FormValidation
import org.kohsuke.stapler.DataBoundConstructor
import org.kohsuke.stapler.QueryParameter
import org.kohsuke.stapler.bind.JavaScriptMethod
import org.zowe.zdevops.Messages
import org.zowe.zdevops.classic.AbstractBuildStep
import org.zowe.zdevops.logic.submitJob
import org.zowe.zdevops.logic.submitJobSync
import org.zowe.zdevops.utils.validateFieldIsNotEmpty

class SubmitJobStep
@DataBoundConstructor
Expand Down Expand Up @@ -66,5 +73,16 @@ constructor(
fun createStepId(): String {
return marker + lastStepId++.toString()
}

/**
* Performs form validation for the 'jobName' parameter to ensure it is not empty.
*
* @param jobName job to run
* @return A {@link FormValidation} object indicating whether the field is valid or contains an error.
*/
fun doCheckJobName(@QueryParameter jobName: String): FormValidation? {
return validateFieldIsNotEmpty(jobName)
}

}
}

0 comments on commit 107ebd4

Please sign in to comment.