Polish /nodes and /network pages

This commit is contained in:
Mononaut
2024-03-05 23:16:20 +00:00
parent c9b2ce3efb
commit 71863e4f48
6 changed files with 81 additions and 17 deletions

View File

@@ -29,8 +29,8 @@ export class ServerHealthComponent implements OnInit {
let statusUrl = '';
let linkHost = '';
if (host.socket) {
statusUrl = window.location.host + subpath + '/status';
linkHost = window.location.host + subpath;
statusUrl = 'https://' + window.location.hostname + subpath + '/status';
linkHost = window.location.hostname + subpath;
} else {
const hostUrl = new URL(host.host);
statusUrl = 'https://' + hostUrl.hostname + subpath + '/status';
@@ -38,6 +38,7 @@ export class ServerHealthComponent implements OnInit {
}
host.statusPage = this.sanitizer.bypassSecurityTrustResourceUrl(this.sanitizer.sanitize(SecurityContext.URL, statusUrl));
host.link = linkHost;
host.flag = this.parseFlag(host.host);
}
return hosts;
})
@@ -45,4 +46,22 @@ export class ServerHealthComponent implements OnInit {
this.tip$ = this.stateService.chainTip$;
this.websocketService.want(['blocks', 'tomahawk']);
}
trackByFn(index: number, host: HealthCheckHost): string {
return host.host;
}
private parseFlag(host: string): string {
if (host.includes('.fra.')) {
return '🇩🇪';
} else if (host.includes('.tk7.')) {
return '🇯🇵';
} else if (host.includes('.fmt.')) {
return '🇺🇸';
} else if (host.includes('.va1.')) {
return '🇺🇸';
} else {
return '';
}
}
}