Skip to content

Commit

Permalink
chore: Run pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
MoritzWeber0 committed Oct 10, 2023
1 parent b375b51 commit 0663c64
Show file tree
Hide file tree
Showing 129 changed files with 551 additions and 527 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class AppComponent implements AfterViewInit {
constructor(
public pageLayoutService: PageLayoutService,
public fullscreenService: FullscreenService,
private navBarService: NavBarService
private navBarService: NavBarService,
) {}

@ViewChild('sidenav') private sidenav?: MatSidenav;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/events/events.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class EventsComponent implements OnInit, AfterViewInit {

historyEventData: HistoryEvent[] = [];
historyEventDataSource = new MatTableDataSource<HistoryEvent>(
this.historyEventData
this.historyEventData,
);

constructor(private eventService: EventsService) {}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/events/service/events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class EventsService {

customSortingDataAccessor(
data: HistoryEvent,
sortHeaderId: string
sortHeaderId: string,
): string | number {
switch (sortHeaderId) {
case 'eventType':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class AuthGuardService implements CanActivate {

canActivate(
_route: ActivatedRouteSnapshot,
_state: RouterStateSnapshot
_state: RouterStateSnapshot,
):
| Observable<boolean | UrlTree>
| Promise<boolean | UrlTree>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class AuthRedirectComponent implements OnInit {
private route: ActivatedRoute,
private authService: AuthService,
private userService: UserService,
private router: Router
private router: Router,
) {}

ngOnInit(): void {
Expand All @@ -30,7 +30,7 @@ export class AuthRedirectComponent implements OnInit {
.map((key) =>
['error', 'error_description', 'error_uri'].includes(key)
? [key, params[key]].join('=')
: ''
: '',
)
.join('&');
this.router.navigateByUrl(redirect_url);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/general/auth/auth/auth.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AuthComponent implements OnInit {
public metadataService: MetadataService,
private authService: AuthService,
private pageLayoutService: PageLayoutService,
private route: ActivatedRoute
private route: ActivatedRoute,
) {
this.pageLayoutService.disableAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,27 @@ import {

@Injectable()
export class AuthInterceptor implements HttpInterceptor {
constructor(private router: Router, private authService: AuthService) {}
constructor(
private router: Router,
private authService: AuthService,
) {}

intercept(
request: HttpRequest<unknown>,
next: HttpHandler
next: HttpHandler,
): Observable<HttpEvent<unknown>> {
const req = this.injectAccessToken(request);
return next.handle(req).pipe(
catchError((err: HttpErrorResponse) => {
return this.handleTokenExpired(err, request, next);
})
}),
);
}

handleTokenExpired(
err: HttpErrorResponse,
request: HttpRequest<unknown>,
next: HttpHandler
next: HttpHandler,
) {
if (err.status === 401) {
if (err.error.detail.err_code == 'token_exp') {
Expand All @@ -50,7 +53,7 @@ export class AuthInterceptor implements HttpInterceptor {
catchError(() => {
this.router.navigateByUrl('/logout?reason=session-expired');
throw err;
})
}),
);
} else {
this.router.navigateByUrl('/logout?reason=unauthorized');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { AuthService } from 'src/app/services/auth/auth.service';
styleUrls: ['./logout-redirect.component.css'],
})
export class LogoutRedirectComponent implements OnInit {
constructor(private authService: AuthService, private router: Router) {}
constructor(
private authService: AuthService,
private router: Router,
) {}

ngOnInit(): void {
this.authService.logOut();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class LogoutComponent implements OnInit {

constructor(
private route: ActivatedRoute,
private pageLayoutService: PageLayoutService
private pageLayoutService: PageLayoutService,
) {
this.pageLayoutService.disableAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ul class="break-all">
/
<li *ngFor="let breadcrumb of breadcrumbService.breadcrumbs | async">
<a class="rounded-lg hover:bg-zinc-300 p-1" [routerLink]="breadcrumb.url">{{
<a class="rounded-lg p-1 hover:bg-zinc-300" [routerLink]="breadcrumb.url">{{
breadcrumb.label
}}</a>
</li>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/general/breadcrumbs/breadcrumbs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class BreadcrumbsService {
const breadcrumbs = (
route: ActivatedRouteSnapshot | null,
placeholders: Data,
parentUrl?: string[]
parentUrl?: string[],
): Breadcrumb[] => {
if (!route) {
return [];
Expand All @@ -66,7 +66,7 @@ const breadcrumbs = (
: '/' + routeUrl.join('/'),
};
return [breadcrumb].concat(
breadcrumbs(route.firstChild, placeholders, routeUrl)
breadcrumbs(route.firstChild, placeholders, routeUrl),
);
}

Expand All @@ -75,7 +75,7 @@ const breadcrumbs = (

const expand = (
term: string | ((placeholders: Data) => string),
placeholders: Data
placeholders: Data,
) => {
return typeof term === 'function' ? term(placeholders) || '...' : term;
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ErrorHandlingInterceptor implements HttpInterceptor {

intercept(
request: HttpRequest<unknown>,
next: HttpHandler
next: HttpHandler,
): Observable<HttpEvent<unknown>> {
return next.handle(request).pipe(
catchError(this.constructErrorDetailTransformationObservable),
Expand All @@ -48,7 +48,7 @@ export class ErrorHandlingInterceptor implements HttpInterceptor {
}
this.toastService.showError(
error.title || '',
error.reason || ''
error.reason || '',
);
}
}
Expand All @@ -59,7 +59,7 @@ export class ErrorHandlingInterceptor implements HttpInterceptor {
}
this.toastService.showWarning(
warning.title || '',
warning.reason || ''
warning.reason || '',
);
}
}
Expand All @@ -81,25 +81,25 @@ export class ErrorHandlingInterceptor implements HttpInterceptor {
for (const error of detail) {
this.toastService.showError(
getReasonPhrase(err.status),
error.msg
error.msg,
);
}
} else if (detail.reason) {
// User defined error
this.toastService.showError(
'An error occurred!',
ErrorHandlingInterceptor.getErrorReason(detail)
ErrorHandlingInterceptor.getErrorReason(detail),
);
}
} else if (err.status === 0) {
this.toastService.showError(
'Backend not reachable',
'Please check your internet connection and refresh the page!'
'Please check your internet connection and refresh the page!',
);
} else {
this.toastService.showError(
'An error occurred!',
'Please try again!'
'Please try again!',
);
}
},
Expand All @@ -113,7 +113,7 @@ export class ErrorHandlingInterceptor implements HttpInterceptor {
}
}
return event;
})
}),
);
}

Expand All @@ -137,7 +137,7 @@ export class ErrorHandlingInterceptor implements HttpInterceptor {
reader.onload = (e: Event) => {
try {
const errmsg = JSON.parse(
(<FileReaderEventTarget>e.target).result
(<FileReaderEventTarget>e.target).result,
);
reject(
new HttpErrorResponse({
Expand All @@ -146,7 +146,7 @@ export class ErrorHandlingInterceptor implements HttpInterceptor {
status: err.status,
statusText: err.statusText,
url: err.url || undefined,
})
}),
);
} catch (e) {
reject(err);
Expand All @@ -156,7 +156,7 @@ export class ErrorHandlingInterceptor implements HttpInterceptor {
reject(err);
};
reader.readAsText(err.error);
})
}),
);
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/general/footer/footer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ import { MetadataService } from 'src/app/general/metadata/metadata.service';
export class FooterComponent {
constructor(
public dialog: MatDialog,
public metadataService: MetadataService
public metadataService: MetadataService,
) {}
}
6 changes: 3 additions & 3 deletions frontend/src/app/general/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-->

<div class="bg-zinc-100">
<div class="flex justify-between items-center min-h-[65px]">
<div class="flex min-h-[65px] items-center justify-between">
<div class="xl:hidden">
<button
mat-icon-button
Expand Down Expand Up @@ -37,7 +37,7 @@
</div>
</div>
<div>
<div class="hidden xl:flex gap-2">
<div class="hidden gap-2 xl:flex">
<div>
<a
mat-raised-button
Expand Down Expand Up @@ -87,7 +87,7 @@
</div>
</div>

<div class="primaryText ml-5 pb-2 select-none text-base">
<div class="primaryText ml-5 select-none pb-2 text-base">
<app-breadcrumbs></app-breadcrumbs>
</div>
</div>
2 changes: 1 addition & 1 deletion frontend/src/app/general/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export class HeaderComponent {
constructor(
public authService: AuthService,
public userService: UserService,
public navBarService: NavBarService
public navBarService: NavBarService,
) {}
}
8 changes: 5 additions & 3 deletions frontend/src/app/general/metadata/metadata.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class MetadataService {
constructor(
private httpClient: HttpClient,
private localStorageService: LocalStorageService,
public dialog: MatDialog
public dialog: MatDialog,
) {
this.loadVersion();
this.loadBackendMetadata().subscribe();
Expand All @@ -29,7 +29,7 @@ export class MetadataService {
public changedVersion = false;

private _backendMetadata = new BehaviorSubject<BackendMetadata | undefined>(
undefined
undefined,
);
readonly backendMetadata = this._backendMetadata.asObservable();

Expand All @@ -48,7 +48,9 @@ export class MetadataService {
return this.httpClient
.get<BackendMetadata>(environment.backend_url + '/metadata')
.pipe(
tap((metadata: BackendMetadata) => this._backendMetadata.next(metadata))
tap((metadata: BackendMetadata) =>
this._backendMetadata.next(metadata),
),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ import { MetadataService } from '../metadata.service';
export class VersionComponent {
constructor(
public metadataService: MetadataService,
public dialog: MatDialog
public dialog: MatDialog,
) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export class NavBarMenuComponent {
constructor(
public authService: AuthService,
public navBarService: NavBarService,
public userService: UserService
public userService: UserService,
) {}
}
2 changes: 1 addition & 1 deletion frontend/src/app/helpers/validators/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function lowerCaseValidator(): ValidatorFn {
export function regExpValidator(
ruleRegExp: RegExp,
value: string,
errors: ValidationErrors
errors: ValidationErrors,
): ValidationErrors | null {
if (!ruleRegExp.test(value)) {
return errors;
Expand Down
Loading

0 comments on commit 0663c64

Please sign in to comment.