hansva opened a new pull request, #8588:
URL: https://github.com/apache/hop/pull/8588
## Dialogs no longer lose configured values when incoming fields can't be
loaded
Fixes #5953.
Many transform dialogs wiped a value the user had configured when the
previous transform's fields could not be loaded, for example when an upstream
Table Input had broken SQL. Pressing OK then saved an empty field name. The
cause is a common pattern: save the text, call `removeAll()`, fetch the fields,
restore the text. SWT's `removeAll()` / `setItems()` also clear the text, and
the restore was skipped when the fetch threw.
A sweep found this in 49 dialogs across 43 modules. In 16 of them it was
worse: on GTK the error dialog reopened every time focus went back to the
combo, so the user could not get out of it.
### Changes
- **New helpers in `hop-ui`**
- `ComboItems.setItemsKeepingText(combo, items)` replaces the items of a
`Combo`, `CCombo`, `ComboVar` or `LabelCombo` and keeps the current value.
- `PreviousFields`, available in dialogs through
`BaseTransformDialog.previousFields()`, fetches the incoming fields once. When
they can't be loaded it returns an empty row, shows the error once and never
throws.
- `GuiCompositeWidgets.setComboValues` now keeps the combo value.
- **49 dialogs fixed** to use the helpers:
- Combos filled from incoming fields that were cleared when the fetch
failed, and in some dialogs on every focus.
- Salesforce, Snowflake, MongoDB Delete and Cassandra combos filled by a
database or API lookup, plus the Google Sheets "Get fields" grid.
- **Separate bugs fixed along the way**
- LDAP Input: the filter field was overwritten with the search-base value.
- Property Output: the dialog could not be opened when the upstream failed.
- Delay Row: a timeout field was saved as a literal, which meant a 0 ms
delay.
- Excel Input and Regex Evaluation: `select(indexOf(...))` cleared values
that were not in the list.
- Kafka Producer: OK was blocked, and the meta was partly written before
validation.
- Table Compare: an NPE escaped `open()`.
- **Test harness**
- `UpstreamFixture` builds a pipeline with a failing or a fixed-fields
upstream.
- `SwtBotTestBase.postEvent` and `closeOtherShells`. `closeOtherShells`
fails when error dialogs keep reopening.
- `withDialog` now also reports the exception from `open()`.
- **Docs:** a new dev-manual page, *GUI design patterns*, and a section on
the UI-testing page.
### Tests
- Every fixed dialog has a `<Dialog>KeepsValuesTest` (`@Tag("uitest")`) that
failed before its fix and passes after it.
- `ComboItemsTest` and `PreviousFieldsTest` in `rcp` cover the helpers.
- All UI tests of the touched modules pass on GTK/Xvfb. The only failure in
`rcp` is `ExplorerPerspectiveTabCloseTest`, which is GTK-only and also fails
without this change.
- 2,284 non-UI unit tests in the touched modules pass; Spotless and RAT are
clean.
### Notes for reviewers
- The error for missing fields now uses the generic `BaseTransformDialog`
message. The per-dialog `*.FailedToGetFields.*` i18n keys are unused but left
in place.
- Delay Row: a timeout that matches the originally configured field stays a
field even when the incoming fields are unknown.
- Kafka Producer: OK is no longer blocked when the incoming fields are
unknown; validation runs completely before anything is written to the meta.
- Follow-up: move the ~150 dialogs that already keep their values to the
helpers.
------------------------
Thank you for your contribution! Follow this checklist to help us
incorporate your contribution quickly and easily:
- [ ] Run `mvn clean install apache-rat:check` to make sure basic checks
pass. A more thorough check will be performed on your pull request
automatically.
- [ ] If you have a group of commits related to the same change, please
squash your commits into one and force push your branch using `git rebase -i`.
- [ ] Mention the appropriate issue in your description (for example:
`addresses #123`), if applicable.
To make clear that you license your contribution under the [Apache License
Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [ ] I hereby declare this contribution to be licensed under the [Apache
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor
License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]