[debug] show services backend version in /services global footer, show services global frontend build in /about

This commit is contained in:
nymkappa 2023-08-20 22:53:33 +02:00
parent ef554ad67b
commit 22886cb32d
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
12 changed files with 63 additions and 20 deletions

View File

@ -4,7 +4,8 @@
<span style="margin-left: auto; margin-right: -20px; margin-bottom: -20px">&reg;</span>
<img class="logo" src="/resources/mempool-logo-bigger.png" />
<div class="version">
v{{ packetJsonVersion }} [<a href="https://github.com/mempool/mempool/commit/{{ frontendGitCommitHash }}">{{ frontendGitCommitHash }}</a>]
<span *ngIf="!stateService.env.SERVICES">v{{ packetJsonVersion }} [<a href="https://github.com/mempool/mempool/commit/{{ frontendGitCommitHash }}">{{ frontendGitCommitHash }}</a>]</span>
<span *ngIf="stateService.env.SERVICES">v{{ packetJsonVersion }} [<a href="https://github.com/mempool/mempool.space/commit/{{ frontendGitCommitHash }}">{{ frontendGitCommitHash }}</a>]</span>
</div>
</div>

View File

@ -1,5 +1,5 @@
<div [formGroup]="fiatForm" class="text-small text-center">
<select formControlName="fiat" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 150px;" (change)="changeFiat()">
<option *ngFor="let currency of currencies" [value]="currency[1].code">{{ currency[1].name + " (" + currency[1].code + ")" }}</option>
<select formControlName="fiat" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 95px;" (change)="changeFiat()">
<option *ngFor="let currency of currencies" [value]="currency[1].code">{{ currency[1].code }}</option>
</select>
</div>

View File

@ -1,5 +1,5 @@
<div [formGroup]="languageForm" class="text-small text-center">
<select formControlName="language" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 100px;" (change)="changeLanguage()">
<select formControlName="language" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 95px;" (change)="changeLanguage()">
<option *ngFor="let lang of languages" [value]="lang.code">{{ lang.name }}</option>
</select>
</div>

View File

@ -12,7 +12,7 @@
<span>{{ group.title }}</span>
</h6>
<ul class="nav flex-column" *ngFor="let item of group.items">
<li class="nav-item d-flex justify-content-start align-items-center" (click)="navOpen = false;">
<li class="nav-item d-flex justify-content-start align-items-center" (click)="onLinkClick()">
<fa-icon [icon]="['fas', item.faIcon]" [fixedWidth]="true"></fa-icon>
<button *ngIf="item.link === 'logout'" class="btn nav-link" role="tab" (click)="logout()">{{ item.title }}</button>
<a *ngIf="item.title !== 'Logout'" class="nav-link" [routerLink]="[item.link]" role="tab">{{ item.title }}</a>

View File

@ -19,7 +19,7 @@
}
.sidenav.open {
width: 235px;
width: 225px;
}
.sidenav.close {
width: 0px;

View File

@ -3,6 +3,7 @@ import { Observable } from 'rxjs';
import { ApiService } from '../../services/api.service';
import { MenuGroup } from '../../interfaces/services.interface';
import { StorageService } from '../../services/storage.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-menu',
@ -11,19 +12,29 @@ import { StorageService } from '../../services/storage.service';
})
export class MenuComponent implements OnInit {
@Output() loggedOut = new EventEmitter<boolean>();
navOpen: boolean = false;
userMenuGroups$: Observable<MenuGroup[]> | undefined;
userAuth: any | undefined;
@Output() loggedOut = new EventEmitter<boolean>();
isServices = false;
constructor(
private apiService: ApiService,
private storageService: StorageService
private storageService: StorageService,
private router: Router
) {}
ngOnInit(): void {
this.userAuth = this.storageService.getAuth();
this.userMenuGroups$ = this.apiService.getUserMenuGroups$();
this.isServices = this.router.url.includes('/services/');
this.navOpen = this.isServices && !this.isSmallScreen();
}
isSmallScreen() {
return window.innerWidth <= 767.98;
}
logout(): void {
@ -31,6 +42,12 @@ export class MenuComponent implements OnInit {
this.loggedOut.emit(true);
}
onLinkClick() {
if (!this.isServices || this.isSmallScreen()) {
this.navOpen = false;
}
}
hambugerClick() {
this.navOpen = !this.navOpen;
}

View File

@ -1,5 +1,5 @@
<div [formGroup]="rateUnitForm" class="text-small text-center">
<select formControlName="rateUnits" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 100px;" (change)="changeUnits()">
<select formControlName="rateUnits" class="custom-select custom-select-sm form-control-secondary form-control mx-auto" style="width: 95px;" (change)="changeUnits()">
<option *ngFor="let unit of units" [value]="unit.name">{{ unit.label }}</option>
</select>
</div>

View File

@ -4,7 +4,7 @@ import { CpfpInfo, OptimizedMempoolStats, AddressInformation, LiquidPegs, ITrans
PoolStat, BlockExtended, TransactionStripped, RewardStats, AuditScore, BlockSizesAndWeights, RbfTree, BlockAudit } from '../interfaces/node-api.interface';
import { Observable, of } from 'rxjs';
import { StateService } from './state.service';
import { WebsocketResponse } from '../interfaces/websocket.interface';
import { IBackendInfo, WebsocketResponse } from '../interfaces/websocket.interface';
import { Outspend, Transaction } from '../interfaces/electrs.interface';
import { Conversion } from './price.service';
import { MenuGroup } from '../interfaces/services.interface';
@ -36,6 +36,10 @@ export class ApiService {
}
this.apiBasePath = network ? '/' + network : '';
});
this.getServicesBackendInfo$().subscribe(version => {
this.stateService.servicesBackendInfo$.next(version);
})
}
list2HStatistics$(): Observable<OptimizedMempoolStats[]> {
@ -367,4 +371,8 @@ export class ApiService {
headers: { 'Authorization': auth.token }
});
}
getServicesBackendInfo$(): Observable<IBackendInfo> {
return this.httpClient.get<IBackendInfo>(`${SERVICES_API_PREFIX}/version`);
}
}

