Skip to content

Commit 74f311a

Browse files
xflordHejdaJakub
authored andcommitted
fix: footer loads properly even when RPC version cannot be parsed
* fixed a bug where if the call for rpc version returned a different response than expected, a type error would happen and the whole footer would not load
1 parent 4f74e37 commit 74f311a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

libs/perun/components/src/lib/perun-footer/perun-footer.component.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { Component, OnInit } from '@angular/core';
66
import { MatDialog } from '@angular/material/dialog';
77
import { ReportIssueDialogComponent } from '../report-issue-dialog/report-issue-dialog.component';
8-
import { AuthService, InitAuthService, StoreService } from '@perun-web-apps/perun/services';
8+
import { StoreService } from '@perun-web-apps/perun/services';
99
import { getDefaultDialogConfig } from '@perun-web-apps/perun/utils';
1010
import { TranslateService } from '@ngx-translate/core';
1111
import { UtilsService } from '@perun-web-apps/perun/openapi';
@@ -30,7 +30,7 @@ export class PerunFooterComponent implements OnInit {
3030
githubBackendRepository: string = this.storeService.getProperty('footer').github_backend_releases;
3131
bgColor: string = this.storeService.getProperty('theme').footer_bg_color;
3232
version = '';
33-
backendVersion = '';
33+
backendVersion = 'N/A';
3434
guiVersion = '';
3535
language = 'en';
3636
columnContentHeight = 0;
@@ -39,9 +39,7 @@ export class PerunFooterComponent implements OnInit {
3939
private storeService: StoreService,
4040
private translateService: TranslateService,
4141
private utilsService: UtilsService,
42-
private dialog: MatDialog,
43-
private authService: AuthService,
44-
private initAuthService: InitAuthService
42+
private dialog: MatDialog
4543
) {}
4644

4745
ngOnInit(): void {
@@ -54,7 +52,10 @@ export class PerunFooterComponent implements OnInit {
5452
this.guiVersion = require('../../../../../../package.json').version as string;
5553

5654
this.utilsService.getPerunRPCVersion(true).subscribe((val) => {
57-
this.backendVersion = val.match('\\bVersion:\\s*([^,\\s]+)')[1];
55+
const match = val.match('\\bVersion:\\s*([^,\\s]+)');
56+
if (match !== null) {
57+
this.backendVersion = match[1];
58+
}
5859
});
5960

6061
this.footerColumns = this.storeService.getProperty('footer').columns;

0 commit comments

Comments
 (0)