You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2023/01/02 18:20:27 UTC

[streampipes] branch chore/ui-linting updated (5f109cbcd -> edd7d2612)

This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a change to branch chore/ui-linting
in repository https://gitbox.apache.org/repos/asf/streampipes.git


 discard 5f109cbcd add linting to enums models (#877)
 discard c2e0811c0 add linting to enums guards (#877)
     new 938fb55d7 add linting to guards model (#877)
     new edd7d2612 add linting to models module (#877)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5f109cbcd)
            \
             N -- N -- N   refs/heads/chore/ui-linting (edd7d2612)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[streampipes] 02/02: add linting to models module (#877)

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch chore/ui-linting
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit edd7d2612499971f9a78d2d0c581f87528d91f86
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Jan 2 19:18:34 2023 +0100

    add linting to models module (#877)
---
 ui/.eslintignore                 | 1 -
 ui/.prettierignore               | 1 -
 ui/src/app/_models/auth.model.ts | 6 +++---
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/ui/.eslintignore b/ui/.eslintignore
index 877a18339..101554f57 100644
--- a/ui/.eslintignore
+++ b/ui/.eslintignore
@@ -19,7 +19,6 @@ dist
 # Remove these in the future to lint additional modules
 # Please also see .prettierignore
 projects
-src/app/_models
 src/app/add
 src/app/apidocs
 src/app/app-asset-monitoring
diff --git a/ui/.prettierignore b/ui/.prettierignore
index dd6aaaa7d..e95abae01 100644
--- a/ui/.prettierignore
+++ b/ui/.prettierignore
@@ -19,7 +19,6 @@ dist
 # Remove these in the future to format additional modules
 # Please also see .eslintignore
 projects
-src/app/_models
 src/app/add
 src/app/apidocs
 src/app/app-asset-monitoring
diff --git a/ui/src/app/_models/auth.model.ts b/ui/src/app/_models/auth.model.ts
index 18fc771ef..ba4a98f28 100644
--- a/ui/src/app/_models/auth.model.ts
+++ b/ui/src/app/_models/auth.model.ts
@@ -22,7 +22,7 @@ import { UserRole } from '../_enums/user-role.enum';
 export type RoleModel = Privilege | Role;
 
 export interface RoleDescription {
-  role: UserRole;
-  roleTitle: string;
-  roleDescription: string;
+    role: UserRole;
+    roleTitle: string;
+    roleDescription: string;
 }


[streampipes] 01/02: add linting to guards model (#877)

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch chore/ui-linting
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 938fb55d704a78f6c4527cf9fd423b5b1d5b982a
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Jan 2 19:17:48 2023 +0100

    add linting to guards model (#877)
---
 ui/.eslintignore                                   |  1 -
 ui/.prettierignore                                 |  1 -
 .../already-configured.can-activate.guard.ts       | 20 ++++----
 .../_guards/auth.can-activate-children.guard.ts    | 33 +++++++------
 .../_guards/base-configured.can-activate.guard.ts  | 54 +++++++++++++---------
 .../app/_guards/configured.can-activate.guard.ts   | 21 ++++-----
 ui/src/app/_guards/page-auth.can-active.guard.ts   | 18 ++++----
 .../registration-allowed.can-activate.guard.ts     | 37 +++++++++------
 .../restore-password-allowed.can-activate.guard.ts | 37 +++++++++------
 9 files changed, 122 insertions(+), 100 deletions(-)

diff --git a/ui/.eslintignore b/ui/.eslintignore
index 4f9dc56c8..877a18339 100644
--- a/ui/.eslintignore
+++ b/ui/.eslintignore
@@ -19,7 +19,6 @@ dist
 # Remove these in the future to lint additional modules
 # Please also see .prettierignore
 projects
-src/app/_guards
 src/app/_models
 src/app/add
 src/app/apidocs
diff --git a/ui/.prettierignore b/ui/.prettierignore
index f5743c083..dd6aaaa7d 100644
--- a/ui/.prettierignore
+++ b/ui/.prettierignore
@@ -19,7 +19,6 @@ dist
 # Remove these in the future to format additional modules
 # Please also see .eslintignore
 projects
-src/app/_guards
 src/app/_models
 src/app/add
 src/app/apidocs
diff --git a/ui/src/app/_guards/already-configured.can-activate.guard.ts b/ui/src/app/_guards/already-configured.can-activate.guard.ts
index 5d51100d8..49cdd2830 100644
--- a/ui/src/app/_guards/already-configured.can-activate.guard.ts
+++ b/ui/src/app/_guards/already-configured.can-activate.guard.ts
@@ -23,17 +23,15 @@ import { BaseConfiguredCanActivateGuard } from './base-configured.can-activate.g
 
 @Injectable()
 export class AlreadyConfiguredCanActivateGuard extends BaseConfiguredCanActivateGuard {
+    constructor(router: Router, authService: AuthService) {
+        super(router, authService);
+    }
 
-  constructor(router: Router,
-              authService: AuthService) {
-    super(router, authService);
-  }
+    onIsConfigured(): boolean | UrlTree {
+        return this.router.parseUrl('login');
+    }
 
-  onIsConfigured(): boolean | UrlTree {
-    return this.router.parseUrl('login');
-  }
-
-  onIsUnconfigured(): boolean | UrlTree {
-    return true;
-  }
+    onIsUnconfigured(): boolean | UrlTree {
+        return true;
+    }
 }
diff --git a/ui/src/app/_guards/auth.can-activate-children.guard.ts b/ui/src/app/_guards/auth.can-activate-children.guard.ts
index 7677ed570..cad3cf7ac 100644
--- a/ui/src/app/_guards/auth.can-activate-children.guard.ts
+++ b/ui/src/app/_guards/auth.can-activate-children.guard.ts
@@ -18,28 +18,27 @@
 
 import { Injectable } from '@angular/core';
 import {
-  ActivatedRouteSnapshot,
-  CanActivateChild,
-  Router,
-  RouterStateSnapshot
+    ActivatedRouteSnapshot,
+    CanActivateChild,
+    Router,
+    RouterStateSnapshot,
 } from '@angular/router';
 import { AuthService } from '../services/auth.service';
 
 @Injectable()
 export class AuthCanActivateChildrenGuard implements CanActivateChild {
+    constructor(private authService: AuthService, private router: Router) {}
 
-  constructor(private authService: AuthService,
-              private router: Router) {
-  }
+    canActivateChild(
+        childRoute: ActivatedRouteSnapshot,
+        state: RouterStateSnapshot,
+    ): boolean {
+        if (this.authService.authenticated()) {
+            return true;
+        }
+        this.authService.logout();
+        this.router.navigate(['/login']);
 
-  canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
-      if (this.authService.authenticated()) {
-        return true;
-      }
-      this.authService.logout();
-      this.router.navigate(['/login']);
-
-      return false;
-
-  }
+        return false;
+    }
 }
diff --git a/ui/src/app/_guards/base-configured.can-activate.guard.ts b/ui/src/app/_guards/base-configured.can-activate.guard.ts
index 4b28598b7..4310328b6 100644
--- a/ui/src/app/_guards/base-configured.can-activate.guard.ts
+++ b/ui/src/app/_guards/base-configured.can-activate.guard.ts
@@ -17,34 +17,44 @@
  */
 
 import {
-  ActivatedRouteSnapshot,
-  CanActivate,
-  Router,
-  RouterStateSnapshot,
-  UrlTree
+    ActivatedRouteSnapshot,
+    CanActivate,
+    Router,
+    RouterStateSnapshot,
+    UrlTree,
 } from '@angular/router';
 import { Observable } from 'rxjs';
 import { AuthService } from '../services/auth.service';
 
 export abstract class BaseConfiguredCanActivateGuard implements CanActivate {
+    constructor(protected router: Router, protected authService: AuthService) {}
 
-  constructor(protected router: Router,
-              protected authService: AuthService) { }
+    canActivate(
+        route: ActivatedRouteSnapshot,
+        state: RouterStateSnapshot,
+    ):
+        | Observable<boolean | UrlTree>
+        | Promise<boolean | UrlTree>
+        | boolean
+        | UrlTree {
+        return new Promise(resolve =>
+            this.authService.checkConfiguration().subscribe(
+                configured => {
+                    if (!configured) {
+                        resolve(this.onIsUnconfigured());
+                    } else {
+                        resolve(this.onIsConfigured());
+                    }
+                },
+                error => {
+                    const url = this.router.parseUrl('startup');
+                    resolve(url);
+                },
+            ),
+        );
+    }
 
-  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
-    return new Promise((resolve) => this.authService.checkConfiguration().subscribe((configured) => {
-      if (!configured) {
-        resolve(this.onIsUnconfigured());
-      } else {
-        resolve(this.onIsConfigured());
-      }
-    }, error => {
-      const url = this.router.parseUrl('startup');
-      resolve(url);
-    }));
-  }
+    abstract onIsConfigured(): boolean | UrlTree;
 
-  abstract onIsConfigured(): boolean | UrlTree;
-
-  abstract onIsUnconfigured(): boolean | UrlTree;
+    abstract onIsUnconfigured(): boolean | UrlTree;
 }
diff --git a/ui/src/app/_guards/configured.can-activate.guard.ts b/ui/src/app/_guards/configured.can-activate.guard.ts
index c787a6001..fc1e47cb6 100644
--- a/ui/src/app/_guards/configured.can-activate.guard.ts
+++ b/ui/src/app/_guards/configured.can-activate.guard.ts
@@ -23,18 +23,15 @@ import { BaseConfiguredCanActivateGuard } from './base-configured.can-activate.g
 
 @Injectable()
 export class ConfiguredCanActivateGuard extends BaseConfiguredCanActivateGuard {
+    constructor(router: Router, authService: AuthService) {
+        super(router, authService);
+    }
 
-  constructor(router: Router,
-              authService: AuthService) {
-    super(router, authService);
-  }
-
-  onIsConfigured(): boolean | UrlTree {
-    return true;
-  }
-
-  onIsUnconfigured(): boolean | UrlTree {
-    return this.router.parseUrl('setup');
-  }
+    onIsConfigured(): boolean | UrlTree {
+        return true;
+    }
 
+    onIsUnconfigured(): boolean | UrlTree {
+        return this.router.parseUrl('setup');
+    }
 }
diff --git a/ui/src/app/_guards/page-auth.can-active.guard.ts b/ui/src/app/_guards/page-auth.can-active.guard.ts
index 2370ebba3..f1acc2320 100644
--- a/ui/src/app/_guards/page-auth.can-active.guard.ts
+++ b/ui/src/app/_guards/page-auth.can-active.guard.ts
@@ -16,20 +16,22 @@
  *
  */
 
-import { ActivatedRouteSnapshot, CanActivateChild, Router } from '@angular/router';
+import {
+    ActivatedRouteSnapshot,
+    CanActivateChild,
+    Router,
+} from '@angular/router';
 import { AuthService } from '../services/auth.service';
 import { PageName } from '../_enums/page-name.enum';
 import { Injectable } from '@angular/core';
 
 @Injectable()
 export class PageAuthGuard implements CanActivateChild {
+    constructor(private router: Router, private authService: AuthService) {}
 
-  constructor(private router: Router,
-              private authService: AuthService) {}
+    canActivateChild(activatedRouteSnapshot: ActivatedRouteSnapshot): boolean {
+        const pageNames: PageName[] = activatedRouteSnapshot.data.authPageNames;
 
-  canActivateChild(activatedRouteSnapshot: ActivatedRouteSnapshot): boolean {
-    const pageNames: PageName[] = activatedRouteSnapshot.data.authPageNames;
-
-    return this.authService.isAnyAccessGranted(pageNames, true);
-  }
+        return this.authService.isAnyAccessGranted(pageNames, true);
+    }
 }
diff --git a/ui/src/app/_guards/registration-allowed.can-activate.guard.ts b/ui/src/app/_guards/registration-allowed.can-activate.guard.ts
index dbd48679e..61b91438f 100644
--- a/ui/src/app/_guards/registration-allowed.can-activate.guard.ts
+++ b/ui/src/app/_guards/registration-allowed.can-activate.guard.ts
@@ -18,11 +18,11 @@
 
 import { Injectable } from '@angular/core';
 import {
-  ActivatedRouteSnapshot,
-  CanActivate,
-  Router,
-  RouterStateSnapshot,
-  UrlTree
+    ActivatedRouteSnapshot,
+    CanActivate,
+    Router,
+    RouterStateSnapshot,
+    UrlTree,
 } from '@angular/router';
 import { LoginService } from '../login/services/login.service';
 import { Observable } from 'rxjs';
@@ -30,15 +30,22 @@ import { map } from 'rxjs/operators';
 
 @Injectable()
 export class RegistrationAllowedCanActivateGuard implements CanActivate {
+    constructor(private router: Router, private loginService: LoginService) {}
 
-  constructor(private router: Router,
-              private loginService: LoginService) {
-  }
-
-  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
-    return this.loginService.fetchLoginSettings().pipe(map(config => {
-      return config.allowSelfRegistration ? true : this.router.parseUrl('register');
-    }));
-  }
-
+    canActivate(
+        route: ActivatedRouteSnapshot,
+        state: RouterStateSnapshot,
+    ):
+        | Observable<boolean | UrlTree>
+        | Promise<boolean | UrlTree>
+        | boolean
+        | UrlTree {
+        return this.loginService.fetchLoginSettings().pipe(
+            map(config => {
+                return config.allowSelfRegistration
+                    ? true
+                    : this.router.parseUrl('register');
+            }),
+        );
+    }
 }
diff --git a/ui/src/app/_guards/restore-password-allowed.can-activate.guard.ts b/ui/src/app/_guards/restore-password-allowed.can-activate.guard.ts
index 8be421ba8..0499d21fa 100644
--- a/ui/src/app/_guards/restore-password-allowed.can-activate.guard.ts
+++ b/ui/src/app/_guards/restore-password-allowed.can-activate.guard.ts
@@ -18,11 +18,11 @@
 
 import { Injectable } from '@angular/core';
 import {
-  ActivatedRouteSnapshot,
-  CanActivate,
-  Router,
-  RouterStateSnapshot,
-  UrlTree
+    ActivatedRouteSnapshot,
+    CanActivate,
+    Router,
+    RouterStateSnapshot,
+    UrlTree,
 } from '@angular/router';
 import { LoginService } from '../login/services/login.service';
 import { Observable } from 'rxjs';
@@ -30,13 +30,24 @@ import { map } from 'rxjs/operators';
 
 @Injectable()
 export class RestorePasswordAllowedCanActivateGuard implements CanActivate {
+    constructor(private router: Router, private loginService: LoginService) {}
 
-  constructor(private router: Router,
-              private loginService: LoginService) {
-  }
-
-  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
-    return this.loginService.fetchLoginSettings().pipe(map(config => config.allowPasswordRecovery ? true : this.router.parseUrl('login')));
-  }
-
+    canActivate(
+        route: ActivatedRouteSnapshot,
+        state: RouterStateSnapshot,
+    ):
+        | Observable<boolean | UrlTree>
+        | Promise<boolean | UrlTree>
+        | boolean
+        | UrlTree {
+        return this.loginService
+            .fetchLoginSettings()
+            .pipe(
+                map(config =>
+                    config.allowPasswordRecovery
+                        ? true
+                        : this.router.parseUrl('login'),
+                ),
+            );
+    }
 }