Display an error text when ValueInput has invalid user input#257
Conversation
|
We talked about this a bit on Slack, so just repeating my thoughts (IIRC). If we evaluate the validity of the input on each key stroke, it's pretty annoying if the layout changes. So it's better to evaluate it when the input field loses focus, and in that case, the layout reflow should be OK. When entering nothing, a reset to the current value also makes sense. A more helpful error text would be "Enter a value between X and Y". Is it possible to use MB instead of MiB? I'd assume that more people know what MB are and might confuse MiB with the Men in Black. |
It has just been merged. Rebase? |
1e89928 to
00fac08
Compare
00fac08 to
8bfafde
Compare
|
Updated from 00fac08 to 8bfafde, compare Changes: Addressed Review feedback
TODO in follow-ups:
|
8bfafde to
d8cf8d0
Compare
It has been just merged. |
d8cf8d0 to
a51820f
Compare
Validates that the input for these settings is not less or larger than the allowed values. If so, displays an informational error text.
a51820f to
524decd
Compare
|
Updated from a51820f to 524decd, compare Changes: @GBKS your concerns should now be addressed here. I hadn't addressed those two points yet because I was thinking about what changes would be needed to ValueInput to allow for it to be used within the Proxy screen, but I'll leave that thinking to another PR.
|
88a38a1 qml: Introduce Storage OptionButton that represents custom prune target (jarolrod) 1b2dde5 qml: expose currently loaded detailItem in InformationPage (jarolrod) aacab2e qml: move setting of default prune setting into StorageOptions (jarolrod) 524decd qml: Validate input for dbcache, threads, and prune target settings (jarolrod) 317b1a5 qml: Expose minimum and maximum valid dbcache values (Jarol Rodriguez) 4eace03 qml: Expose minimum and maximum valid Script Verif Threads values (Jarol Rodriguez) 6440078 qml: Allow to show an error text below Setting header text (jarolrod) 195d8c5 qml: Allow to specify subtext color (jarolrod) Pull request description: Based on #257 to not conflict This introduces a new OptionButton in StorageOptions that represents a custom prune target option. This is shown only when the user has gone into detailed settings and chosen a custom prune target. Additionally, this moves the logic of setting the default prune value from SettingsStorage into StorageOptions. It is the easy storage option button shown during onboarding that should set this. With the original logic, when onboarding is not shown because the user has already gone through it, the app will set prune to 2 gb again. | light | dark | | ----- | ---- | | <img width="752" alt="Screen Shot 2023-02-01 at 10 30 36 PM" src="https://user-images.githubusercontent.com/23396902/216224800-6bda5263-2661-4eed-b550-7cdf94731408.png"> | <img width="752" alt="Screen Shot 2023-02-01 at 10 30 16 PM" src="https://user-images.githubusercontent.com/23396902/216224815-8cdc3f36-6493-4d80-afc8-c4c26ddb2b5c.png"> | [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/245) ACKs for top commit: johnny9: ACK 88a38a1 Tree-SHA512: 931f79d4950476e74ebd24d5c9389f364e84ef199e4407e225f11792422be7b0acf4c0abd3cf3feb4f0b03d9a6b9c96af947dc6709249bc4857f7c3da66e7b80
|
Merged as a part of #245. |
7968ca9 qml: Introduce Storage OptionButton that represents custom prune target (jarolrod) 61b01e3 qml: expose currently loaded detailItem in InformationPage (jarolrod) 9c6a682 qml: move setting of default prune setting into StorageOptions (jarolrod) d05ea90 qml: Validate input for dbcache, threads, and prune target settings (jarolrod) a339e43 qml: Expose minimum and maximum valid dbcache values (Jarol Rodriguez) a895163 qml: Expose minimum and maximum valid Script Verif Threads values (Jarol Rodriguez) 357a9a5 qml: Allow to show an error text below Setting header text (jarolrod) 390db68 qml: Allow to specify subtext color (jarolrod) Pull request description: Based on bitcoin-core/gui-qml#257 to not conflict This introduces a new OptionButton in StorageOptions that represents a custom prune target option. This is shown only when the user has gone into detailed settings and chosen a custom prune target. Additionally, this moves the logic of setting the default prune value from SettingsStorage into StorageOptions. It is the easy storage option button shown during onboarding that should set this. With the original logic, when onboarding is not shown because the user has already gone through it, the app will set prune to 2 gb again. | light | dark | | ----- | ---- | | <img width="752" alt="Screen Shot 2023-02-01 at 10 30 36 PM" src="https://user-images.githubusercontent.com/23396902/216224800-6bda5263-2661-4eed-b550-7cdf94731408.png"> | <img width="752" alt="Screen Shot 2023-02-01 at 10 30 16 PM" src="https://user-images.githubusercontent.com/23396902/216224815-8cdc3f36-6493-4d80-afc8-c4c26ddb2b5c.png"> | [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/245) ACKs for top commit: johnny9: ACK 7968ca9 Tree-SHA512: 931f79d4950476e74ebd24d5c9389f364e84ef199e4407e225f11792422be7b0acf4c0abd3cf3feb4f0b03d9a6b9c96af947dc6709249bc4857f7c3da66e7b80
7968ca99b4489a0d55203b4e3ed36122dbf89fa9 qml: Introduce Storage OptionButton that represents custom prune target (jarolrod) 61b01e31c4810f8ef62997b3aeb1d717dad333ca qml: expose currently loaded detailItem in InformationPage (jarolrod) 9c6a682325ab2e04f54a74e1ffbd23dbf9152e7e qml: move setting of default prune setting into StorageOptions (jarolrod) d05ea90ae6994da08c911167778a8f487b9ca6ac qml: Validate input for dbcache, threads, and prune target settings (jarolrod) a339e4316193a1c7df017aec73565d4d4d2c29b1 qml: Expose minimum and maximum valid dbcache values (Jarol Rodriguez) a895163aaaaa6290f6387cded39c00980403acef qml: Expose minimum and maximum valid Script Verif Threads values (Jarol Rodriguez) 357a9a569b7551791d4320bffb27cd4d4b3266b0 qml: Allow to show an error text below Setting header text (jarolrod) 390db68fa5f496717f5e542d93ee4dc203c30891 qml: Allow to specify subtext color (jarolrod) Pull request description: Based on bitcoin-core/gui-qml#257 to not conflict This introduces a new OptionButton in StorageOptions that represents a custom prune target option. This is shown only when the user has gone into detailed settings and chosen a custom prune target. Additionally, this moves the logic of setting the default prune value from SettingsStorage into StorageOptions. It is the easy storage option button shown during onboarding that should set this. With the original logic, when onboarding is not shown because the user has already gone through it, the app will set prune to 2 gb again. | light | dark | | ----- | ---- | | <img width="752" alt="Screen Shot 2023-02-01 at 10 30 36 PM" src="https://user-images.githubusercontent.com/23396902/216224800-6bda5263-2661-4eed-b550-7cdf94731408.png"> | <img width="752" alt="Screen Shot 2023-02-01 at 10 30 16 PM" src="https://user-images.githubusercontent.com/23396902/216224815-8cdc3f36-6493-4d80-afc8-c4c26ddb2b5c.png"> | [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/insecure_win_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/insecure_mac_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/insecure_mac_arm64_gui.zip?branch=pull/245) [](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/insecure_android_apk.zip?branch=pull/245) ACKs for top commit: johnny9: ACK 7968ca99b4489a0d55203b4e3ed36122dbf89fa9 Tree-SHA512: 931f79d4950476e74ebd24d5c9389f364e84ef199e4407e225f11792422be7b0acf4c0abd3cf3feb4f0b03d9a6b9c96af947dc6709249bc4857f7c3da66e7b80


This allows for a ValueInput to signal when it currently has an invalid input from the user and display an error text to the user. In doing so, it is validating the input for the dbcache and threads settings; only writing to settings.json when there is valid input. Valid input for dbcache and thread is based on what are the minimum and maximum values the node will recognize for this. Proper validation for the prune setting will be handled in a future pr.