mcgilman commented on code in PR #11677:
URL: https://github.com/apache/nifi/pull/11677#discussion_r4195565071
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/connectors/ui/connector-table/connector-table.component.ts:
##########
@@ -157,6 +160,24 @@ export class ConnectorTable {
return isConnectorActionAllowed(entity, 'PURGE_FLOWFILES');
}
+ canChangeVersion(entity: ConnectorEntity): boolean {
+ const versionChangeEligibleStates = [
+ ConnectorState.STOPPED,
+ ConnectorState.UPDATED,
+ ConnectorState.UPDATE_FAILED
+ ];
+ const state = entity.component.state as ConnectorState;
+ const noActiveThreads =
entity.status?.aggregateSnapshot?.activeThreadCount === 0;
+ return (
+ this.canRead(entity) &&
+ this.canModify(entity) &&
+ !this.saving &&
+ versionChangeEligibleStates.includes(state) &&
+ (state === ConnectorState.STOPPED || noActiveThreads) &&
+ entity.component.multipleVersionsAvailable === true
+ );
Review Comment:
**Medium — drive Change Version from availableActions**
`canChangeVersion` reimplements the reload rule in `verifyCanReload()` /
`isStopped()`: `STOPPED`, or `UPDATED` / `UPDATE_FAILED` with no active
threads. Every other item in this menu asks `isConnectorActionAllowed` and
reads `component.availableActions`, which already carries `allowed` and
`reasonNotAllowed`.
Please add a `CHANGE_VERSION` action from
`StandardConnectorNode.getAvailableActions()`, allowed exactly when
`verifyCanReload()` would succeed, and switch this method to
`isConnectorActionAllowed(entity, 'CHANGE_VERSION')`. That gives the UI, the
CLI, and any other client one definition of when a version change is legal,
plus a reason when it is not.
`multipleVersionsAvailable` is still the right signal that another bundle
with the same group and artifact is installed; the node does not see that
inventory. If the menu should depend on a single action, `DtoFactory` can set
this action's `allowed` to false when `multipleVersionsAvailable` is false. The
read/modify permission checks and the listing `saving` flag should stay here.
--
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]