Skip to content

NIFI-15931: Fetching parameter values in the Connector canvas.#11263

Open
mcgilman wants to merge 2 commits into
apache:mainfrom
mcgilman:NIFI-15931
Open

NIFI-15931: Fetching parameter values in the Connector canvas.#11263
mcgilman wants to merge 2 commits into
apache:mainfrom
mcgilman:NIFI-15931

Conversation

@mcgilman
Copy link
Copy Markdown
Contributor

Summary

JIRA: NIFI-15931

Surfaces parameter values inline in the Connector canvas so property tables and the codemirror parameter tip can resolve #{param} references without leaving the canvas. Read-only by design: values render in tooltips, but the "Go to Parameter" affordance is hidden because connector-managed parameter contexts are not navigable.

Description

Backend

  • New REST endpoint GET /connectors/{connectorId}/flow/process-groups/{processGroupId}/parameter-context on ConnectorResource. Requires READ on the connector, returns a ParameterContextEntity for the PG's bound context, or 204 No Content when no context is bound. Sensitive values are masked via the existing DtoFactory path.
  • NiFiServiceFacade#getConnectorParameterContext and its StandardNiFiServiceFacade implementation look up the ConnectorNode, locate the target ProcessGroup, and return its bound ParameterContext.
  • DtoFactory#createParameterDto now walks the in-memory inheritance graph of the supplied ParameterContext to populate containingParameterContext (with cycle protection), falling back to the supplied ParameterContextLookup only when no in-memory match is found. This is required because connector-managed parameter contexts are not registered in the global ParameterContextDAO, so the previous lookup-only path returned "Unable to find Parameter Context …" for any inherited parameter on a connector PG.

Frontend

  • ConnectorService.getConnectorParameterContext(connectorId, processGroupId) wraps the new endpoint, mapping 204 to null so the caller can distinguish "no context" from a load failure.
  • New NgRx action set (loadConnectorParameterContext / Success / Failure) and parameterContext slice on ConnectorCanvasState. Selectors expose the current value to dialogs.
  • A single effect, loadConnectorParameterContextOnLoadSuccess$, listens to both loadConnectorFlowSuccess and loadConnectorControllerServicesSuccess, normalizes their payloads, filters out null processGroupIds, and dedupes via distinctUntilChanged on (connectorId, processGroupId). This covers the deep-link case where the user lands directly on /connectors/:id/canvas/:pgId/controller-services (the CS route is a sibling of the canvas route, not a child, so it does not activate the canvas component) without firing duplicate fetches when polling or the canvas → CS transition refires within the same PG.
  • The action carries an errorContext: ErrorContextKey chosen by the trigger (CONNECTOR_CANVAS for canvas, CONTROLLER_SERVICES for CS-listing) so loadConnectorParameterContext$ can surface failures on the page the user is actually looking at via addBannerError.
  • A shared helper bindConnectorParameterContext(store, teardown$, apply) wires the current parameter context onto the read-only EditProcessor and EditControllerService dialogs for the lifetime of dialogRef.afterClosed(). goToParameter is intentionally left undefined; the property table now hides the "Go to Parameter" menu item whenever the callback is missing (property-table.component.ts).
  • @Input() goToParameter?: (parameter: string) => void is now optional on EditProcessor and EditControllerService to match.
  • The property-value-tip template and the codemirror parameter-tip template render explicit empty-state copy ("No value set" / "Empty string set") so users can tell unset parameters from values that simply weren't fetched. Both null and undefined are handled because the wire format prunes nulls.
  • Canvas reducer also resets cached component data + parameter context whenever connectorId (in addition to processGroupId) changes, so navigating between connectors doesn't briefly leak stale shapes.

Test fixture

  • pages/connectors/testing/parameter-context-fixture.ts centralizes the as unknown as ParameterContextEntity cast for test fixtures.

Tests

  • DtoFactoryTest: 7 new cases covering null/matching IDs, direct and transitive inheritance, fallback to lookup, cyclic inheritance graphs, and sensitive value masking.
  • StandardNiFiServiceFacadeTest: happy path returning the entity, null when no context is bound, and ResourceNotFoundException when the PG cannot be located.
  • TestConnectorResource: 200 / 204 / AccessDeniedException cases for the new endpoint.
  • Frontend (Vitest): ConnectorService (200 vs 204), connectorCanvasReducer parameter context handling and connector-id reset behavior, ConnectorCanvasEffects (load on canvas + CS deep link, polling/transition dedupe, failure routing per trigger), ConnectorControllerServicesEffects parameter-context binding in the read-only dialog, and property-table canGoToParameter with/without callback. Tooltip rendering for null/undefined/''/non-empty across both property-value-tip and parameter-tip.

@mcgilman mcgilman added the ui Pull requests for work relating to the user interface label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui Pull requests for work relating to the user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant