You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "mcgilman (via GitHub)" <gi...@apache.org> on 2026/04/17 15:08:05 UTC

[PR] NIFI-15820: Adding an expandable side panel with a Connector info car… [nifi]

mcgilman opened a new pull request, #11160:
URL: https://github.com/apache/nifi/pull/11160

   …d to the Connector canvas.
   
   ## Summary
   
   Introduces an expandable side panel on the connector canvas that surfaces a `Connector Info` control with inline connector management. The side panel uses a `mat-sidenav` in `side`/`disableClose` mode, toggled from the header bar, with its open/closed preference persisted via the `Storage` service so the layout is remembered across sessions.
   
   The new `connector-info-control` card displays connector state and queued-data metrics, and exposes action buttons for:
   
   - **Start** / **Stop** — transition the connector between `RUNNING` and `STOPPED`.
   - **Drain** / **Cancel Drain** — initiate draining of queued FlowFiles and cancel an in-flight drain. Drain prompts for confirmation; Cancel Drain does not.
   
   Buttons are kept rendered and toggled via `disabled` state (rather than unmounted) while actions are in-flight to avoid the info panel briefly shrinking to a single row and causing a flicker. Start/Stop are rendered as icon buttons; drain controls use `mat-stroked-button`; all row-one actions are left-aligned.
   
   A new `connector-detail-header` shared component provides the name/type/state header and is reused inside the info control.
   
   ## Connector-scoped error banner
   
   To keep API failures from the info card visible (and not silently dropped), a `CONNECTOR_CANVAS` `ErrorContextKey` was added and a `<context-error-banner>` is mounted as a floating overlay over the reusable canvas. A new effect clears prior `CONNECTOR_CANVAS` banner errors on each action dispatch so stale errors do not leak between operations or across pages. Banner chrome (background, outline, border-radius, shadow) is applied via a new `_connector-canvas.component-theme.scss` partial included from `styles.scss`, avoiding `::ng-deep` while participating in light/dark theming.
   
   ## Changes
   
   - **State** — New `connector-canvas-entity` feature slice (`actions`, `reducer`, `effects`) handling load, start, stop, drain, cancel-drain, and a unified `connectorActionApiError` action routed to the new canvas banner context.
   - **UI**
     - `connector-canvas.component` mounts the sidenav, graph controls, and floating error banner.
     - `connector-graph-controls.component` hosts the collapsible panel content.
     - `connector-info-control.component` renders the connector detail header, metrics, and actions.
     - `connector-detail-header.component` added under `libs/shared` for reuse.
   - **Styling** — New component theme partial wired into `styles.scss` for both light and dark themes.
   - **Error model** — `CONNECTOR_CANVAS` added to `ErrorContextKey`.
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-15820: Adding an expandable side panel with a Connector info car… [nifi]

Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows commented on code in PR #11160:
URL: https://github.com/apache/nifi/pull/11160#discussion_r3126117350


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/connectors/ui/connector-canvas/connector-canvas.component.ts:
##########
@@ -64,6 +77,10 @@ export class ConnectorCanvasComponent implements OnInit, OnDestroy {
     private destroyRef = inject(DestroyRef);
     private router = inject(Router);
     private dialog = inject(MatDialog);
+    private storage = inject(Storage);
+
+    private static readonly CONTROL_VISIBILITY_KEY = 'graph-control-visibility';
+    private static readonly GRAPH_CONTROL_KEY = 'connector-graph-controls';

Review Comment:
   This duplicates `GRAPH_CONTROLS_STORAGE_KEY` on line 55 above. We should get rid of one of them. At this point, `GRAPH_CONTROLS_STORAGE_KEY` is unused and actually spawns a lint warning.



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/connectors/ui/connector-canvas/connector-canvas.component.scss:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+context-error-banner.canvas-error-banner {
+    ::ng-deep .banner-container {
+        background-color: var(--mat-sys-surface-container);
+        border: 1px solid var(--mat-sys-outline-variant);
+        border-radius: 4px;
+        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
+        color: var(--mat-sys-on-surface);
+        margin-bottom: 0;
+    }
+}

Review Comment:
   This file isn't leveraged/referenced in the `@Component` ts file and it duplicates the same styles as in `_connector-canvas.component-theme.scss`... can we just delete this file since it seems to be unsed?



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/connectors/ui/connector-canvas/graph-controls/connector-info-control/connector-info-control.component.ts:
##########
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, inject, input } from '@angular/core';
+import { MatButtonModule } from '@angular/material/button';
+import { MatExpansionPanel, MatExpansionPanelHeader, MatExpansionPanelTitle } from '@angular/material/expansion';
+import { MatTooltip } from '@angular/material/tooltip';
+import { Store } from '@ngrx/store';
+import {
+    ConnectorDetailHeader,
+    ConnectorEntity,
+    Storage,
+    canReadConnector,
+    canModifyConnector,
+    canOperateConnector,
+    isConnectorActionAllowed,
+    getConnectorActionDisabledReason
+} from '@nifi/shared';
+import * as ConnectorCanvasEntityActions from '../../../../state/connector-canvas-entity/connector-canvas-entity.actions';
+import {
+    navigateToViewConnectorDetails,
+    navigateToConfigureConnector
+} from '../../../../state/connectors-listing/connectors-listing.actions';
+
+@Component({
+    selector: 'connector-info-control',
+    standalone: true,
+    imports: [
+        ConnectorDetailHeader,
+        MatButtonModule,
+        MatExpansionPanel,
+        MatExpansionPanelHeader,
+        MatExpansionPanelTitle,
+        MatTooltip
+    ],
+    templateUrl: './connector-info-control.component.html',
+    styleUrls: ['./connector-info-control.component.scss']
+})
+export class ConnectorInfoControl {
+    private store = inject(Store);
+    private storage = inject(Storage);
+
+    private static readonly CONTROL_VISIBILITY_KEY = 'graph-control-visibility';
+    private static readonly CONNECTOR_KEY = 'connector-info-control';
+
+    connectorCollapsed = false;
+
+    connectorEntity = input<ConnectorEntity | null>(null);
+    entitySaving = input<boolean>(false);
+
+    constructor() {
+        try {
+            const item: { [key: string]: boolean } | null = this.storage.getItem(
+                ConnectorInfoControl.CONTROL_VISIBILITY_KEY
+            );
+            if (item) {
+                this.connectorCollapsed = item[ConnectorInfoControl.CONNECTOR_KEY] === false;
+            }
+        } catch (_e) {
+            // likely could not parse item... ignoring
+        }
+    }
+
+    toggleCollapsed(collapsed: boolean): void {
+        this.connectorCollapsed = collapsed;
+
+        let item: { [key: string]: boolean } | null = this.storage.getItem(ConnectorInfoControl.CONTROL_VISIBILITY_KEY);
+        if (item == null) {
+            item = {};
+        }
+
+        item[ConnectorInfoControl.CONNECTOR_KEY] = !this.connectorCollapsed;
+        this.storage.setItem(ConnectorInfoControl.CONTROL_VISIBILITY_KEY, item);
+    }
+
+    canRead(): boolean {
+        const entity = this.connectorEntity();
+        return !!entity && canReadConnector(entity);
+    }
+
+    canConfigure(): boolean {
+        const entity = this.connectorEntity();
+        if (!entity || this.entitySaving()) {
+            return false;
+        }
+        return canReadConnector(entity) && canModifyConnector(entity) && isConnectorActionAllowed(entity, 'CONFIGURE');
+    }
+
+    getConfigureDisabledReason(): string {
+        const entity = this.connectorEntity();
+        if (!entity) {
+            return '';
+        }
+        return getConnectorActionDisabledReason(entity, 'CONFIGURE');
+    }
+
+    showConfigureButton(): boolean {
+        const entity = this.connectorEntity();
+        if (!entity) {
+            return false;
+        }
+        return canReadConnector(entity) && canModifyConnector(entity);
+    }
+
+    canDrain(): boolean {
+        const entity = this.connectorEntity();
+        if (!entity) {
+            return false;
+        }
+        return canOperateConnector(entity) && isConnectorActionAllowed(entity, 'DRAIN_FLOWFILES');
+    }
+
+    canCancelDrain(): boolean {
+        const entity = this.connectorEntity();
+        if (!entity) {
+            return false;
+        }
+        return canOperateConnector(entity) && isConnectorActionAllowed(entity, 'CANCEL_DRAIN_FLOWFILES');
+    }

Review Comment:
   These 2 `canXXX` methods differ in pattern to the others in this file in that these don't consider the `this.entitySaving()`. They are more similar to the `showXXX` methods. I see the `entitySaving` is instead used on the DOM elements to control disabled state. Maybe tighten up the pattern? I think we are getting what the desired effect is, but the logic isn't consistent.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-15820: Adding an expandable side panel with a Connector info car… [nifi]

Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows commented on PR #11160:
URL: https://github.com/apache/nifi/pull/11160#issuecomment-4298946866

   Reviewing...
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-15820: Adding an expandable side panel with a Connector info car… [nifi]

Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows merged PR #11160:
URL: https://github.com/apache/nifi/pull/11160


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org