rfellows commented on code in PR #8786:
URL: https://github.com/apache/nifi/pull/8786#discussion_r1596711403


##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/component-context/component-context.component.ts:
##########
@@ -27,22 +27,25 @@ import { ComponentTypeNamePipe } from 
'../../../pipes/component-type-name.pipe';
     styleUrl: './component-context.component.scss'
 })
 export class ComponentContext {
-    private _componentType: ComponentType = ComponentType.Processor;
+    private _componentType: ComponentType | string | null = 
ComponentType.Processor;
     componentIconClass: string = '';
 
-    @Input() set type(type: ComponentType) {
+    @Input() set type(type: ComponentType | string | null) {
         this._componentType = type;
         this.componentIconClass = this.getIconClassName(type);
     }
 
-    get type(): ComponentType {
+    get type(): ComponentType | string | null {
         return this._componentType;
     }
 
     @Input() id: string | null = null;
     @Input() name: string = '';
 
-    private getIconClassName(type: ComponentType) {
+    private getIconClassName(type: ComponentType | string | null) {
+        if (type !== null && typeof type !== 'string') {
+            return 'icon-drop';
+        }

Review Comment:
   This didn't work for the Parameter Context example. It should show the nifi 
drop logo for param contexts. I made a quick change to this method that solves 
the issue.
   
   basically we can't determine the difference between a string and a Component 
type. need to return the drop icon if it is null or it isn't in the switch (so 
the default scenario)...
   
   ```
       private getIconClassName(type: ComponentType | string | null) {
           if (type === null) {
               return 'icon-drop';
           }
           switch (type) {
               case ComponentType.Connection:
                   return 'icon-connect';
               case ComponentType.Processor:
                   return 'icon-processor';
               case ComponentType.OutputPort:
                   return 'icon-port-out';
               case ComponentType.InputPort:
                   return 'icon-port-in';
               case ComponentType.ProcessGroup:
                   return 'icon-group';
               case ComponentType.Funnel:
                   return 'icon-funnel';
               case ComponentType.Label:
                   return 'icon-label';
               case ComponentType.RemoteProcessGroup:
                   return 'icon-group-remote';
               default:
                   return 'icon-drop';
           }
       }
   ```



-- 
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