mirror of https://github.com/apache/nifi.git
NIFI-13083: (#8684)
- Fixing import preventing the dialog from warning the user that they must apply changes before deleting/adding the same parameter with different sensitivities. - Allowing the sensitivity to change when deleting/adding the same parameter as long as it hasn't been saved yet. - Adding the Parameters context menu item for Process Groups.
This commit is contained in:
parent
90506823e1
commit
72a3529718
|
@ -57,7 +57,8 @@ import {
|
|||
stopVersionControlRequest,
|
||||
copy,
|
||||
paste,
|
||||
terminateThreads
|
||||
terminateThreads,
|
||||
navigateToParameterContext
|
||||
} from '../state/flow/flow.actions';
|
||||
import { ComponentType } from '../../../state/shared';
|
||||
import {
|
||||
|
@ -504,14 +505,29 @@ export class CanvasContextMenu implements ContextMenuDefinitionProvider {
|
|||
}
|
||||
},
|
||||
{
|
||||
condition: (selection: any) => {
|
||||
// TODO - hasParameterContext
|
||||
return false;
|
||||
condition: (selection: d3.Selection<any, any, any, any>) => {
|
||||
return this.canvasUtils.hasParameterContext(selection);
|
||||
},
|
||||
clazz: 'fa',
|
||||
text: 'Parameters',
|
||||
action: () => {
|
||||
// TODO - open parameter context
|
||||
action: (selection: d3.Selection<any, any, any, any>) => {
|
||||
let id;
|
||||
if (selection.empty()) {
|
||||
id = this.canvasUtils.getParameterContextId();
|
||||
} else {
|
||||
const selectionData = selection.datum();
|
||||
id = selectionData.parameterContext.id;
|
||||
}
|
||||
|
||||
if (id) {
|
||||
this.store.dispatch(
|
||||
navigateToParameterContext({
|
||||
request: {
|
||||
id
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@ import {
|
|||
selectCanvasPermissions,
|
||||
selectConnections,
|
||||
selectCopiedSnippet,
|
||||
selectCurrentParameterContext,
|
||||
selectCurrentProcessGroupId,
|
||||
selectParentProcessGroupId
|
||||
} from '../state/flow/flow.selectors';
|
||||
|
@ -32,7 +33,7 @@ import { initialState as initialFlowState } from '../state/flow/flow.reducer';
|
|||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { BulletinsTip } from '../../../ui/common/tooltips/bulletins-tip/bulletins-tip.component';
|
||||
import { BreadcrumbEntity, Position } from '../state/shared';
|
||||
import { ComponentType, Permissions } from '../../../state/shared';
|
||||
import { ComponentType, ParameterContextReferenceEntity, Permissions } from '../../../state/shared';
|
||||
import { NiFiCommon } from '../../../service/nifi-common.service';
|
||||
import { CurrentUser } from '../../../state/current-user';
|
||||
import { initialState as initialUserState } from '../../../state/current-user/current-user.reducer';
|
||||
|
@ -57,6 +58,8 @@ export class CanvasUtils {
|
|||
private parentProcessGroupId: string | null = initialFlowState.flow.processGroupFlow.parentGroupId;
|
||||
private canvasPermissions: Permissions = initialFlowState.flow.permissions;
|
||||
private currentUser: CurrentUser = initialUserState.user;
|
||||
private currentParameterContext: ParameterContextReferenceEntity | null =
|
||||
initialFlowState.flow.processGroupFlow.parameterContext;
|
||||
private flowConfiguration: FlowConfiguration | null = initialFlowConfigurationState.flowConfiguration;
|
||||
private connections: any[] = [];
|
||||
private breadcrumbs: BreadcrumbEntity | null = null;
|
||||
|
@ -107,6 +110,13 @@ export class CanvasUtils {
|
|||
this.currentUser = user;
|
||||
});
|
||||
|
||||
this.store
|
||||
.select(selectCurrentParameterContext)
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((currentParameterContext) => {
|
||||
this.currentParameterContext = currentParameterContext;
|
||||
});
|
||||
|
||||
this.store
|
||||
.select(selectFlowConfiguration)
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
|
@ -205,6 +215,13 @@ export class CanvasUtils {
|
|||
return this.parentProcessGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current parameter context id or null if there is no bound parameter context.
|
||||
*/
|
||||
public getParameterContextId(): string | null {
|
||||
return this.currentParameterContext ? this.currentParameterContext.id : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the current group is not the root group and the current selection is empty.
|
||||
*
|
||||
|
@ -600,6 +617,28 @@ export class CanvasUtils {
|
|||
return this.isProcessor(selection) && this.canAccessProvenance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if there is a Parameter Context bound.
|
||||
*
|
||||
* @param selection
|
||||
*/
|
||||
public hasParameterContext(selection: d3.Selection<any, any, any, any>): boolean {
|
||||
let parameterContext;
|
||||
|
||||
if (selection.empty()) {
|
||||
parameterContext = this.currentParameterContext;
|
||||
} else if (this.isProcessGroup(selection)) {
|
||||
const pg = selection.datum();
|
||||
parameterContext = pg.parameterContext;
|
||||
}
|
||||
|
||||
if (parameterContext) {
|
||||
return parameterContext.permissions.canRead;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the current user can view the status history for the selected component.
|
||||
*
|
||||
|
|
|
@ -59,6 +59,7 @@ import {
|
|||
NavigateToComponentRequest,
|
||||
NavigateToControllerServicesRequest,
|
||||
NavigateToManageComponentPoliciesRequest,
|
||||
NavigateToParameterContext,
|
||||
NavigateToQueueListing,
|
||||
OpenChangeVersionDialogRequest,
|
||||
OpenComponentDialogRequest,
|
||||
|
@ -388,6 +389,11 @@ export const navigateToQueueListing = createAction(
|
|||
props<{ request: NavigateToQueueListing }>()
|
||||
);
|
||||
|
||||
export const navigateToParameterContext = createAction(
|
||||
`${CANVAS_PREFIX} Navigate To Parameter Context`,
|
||||
props<{ request: NavigateToParameterContext }>()
|
||||
);
|
||||
|
||||
export const editCurrentProcessGroup = createAction(
|
||||
`${CANVAS_PREFIX} Edit Current Process Group`,
|
||||
props<{
|
||||
|
|
|
@ -933,6 +933,18 @@ export class FlowEffects {
|
|||
{ dispatch: false }
|
||||
);
|
||||
|
||||
navigateToParameterContext$ = createEffect(
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
ofType(FlowActions.navigateToParameterContext),
|
||||
map((action) => action.request),
|
||||
tap((request) => {
|
||||
this.router.navigate(['/parameter-contexts', request.id]);
|
||||
})
|
||||
),
|
||||
{ dispatch: false }
|
||||
);
|
||||
|
||||
navigateToEditCurrentProcessGroup$ = createEffect(
|
||||
() =>
|
||||
this.actions$.pipe(
|
||||
|
|
|
@ -367,6 +367,10 @@ export interface NavigateToQueueListing {
|
|||
connectionId: string;
|
||||
}
|
||||
|
||||
export interface NavigateToParameterContext {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface EditCurrentProcessGroupRequest {
|
||||
id: string;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import { Observable, take } from 'rxjs';
|
|||
import { ParameterReferences } from '../../../../../ui/common/parameter-references/parameter-references.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ParameterContextListingState } from '../../../state/parameter-context-listing';
|
||||
import { showOkDialog } from '../../../../flow-designer/state/flow/flow.actions';
|
||||
import { showOkDialog } from '../../../state/parameter-context-listing/parameter-context-listing.actions';
|
||||
|
||||
export interface ParameterItem {
|
||||
deleted: boolean;
|
||||
|
@ -157,7 +157,10 @@ export class ParameterTable implements AfterViewInit, ControlValueAccessor {
|
|||
);
|
||||
|
||||
if (item) {
|
||||
if (item.entity.parameter.sensitive !== parameter.sensitive) {
|
||||
// if the item is added that means it hasn't been saved yet. in this case, we
|
||||
// can simply update the existing parameter. if the item has been saved, and the
|
||||
// sensitivity has changed, the user must apply the changes first.
|
||||
if (!item.added && item.entity.parameter.sensitive !== parameter.sensitive) {
|
||||
this.store.dispatch(
|
||||
showOkDialog({
|
||||
title: 'Parameter Exists',
|
||||
|
|
Loading…
Reference in New Issue