Correct ranges and enums for various preference values#10
Conversation
|
Do we need to consider the case that users modify the value directly in preferences.json? If yes, users giving any unvalidated value will cause preferences to be reset. I guess we need to handle the incorrect value in |
|
@loveluthien only the individual preferences which are invalid will be reset. I think this is to be expected if users manually edit the file and make a mistake; we don't need to add any special handling. In any case, this is an issue for the frontend, not for the schemas (here we only define what the schema should be). |
loveluthien
left a comment
There was a problem hiding this comment.
Looks good. Feel free to merge if you want to merge tonight, I will update schemas in the frontend in my morning.
| "minimum": 0.5, | ||
| "maximum": 10 | ||
| }, | ||
| "pvPreviewCubeSizeLimit": { |
There was a problem hiding this comment.
Please modify this to "minimum": 0 and "maximum": 2
| }, | ||
| "pvPreviewCubeSizeLimitUnit": { | ||
| "type": "string", | ||
| "enum": ["TB", "GB", "MB", "kB", "B"] |
|
@confluence, ksw found an asynchronous problem when changing the |
|
@kswang1029 @loveluthien Eliminating the different units simplifies a lot of things -- this is one of the changes I suggested in this refactoring request. If we're doing this now, I suggest that we deprecate Regarding the constraints: The current minimum in the frontend should to be changed so that values lower than a sensible minimum aren't allowed: if the unit is GB, 1e-12 is less than a byte! It would be about a byte if the unit were TB, which still seems ridiculous. If you're allowing the user to select input units, the bounds should change with the unit. |
|
I will make |
I am suggesting that we use something like 0.1, as @kswang1029 suggested. I will make more comments in the frontend PR. |
…ubeSizeLimit (now always in GB)
Fixes #8.
This PR corrects several restrictions on preference values which are out of sync with the frontend and cause unexpected behaviour because of schema validation errors.
These changes mostly affect the frontend, so I will describe the details in the related frontend issue.
I have removed the types from preferences which have values restricted to enums -- per the JSON schema docs, including them is considered bad practice, as the enum already implicitly determines the type(s).
Some constraints have been relaxed, so that limitations in the frontend input GUI don't restrict what valid values can be entered, and so that we don't make it unnecessarily difficult to change these input selections.
Companion PRs in the backend, frontend, and controller.