From 107ebd4166c6b9a68e2dd5da00709c5225da1263 Mon Sep 17 00:00:00 2001 From: Anatoli Kalbasin Date: Wed, 25 Sep 2024 14:23:50 +0200 Subject: [PATCH 1/2] add jobName validation Signed-off-by: Anatoli Kalbasin --- .../zdevops/classic/steps/SubmitJobStep.kt | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/zowe/zdevops/classic/steps/SubmitJobStep.kt b/src/main/kotlin/org/zowe/zdevops/classic/steps/SubmitJobStep.kt index 6a5e548..a016451 100644 --- a/src/main/kotlin/org/zowe/zdevops/classic/steps/SubmitJobStep.kt +++ b/src/main/kotlin/org/zowe/zdevops/classic/steps/SubmitJobStep.kt @@ -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 @@ -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 @@ -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) + } + } } From 38f9595b5e2184c43e271246f878c7568045e7d8 Mon Sep 17 00:00:00 2001 From: Anatoli Kalbasin Date: Wed, 25 Sep 2024 14:24:39 +0200 Subject: [PATCH 2/2] delete testing mark Signed-off-by: Anatoli Kalbasin --- .../org/zowe/zdevops/classic/steps/SubmitJobStep/config.jelly | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/org/zowe/zdevops/classic/steps/SubmitJobStep/config.jelly b/src/main/resources/org/zowe/zdevops/classic/steps/SubmitJobStep/config.jelly index 5f79f1b..41b0e9c 100644 --- a/src/main/resources/org/zowe/zdevops/classic/steps/SubmitJobStep/config.jelly +++ b/src/main/resources/org/zowe/zdevops/classic/steps/SubmitJobStep/config.jelly @@ -5,7 +5,6 @@ -

${stepId}