mirror of https://github.com/apache/nifi.git
NIFI-13636: Fixing back navigation when navigating to manage access policies. (#9153)
This closes #9153
This commit is contained in:
parent
0ea55bebc8
commit
05c92e45d8
|
@ -223,60 +223,75 @@ export class CanvasActionsService {
|
||||||
return this.canvasUtils.canManagePolicies(selection);
|
return this.canvasUtils.canManagePolicies(selection);
|
||||||
},
|
},
|
||||||
action: (selection: d3.Selection<any, any, any, any>, extraArgs?) => {
|
action: (selection: d3.Selection<any, any, any, any>, extraArgs?) => {
|
||||||
if (selection.empty()) {
|
const routeBoundary: string[] = ['/access-policies'];
|
||||||
if (extraArgs?.processGroupId) {
|
|
||||||
|
if (extraArgs?.processGroupId) {
|
||||||
|
if (selection.empty()) {
|
||||||
this.store.dispatch(
|
this.store.dispatch(
|
||||||
navigateToManageComponentPolicies({
|
navigateToManageComponentPolicies({
|
||||||
request: {
|
request: {
|
||||||
resource: 'process-groups',
|
resource: 'process-groups',
|
||||||
id: extraArgs.processGroupId,
|
id: extraArgs.processGroupId,
|
||||||
backNavigationContext: 'Process Group'
|
backNavigation: {
|
||||||
|
route: ['/process-groups', extraArgs.processGroupId],
|
||||||
|
routeBoundary,
|
||||||
|
context: 'Process Group'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const selectionData = selection.datum();
|
||||||
|
const componentType: ComponentType = selectionData.type;
|
||||||
|
|
||||||
|
let resource = 'process-groups';
|
||||||
|
let context = 'Process Group';
|
||||||
|
switch (componentType) {
|
||||||
|
case ComponentType.Processor:
|
||||||
|
resource = 'processors';
|
||||||
|
context = 'Processor';
|
||||||
|
break;
|
||||||
|
case ComponentType.InputPort:
|
||||||
|
resource = 'input-ports';
|
||||||
|
context = 'Input Port';
|
||||||
|
break;
|
||||||
|
case ComponentType.OutputPort:
|
||||||
|
resource = 'output-ports';
|
||||||
|
context = 'Output Port';
|
||||||
|
break;
|
||||||
|
case ComponentType.Funnel:
|
||||||
|
resource = 'funnels';
|
||||||
|
context = 'Funnel';
|
||||||
|
break;
|
||||||
|
case ComponentType.Label:
|
||||||
|
resource = 'labels';
|
||||||
|
context = 'Label';
|
||||||
|
break;
|
||||||
|
case ComponentType.RemoteProcessGroup:
|
||||||
|
resource = 'remote-process-groups';
|
||||||
|
context = 'Remote Process Group';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.store.dispatch(
|
||||||
|
navigateToManageComponentPolicies({
|
||||||
|
request: {
|
||||||
|
resource,
|
||||||
|
id: selectionData.id,
|
||||||
|
backNavigation: {
|
||||||
|
route: [
|
||||||
|
'/process-groups',
|
||||||
|
extraArgs.processGroupId,
|
||||||
|
componentType,
|
||||||
|
selectionData.id
|
||||||
|
],
|
||||||
|
routeBoundary,
|
||||||
|
context
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
const selectionData = selection.datum();
|
|
||||||
const componentType: ComponentType = selectionData.type;
|
|
||||||
|
|
||||||
let resource = 'process-groups';
|
|
||||||
let backNavigationContext = 'Process Group';
|
|
||||||
switch (componentType) {
|
|
||||||
case ComponentType.Processor:
|
|
||||||
resource = 'processors';
|
|
||||||
backNavigationContext = 'Processor';
|
|
||||||
break;
|
|
||||||
case ComponentType.InputPort:
|
|
||||||
resource = 'input-ports';
|
|
||||||
backNavigationContext = 'Input Port';
|
|
||||||
break;
|
|
||||||
case ComponentType.OutputPort:
|
|
||||||
resource = 'output-ports';
|
|
||||||
backNavigationContext = 'Output Port';
|
|
||||||
break;
|
|
||||||
case ComponentType.Funnel:
|
|
||||||
resource = 'funnels';
|
|
||||||
backNavigationContext = 'Funnel';
|
|
||||||
break;
|
|
||||||
case ComponentType.Label:
|
|
||||||
resource = 'labels';
|
|
||||||
backNavigationContext = 'Label';
|
|
||||||
break;
|
|
||||||
case ComponentType.RemoteProcessGroup:
|
|
||||||
resource = 'remote-process-groups';
|
|
||||||
backNavigationContext = 'Remote Process Group';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.store.dispatch(
|
|
||||||
navigateToManageComponentPolicies({
|
|
||||||
request: {
|
|
||||||
resource,
|
|
||||||
id: selectionData.id,
|
|
||||||
backNavigationContext
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1065,18 +1065,15 @@ export class FlowEffects {
|
||||||
this.actions$.pipe(
|
this.actions$.pipe(
|
||||||
ofType(FlowActions.navigateToManageComponentPolicies),
|
ofType(FlowActions.navigateToManageComponentPolicies),
|
||||||
map((action) => action.request),
|
map((action) => action.request),
|
||||||
concatLatestFrom(() => this.store.select(selectCurrentProcessGroupId)),
|
tap((request) => {
|
||||||
tap(([request, processGroupId]) => {
|
this.router.navigate(
|
||||||
const routeBoundary: string[] = ['/access-policies'];
|
[...request.backNavigation.routeBoundary, 'read', 'component', request.resource, request.id],
|
||||||
this.router.navigate([...routeBoundary, 'read', 'component', request.resource, request.id], {
|
{
|
||||||
state: {
|
state: {
|
||||||
backNavigation: {
|
backNavigation: request.backNavigation
|
||||||
route: ['/process-groups', processGroupId, request.resource, request.id],
|
}
|
||||||
routeBoundary,
|
|
||||||
context: request.backNavigationContext
|
|
||||||
} as BackNavigation
|
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
{ dispatch: false }
|
{ dispatch: false }
|
||||||
|
|
|
@ -346,7 +346,7 @@ export interface OpenComponentDialogRequest {
|
||||||
export interface NavigateToManageComponentPoliciesRequest {
|
export interface NavigateToManageComponentPoliciesRequest {
|
||||||
resource: string;
|
resource: string;
|
||||||
id: string;
|
id: string;
|
||||||
backNavigationContext: string;
|
backNavigation: BackNavigation;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EditComponentDialogRequest {
|
export interface EditComponentDialogRequest {
|
||||||
|
|
|
@ -57,7 +57,7 @@ import {
|
||||||
selectSkipTransform,
|
selectSkipTransform,
|
||||||
selectViewStatusHistoryComponent
|
selectViewStatusHistoryComponent
|
||||||
} from '../../state/flow/flow.selectors';
|
} from '../../state/flow/flow.selectors';
|
||||||
import { filter, map, switchMap, take } from 'rxjs';
|
import { filter, map, NEVER, switchMap, take } from 'rxjs';
|
||||||
import { restoreViewport } from '../../state/transform/transform.actions';
|
import { restoreViewport } from '../../state/transform/transform.actions';
|
||||||
import { initialState } from '../../state/flow/flow.reducer';
|
import { initialState } from '../../state/flow/flow.reducer';
|
||||||
import { CanvasContextMenu } from '../../service/canvas-context-menu.service';
|
import { CanvasContextMenu } from '../../service/canvas-context-menu.service';
|
||||||
|
@ -218,7 +218,8 @@ export class Canvas implements OnInit, OnDestroy {
|
||||||
component$ = this.store.select(selectLabel(selectedComponent.id));
|
component$ = this.store.select(selectLabel(selectedComponent.id));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw 'Unrecognized Component Type';
|
component$ = NEVER;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// combine the original selection with the component
|
// combine the original selection with the component
|
||||||
|
|
Loading…
Reference in New Issue