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,
|
stopVersionControlRequest,
|
||||||
copy,
|
copy,
|
||||||
paste,
|
paste,
|
||||||
terminateThreads
|
terminateThreads,
|
||||||
|
navigateToParameterContext
|
||||||
} from '../state/flow/flow.actions';
|
} from '../state/flow/flow.actions';
|
||||||
import { ComponentType } from '../../../state/shared';
|
import { ComponentType } from '../../../state/shared';
|
||||||
import {
|
import {
|
||||||
|
@ -504,14 +505,29 @@ export class CanvasContextMenu implements ContextMenuDefinitionProvider {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: (selection: any) => {
|
condition: (selection: d3.Selection<any, any, any, any>) => {
|
||||||
// TODO - hasParameterContext
|
return this.canvasUtils.hasParameterContext(selection);
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
clazz: 'fa',
|
clazz: 'fa',
|
||||||
text: 'Parameters',
|
text: 'Parameters',
|
||||||
action: () => {
|
action: (selection: d3.Selection<any, any, any, any>) => {
|
||||||
// TODO - open parameter context
|
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,
|
selectCanvasPermissions,
|
||||||
selectConnections,
|
selectConnections,
|
||||||
selectCopiedSnippet,
|
selectCopiedSnippet,
|
||||||
|
selectCurrentParameterContext,
|
||||||
selectCurrentProcessGroupId,
|
selectCurrentProcessGroupId,
|
||||||
selectParentProcessGroupId
|
selectParentProcessGroupId
|
||||||
} from '../state/flow/flow.selectors';
|
} 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 { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
import { BulletinsTip } from '../../../ui/common/tooltips/bulletins-tip/bulletins-tip.component';
|
import { BulletinsTip } from '../../../ui/common/tooltips/bulletins-tip/bulletins-tip.component';
|
||||||
import { BreadcrumbEntity, Position } from '../state/shared';
|
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 { NiFiCommon } from '../../../service/nifi-common.service';
|
||||||
import { CurrentUser } from '../../../state/current-user';
|
import { CurrentUser } from '../../../state/current-user';
|
||||||
import { initialState as initialUserState } from '../../../state/current-user/current-user.reducer';
|
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 parentProcessGroupId: string | null = initialFlowState.flow.processGroupFlow.parentGroupId;
|
||||||
private canvasPermissions: Permissions = initialFlowState.flow.permissions;
|
private canvasPermissions: Permissions = initialFlowState.flow.permissions;
|
||||||
private currentUser: CurrentUser = initialUserState.user;
|
private currentUser: CurrentUser = initialUserState.user;
|
||||||
|
private currentParameterContext: ParameterContextReferenceEntity | null =
|
||||||
|
initialFlowState.flow.processGroupFlow.parameterContext;
|
||||||
private flowConfiguration: FlowConfiguration | null = initialFlowConfigurationState.flowConfiguration;
|
private flowConfiguration: FlowConfiguration | null = initialFlowConfigurationState.flowConfiguration;
|
||||||
private connections: any[] = [];
|
private connections: any[] = [];
|
||||||
private breadcrumbs: BreadcrumbEntity | null = null;
|
private breadcrumbs: BreadcrumbEntity | null = null;
|
||||||
|
@ -107,6 +110,13 @@ export class CanvasUtils {
|
||||||
this.currentUser = user;
|
this.currentUser = user;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.store
|
||||||
|
.select(selectCurrentParameterContext)
|
||||||
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe((currentParameterContext) => {
|
||||||
|
this.currentParameterContext = currentParameterContext;
|
||||||
|
});
|
||||||
|
|
||||||
this.store
|
this.store
|
||||||
.select(selectFlowConfiguration)
|
.select(selectFlowConfiguration)
|
||||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
@ -205,6 +215,13 @@ export class CanvasUtils {
|
||||||
return this.parentProcessGroupId;
|
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.
|
* 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();
|
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.
|
* Determines whether the current user can view the status history for the selected component.
|
||||||
*
|
*
|
||||||
|
|
|
@ -59,6 +59,7 @@ import {
|
||||||
NavigateToComponentRequest,
|
NavigateToComponentRequest,
|
||||||
NavigateToControllerServicesRequest,
|
NavigateToControllerServicesRequest,
|
||||||
NavigateToManageComponentPoliciesRequest,
|
NavigateToManageComponentPoliciesRequest,
|
||||||
|
NavigateToParameterContext,
|
||||||
NavigateToQueueListing,
|
NavigateToQueueListing,
|
||||||
OpenChangeVersionDialogRequest,
|
OpenChangeVersionDialogRequest,
|
||||||
OpenComponentDialogRequest,
|
OpenComponentDialogRequest,
|
||||||
|
@ -388,6 +389,11 @@ export const navigateToQueueListing = createAction(
|
||||||
props<{ request: NavigateToQueueListing }>()
|
props<{ request: NavigateToQueueListing }>()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const navigateToParameterContext = createAction(
|
||||||
|
`${CANVAS_PREFIX} Navigate To Parameter Context`,
|
||||||
|
props<{ request: NavigateToParameterContext }>()
|
||||||
|
);
|
||||||
|
|
||||||
export const editCurrentProcessGroup = createAction(
|
export const editCurrentProcessGroup = createAction(
|
||||||
`${CANVAS_PREFIX} Edit Current Process Group`,
|
`${CANVAS_PREFIX} Edit Current Process Group`,
|
||||||
props<{
|
props<{
|
||||||
|
|
|
@ -933,6 +933,18 @@ export class FlowEffects {
|
||||||
{ dispatch: false }
|
{ 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(
|
navigateToEditCurrentProcessGroup$ = createEffect(
|
||||||
() =>
|
() =>
|
||||||
this.actions$.pipe(
|
this.actions$.pipe(
|
||||||
|
|
|
@ -367,6 +367,10 @@ export interface NavigateToQueueListing {
|
||||||
connectionId: string;
|
connectionId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface NavigateToParameterContext {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface EditCurrentProcessGroupRequest {
|
export interface EditCurrentProcessGroupRequest {
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ import { Observable, take } from 'rxjs';
|
||||||
import { ParameterReferences } from '../../../../../ui/common/parameter-references/parameter-references.component';
|
import { ParameterReferences } from '../../../../../ui/common/parameter-references/parameter-references.component';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { ParameterContextListingState } from '../../../state/parameter-context-listing';
|
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 {
|
export interface ParameterItem {
|
||||||
deleted: boolean;
|
deleted: boolean;
|
||||||
|
@ -157,7 +157,10 @@ export class ParameterTable implements AfterViewInit, ControlValueAccessor {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (item) {
|
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(
|
this.store.dispatch(
|
||||||
showOkDialog({
|
showOkDialog({
|
||||||
title: 'Parameter Exists',
|
title: 'Parameter Exists',
|
||||||
|
|
Loading…
Reference in New Issue