1
0
Fork 0
forked from lthn/blockchain

Merge branch 'develop' into release

This commit is contained in:
sowle 2020-03-24 12:09:34 +03:00
commit 135eed3d02
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
13 changed files with 149 additions and 11 deletions

View file

@ -50,7 +50,9 @@
"COMPLETE": "Completion",
"SYNCING": "Syncing block",
"LOADING": "Loading blockchain data",
"SLASH": "/"
"DOWNLOADING": "Downloading",
"SLASH": "/",
"MB": "MB"
},
"UPDATE": {
"STANDARD": "Update available",

View file

@ -227,6 +227,23 @@ app-sidebar {
}
}
}
&.downloading {
.progress-bar {
@include themify($themes) {
background-color: themed(progressBarBackgroundColor);
}
.fill {
@include themify($themes) {
background-color: themed(blueTextColor);
}
}
}
}
}
.loading {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -23,6 +23,8 @@ export class VariablesService {
public net_time_delta_median = 0;
public height_app = 0;
public height_max = 0;
public downloaded = 0;
public total = 0;
public last_build_available = '';
public last_build_displaymode = 0;
public daemon_state = 3;
@ -30,6 +32,10 @@ export class VariablesService {
progress_value: 0,
progress_value_text: '0'
};
public download = {
progress_value: 0,
progress_value_text: '0'
};
public default_fee = '0.010000000000';
public default_fee_big = new BigNumber('10000000000');
@ -66,6 +72,8 @@ export class VariablesService {
getExpMedTsEvent = new BehaviorSubject(null);
getHeightAppEvent = new BehaviorSubject(null);
getHeightMaxEvent = new BehaviorSubject(null);
getDownloadedAppEvent = new BehaviorSubject(null);
getTotalEvent = new BehaviorSubject(null);
getRefreshStackingEvent = new BehaviorSubject(null);
getAliasChangedEvent = new BehaviorSubject(null);
@ -112,6 +120,20 @@ export class VariablesService {
}
}
setDownloadedBytes(bytes: number) {
if (bytes !== this.downloaded) {
this.downloaded = this.bytesToMb(bytes);
this.getDownloadedAppEvent.next(bytes);
}
}
setTotalBytes(bytes: number) {
if (bytes !== this.total) {
this.total = this.bytesToMb(bytes);
this.getTotalEvent.next(bytes);
}
}
setRefreshStacking(wallet_id: number) {
this.getHeightAppEvent.next(wallet_id);
}
@ -149,6 +171,10 @@ export class VariablesService {
this.idle.within(this.settings.appLockTime).restart();
}
bytesToMb(bytes) {
return Number((bytes / Math.pow(1024, 2)).toFixed(1));
}
public onContextMenu($event: MouseEvent): void {
$event.target['contextSelectionStart'] = $event.target['selectionStart'];
$event.target['contextSelectionEnd'] = $event.target['selectionEnd'];

View file

@ -1,7 +1,7 @@
<app-sidebar *ngIf="variablesService.appLogin"></app-sidebar>
<div class="app-content scrolled-content">
<router-outlet *ngIf="[0, 1, 2].indexOf(variablesService.daemon_state) !== -1"></router-outlet>
<router-outlet *ngIf="[0, 1, 2, 6].indexOf(variablesService.daemon_state) !== -1"></router-outlet>
<div class="preloader" *ngIf="[3, 4, 5].indexOf(variablesService.daemon_state) !== -1">
<span *ngIf="variablesService.daemon_state === 3">{{ 'SIDEBAR.SYNCHRONIZATION.LOADING' | translate }}</span>
<span *ngIf="variablesService.daemon_state === 4">{{ 'SIDEBAR.SYNCHRONIZATION.ERROR' | translate }}</span>

View file

@ -185,6 +185,10 @@ export class AppComponent implements OnInit, OnDestroy {
this.variablesService.last_build_displaymode = data.last_build_displaymode;
this.variablesService.setHeightApp(data.height);
this.variablesService.setHeightMax(data.max_net_seen_height);
this.variablesService.setDownloadedBytes(data.downloaded_bytes);
this.variablesService.setTotalBytes(data.download_total_data_size);
this.backend.getContactAlias();
this.ngZone.run(() => {
this.variablesService.daemon_state = data['daemon_network_state'];
@ -203,6 +207,22 @@ export class AppComponent implements OnInit, OnDestroy {
this.variablesService.sync.progress_value_text = return_val.toFixed(2);
}
}
if (data['daemon_network_state'] === 6) {
const max = data['download_total_data_size'];
const current = data['downloaded_bytes'];
const return_val = Math.floor((current / max) * 100);
if (max === 0 || return_val < 0) {
this.variablesService.download.progress_value = 0;
this.variablesService.download.progress_value_text = '0.00';
} else if (return_val >= 100) {
this.variablesService.download.progress_value = 100;
this.variablesService.download.progress_value_text = '99.99';
} else {
this.variablesService.download.progress_value = return_val;
this.variablesService.download.progress_value_text = return_val.toFixed(2);
}
}
});
if (!this.firstOnlineState && data['daemon_network_state'] === 2) {
this.getAliases();

View file

@ -98,7 +98,7 @@
</div>
</ng-template>
</div>
<div class="sidebar-synchronization-status" [ngStyle]="{'align-items': variablesService.daemon_state === 1 ? 'flex-start' : 'center'}">
<div class="sidebar-synchronization-status" [ngStyle]="{'align-items': variablesService.daemon_state === 1 || variablesService.daemon_state === 6 ? 'flex-start' : 'center'}">
<div class="status-container">
<span class="offline" *ngIf="variablesService.daemon_state === 0">
{{ 'SIDEBAR.SYNCHRONIZATION.OFFLINE' | translate }}
@ -118,6 +118,9 @@
<span class="online" *ngIf="variablesService.daemon_state === 5">
{{ 'SIDEBAR.SYNCHRONIZATION.COMPLETE' | translate }}
</span>
<span class="syncing" *ngIf="variablesService.daemon_state === 6">
{{ 'SIDEBAR.SYNCHRONIZATION.DOWNLOADING' | translate }} {{ variablesService.downloaded }}{{ 'SIDEBAR.SYNCHRONIZATION.SLASH' | translate }}{{ variablesService.total }}{{ 'SIDEBAR.SYNCHRONIZATION.MB' | translate }}
</span>
<div class="progress-bar-container" *ngIf="variablesService.daemon_state === 1 || variablesService.daemon_state === 3">
<div class="syncing" *ngIf="variablesService.daemon_state === 1">
<div class="progress-bar">
@ -127,6 +130,15 @@
</div>
<div class="loading" *ngIf="variablesService.daemon_state === 3"></div>
</div>
<div class="progress-bar-container" *ngIf="variablesService.daemon_state === 6">
<div class="syncing downloading" *ngIf="variablesService.daemon_state === 6">
<div class="progress-bar">
<div class="fill" [style.width]="variablesService.download.progress_value + '%'"></div>
</div>
<div class="progress-percent">{{ variablesService.download.progress_value_text }}%</div>
</div>
</div>
</div>
<div class="update-container" *ngIf="(variablesService.daemon_state === 0 || variablesService.daemon_state === 2) && [2, 3, 4].indexOf(variablesService.last_build_displaymode) !== -1">
<ng-container *ngIf="variablesService.last_build_displaymode === 2">

View file

@ -24,7 +24,7 @@
<label for="alias-comment">
{{ 'TRANSFER_ALIAS.COMMENT.LABEL' | translate }}
</label>
<textarea id="alias-comment" [value]="alias.comment" placeholder="{{ 'EDIT_ALIAS.COMMENT.PLACEHOLDER' | translate }}" readonly></textarea>
<textarea id="alias-comment" [value]="alias.comment" placeholder="{{ 'EDIT_ALIAS.COMMENT.PLACEHOLDER' | translate }}"></textarea>
</div>
<div class="input-block alias-transfer-address">

View file

@ -50,7 +50,9 @@
"COMPLETE": "Completion",
"SYNCING": "Syncing block",
"LOADING": "Loading blockchain data",
"SLASH": "/"
"DOWNLOADING": "Downloading",
"SLASH": "/",
"MB": "MB"
},
"UPDATE": {
"STANDARD": "Update available",

View file

@ -227,6 +227,23 @@ app-sidebar {
}
}
}
&.downloading {
.progress-bar {
@include themify($themes) {
background-color: themed(progressBarBackgroundColor);
}
.fill {
@include themify($themes) {
background-color: themed(blueTextColor);
}
}
}
}
}
.loading {