Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-13670: Improve sensitive value editing. #9191

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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