Surface an error when the webhook credential type lookup returns nothing#390
Conversation
WebhookSubForm looked up the '<service>_token' credential type to drive the Webhook Credential lookup, but when the API responded successfully with no results the field silently never rendered (an explicit TODO in the code) - users selecting a webhook service got no credential field and no explanation. The lookup now renders an inline warning Alert when a webhook service is selected but no matching credential type could be resolved. Also fixes the error page for webhook-key failures, which rendered ContentError with the wrong (undefined) error object when only webhookKeyError was set. Locale catalogs re-extracted for the new string (msgstr left for translators, per convention). The new tests cover both the rendered lookup on success and the warning on empty results - notably the pre-existing suite ran entirely in the silent-failure regime, since the auto-mocked CredentialTypesAPI returned no credential type and nothing asserted the lookup's presence.
c2bdd9e to
8144512
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the Template webhook subform in the AWX UI to avoid a silent failure when a selected webhook service cannot be mapped to a corresponding *_token credential type, and fixes an error-propagation issue for webhook-key failures.
Changes:
- Render an inline warning
Alertwhen a webhook service is selected but no credential type can be resolved, instead of rendering nothing. - Fix
ContentErrorwiring so webhook-key failures display the correct error object. - Add/extend unit tests to cover both the “credential type resolves” and “no results” behaviors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
awx/ui/src/screens/Template/shared/WebhookSubForm.js |
Adds an inline warning alert for missing credential-type lookups; fixes the error passed into ContentError. |
awx/ui/src/screens/Template/shared/WebhookSubForm.test.js |
Adds tests to assert credential lookup renders when a type resolves and that a warning renders when no type is found. |
- wait for the async credential-type lookup to settle (waitForElement on ContentLoading) instead of asserting right after mount - mock CredentialsAPI.read/readOptions with complete response shapes in the success-path test so CredentialLookup actually renders instead of sitting in a silent error state (which surfaced a missing count field in the original mock)
|
All three comments addressed: both new tests now wait for the async credential-type lookup to settle ( |
|
All review feedback on this PR is addressed, and after the latest merges to main (#376, #380, #386, #389, #391, #394) this branch has been re-verified: it merges cleanly into current main (51188f0) and is conflict-free against every other open PR (git merge-tree, all pairs). Ready to merge — in any order relative to #385/#390/#392/#393/#395. |
The comment asked how to handle an empty credential-type result; the inline warning Alert added here is that handling.
SUMMARY
Fixes the second documented known-bug from the UI gaps list.
WebhookSubFormlooks up the<service>_tokencredential type to drive the Webhook Credential field, but when the API responds successfully with no results, the field silently never rendered (there's an explicit TODO at the lookup acknowledging this) — users selecting a webhook service got no credential field and no explanation.<ContentError error={error} />with the wrong (undefined) error object when onlywebhookKeyErrorwas set.extract-stringsrun.Worth noting: the pre-existing test suite ran entirely in the silent-failure regime — the auto-mocked
CredentialTypesAPIreturned no credential type and nothing asserted the lookup's presence. The new tests cover both sides: the lookup renders when a type resolves, and the warning appears (lookup absent) on empty results.No dependency, lockfile or locale-catalog changes. Independent of every other open PR — verified conflict-free via pairwise
git merge-tree.ISSUE TYPE
COMPONENT NAME
ASCENDER VERSION
ADDITIONAL INFORMATION