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


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/documentation/feature/documentation.component.spec.ts:
##########
@@ -0,0 +1,52 @@
+/*
+ * 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 { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { Documentation } from './documentation.component';
+import { RouterModule } from '@angular/router';
+import { RouterTestingModule } from '@angular/router/testing';
+import { Component } from '@angular/core';
+import { provideMockStore } from '@ngrx/store/testing';
+import { initialState } from 
'../../../state/documentation/documentation.reducer';
+
+describe('Documentation', () => {
+    let component: Documentation;
+    let fixture: ComponentFixture<Documentation>;
+
+    @Component({
+        selector: 'navigation',
+        standalone: true,
+        template: ''
+    })
+    class MockNavigation {}

Review Comment:
   This mock could be useful in other tests. Do you think it is worth it to 
move it to a common location?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/flow-analysis-rule-table/flow-analysis-rule-table.component.html:
##########
@@ -31,7 +31,10 @@
                 <td mat-cell *matCellDef="let item">
                     @if (canRead(item)) {
                         <div class="flex items-center gap-x-3">
-                            <div class="pointer fa fa-book" 
title="Usage"></div>
+                            <div
+                                class="pointer fa fa-book"
+                                (click)="viewDocumentationClicked(item, 
$event)"
+                                title="View Documentation"></div>

Review Comment:
   General question: are we using title for tooltips in the new NiFi UI? The 
styles are different from other tooltips and likely don't work well with 
light/dark themes.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/documentation/feature/documentation.component.html:
##########
@@ -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.
+  -->
+
+<div class="pb-5 flex flex-col h-screen justify-between">
+    <header class="nifi-header">
+        <navigation></navigation>

Review Comment:
   I thought we landed a PR where if the user clicks the nifi logo in the 
header they are returned the user to the selected component on the canvas? Or 
at least to the PG they were in:
   
   ![Kapture 2024-02-15 at 15 53 
40](https://github.com/apache/nifi/assets/6797571/6d418309-ef8a-4039-933a-628e551d43b6)
   
   Also, dark mode does not look great with the documentation app. We will need 
to address that in a follow on effort.
   



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/app-routing.module.ts:
##########
@@ -28,6 +28,12 @@ const routes: Routes = [
         path: 'error',
         loadChildren: () => 
import('./pages/error/feature/error.module').then((m) => m.ErrorModule)
     },
+    {
+        path: 'documentation',
+        canMatch: [authenticationGuard],

Review Comment:
   Does the user really need to be authorized to view the documentation?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts:
##########
@@ -57,6 +57,7 @@ import {
 } from '../../../ui/common/context-menu/context-menu.component';
 import { promptEmptyQueueRequest, promptEmptyQueuesRequest } from 
'../state/queue/queue.actions';
 import { getComponentStateAndOpenDialog } from 
'../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../state/documentation/documentation.actions';

Review Comment:
   Should this be 'import * as DocumentationActions from 
'./documentation.actions';'?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/controller-service/controller-services.component.ts:
##########
@@ -46,6 +46,7 @@ import { selectFlowConfiguration } from 
'../../../../state/flow-configuration/fl
 import { NiFiState } from '../../../../state';
 import { loadFlowConfiguration } from 
'../../../../state/flow-configuration/flow-configuration.actions';
 import { getComponentStateAndOpenDialog } from 
'../../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Should this be 'import * as DocumentationActions from 
'./documentation.actions';'?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts:
##########
@@ -717,13 +718,26 @@ export class CanvasContextMenu implements 
ContextMenuDefinitionProvider {
             },
             {
                 condition: (selection: any) => {
-                    // TODO - hasUsage
-                    return false;
+                    return (
+                        this.canvasUtils.canRead(selection) &&

Review Comment:
   Does the user need read policy to view the documentation for a processor?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/navigation/navigation.component.html:
##########
@@ -136,15 +136,18 @@
                             <mat-divider></mat-divider>
                         }
                     }
-                    <button mat-menu-item class="global-menu-item">
+                    <button mat-menu-item class="global-menu-item" 
[routerLink]="['/documentation']">
                         <i class="fa fa-fw fa-question-circle mr-2"></i>
                         Help
                     </button>
                     <button mat-menu-item class="global-menu-item">
                         <i class="fa fa-fw fa-info-circle mr-2"></i>
                         About
                     </button>
-                    <button mat-menu-item 
[matMenuTriggerFor]="theming">Appearance</button>
+                    <button mat-menu-item [matMenuTriggerFor]="theming">
+                        <i class="fa fa-fw mr-2"></i>

Review Comment:
   Thanks for fixing this!



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/controller-service/controller-service-table/controller-service-table.component.html:
##########
@@ -31,13 +31,11 @@
                 <td mat-cell *matCellDef="let item">
                     @if (canRead(item)) {
                         <div class="flex items-center gap-x-3">
-                            <div class="pointer fa fa-book" 
title="Usage"></div>
-                            <!--
-              nifiTooltip dynamically inserts the tooltip component
-              into the dom. the dom placement caused shifting of icons
-              because of the gap between items. simple solution is to
-              just wrap the target.
-              -->
+                            <div
+                                class="pointer fa fa-book"
+                                (click)="viewDocumentationClicked(item, 
$event)"
+                                title="View Documentation"></div>

Review Comment:
   title versus tooltip?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/reporting-tasks.component.ts:
##########
@@ -43,6 +43,7 @@ import { NiFiState } from '../../../../state';
 import { loadFlowConfiguration } from 
'../../../../state/flow-configuration/flow-configuration.actions';
 import { selectFlowConfiguration } from 
'../../../../state/flow-configuration/flow-configuration.selectors';
 import { getComponentStateAndOpenDialog } from 
'../../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Should this be 'import * as DocumentationActions from 
'./documentation.actions';'?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/parameter-providers/parameter-providers-table/parameter-providers-table.component.html:
##########
@@ -31,25 +31,29 @@
                     <ng-container matColumnDef="moreDetails">
                         <th mat-header-cell *matHeaderCellDef></th>
                         <td mat-cell *matCellDef="let item">
-                            <div class="flex items-center gap-x-3">
-                                <!-- TODO: open details -->
-                                <div class="pointer fa fa-info-circle" 
title="View details"></div>
+                            @if (canRead(item)) {
+                                <div class="flex items-center gap-x-3">
+                                    <!-- TODO: open details -->
+                                    <div class="pointer fa fa-info-circle" 
title="View details"></div>
 
-                                <!-- TODO: open documentation -->
-                                <div class="pointer fa fa-book" title="View 
Documentation"></div>
+                                    <div
+                                        class="pointer fa fa-book"
+                                        
(click)="viewDocumentationClicked(item, $event)"
+                                        title="View Documentation"></div>

Review Comment:
   title versus tooltip?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/documentation/feature/documentation.component.ts:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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, OnDestroy, SecurityContext } from '@angular/core';
+import { NiFiState } from '../../../state';
+import { Store } from '@ngrx/store';
+import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
+import { HttpParams } from '@angular/common/http';
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
+import { selectDocumentationParameters } from 
'../../../state/documentation/documentation.selectors';
+import { DocumentationParameters } from '../../../state/documentation';
+import { clearDocumentationParameters } from 
'../../../state/documentation/documentation.actions';

Review Comment:
   Should this be 'import * as DocumentationActions from 
'./documentation.actions';'?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/flow-analysis-rules.component.ts:
##########
@@ -41,6 +41,7 @@ import { selectCurrentUser } from 
'../../../../state/current-user/current-user.s
 import { NiFiState } from '../../../../state';
 import { FlowAnalysisRuleEntity, FlowAnalysisRulesState } from 
'../../state/flow-analysis-rules';
 import { getComponentStateAndOpenDialog } from 
'../../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Should this be 'import * as DocumentationActions from 
'./documentation.actions';'?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/documentation/documentation.reducer.ts:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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 { createReducer, on } from '@ngrx/store';
+import { DocumentationState } from './index';
+import { clearDocumentationParameters, navigateToComponentDocumentation } from 
'./documentation.actions';

Review Comment:
   Should this be 'import * as DocumentationActions from 
'./documentation.actions';'? I think we talked about this in the effects 
modules but do we want to follow that same approach in the reducers?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/management-controller-services/management-controller-services.component.ts:
##########
@@ -45,6 +45,7 @@ import { selectFlowConfiguration } from 
'../../../../state/flow-configuration/fl
 import { loadFlowConfiguration } from 
'../../../../state/flow-configuration/flow-configuration.actions';
 import { CurrentUser } from '../../../../state/current-user';
 import { getComponentStateAndOpenDialog } from 
'../../../../state/component-state/component-state.actions';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Should this be 'import * as DocumentationActions from 
'./documentation.actions';'?



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/parameter-providers/parameter-providers.component.ts:
##########
@@ -34,6 +34,7 @@ import { initialParameterProvidersState } from 
'../../state/parameter-providers/
 import { switchMap, take } from 'rxjs';
 import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
 import { isDefinedAndNotNull } from '../../../../state/shared';
+import { navigateToComponentDocumentation } from 
'../../../../state/documentation/documentation.actions';

Review Comment:
   Should this be 'import * as DocumentationActions from 
'./documentation.actions';'?



-- 
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-unsubscr...@nifi.apache.org

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

Reply via email to