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

Dynamic typing of activity map parameter values (or dynamic dropdown choices in UI) #1075

Open
bradNASA opened this issue Jan 4, 2024 · 4 comments
Labels
feature New feature or request next Near term candidates srl Requests from the SRL project

Comments

@bradNASA
Copy link

bradNASA commented Jan 4, 2024

Checked for duplicates

Yes - I've already checked

Alternatives considered

Yes - and alternatives don't suffice

Related problems

When the legal values for an entry in an activity map parameter depend on the key of the entry, I have to provide values for all keys and have to guess the right values when editing in the UI.

For example (and show below), I would like a parameter to list a subset of devices and the corresponding states to which I want to set the devices. The devices and their states come from a PEL (power equipment list).

image

Each device has a different set of legal states, but I can't change the possible values based on the key, so I list all of them together. In the screenshot above, ON_UHF_BITSTREAM is a not legal value for the ALTIMETER_ALT_STATE component. This mission model only includes a small set of devices for testing. But, we expect to have 100+ devices that together will have a 1000+ values, so I'll need an enum in the Java with these 1000+ states. Users will need to know the possible states to find in the dropdown of 1000+ choices.

Describe the feature request

I would like to somehow be able to change or restrict the possible choices in the UI dropdown for a value of an entr in an activity map parameter based on the chosen key of the entry.

There are multiple possible designs for this.

@bradNASA bradNASA added feature New feature or request srl Requests from the SRL project labels Jan 4, 2024
@bradNASA
Copy link
Author

Matt Dailis mentioned, "Expanding the value schema to support tagged unions is something we've wanted for a while, but never got around to. I think that would address this particular use case."

@joswig joswig added the next Near term candidates label Jul 2, 2024
@Mythicaeda
Copy link
Contributor

Can you give more information on the code you have written/restrictions you have?

In my experience from Clipper, these PEL states were represented as a enum made of the permitted compound states. For example, rather than one mega enum for all possible PEL states across instruments, there'd be one enum per instrument (ie ALTIMETER_ON, ALTIMETER_OFF). Additionally, rather than having one generic activity type that could change any state arbitrarily, there was one activity type per subsystem, ie SetAltimeterState (or whatever the subsystem for the Altimeter is). Together, these can limit the need for a mega enum.

@bradNASA
Copy link
Author

bradNASA commented Oct 27, 2024

Can you give more information on the code you have written/restrictions you have?

In my experience from Clipper, these PEL states were represented as a enum made of the permitted compound states. For example, rather than one mega enum for all possible PEL states across instruments, there'd be one enum per instrument (ie ALTIMETER_ON, ALTIMETER_OFF). Additionally, rather than having one generic activity type that could change any state arbitrarily, there was one activity type per subsystem, ie SetAltimeterState (or whatever the subsystem for the Altimeter is). Together, these can limit the need for a mega enum.

We don't want a separate parameter for each device because the activity type, by default, may only be relevant to a few devices, and we don't want to limit which devices are affected in order to give the user flexibility to modify individual activity instances.

@bradNASA
Copy link
Author

#1526 is a possible solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request next Near term candidates srl Requests from the SRL project
Projects
Status: Todo
Development

No branches or pull requests

3 participants