Refactory

This commit is contained in:
everoddandeven 2024-09-22 16:56:34 +02:00
parent 80e8a283f4
commit ba8b471958
9 changed files with 147 additions and 39 deletions

View file

@ -12,7 +12,7 @@
@for(card of cards; track card.header) {
<div class="card text-bg-dark m-3 text-center" style="max-width: 18rem;">
<div class="card-header">{{card.header}}</div>
<div class="card-header"><strong>{{card.header}}</strong></div>
<div class="card-body">
<h5 class="card-title">{{card.content}}</h5>
</div>

View file

@ -1,4 +1,4 @@
<div class="tab-content" id="pills-tabContent">
<div *ngIf="!coreBusy" class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-miner-data" role="tabpanel" aria-labelledby="pills-miner-data-tab" tabindex="0">
<div class="row d-flex">
@ -50,4 +50,20 @@
</div>
</div>
<div class="tab-pane fade" id="pills-disabled" role="tabpanel" aria-labelledby="pills-disabled-tab" tabindex="0">...</div>
</div>
</div>
<div *ngIf="coreBusy" class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column text-center">
<main class="px-3">
<h1>Core is busy.</h1>
<p class="lead">Mining capabilities are not available during daemon sync.</p>
<p class="lead">
<a href="#" class="btn btn-lg btn-light fw-bold border-white bg-white">Learn more</a>
</p>
</main>
<!--
<footer class="mt-auto text-white-50">
<p>Cover template for <a href="https://getbootstrap.com/" class="text-white">Bootstrap</a>, by <a href="https://twitter.com/mdo" class="text-white">mdo</a>.</p>
</footer>
-->
</div>

View file

@ -0,0 +1,76 @@
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
.b-example-divider {
width: 100%;
height: 3rem;
background-color: rgba(0, 0, 0, .1);
border: solid rgba(0, 0, 0, .15);
border-width: 1px 0;
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}
.b-example-vr {
flex-shrink: 0;
width: 1.5rem;
height: 100vh;
}
.bi {
vertical-align: -.125em;
fill: currentColor;
}
.nav-scroller {
position: relative;
z-index: 2;
height: 2.75rem;
overflow-y: hidden;
}
.nav-scroller .nav {
display: flex;
flex-wrap: nowrap;
padding-bottom: 1rem;
margin-top: -1px;
overflow-x: auto;
text-align: center;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
.btn-bd-primary {
--bd-violet-bg: #712cf9;
--bd-violet-rgb: 112.520718, 44.062154, 249.437846;
--bs-btn-font-weight: 600;
--bs-btn-color: var(--bs-white);
--bs-btn-bg: var(--bd-violet-bg);
--bs-btn-border-color: var(--bd-violet-bg);
--bs-btn-hover-color: var(--bs-white);
--bs-btn-hover-bg: #6528e0;
--bs-btn-hover-border-color: #6528e0;
--bs-btn-focus-shadow-rgb: var(--bd-violet-rgb);
--bs-btn-active-color: var(--bs-btn-hover-color);
--bs-btn-active-bg: #5a23c8;
--bs-btn-active-border-color: #5a23c8;
}
.bd-mode-toggle {
z-index: 1500;
}
.bd-mode-toggle .dropdown-menu .active .bi {
display: block !important;
}

View file

@ -7,6 +7,7 @@ import { NavbarLink } from '../navbar/navbar.model';
import { MineableTxBacklog } from '../../common/MineableTxBacklog';
import { Chain } from '../../common/Chain';
import { CoreIsBusyError } from '../../common/error';
import { CommonModule, NgIf } from '@angular/common';
@Component({
selector: 'app-mining',
@ -16,7 +17,7 @@ import { CoreIsBusyError } from '../../common/error';
export class MiningComponent implements AfterViewInit {
private readonly navbarLinks: NavbarLink[];
private coreBusy: boolean;
public coreBusy: boolean;
private minerData?: MinerData;
private majorVersion: number;

View file

@ -2,13 +2,15 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MiningRoutingModule } from './mining-routing.module';
import { SharedModule } from '../shared/shared.module';
import { LoadComponent } from '../load/load.component';
import { MiningComponent } from './mining.component';
@NgModule({
declarations: [],
declarations: [MiningComponent],
imports: [
CommonModule,
MiningRoutingModule
CommonModule, SharedModule,MiningRoutingModule, LoadComponent
]
})
export class MiningModule { }

View file

@ -260,12 +260,47 @@
<div class="row g-3">
<h4 class="mb-3">Synchronization</h4>
<div class="form-check form-switch col-md-12">
<div class="form-check form-switch col-md-6">
<label for="sync-enabled" class="form-check-label">Enabled</label>
<input class="form-control form-check-input" type="checkbox" role="switch" id="sync-enabled" checked>
<br>
<small class="text-body-secondary">Synchronize the blockchain with other peers</small>
</div>
<div class="form-check form-switch col-md-6">
<label for="prune-blockchain" class="form-check-label">Prune Blockchain</label>
<input class="form-control form-check-input" type="checkbox" role="switch" id="prune-blockchain">
<br>
<small class="text-body-secondary">Reduce blockchain disk usage</small>
</div>
<div class="form-check form-switch col-md-6">
<label for="sync-pruned-blocks" class="form-check-label">Sync pruned blocks</label>
<input class="form-control form-check-input" type="checkbox" role="switch" id="sync-pruned-blocks">
<br>
<small class="text-body-secondary">Allow syncing from nodes with only pruned blocks</small>
</div>
<div class="form-check form-switch col-md-6">
<label for="fast-block-sync" class="form-check-label">Fast block sync</label>
<input class="form-control form-check-input" type="checkbox" role="switch" id="fast-block-sync">
<br>
<small class="text-body-secondary">Sync up most of the way by using embedded, known block hashes</small>
</div>
<div class="form-check form-switch col-md-6">
<label for="relay-fluffly-blocks" class="form-check-label">Relay fluffy blocks</label>
<input class="form-control form-check-input" type="checkbox" role="switch" id="relay-fluffly-blocks" checked>
<br>
<small class="text-body-secondary">Relay blocks as fluffy blocks</small>
</div>
<div class="form-check form-switch col-md-6">
<label for="keep-alt-blocks" class="form-check-label">Keep alternative blocks</label>
<input class="form-control form-check-input" type="checkbox" role="switch" id="keep-alt-blocks">
<br>
<small class="text-body-secondary">Keep alternative blocks on restart</small>
</div>
<div class="col-md-4">
<label for="block-sync-size" class="form-label">Block sync size</label>
@ -282,34 +317,6 @@
<input type="text" class="form-control" id="db-sync-mode" placeholder="fast:async:250000000bytes">
</div>
<br>
<br>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="same-address">
<label class="form-check-label" for="same-address">Prune blockchain</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="save-info">
<label class="form-check-label" for="save-info">Sync pruned blocks</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="fast-block-sync">
<label class="form-check-label" for="fast-block-sync">Fast block sync</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="relay-fluffy-blocks" checked>
<label class="form-check-label" for="fast-block-sync">Relay fluffy blocks</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="keep-alt-blocks">
<label class="form-check-label" for="keep-alt-block">Keep alternative blocks on restart</label>
</div>
<hr class="my-4">
<h4 class="mb-3">Network type</h4>

View file

@ -1,3 +1,4 @@
export { RPCRequest } from "./request/RPCRequest";
export { JsonRPCRequest } from "./request/JsonRPCRequest";
export { GetBlockCountRequest } from "./request/GetBlockCountRequest";
export { GetBlockHashRequest } from "./request/GetBlockHashRequest";

View file

@ -1,8 +1,8 @@
export abstract class JsonRPCRequest {
import { RPCRequest } from "./RPCRequest";
export abstract class JsonRPCRequest extends RPCRequest {
public readonly version: string = "2.0";
public readonly id: string = "0";
public abstract readonly method: string;
public abstract readonly restricted: boolean;
public toDictionary(): { [key: string]: any } {
return {

View file

@ -0,0 +1,5 @@
export abstract class RPCRequest {
public abstract readonly method: string;
public abstract readonly restricted: boolean;
}