-
Notifications
You must be signed in to change notification settings - Fork 397
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
UI: modal-line element INPUT with optional unit #2489
Conversation
Implement INPUT_UNIT for INPUT with changable Unit
Added INPUT_UNIT as new control element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a design error, i would add a optional unit to the control object and use "W" as fallback
1 similar comment
Yes, that is a better option. I have changed it now. Please take a look at it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think there is still a cleaner solution for this. Create a Enum e.g. InputUnits, that holds in this case only WATT = 'W'. Use this then as the type for the unit. Define the defaultValue in typescript then
I'm not sure if this is really a clean solution, because for the control RANGE there is also the same way to define the unit if i understand it correct. So if we do it with Enum now, there are different possibilities for each control and so I think it is more difficult to understand which definition is the right one for each control. An alternative idea is, we make a new unit.ts in the shared folder so that every unit definition on the genericComponents can use it and it is defined for all at one point. |
@JosefRick so you would define a fallback type "W" in this, do i understand correctly? |
@lukasrgr Yes, with this code I have defined a fallback 'W' if no properties are specified in the control type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks!
@lukasrgr: What's the reason for keeping unit "W" as default? I actually think there should be no default unit here. If none is given, none should be displayed. Of course this requires changes in quite a few files to explicitely set the unit there.
Implements a new modal-line element INPUT_UNIT. It's the similar to INPUT with the option to change the unit with the following code line. eg: [control]="{type: 'INPUT_UNIT', properties: {unit: 'mA'}}">
Implements a new modal-line element INPUT_UNIT. It's the similar to INPUT with the option to change the unit with the following code line.
eg: [control]="{type: 'INPUT_UNIT', properties: {unit: 'mA'}}">