This is an automated email from the ASF dual-hosted git repository.
rfellows pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 978ce391d2 NIFI-15087: Add support to edit parameters by double
clicking on the row. (#10415)
978ce391d2 is described below
commit 978ce391d2a5eb1b77d4d56aacad2714bba17979
Author: Matt Gilman <[email protected]>
AuthorDate: Tue Oct 14 12:43:12 2025 -0400
NIFI-15087: Add support to edit parameters by double clicking on the row.
(#10415)
This closes #10415
---
.../parameter-table/parameter-table.component.html | 1 +
.../parameter-table.component.spec.ts | 167 +++++++++++++++++++++
.../parameter-table/parameter-table.component.ts | 6 +
3 files changed, 174 insertions(+)
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.html
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.html
index be162c32ad..eadeaaf17e 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.html
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.html
@@ -170,6 +170,7 @@
mat-row
*matRowDef="let row; let even = even; columns:
displayedColumns"
(click)="selectParameter(row)"
+ (dblclick)="doubleClicked(row)"
[class.selected]="isSelected(row)"
[class.even]="even"></tr>
</table>
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.spec.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.spec.ts
index b5cebbda98..22058216fb 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.spec.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.spec.ts
@@ -684,4 +684,171 @@ describe('ParameterTable', () => {
expect(component.isVisible(item)).toBe(true);
});
});
+
+ describe('doubleClicked', () => {
+ it('should call editClicked when parameter is editable and not
disabled', () => {
+ const item: ParameterItem = {
+ added: false,
+ dirty: false,
+ deleted: false,
+ originalEntity: {
+ parameter: {
+ name: 'param',
+ value: 'value',
+ description: 'asdf',
+ sensitive: false,
+ provided: false,
+ inherited: false
+ },
+ canWrite: true
+ }
+ };
+
+ const editClickedSpy = jest.spyOn(component,
'editClicked').mockImplementation(() => {});
+ component.isDisabled = false;
+
+ component.doubleClicked(item);
+
+ expect(editClickedSpy).toHaveBeenCalledWith(item);
+ });
+
+ it('should not call editClicked when parameter is not editable', () =>
{
+ const item: ParameterItem = {
+ added: false,
+ dirty: false,
+ deleted: false,
+ originalEntity: {
+ parameter: {
+ name: 'param',
+ value: 'value',
+ description: 'asdf',
+ sensitive: false,
+ provided: true, // provided parameters cannot be edited
+ inherited: false
+ },
+ canWrite: true
+ }
+ };
+
+ const editClickedSpy = jest.spyOn(component, 'editClicked');
+ component.isDisabled = false;
+
+ component.doubleClicked(item);
+
+ expect(editClickedSpy).not.toHaveBeenCalled();
+ });
+
+ it('should not call editClicked when component is disabled', () => {
+ const item: ParameterItem = {
+ added: false,
+ dirty: false,
+ deleted: false,
+ originalEntity: {
+ parameter: {
+ name: 'param',
+ value: 'value',
+ description: 'asdf',
+ sensitive: false,
+ provided: false,
+ inherited: false
+ },
+ canWrite: true
+ }
+ };
+
+ const editClickedSpy = jest.spyOn(component, 'editClicked');
+ component.isDisabled = true;
+
+ component.doubleClicked(item);
+
+ expect(editClickedSpy).not.toHaveBeenCalled();
+ });
+
+ it('should not call editClicked when parameter does not have write
permission', () => {
+ const item: ParameterItem = {
+ added: false,
+ dirty: false,
+ deleted: false,
+ originalEntity: {
+ parameter: {
+ name: 'param',
+ value: 'value',
+ description: 'asdf',
+ sensitive: false,
+ provided: false,
+ inherited: false
+ },
+ canWrite: false
+ }
+ };
+
+ const editClickedSpy = jest.spyOn(component, 'editClicked');
+ component.isDisabled = false;
+
+ component.doubleClicked(item);
+
+ expect(editClickedSpy).not.toHaveBeenCalled();
+ });
+
+ it('should not call editClicked for inherited parameter that is not
overridden', () => {
+ const item: ParameterItem = {
+ added: false,
+ dirty: false,
+ deleted: false,
+ originalEntity: {
+ parameter: {
+ name: 'param',
+ value: 'value',
+ description: 'asdf',
+ sensitive: false,
+ provided: false,
+ inherited: true
+ },
+ canWrite: true
+ }
+ };
+
+ const editClickedSpy = jest.spyOn(component, 'editClicked');
+ component.isDisabled = false;
+
+ component.doubleClicked(item);
+
+ expect(editClickedSpy).not.toHaveBeenCalled();
+ });
+
+ it('should call editClicked for inherited parameter that is
overridden', () => {
+ const item: ParameterItem = {
+ added: false,
+ dirty: false,
+ deleted: false,
+ originalEntity: {
+ parameter: {
+ name: 'param',
+ value: 'value',
+ description: 'asdf',
+ sensitive: false,
+ provided: false,
+ inherited: true
+ },
+ canWrite: true
+ },
+ updatedEntity: {
+ parameter: {
+ name: 'param',
+ value: 'value2',
+ description: 'asdf',
+ sensitive: false
+ },
+ canWrite: true
+ }
+ };
+
+ const editClickedSpy = jest.spyOn(component,
'editClicked').mockImplementation(() => {});
+ component.isDisabled = false;
+
+ component.doubleClicked(item);
+
+ expect(editClickedSpy).toHaveBeenCalledWith(item);
+ });
+ });
});
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.ts
index c2ee52d430..1e4534baef 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/parameter-contexts/ui/parameter-context-listing/parameter-table/parameter-table.component.ts
@@ -533,6 +533,12 @@ export class ParameterTable implements AfterViewInit,
ControlValueAccessor {
this.selectedItem = item;
}
+ doubleClicked(item: ParameterItem): void {
+ if (this.canEdit(item) && !this.isDisabled) {
+ this.editClicked(item);
+ }
+ }
+
isSelected(item: ParameterItem): boolean {
if (this.selectedItem) {
return item.originalEntity.parameter.name ==
this.selectedItem.originalEntity.parameter.name;