You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm frustrated when I want to limit the drop-down choices for an activity (or configuration) parameter dynamically, but I need to determine them from an enum in the mission model Java code.
This closely related to #1075 including a possible solution for it.
Describe the feature request
The UI could use drop-down choices for activity (and simulation configuration) parameters calculated dynamically by validation functions for activities (and the simulation configuration).
Currently, a Java validation function for an activity type returns a boolean for whether the current parameter values are valid paired with an error message String if they are not. The feature request is
that when the returned string is parsable as JSON, it be used to determine drop-down choices (and also the message in the tooltip) for both valid and invalid cases and
that such validation functions be supported for simulation configurations, too.
return new ValidationResult(false, "spice_dir", "{'choices':['spice cfg x', 'spice cfg y', 'spice cfg z'], 'message': 'The specified spice directory, spice_dir = " + spice_dir + " does not exist in " + SPICE_FOLDER + "}'); // invalid case for sim configuration
return new ValidationResult(true, "spice_dir", "{'choices':['spice cfg x', 'spice cfg y', 'spice cfg z'], 'message': 'Spice directories for spice_dir are located in " + SPICE_FOLDER + "}'"); // valid case for sim configuration
return new ValidationResult(true, "device_state", "{'choices' : {'device1' : ['OFF', 'ON'], 'device2' : ['0', '1', '2']}, 'message' : ''}"); // valid result with empty message for activity parameter with a Map value, customizing drop-down for both map keys and map values for each keys
return new ValidationResult(false, "device_state", "{'choices' : {'device1' : ['OFF', 'ON'], 'device2' : ['0', '1', '2']}, 'message' : 'There is no device state " + state + " for device, " + device + "' }"); // invalid result for activity parameter with a Map value, customizing drop-down for both map keys and map values for each keys
For activities, these return values require no change on the backend, but it could be worth adding additional members and constructors (for backwards compatibility) to the ValidationResult class to separate the 'choices' from the 'message'. I expect there are no validation functions for the sim config, but I didn't verify.
The text was updated successfully, but these errors were encountered:
Checked for duplicates
No - I haven't checked
Alternatives considered
Yes - and alternatives don't suffice
Related problems
I'm frustrated when I want to limit the drop-down choices for an activity (or configuration) parameter dynamically, but I need to determine them from an enum in the mission model Java code.
This closely related to #1075 including a possible solution for it.
Describe the feature request
The UI could use drop-down choices for activity (and simulation configuration) parameters calculated dynamically by validation functions for activities (and the simulation configuration).
Currently, a Java validation function for an activity type returns a
boolean
for whether the current parameter values are valid paired with an error messageString
if they are not. The feature request isSome examples of return statements for validation functions:
return new ValidationResult(false, "spice_dir", "{'choices':['spice cfg x', 'spice cfg y', 'spice cfg z'], 'message': 'The specified spice directory, spice_dir = " + spice_dir + " does not exist in " + SPICE_FOLDER + "}'); // invalid case for sim configuration
return new ValidationResult(true, "spice_dir", "{'choices':['spice cfg x', 'spice cfg y', 'spice cfg z'], 'message': 'Spice directories for spice_dir are located in " + SPICE_FOLDER + "}'"); // valid case for sim configuration
return new ValidationResult(true, "device_state", "{'choices' : {'device1' : ['OFF', 'ON'], 'device2' : ['0', '1', '2']}, 'message' : ''}"); // valid result with empty message for activity parameter with a Map value, customizing drop-down for both map keys and map values for each keys
return new ValidationResult(false, "device_state", "{'choices' : {'device1' : ['OFF', 'ON'], 'device2' : ['0', '1', '2']}, 'message' : 'There is no device state " + state + " for device, " + device + "' }"); // invalid result for activity parameter with a Map value, customizing drop-down for both map keys and map values for each keys
For activities, these return values require no change on the backend, but it could be worth adding additional members and constructors (for backwards compatibility) to the
ValidationResult
class to separate the 'choices' from the 'message'. I expect there are no validation functions for the sim config, but I didn't verify.The text was updated successfully, but these errors were encountered: