Skip to content

Commit

Permalink
NIFI-13670: Improve sensitive value editing. (#9191)
Browse files Browse the repository at this point in the history
* NIFI-13670: Improve sensitive value editing.
- Do not present the user with the masked value.
- Do not use the masked value when determining if a value has changed.
- Do not include the masked value in the payload if the value hasn't changed.
- Updates to ParameterItem model to more easily track changes.

* NIFI-13670: Not setting valueRemoved when deleting a parameter.

* NIFI-13670: Marking field as dirty following removal of sensitive value set text.
  • Loading branch information
mcgilman authored Aug 26, 2024
1 parent cbdc53a commit 7945234
Show file tree
Hide file tree
Showing 10 changed files with 310 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class ParameterContextListingEffects {

dialogReference.componentInstance.createNewParameter = (
existingParameters: string[]
): Observable<Parameter> => {
): Observable<EditParameterResponse> => {
const dialogRequest: EditParameterRequest = { existingParameters };
const newParameterDialogReference = this.dialog.open(EditParameterDialog, {
...MEDIUM_DIALOG,
Expand All @@ -128,13 +128,15 @@ export class ParameterContextListingEffects {
newParameterDialogReference.close();

return {
...dialogResponse.parameter
...dialogResponse
};
})
);
};

dialogReference.componentInstance.editParameter = (parameter: Parameter): Observable<Parameter> => {
dialogReference.componentInstance.editParameter = (
parameter: Parameter
): Observable<EditParameterResponse> => {
const dialogRequest: EditParameterRequest = {
parameter: {
...parameter
Expand All @@ -153,7 +155,7 @@ export class ParameterContextListingEffects {
editParameterDialogReference.close();

return {
...dialogResponse.parameter
...dialogResponse
};
})
);
Expand Down Expand Up @@ -317,7 +319,7 @@ export class ParameterContextListingEffects {

editDialogReference.componentInstance.createNewParameter = (
existingParameters: string[]
): Observable<Parameter> => {
): Observable<EditParameterResponse> => {
const dialogRequest: EditParameterRequest = { existingParameters };
const newParameterDialogReference = this.dialog.open(EditParameterDialog, {
...MEDIUM_DIALOG,
Expand All @@ -332,15 +334,15 @@ export class ParameterContextListingEffects {
newParameterDialogReference.close();

return {
...dialogResponse.parameter
...dialogResponse
};
})
);
};

editDialogReference.componentInstance.editParameter = (
parameter: Parameter
): Observable<Parameter> => {
): Observable<EditParameterResponse> => {
const dialogRequest: EditParameterRequest = {
parameter: {
...parameter
Expand All @@ -359,7 +361,7 @@ export class ParameterContextListingEffects {
editParameterDialogReference.close();

return {
...dialogResponse.parameter
...dialogResponse
};
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { NifiSpinnerDirective } from '../../../../../ui/common/spinner/nifi-spin
import { Client } from '../../../../../service/client.service';
import { ParameterTable } from '../parameter-table/parameter-table.component';
import {
EditParameterResponse,
Parameter,
ParameterContextEntity,
ParameterContextUpdateRequestEntity,
Expand Down Expand Up @@ -73,8 +74,8 @@ import { NiFiCommon, TextTip, NifiTooltipDirective } from '@nifi/shared';
styleUrls: ['./edit-parameter-context.component.scss']
})
export class EditParameterContext extends TabbedDialog {
@Input() createNewParameter!: (existingParameters: string[]) => Observable<Parameter>;
@Input() editParameter!: (parameter: Parameter) => Observable<Parameter>;
@Input() createNewParameter!: (existingParameters: string[]) => Observable<EditParameterResponse>;
@Input() editParameter!: (parameter: Parameter) => Observable<EditParameterResponse>;
@Input() updateRequest!: Observable<ParameterContextUpdateRequestEntity | null>;
@Input() availableParameterContexts$!: Observable<ParameterContextEntity[]>;
@Input() saving$!: Observable<boolean>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
<div class="flex justify-between items-center">
<div
class="whitespace-nowrap overflow-hidden text-ellipsis leading-normal"
[title]="item.entity.parameter.name">
{{ item.entity.parameter.name }}
[title]="item.originalEntity.parameter.name">
{{ item.originalEntity.parameter.name }}
</div>
@if (hasDescription(item)) {
<i
class="fa fa-info-circle primary-color"
nifiTooltip
[tooltipComponentType]="TextTip"
[tooltipInputData]="item.entity.parameter.description"
[tooltipInputData]="getDescription(item)"
[delayClose]="false"></i>
}
@if (canOverride(item)) {
Expand All @@ -68,42 +68,46 @@
<ng-container matColumnDef="value">
<th mat-header-cell *matHeaderCellDef>Value</th>
<td mat-cell *matCellDef="let item">
@if (isNull(item.entity.parameter.value)) {
<div class="unset surface-color">No value set</div>
} @else {
<ng-container
*ngTemplateOutlet="
isSensitiveParameter(item) ? sensitive : nonSensitive;
context: { $implicit: item.entity.parameter.value }
"></ng-container>
<ng-template #sensitive>
<div class="sensitive surface-color">Sensitive value set</div>
</ng-template>
<ng-template #nonSensitive let-value>
<ng-container
*ngTemplateOutlet="renderValue; context: { $implicit: getValue(item) }"></ng-container>
<ng-template #renderValue let-parameterValue>
@if (isNull(parameterValue)) {
<div class="unset surface-color">No value set</div>
} @else {
<ng-container
*ngTemplateOutlet="
isEmptyString(value) ? blank : nonBlank;
context: { $implicit: value }
isSensitiveParameter(item) ? sensitive : nonSensitive;
context: { $implicit: parameterValue }
"></ng-container>
</ng-template>
<ng-template #blank>
<div class="empty surface-color">Empty string set</div>
</ng-template>
<ng-template #nonBlank let-value>
<div class="flex justify-between items-center">
<div class="whitespace-nowrap overflow-hidden text-ellipsis">
{{ value }}
<ng-template #sensitive>
<div class="sensitive surface-color">Sensitive value set</div>
</ng-template>
<ng-template #nonSensitive let-value>
<ng-container
*ngTemplateOutlet="
isEmptyString(value) ? blank : nonBlank;
context: { $implicit: value }
"></ng-container>
</ng-template>
<ng-template #blank>
<div class="empty surface-color">Empty string set</div>
</ng-template>
<ng-template #nonBlank let-value>
<div class="flex justify-between items-center">
<div class="whitespace-nowrap overflow-hidden text-ellipsis">
{{ value }}
</div>
@if (hasExtraWhitespace(value)) {
<div
class="fa fa-info-circle primary-color"
nifiTooltip
[tooltipComponentType]="TextTip"
tooltipInputData="The specified value contains leading and/or trailing whitespace character(s). This could produce unexpected results if it was not intentional."></div>
}
</div>
@if (hasExtraWhitespace(value)) {
<div
class="fa fa-info-circle primary-color"
nifiTooltip
[tooltipComponentType]="TextTip"
tooltipInputData="The specified value contains leading and/or trailing whitespace character(s). This could produce unexpected results if it was not intentional."></div>
}
</div>
</ng-template>
}
</ng-template>
}
</ng-template>
</td>
</ng-container>

Expand Down Expand Up @@ -171,7 +175,7 @@
<div>Parameter</div>
<div class="accent-color font-medium">
@if (selectedItem) {
<span>{{ selectedItem.entity.parameter.name }}</span>
<span>{{ selectedItem.originalEntity.parameter.name }}</span>
} @else {
<span class="unset surface-color">None</span>
}
Expand All @@ -191,7 +195,7 @@
@if (selectedItem) {
<parameter-references
[parameterReferences]="
selectedItem.entity.parameter.referencingComponents
selectedItem.originalEntity.parameter.referencingComponents
"></parameter-references>
}
</div>
Expand Down
Loading

0 comments on commit 7945234

Please sign in to comment.