This is an automated email from the ASF dual-hosted git repository.
scottyaslan 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 a55591815b NIFI-14060: Code clean up, fix unit tests, and remove
console log. (#9564)
a55591815b is described below
commit a55591815bf748f7e491cd65fe49e98350e48def
Author: Matt Gilman <[email protected]>
AuthorDate: Thu Dec 5 19:40:41 2024 -0500
NIFI-14060: Code clean up, fix unit tests, and remove console log. (#9564)
---
.../service/canvas-actions.service.ts | 33 +++++++++++++---------
.../pages/flow-designer/state/flow/flow.effects.ts | 3 +-
.../app/pages/flow-designer/state/flow/index.ts | 6 ++++
.../ui/canvas/canvas.component.spec.ts | 3 +-
.../operation-control.component.spec.ts | 3 +-
.../apps/nifi/src/app/state/copy/copy.actions.ts | 2 ++
6 files changed, 32 insertions(+), 18 deletions(-)
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-actions.service.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-actions.service.ts
index fc13989716..e1ffa989ff 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-actions.service.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-actions.service.ts
@@ -210,21 +210,26 @@ export class CanvasActionsService {
return new Blob([JSON.stringify(response, null, 2)], {
type: 'text/plain' });
})
});
- navigator.clipboard.write([clipboardItem]).then(() => {
- if (copyResponse) {
- this.store.dispatch(
- copySuccess({
- response: {
- copyResponse,
- processGroupId:
copyRequestContext.processGroupId,
- pasteCount: 0
- }
- })
- );
- } else {
+ navigator.clipboard
+ .write([clipboardItem])
+ .then(() => {
+ if (copyResponse) {
+ this.store.dispatch(
+ copySuccess({
+ response: {
+ copyResponse,
+ processGroupId:
copyRequestContext.processGroupId,
+ pasteCount: 0
+ }
+ })
+ );
+ } else {
+ this.store.dispatch(snackBarError({ error: 'Copy
failed' }));
+ }
+ })
+ .catch(() => {
this.store.dispatch(snackBarError({ error: 'Copy
failed' }));
- }
- });
+ });
}
},
selectAll: {
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts
index 6c540083e7..576f57114b 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts
@@ -2253,8 +2253,7 @@ export class FlowEffects {
})
);
}),
- catchError((e) => {
- console.log(e);
+ catchError(() => {
return of(FlowActions.flowSnackbarError({
error: 'Copy failed' }));
})
);
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/index.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/index.ts
index b224ce1c79..eea1eea233 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/index.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/index.ts
@@ -455,29 +455,35 @@ export interface MoveComponentsRequest {
}
///////////////////////////////////////////////////////////
+
export interface PasteRequest {
copyResponse: CopyResponseEntity;
strategy: PasteRequestStrategy;
fitToScreen?: boolean;
bbox?: any;
}
+
export interface PasteRequestEntity {
copyResponse: CopyResponseEntity;
revision: Revision;
disconnectedNodeAcknowledged?: boolean;
}
+
export interface PasteRequestContext {
processGroupId: string;
pasteRequest: PasteRequestEntity;
pasteStrategy: PasteRequestStrategy;
}
+
export interface PasteResponseEntity {
flow: Flow;
revision: Revision;
}
+
export interface PasteResponseContext extends PasteResponseEntity {
pasteRequest: PasteRequest;
}
+
///////////////////////////////////////////////////////////
export interface DeleteComponentRequest {
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.spec.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.spec.ts
index 1076af4bce..1afed0fd70 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.spec.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.spec.ts
@@ -33,6 +33,7 @@ import { canvasFeatureKey } from '../../state';
import { flowFeatureKey } from '../../state/flow';
import { FlowAnalysisDrawerComponent } from
'./header/flow-analysis-drawer/flow-analysis-drawer.component';
import { CanvasActionsService } from '../../service/canvas-actions.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('Canvas', () => {
let component: Canvas;
@@ -60,7 +61,7 @@ describe('Canvas', () => {
MatSidenavModule,
NoopAnimationsModule,
MatSidenavModule,
- NoopAnimationsModule,
+ HttpClientTestingModule,
MockComponent(GraphControls),
MockComponent(HeaderComponent),
MockComponent(FooterComponent),
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/graph-controls/operation-control/operation-control.component.spec.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/graph-controls/operation-control/operation-control.component.spec.ts
index be86788b5f..fa814f05b4 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/graph-controls/operation-control/operation-control.component.spec.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/graph-controls/operation-control/operation-control.component.spec.ts
@@ -20,6 +20,7 @@ import { ComponentFixture, TestBed } from
'@angular/core/testing';
import { OperationControl } from './operation-control.component';
import { provideMockStore } from '@ngrx/store/testing';
import { initialState } from '../../../../state/flow/flow.reducer';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('OperationControl', () => {
let component: OperationControl;
@@ -27,7 +28,7 @@ describe('OperationControl', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [OperationControl],
+ imports: [OperationControl, HttpClientTestingModule],
providers: [
provideMockStore({
initialState
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/state/copy/copy.actions.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/state/copy/copy.actions.ts
index 12f78be1f0..a5b4dd6c2e 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/state/copy/copy.actions.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/state/copy/copy.actions.ts
@@ -21,5 +21,7 @@ import { createAction, props } from '@ngrx/store';
import { CopiedContentInfo, CopyResponseContext } from './index';
export const setCopiedContent = createAction('[Copy] Copied Content', props<{
content: CopyResponseContext }>());
+
export const contentPasted = createAction('[Copy] Copied Content Pasted',
props<{ pasted: CopiedContentInfo }>());
+
export const resetCopiedContent = createAction('[Copy] Reset Copied Content');