NIFI-16240 - Navigate to the referenced parameter from property table Go to Parameter - #11580
NIFI-16240 - Navigate to the referenced parameter from property table Go to Parameter#11580rfellows wants to merge 1 commit into
Conversation
… Go to Parameter Extract the referenced parameter name from a property value and pass it through router state so the Parameter Context edit dialog can highlight and scroll to that row. Carry the same state through save-then-navigate so the highlight is preserved when the edit dialog is dirty.
|
Reviewing... |
| const match = /#{(['"]?)([^}]+)\1}/.exec(value); | ||
| return match?.[2]; |
There was a problem hiding this comment.
extractParameterName should share a capturing form of the same charset as PropertyTable.PARAM_REF_REGEX (/#{(['"]?)[a-zA-Z0-9-_. ]+\1}/), and trim the captured name.
canGoToParameter uses the strict regex; this uses [^}]+. For a value like #{bad:name} #{kafka.brokers}, the menu appears because of kafka.brokers, but extract returns bad:name and no row is selected.
Unquoted #{ my-param } also matches (space is in the charset) and extracts ' my-param '. Highlight is an exact === on parameter.name, so the row is missed. #{} / #{ } should still return undefined.
Suggested:
const match = /#{(['"]?)([a-zA-Z0-9-_. ]+)\1}/.exec(value);
return match?.[2]?.trim() || undefined;
Exporting that regex (and using it from PropertyTable) would keep the two from drifting. Please also add specs for mixed invalid-then-valid refs (#{bad:name} #{kafka.brokers} → kafka.brokers) and #{ my-param } / #{ }.
NIFI-16240 Navigate to the referenced parameter from a component property's "Go to Parameter"
Summary
JIRA: NIFI-16240
When a Processor or Controller Service property value contains a parameter reference (for example
#{kafka.brokers}), the property table offers a Go to Parameter menu item. Selecting it navigated to the bound Parameter Context's edit dialog but gave no indication of which parameter the user came from — they landed on an unfiltered parameter table and had to find the row themselves. In contexts with dozens of parameters this defeats the purpose of the link, andPropertyTable.canGoToParametercarried a long-standingTODOacknowledging that the route could not target a specific parameter.This change extracts the referenced parameter name from the property value and passes it along with the navigation, so the Parameter Context listing selects and scrolls to the matching row on arrival. The receiving side already understands this — the parameter table's
highlightedParameterNameinput and the listing's reading of Router navigationstatewere added in NIFI-16217 — so this change is limited to producing the value at the origin and preserving it across the save-before-leave flow.How it works
extractParameterName(new,apps/nifi/src/app/ui/common/utils/parameter.utils.ts) parses the first#{...}reference from a property value, supporting unquoted, single-quoted, and double-quoted names (#{name},#{'name'},#{"name"}). It returnsundefinedwhen no reference is present or the reference is empty, in which case navigation proceeds exactly as before with no highlight. When a value contains multiple references (#{p1}-#{p2}), the first in reading order wins — deterministic and non-surprising, and a natural place to later offer a sub-menu listing every referenced parameter.The extracted name is wrapped in the existing
PostUpdateNavigationStateshape ({ highlightedParameterName }) and spread into the Angular Router's navigationstatealongside thebackNavigationentry the dialogs already send. For a dirty form, the state has to survive the "Save changes before going to this Parameter?" round trip, so it is threaded through the update request/response types and re-applied when the post-update navigation is finally performed:flowchart TD A["Property table: Go to Parameter\n(value contains #{param})"] --> B["effects goToParameter(parameterValue)"] B --> C["extractParameterName(value)"] C -->|no reference| N0["navigate without highlight\n(existing behavior)"] C -->|"name"| D{"Edit form dirty?"} D -->|"No"| E["router.navigate(commands,\nstate: { backNavigation, highlightedParameterName })"] D -->|"Yes"| F["YesNoDialog:\nSave changes before going to this Parameter?"] F -->|"No"| E F -->|"Yes"| G["submitForm(commands, commandBoundary,\npostUpdateNavigationState)"] G --> H["update Processor / Controller Service request\ncarries postUpdateNavigationState"] H --> I["update success response\ncarries postUpdateNavigationState"] I --> E E --> J["ParameterContextListing reads\nlastSuccessfulNavigation().extras.state"] J --> K["EditParameterContext passes\n[highlightedParameterName] to parameter-table"] K --> L["Matching row selected and scrolled into view"]Scope and limitations
Inherited parameters navigate to the process group's bound Parameter Context and highlight the row there. Inherited rows are already rendered in that context's parameter table, so the highlight lands correctly; this change intentionally does not walk the inheritance chain to open the ancestor context that defines the parameter.
What changed
Flow designer / Controller Services effects
flow.effects.tsandcontroller-services.effects.ts: thegoToParametercallback now receives the property value, extracts the parameter name, and passes an optionalPostUpdateNavigationStateinto the sharedgoTohelper.goTospreads that state intorouter.navigatefor both the clean-form and "don't save" paths, and forwards it tosubmitFormon the "save" path.updateProcessorSuccess/ configure-success now spreadspostUpdateNavigationStateinto the navigationstate.Types
UpdateProcessorRequest,UpdateProcessorResponse,UpdateControllerServiceRequest,ConfigureControllerServiceRequest, andConfigureControllerServiceSuccessgain an optionalpostUpdateNavigationState?: PostUpdateNavigationState.Dialogs
EditProcessor.submitFormandEditControllerService.submitFormaccept an optional third argument,postUpdateNavigationState, and include it in the emitted update request.Cleanup
TODOinPropertyTable.canGoToParameterstating that the parameter context route cannot target a specific parameter.New file
apps/nifi/src/app/ui/common/utils/parameter.utils.ts(+ spec).No backend, REST, or persistence changes; no new user-facing strings.
Manual verification
#{some-param}, and apply.some-paramselected and scrolled into view.some-param.some-param.#{'param with spaces'},#{"param with spaces"}) and a value that embeds a reference (prefix #{some-param} suffix).