Merge branch 'master' into simon/bisq-dashboard

# Conflicts:
#	frontend/package-lock.json
#	frontend/src/app/components/master-page/master-page.component.html
This commit is contained in:
softsimon
2021-04-23 15:35:35 +04:00
32 changed files with 358 additions and 64 deletions

View File

@@ -1,7 +1,7 @@
import { Inject, Injectable, PLATFORM_ID } from '@angular/core';
import { ReplaySubject, BehaviorSubject, Subject, fromEvent, Observable } from 'rxjs';
import { Block, Transaction } from '../interfaces/electrs.interface';
import { MempoolBlock, MempoolInfo, TransactionStripped } from '../interfaces/websocket.interface';
import { IBackendInfo, MempoolBlock, MempoolInfo, TransactionStripped } from '../interfaces/websocket.interface';
import { OptimizedMempoolStats } from '../interfaces/node-api.interface';
import { Router, NavigationStart } from '@angular/router';
import { isPlatformBrowser } from '@angular/common';
@@ -28,6 +28,8 @@ export interface Env {
NGINX_PROTOCOL?: string;
NGINX_HOSTNAME?: string;
NGINX_PORT?: string;
GIT_COMMIT_HASH: string;
PACKAGE_JSON_VERSION: string;
}
const defaultEnv: Env = {
@@ -43,6 +45,8 @@ const defaultEnv: Env = {
'NGINX_PROTOCOL': 'http',
'NGINX_HOSTNAME': '127.0.0.1',
'NGINX_PORT': '80',
'GIT_COMMIT_HASH': '',
'PACKAGE_JSON_VERSION': '',
};
@Injectable({
@@ -67,7 +71,7 @@ export class StateService {
isLoadingWebSocket$ = new ReplaySubject<boolean>(1);
vbytesPerSecond$ = new ReplaySubject<number>(1);
lastDifficultyAdjustment$ = new ReplaySubject<number>(1);
gitCommit$ = new ReplaySubject<string>(1);
backendInfo$ = new ReplaySubject<IBackendInfo>(1);
loadingIndicators$ = new ReplaySubject<ILoadingIndicators>(1);
live2Chart$ = new Subject<OptimizedMempoolStats>();

View File

@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { webSocket, WebSocketSubject } from 'rxjs/webSocket';
import { WebsocketResponse } from '../interfaces/websocket.interface';
import { WebsocketResponse, IBackendInfo } from '../interfaces/websocket.interface';
import { StateService } from './state.service';
import { Block, Transaction } from '../interfaces/electrs.interface';
import { Subscription } from 'rxjs';
@@ -244,13 +244,13 @@ export class WebsocketService {
this.stateService.bsqPrice$.next(response['bsq-price']);
}
if (response['git-commit']) {
this.stateService.gitCommit$.next(response['git-commit']);
if (response.backendInfo) {
this.stateService.backendInfo$.next(response.backendInfo);
if (!this.latestGitCommit) {
this.latestGitCommit = response['git-commit'];
this.latestGitCommit = response.backendInfo.gitCommit;
} else {
if (this.latestGitCommit !== response['git-commit']) {
if (this.latestGitCommit !== response.backendInfo.gitCommit) {
setTimeout(() => {
window.location.reload();
}, Math.floor(Math.random() * 60000) + 60000);
@@ -291,7 +291,7 @@ export class WebsocketService {
}
if (response['git-commit']) {
this.stateService.gitCommit$.next(response['git-commit']);
this.stateService.backendInfo$.next(response['git-commit']);
}
}
}