View File

@ -8,6 +8,7 @@ import { isPlatformBrowser } from '@angular/common';
import { filter, map, scan, shareReplay } from 'rxjs/operators';
import { StorageService } from './storage.service';
import { hasTouchScreen } from '../shared/pipes/bytes-pipe/utils';
import { ApiService } from './api.service';
export interface MarkBlockState {
blockHeight?: number;
@ -48,6 +49,7 @@ export interface Env {
SIGNET_BLOCK_AUDIT_START_HEIGHT: number;
HISTORICAL_PRICE: boolean;
ACCELERATOR: boolean;
SERVICES: boolean;
}
const defaultEnv: Env = {
@ -79,6 +81,7 @@ const defaultEnv: Env = {
'SIGNET_BLOCK_AUDIT_START_HEIGHT': 0,
'HISTORICAL_PRICE': true,
'ACCELERATOR': false,
'SERVICES': false,
};
@Injectable({
@ -120,6 +123,7 @@ export class StateService {
vbytesPerSecond$ = new ReplaySubject<number>(1);
previousRetarget$ = new ReplaySubject<number>(1);
backendInfo$ = new ReplaySubject<IBackendInfo>(1);
servicesBackendInfo$ = new ReplaySubject<IBackendInfo>(1);
loadingIndicators$ = new ReplaySubject<ILoadingIndicators>(1);
recommendedFees$ = new ReplaySubject<Recommendedfees>(1);
chainTip$ = new ReplaySubject<number>(-1);

View File

@ -1,6 +1,7 @@
<footer>
<div class="container-fluid">
<div class="row main">
<div class="container-fluid">
<div class="row main" [style]="addPadding ? 'padding-left: 250px !important' : ''">
<div class="col-md-12 branding mt-2">
<div class="main-logo">
<app-svg-images *ngIf="officialMempoolSpace" name="officialMempoolSpace" viewBox="0 0 500 126"></app-svg-images>
@ -25,7 +26,7 @@
</div>
</div>
</div>
<div class="row col-md-12 link-tree">
<div class="row col-md-12 link-tree" [style]="addPadding ? 'padding-left: 250px !important' : ''">
<div class="links">
<p class="category">Explore</p>
<p><a [routerLink]="['/mining' | relativeUrl]">Mining Dashboard</a></p>
@ -67,9 +68,8 @@
<p><a [routerLink]="['/privacy-policy']" i18n="shared.privacy-policy|Privacy Policy">Privacy Policy</a></p>
<p><a [routerLink]="['/trademark-policy']">Trademark Policy</a></p>
</div>
</div>
<div class="row social-links">
<div class="row social-links" [style]="addPadding ? 'padding-left: 250px !important' : ''">
<div class="col-sm-12">
<a href="https://github.com/mempool" target="_blank"><svg fill="#fff" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a>
<a href="https://twitter.com/mempool" target="_blank"><svg fill="#fff" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitter</title><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg></a>
@ -79,13 +79,15 @@
<a href="https://mempool.chat" target="_blank"><svg fill="#fff" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Matrix</title><path d="M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.481.314.448.208.785.582 1.02 1.108.254-.374.6-.706 1.034-.992.434-.287.95-.43 1.546-.43.453 0 .872.056 1.26.167.388.11.716.286.993.53.276.245.489.559.646.951.152.392.23.863.23 1.417v5.728h-2.349V11.52c0-.286-.01-.559-.032-.812a1.755 1.755 0 0 0-.18-.66 1.106 1.106 0 0 0-.438-.448c-.194-.11-.457-.166-.785-.166-.332 0-.6.064-.803.189a1.38 1.38 0 0 0-.48.499 1.946 1.946 0 0 0-.231.696 5.56 5.56 0 0 0-.06.785v4.768h-2.35v-4.8c0-.254-.004-.503-.018-.752a2.074 2.074 0 0 0-.143-.688 1.052 1.052 0 0 0-.415-.503c-.194-.125-.476-.19-.854-.19-.111 0-.259.024-.439.074-.18.051-.36.143-.53.282-.171.138-.319.337-.439.595-.12.259-.18.6-.18 1.02v4.966H5.46V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z"/></svg></a>
</div>
</div>
<div class="row version">
<div class="row version" [style]="addPadding ? 'padding-left: 250px !important' : ''">
<div class="col-sm-12">
<p *ngIf="officialMempoolSpace">{{ (backendInfo$ | async)?.hostname }} (v{{ (backendInfo$ | async )?.version }}) [<a target="_blank" href="https://github.com/mempool/mempool/commit/{{ (backendInfo$ | async )?.gitCommit | slice:0:8 }}">{{ (backendInfo$ | async )?.gitCommit | slice:0:8 }}</a>]</p>
<p *ngIf="!officialMempoolSpace">v{{ packetJsonVersion }} [<a target="_blank" href="https://github.com/mempool/mempool/commit/{{ frontendGitCommitHash }}">{{ frontendGitCommitHash }}</a>]</p>
</div>
<div class="col-sm-12" *ngIf="isServices">
<p>{{ (servicesBackendInfo$ | async)?.hostname }} (v{{ (servicesBackendInfo$ | async )?.version }}) [<a target="_blank" href="https://github.com/mempool/mempool.space/commit/{{ (servicesBackendInfo$ | async )?.gitCommit | slice:0:8 }}">{{ (servicesBackendInfo$ | async )?.gitCommit | slice:0:8 }}</a>]</p>
</div>
</div>
</div>
</footer>

View File

@ -88,7 +88,8 @@ footer .row.social-links svg {
}
footer .row.version {
padding: 20px !important;
padding-top: 20px !important;
padding-bottom: 20px !important;
background-color: #11131f;
}

View File

@ -20,6 +20,7 @@ export class GlobalFooterComponent implements OnInit {
env: Env;
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
backendInfo$: Observable<IBackendInfo>;
servicesBackendInfo$: Observable<IBackendInfo>;
frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH;
packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
urlLanguage: string;
@ -29,6 +30,8 @@ export class GlobalFooterComponent implements OnInit {
loggedIn = false;
username = null;
urlSubscription: Subscription;
addPadding = false;
isServices = false;
constructor(
public stateService: StateService,
@ -38,12 +41,15 @@ export class GlobalFooterComponent implements OnInit {
private storageService: StorageService,
private route: ActivatedRoute,
private cd: ChangeDetectorRef,
private websocketService: WebsocketService
private websocketService: WebsocketService,
private router: Router
) {}
ngOnInit(): void {
this.isServices = this.router.url.includes('/services/');
this.env = this.stateService.env;
this.backendInfo$ = this.stateService.backendInfo$;
this.servicesBackendInfo$ = this.stateService.servicesBackendInfo$;
this.urlLanguage = this.languageService.getLanguageForUrl();
this.navigationService.subnetPaths.subscribe((paths) => {
this.networkPaths = paths;
@ -65,6 +71,7 @@ export class GlobalFooterComponent implements OnInit {
} else {
this.username = null;
}
this.addPadding = url[0].path === 'services' && !this.isSmallScreen();
this.cd.markForCheck();
})
}
@ -88,4 +95,7 @@ export class GlobalFooterComponent implements OnInit {
}
}
isSmallScreen() {
return window.innerWidth <= 767.98;
}
}