forked from lthn/blockchain
gui code improvements
1) all hardcoded URL links moved to constants.ts 2) gui now aware of mainnet/testnet 3) testnet build open up testnet block explorer 4) testnet build is marked with TESTNET note right after version
This commit is contained in:
parent
f2fa26f1d8
commit
0b6c5ca53a
14 changed files with 159 additions and 103 deletions
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
File diff suppressed because one or more lines are too long
|
|
@ -3,6 +3,8 @@ import {Transaction} from '../../models/transaction.model';
|
|||
import {VariablesService} from '../../services/variables.service';
|
||||
import {BackendService} from '../../services/backend.service';
|
||||
import {IntToMoneyPipe} from '../../pipes/int-to-money.pipe';
|
||||
import {BLOCK_EXPLORER_TX_URL_PREFIX} from '../../../_shared/constants';
|
||||
import {BLOCK_EXPLORER_TN_TX_URL_PREFIX} from '../../../_shared/constants';
|
||||
|
||||
@Component({
|
||||
selector: 'app-transaction-details',
|
||||
|
|
@ -32,7 +34,7 @@ export class TransactionDetailsComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
openInBrowser(tr) {
|
||||
this.backendService.openUrlInBrowser('explorer.zano.org/transaction/' + tr);
|
||||
this.backendService.openUrlInBrowser((this.variablesService.testnet ? BLOCK_EXPLORER_TN_TX_URL_PREFIX : BLOCK_EXPLORER_TX_URL_PREFIX)+ tr);
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
|
|
|
|||
|
|
@ -645,7 +645,9 @@ export class BackendService {
|
|||
|
||||
getVersion(callback) {
|
||||
this.runCommand('get_version', {}, (status, version) => {
|
||||
callback(version);
|
||||
this.runCommand('get_network_type', {}, (status, type) => {
|
||||
callback(version, type);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ export class VariablesService {
|
|||
public count = 40;
|
||||
public maxPages = 5;
|
||||
|
||||
public testnet = false;
|
||||
public networkType = ''; // testnet of mainnet
|
||||
|
||||
public wallets: Array<Wallet> = [];
|
||||
public currentWallet: Wallet;
|
||||
public selectWallet: number;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
export const MIXIN: number = 10;
|
||||
export const AUDITABLE_WALLET_HELP_PAGE: string = 'docs.zano.org/docs/auditable-wallets';
|
||||
export const RCV_ADDR_QR_SCALE: number = 2;
|
||||
export const MIXIN: number = 10; // default mixin value
|
||||
export const RCV_ADDR_QR_SCALE: number = 2; // scale factor for QR code
|
||||
|
||||
export const AUDITABLE_WALLET_HELP_PAGE: string = 'docs.zano.org/docs/auditable-wallets';
|
||||
export const CREATE_NEW_WALLET_HELP_PAGE: string = 'docs.zano.org/docs/getting-started-1#section-create-new-wallet';
|
||||
export const LOCKED_BALANCE_HELP_PAGE: string = 'docs.zano.org/docs/locked-balance';
|
||||
export const DOWNLOADS_PAGE_URL: string = 'zano.org/downloads.html';
|
||||
|
||||
export const BLOCK_EXPLORER_TX_URL_PREFIX: string = 'explorer.zano.org/transaction/';
|
||||
export const BLOCK_EXPLORER_TN_TX_URL_PREFIX: string = 'testnet-explorer.zano.org/transaction/';
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {BackendService} from '../_helpers/services/backend.service';
|
|||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
import {ModalService} from '../_helpers/services/modal.service';
|
||||
import {Wallet} from '../_helpers/models/wallet.model';
|
||||
import {DOWNLOADS_PAGE_URL} from '../_shared/constants'
|
||||
|
||||
import icons from '../../assets/icons/icons.json';
|
||||
|
||||
|
|
@ -234,7 +235,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
getUpdate() {
|
||||
this.backend.openUrlInBrowser('zano.org/downloads.html');
|
||||
this.backend.openUrlInBrowser(DOWNLOADS_PAGE_URL);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {BackendService} from '../_helpers/services/backend.service';
|
|||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
import {CREATE_NEW_WALLET_HELP_PAGE} from '../_shared/constants';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main',
|
||||
|
|
@ -45,7 +46,7 @@ export class MainComponent implements OnInit {
|
|||
}
|
||||
|
||||
openInBrowser() {
|
||||
this.backend.openUrlInBrowser('docs.zano.org/docs/getting-started-1#section-create-new-wallet');
|
||||
this.backend.openUrlInBrowser(CREATE_NEW_WALLET_HELP_PAGE);
|
||||
}
|
||||
|
||||
back() {
|
||||
|
|
|
|||
|
|
@ -122,9 +122,16 @@ export class SettingsComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.backend.getVersion((version) => {
|
||||
this.backend.getVersion((version, type) => {
|
||||
this.ngZone.run(() => {
|
||||
this.currentBuild = version;
|
||||
this.variablesService.testnet = false;
|
||||
if (type == 'testnet')
|
||||
{
|
||||
this.currentBuild += ' TESTNET';
|
||||
this.variablesService.testnet = true;
|
||||
}
|
||||
this.variablesService.networkType = type;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {VariablesService} from '../_helpers/services/variables.service';
|
|||
import {BackendService} from '../_helpers/services/backend.service';
|
||||
import { ModalService } from '../_helpers/services/modal.service';
|
||||
import {AUDITABLE_WALLET_HELP_PAGE} from '../_shared/constants';
|
||||
import {DOWNLOADS_PAGE_URL} from '../_shared/constants';
|
||||
|
||||
import icons from '../../assets/icons/icons.json';
|
||||
|
||||
|
|
@ -121,7 +122,7 @@ export class SidebarComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
getUpdate() {
|
||||
this.backend.openUrlInBrowser('zano.org/downloads.html');
|
||||
this.backend.openUrlInBrowser(DOWNLOADS_PAGE_URL);
|
||||
}
|
||||
goToAuditableWalletHelpPage(e) {
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { BackendService } from '../_helpers/services/backend.service';
|
|||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { IntToMoneyPipe } from '../_helpers/pipes/int-to-money.pipe';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { LOCKED_BALANCE_HELP_PAGE } from '../_shared/constants';
|
||||
|
||||
import icons from '../../assets/icons/icons.json';
|
||||
import { PaginationService } from '../_helpers/services/pagination.service';
|
||||
|
|
@ -177,7 +178,7 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
link.setAttribute('class', 'link');
|
||||
link.innerHTML = this.translate.instant('WALLET.LOCKED_BALANCE_LINK');
|
||||
link.addEventListener('click', () => {
|
||||
this.openInBrowser('docs.zano.org/docs/locked-balance');
|
||||
this.openInBrowser(LOCKED_BALANCE_HELP_PAGE);
|
||||
});
|
||||
this.balanceTooltip.appendChild(link);
|
||||
return this.balanceTooltip;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue