rfellows commented on code in PR #8843:
URL: https://github.com/apache/nifi/pull/8843#discussion_r1607179560
##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/login-configuration/login-configuration.actions.ts:
##########
@@ -15,19 +15,12 @@
* limitations under the License.
*/
-import { TestBed } from '@angular/core/testing';
+import { createAction, props } from '@ngrx/store';
+import { LoadLoginConfigurationResponse } from './index';
-import { AuthStorage } from './auth-storage.service';
+export const loadLoginConfiguration = createAction('[Login Configuration] Load
Login Configuration');
-describe('AuthStorage', () => {
- let service: AuthStorage;
-
- beforeEach(() => {
- TestBed.configureTestingModule({});
- service = TestBed.inject(AuthStorage);
- });
-
- it('should be created', () => {
- expect(service).toBeTruthy();
- });
-});
+export const loadLoginConfigurationSuccess = createAction(
+ '[Flow Configuration] Load Login Configuration Success',
+ props<{ response: LoadLoginConfigurationResponse }>()
+);
Review Comment:
We should be consistent in the action `type` naming.
```suggestion
export const loadLoginConfigurationSuccess = createAction(
'[Login Configuration] Load Login Configuration Success',
props<{ response: LoadLoginConfigurationResponse }>()
);
```
##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/login-configuration/login-configuration.effects.ts:
##########
@@ -0,0 +1,61 @@
+/*
+ * 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 { Injectable } from '@angular/core';
+import { Actions, createEffect, ofType } from '@ngrx/effects';
+import * as LoginConfigurationActions from './login-configuration.actions';
+import { catchError, from, map, of, switchMap } from 'rxjs';
+import * as ErrorActions from '../error/error.actions';
+import { HttpErrorResponse } from '@angular/common/http';
+import { ErrorHelper } from '../../service/error-helper.service';
+import { AuthService } from '../../service/auth.service';
+
+@Injectable()
+export class LoginConfigurationEffects {
+ constructor(
+ private actions$: Actions,
+ private authService: AuthService,
+ private errorHelper: ErrorHelper
+ ) {}
+
+ loadFlowConfiguration$ = createEffect(() =>
Review Comment:
```suggestion
loadLoginConfiguration$ = createEffect(() =>
```
##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/page-content/page-content.component.ts:
##########
@@ -30,16 +33,18 @@ import { RouterLink } from '@angular/router';
export class PageContent {
@Input() title = '';
+ logoutSupported = this.store.selectSignal(selectLogoutSupported);
+
constructor(
- private authStorage: AuthStorage,
+ private store: Store<NiFiState>,
private authService: AuthService
) {}
- logout(): void {
- this.authService.logout();
+ resetRoutedToFullScreenError(): void {
+ this.store.dispatch(setRoutedToFullScreenError({
routedToFullScreenError: false }));
}
- hasToken(): boolean {
- return this.authStorage.hasToken();
+ logout(): void {
+ this.authService.logout();
Review Comment:
Seems inconsistent to call directly to the authService from here to logout
and not fire an action for it. I realize this didn't change in this PR, but
seems like a good time to align it with how everything else is done.
--
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]