Skip to content
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

Fixes #24099: Add a select type for technique parameter #5362

Conversation

VinceMacBuche
Copy link
Member

@VinceMacBuche VinceMacBuche commented Jan 29, 2024

https://issues.rudder.io/issues/24099

This feature adds constraints to technique parameter to generate different metadata.xml with support for different inputs. Everything is already ok rudderc side. we juste need to add it into rudder api and also in technique editor UI

@VinceMacBuche
Copy link
Member Author

Commit modified

@VinceMacBuche VinceMacBuche force-pushed the bug_24099/add_a_select_type_for_technique_parameter branch from b9c00fd to 63f5371 Compare January 29, 2024 23:51
Comment on lines 283 to 294
case class Constraints(
allowEmptyString: Option[Boolean],
allowWhiteSpaceString: Option[Boolean],
minLength: Option[Int],
maxLength: Option[Int],
regex: Option[String],
notRegex: Option[String],
select: Option[List[String]]
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technique constraints are different from method constraints, cf. https://docs.rudder.io/techniques/8.1/syntax.html#parameters

@VinceMacBuche
Copy link
Member Author

Commit modified

@VinceMacBuche VinceMacBuche force-pushed the bug_24099/add_a_select_type_for_technique_parameter branch 2 times, most recently from 47f46db to 9515234 Compare February 1, 2024 13:13
@VinceMacBuche
Copy link
Member Author

Commit modified

1 similar comment
@VinceMacBuche
Copy link
Member Author

Commit modified

@VinceMacBuche VinceMacBuche force-pushed the bug_24099/add_a_select_type_for_technique_parameter branch from 9515234 to e337a48 Compare February 1, 2024 18:24
@VinceMacBuche
Copy link
Member Author

Commit modified

@VinceMacBuche VinceMacBuche force-pushed the bug_24099/add_a_select_type_for_technique_parameter branch from e337a48 to 1361841 Compare February 6, 2024 13:44
@fanf
Copy link
Member

fanf commented Feb 6, 2024

I get an API error when trying to save with no documentation, it should be optionnal (or have a default value to "" if needed)
image

@fanf
Copy link
Member

fanf commented Feb 6, 2024

(I'm not sure where the change comes from though)

@VinceMacBuche
Copy link
Member Author

(I'm not sure where the change comes from though)

probleme was there: https://github.com/Normation/rudder/pull/5362/files#diff-b3d308fc87b50cacb27b8c7ae19ef5befc0b483b0c4d132b8982a1932fae1ef3R28

@VinceMacBuche
Copy link
Member Author

Commit modified

@VinceMacBuche VinceMacBuche force-pushed the bug_24099/add_a_select_type_for_technique_parameter branch from 1361841 to 39ade54 Compare February 7, 2024 08:34
Nothing -> []
Just r -> if Regex.contains r (displayValue call.value) then [ConstraintError { id = call.id, message = ( "Parameter '"++call.id.value++"' start or end with whitespace characters" ) } ] else []

checkMax = if lengthValue call.value >= (constraint.maxLength |> Maybe.withDefault 16384) then [ConstraintError { id = call.id, message = ("Parameter '"++call.id.value++"' should be at most " ++ (String.fromInt (constraint.maxLength |> Maybe.withDefault 16384) ) ++ " long" ) } ]else []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value 16384 should be defined somewhere globally and documented, in DataTypes likelly (it should not be in the middle of a view method)
I belived it should be the same for the name of the constraints, and their respective defaults (and perhaps the standard error message).

@fanf
Copy link
Member

fanf commented Feb 9, 2024

Merging this one as is, but the changes will need to be address afterward @VinceMacBuche

@Normation-Quality-Assistant
Copy link
Contributor

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit a2740ca into Normation:branches/rudder/8.1 Feb 9, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants