scottyaslan commented on code in PR #9548:
URL: https://github.com/apache/nifi/pull/9548#discussion_r1876733468


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/processor/edit-processor/edit-processor.component.ts:
##########
@@ -401,8 +460,166 @@ export class EditProcessor extends TabbedDialog {
         });
     }
 
+    hasBulletins(): boolean {
+        return this.request.entity.permissions.canRead && 
!this.nifiCommon.isEmpty(this.bulletins);
+    }
+
+    getBulletinsTipData(): BulletinsTipInput {
+        return {
+            bulletins: this.bulletins
+        };
+    }
+
+    getBulletinTooltipPosition(): ConnectedPosition {
+        return {
+            originX: 'end',
+            originY: 'bottom',
+            overlayX: 'end',
+            overlayY: 'top',
+            offsetX: -8,
+            offsetY: 8
+        };
+    }
+
+    getMostSevereBulletinLevel(): string | null {
+        // determine the most severe of the bulletins
+        const mostSevere = 
this.canvasUtils.getMostSevereBulletin(this.bulletins);
+        return mostSevere ? mostSevere.bulletin.level.toLowerCase() : null;
+    }
+
+    isStoppable(): boolean {
+        if (!this.canOperate()) {
+            return false;
+        }
+
+        return this.status.aggregateSnapshot.runStatus === 'Running';
+    }
+
+    isStopping(): boolean {
+        if (!this.canOperate()) {
+            return false;
+        }
+
+        return (
+            this.status.aggregateSnapshot.runStatus === 'Stopped' && 
this.status.aggregateSnapshot.activeThreadCount > 0
+        );
+    }
+
+    isInvalid(): boolean {
+        if (!this.canOperate()) {
+            return false;
+        }
+
+        return this.status.aggregateSnapshot.runStatus === 'Invalid';
+    }
+
+    isDisabled(): boolean {
+        if (!this.canOperate()) {
+            return false;
+        }
+
+        return this.status.aggregateSnapshot.runStatus === 'Disabled';
+    }
+
+    isRunnable(): boolean {
+        if (!this.canOperate()) {
+            return false;
+        }
+
+        return (
+            !(
+                this.status.aggregateSnapshot.runStatus === 'Running' ||
+                this.status.aggregateSnapshot.activeThreadCount > 0
+            ) && this.status.aggregateSnapshot.runStatus === 'Stopped'
+        );
+    }
+
+    isDisableable(): boolean {
+        if (!this.canOperate()) {
+            return false;
+        }
+
+        return (
+            !(
+                this.status.aggregateSnapshot.runStatus === 'Running' ||
+                this.status.aggregateSnapshot.activeThreadCount > 0
+            ) &&
+            (this.status.aggregateSnapshot.runStatus === 'Stopped' ||
+                this.status.aggregateSnapshot.runStatus === 'Invalid')
+        );
+    }
+
+    isEnableable(): boolean {
+        if (!this.canOperate()) {
+            return false;
+        }
+
+        return (
+            !(
+                this.status.aggregateSnapshot.runStatus === 'Running' ||
+                this.status.aggregateSnapshot.activeThreadCount > 0
+            ) && this.status.aggregateSnapshot.runStatus === 'Disabled'
+        );
+    }
+
+    private canOperate(): boolean {
+        return this.request.entity.permissions.canWrite || 
this.request.entity.operatePermissions?.canWrite;
+    }
+
+    stop() {
+        this.stopComponentRequest.next({
+            id: this.request.entity.id,
+            uri: this.request.entity.uri,
+            type: ComponentType.Processor,
+            revision: this.client.getRevision({
+                ...this.request.entity,
+                revision: this.revision
+            }),
+            errorStrategy: 'snackbar'
+        });
+    }
+
+    start() {
+        this.startComponentRequest.next({
+            id: this.request.entity.id,
+            uri: this.request.entity.uri,
+            type: ComponentType.Processor,
+            revision: this.client.getRevision({
+                ...this.request.entity,
+                revision: this.revision
+            }),
+            errorStrategy: 'snackbar'
+        });
+    }
+
+    disable() {
+        this.disableComponentRequest.next({
+            id: this.request.entity.id,
+            uri: this.request.entity.uri,
+            type: ComponentType.Processor,
+            revision: this.client.getRevision({
+                ...this.request.entity,
+                revision: this.revision
+            }),
+            errorStrategy: 'snackbar'
+        });
+    }
+
+    enable() {
+        this.enableComponentRequest.next({
+            id: this.request.entity.id,
+            uri: this.request.entity.uri,
+            type: ComponentType.Processor,
+            revision: this.client.getRevision({
+                ...this.request.entity,
+                revision: this.revision
+            }),
+            errorStrategy: 'snackbar'
+        });
+    }
+
     private getModifiedProperties(): ModifiedProperties {
-        const propertyControl: AbstractControl | null = 
this.editProcessorForm.get('properties');
+        const propertyControl: AbstractControl | null | undefined = 
this.editProcessorForm.get('properties');

Review Comment:
   Good catch. It is not needed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to