forked from lthn/blockchain
Implement auditable and auditable watch-only wallets highlightning in…
issue #175 * Implement auditable and auditable watch-only wallets highlightning in GUI * changed highlightning style * renamed goToZanoSite --> goToAuditableWalletHelpPage and ZANO_SITE --> AUDITABLE_WALLET_HELP_PAGE
This commit is contained in:
parent
322aaf8251
commit
e4fe9f95c8
14 changed files with 157 additions and 60 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,8 @@ export class Wallet {
|
|||
unlocked_balance: BigNumber;
|
||||
mined_total: number;
|
||||
tracking_hey: string;
|
||||
is_auditable: boolean;
|
||||
is_watch_only: boolean;
|
||||
alias_available: boolean;
|
||||
|
||||
alias?: object;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ export class VariablesService {
|
|||
|
||||
public wallets: Array<Wallet> = [];
|
||||
public currentWallet: Wallet;
|
||||
public walletIsAuditable: any = [];
|
||||
public selectWallet: number;
|
||||
public aliases: any = [];
|
||||
public aliasesChecked: any = {};
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
export const MIXIN: number = 10;
|
||||
export const AUDITABLE_WALLET_HELP_PAGE: string = 'zano.org';
|
||||
|
|
|
|||
|
|
@ -55,12 +55,6 @@ export class OpenWalletModalComponent implements OnInit {
|
|||
return;
|
||||
}
|
||||
this.backend.openWallet(this.wallet.path, this.wallet.pass, this.variablesService.count, false, (open_status, open_data, open_error) => {
|
||||
if (open_data.wi.is_auditable) {
|
||||
let address = open_data['wi'].address;
|
||||
if (this.variablesService.walletIsAuditable.indexOf(address) === -1) {
|
||||
this.variablesService.walletIsAuditable.push(address);
|
||||
}
|
||||
}
|
||||
if (open_error && open_error === 'FILE_NOT_FOUND') {
|
||||
let error_translate = this.translate.instant('OPEN_WALLET.FILE_NOT_FOUND1');
|
||||
error_translate += ':<br>' + this.wallet.path;
|
||||
|
|
@ -92,6 +86,8 @@ export class OpenWalletModalComponent implements OnInit {
|
|||
open_data['wi'].tracking_hey
|
||||
);
|
||||
new_wallet.alias = this.backend.getWalletAlias(new_wallet.address);
|
||||
new_wallet.is_auditable = open_data['wi'].is_auditable;
|
||||
new_wallet.is_watch_only = open_data['wi'].is_watch_only;
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
new_wallet.total_history_item = open_data.recent_history.total_history_items;
|
||||
new_wallet.totalPages = Math.ceil( open_data.recent_history.total_history_items / this.variablesService.count);
|
||||
|
|
|
|||
|
|
@ -62,12 +62,6 @@ export class OpenWalletComponent implements OnInit, OnDestroy {
|
|||
openWallet() {
|
||||
if (this.openForm.valid && this.openForm.get('name').value.length <= this.variablesService.maxWalletNameLength) {
|
||||
this.backend.openWallet(this.filePath, this.openForm.get('password').value, this.variablesService.count, false, (open_status, open_data, open_error) => {
|
||||
if (open_data.wi.is_auditable) {
|
||||
let address = open_data['wi'].address;
|
||||
if (this.variablesService.walletIsAuditable.indexOf(address) === -1) {
|
||||
this.variablesService.walletIsAuditable.push(address);
|
||||
}
|
||||
}
|
||||
if (open_error && open_error === 'FILE_NOT_FOUND') {
|
||||
let error_translate = this.translate.instant('OPEN_WALLET.FILE_NOT_FOUND1');
|
||||
error_translate += ':<br>' + this.filePath;
|
||||
|
|
@ -104,6 +98,8 @@ export class OpenWalletComponent implements OnInit, OnDestroy {
|
|||
);
|
||||
new_wallet.alias = this.backend.getWalletAlias(new_wallet.address);
|
||||
new_wallet.currentPage = 1;
|
||||
new_wallet.is_auditable = open_data['wi'].is_auditable;
|
||||
new_wallet.is_watch_only = open_data['wi'].is_watch_only;
|
||||
if (open_data.recent_history && open_data.recent_history.history) {
|
||||
new_wallet.total_history_item = open_data.recent_history.total_history_items;
|
||||
new_wallet.totalPages = Math.ceil( open_data.recent_history.total_history_items / this.variablesService.count);
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export class SendComponent implements OnInit, OnDestroy {
|
|||
this.parentRouting = this.route.parent.params.subscribe(params => {
|
||||
this.currentWalletId = params['id'];
|
||||
this.mixin = this.variablesService.currentWallet.send_data['mixin'] || MIXIN;
|
||||
if (this.variablesService.walletIsAuditable.indexOf(this.variablesService.currentWallet.address) !== -1) {
|
||||
if (this.variablesService.currentWallet.is_auditable) {
|
||||
this.mixin = 0;
|
||||
this.sendForm.controls['mixin'].disable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,22 @@
|
|||
</div>
|
||||
<div class="sidebar-accounts-list scrolled-content">
|
||||
<div class="sidebar-account" *ngFor="let wallet of variablesService.wallets" [class.active]="wallet?.wallet_id === walletActive" [routerLink]="['/wallet/' + wallet.wallet_id + '/history']">
|
||||
<div class="wallet-type" (click)="goToAuditableWalletHelpPage($event)">
|
||||
<div class="auditable" *ngIf="wallet.is_auditable && !wallet.is_watch_only">
|
||||
<div class="content">Auditable</div>
|
||||
</div>
|
||||
<div class="watch-only" *ngIf="!wallet.is_auditable && wallet.is_watch_only">
|
||||
<div class="content">Watch-only</div>
|
||||
</div>
|
||||
<div class="auditable-watch-only" *ngIf="wallet.is_auditable && wallet.is_watch_only">
|
||||
<div>
|
||||
<div class="content">Auditable</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="content">Watch-only</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="close-wallet-wrapper">
|
||||
<button type="button" (click)="showDialog(wallet.wallet_id)" tooltip="{{ 'WALLET.TOOLTIPS.CLOSE' | translate }}" placement="top-left" tooltipClass="table-tooltip account-tooltip" [delay]="500" [timeDelay]="500">
|
||||
<i class="icon close-wallet"></i>
|
||||
|
|
@ -22,10 +38,12 @@
|
|||
</div>
|
||||
<span class="price">$ {{wallet.getMoneyEquivalent(variablesService.moneyEquivalent) | intToMoney | number : '1.2-2'}}</span>
|
||||
</div>
|
||||
<div class="sidebar-account-row account-staking" *ngIf="!(!wallet.loaded && variablesService.daemon_state === 2)">
|
||||
<span class="text">{{ 'SIDEBAR.ACCOUNT.STAKING' | translate }}</span>
|
||||
<app-staking-switch [wallet_id]="wallet.wallet_id" [(staking)]="wallet.staking"></app-staking-switch>
|
||||
</div>
|
||||
<ng-container *ngIf="(!wallet.is_auditable && !wallet.is_watch_only) || (wallet.is_auditable && !wallet.is_watch_only)">
|
||||
<div class="sidebar-account-row account-staking" *ngIf="!(!wallet.loaded && variablesService.daemon_state === 2)">
|
||||
<span class="text">{{ 'SIDEBAR.ACCOUNT.STAKING' | translate }}</span>
|
||||
<app-staking-switch [wallet_id]="wallet.wallet_id" [(staking)]="wallet.staking"></app-staking-switch>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="sidebar-account-row account-messages" *ngIf="!(!wallet.loaded && variablesService.daemon_state === 2)">
|
||||
<span class="text">{{ 'SIDEBAR.ACCOUNT.MESSAGES' | translate }}</span>
|
||||
<span class="indicator">{{wallet.new_contracts}}</span>
|
||||
|
|
@ -44,7 +62,7 @@
|
|||
</div>
|
||||
<div class="sidebar-settings">
|
||||
<div class="wrap-button" routerLinkActive="active" *ngIf="variablesService.appPass === ''; else contactsShow" tooltip="{{ 'SIDEBAR.CONTACTS_TOOLTIP' | translate }}" placement="top" tooltipClass="table-tooltip account-tooltip" [delay]="500" [timeDelay]="500">
|
||||
<button (click)="contactsRoute()" [class.disabled]="variablesService.daemon_state !== 2 || variablesService.appPass === ''"
|
||||
<button (click)="contactsRoute()" [class.disabled]="variablesService.daemon_state !== 2 || variablesService.appPass === ''"
|
||||
[disabled]="variablesService.daemon_state !== 2 || variablesService.appPass === ''">
|
||||
<i class="icon contacts"></i>
|
||||
<span>{{ 'SIDEBAR.CONTACTS' | translate }}</span>
|
||||
|
|
@ -84,7 +102,7 @@
|
|||
</div>
|
||||
<ng-template #masterPass>
|
||||
<div class="wrap-button">
|
||||
<button
|
||||
<button
|
||||
(mouseover)="itemHovered = true"
|
||||
(mouseleave)="itemHovered = false"
|
||||
(click)="logOut()">
|
||||
|
|
@ -92,7 +110,7 @@
|
|||
<ng-template #svgLogout>
|
||||
<div class="animated" [innerHTML]="exit | safeHTML"></div>
|
||||
</ng-template>
|
||||
|
||||
|
||||
<span>{{ 'SIDEBAR.LOG_OUT' | translate }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,13 +17,86 @@
|
|||
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
|
||||
|
||||
path, circle, polygon {
|
||||
fill: #4db1ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.wallet-type {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 7px;
|
||||
background-color: transparent;
|
||||
transition: all ease .3s;
|
||||
> div {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
&:hover {
|
||||
height: auto;
|
||||
.content {
|
||||
opacity: 1;
|
||||
}
|
||||
.auditable {
|
||||
background-color: transparent;
|
||||
.content {
|
||||
margin: 0 3rem;
|
||||
background-color: #5cda9d;
|
||||
}
|
||||
}
|
||||
.watch-only {
|
||||
background-color: transparent;
|
||||
.content {
|
||||
margin: 0 3rem;
|
||||
background-color: #8686ff;
|
||||
}
|
||||
}
|
||||
.auditable-watch-only {
|
||||
> div:first-child {
|
||||
margin-right: 10px;
|
||||
margin-left: 3rem;
|
||||
}
|
||||
> div:last-child {
|
||||
margin-right: 3rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content {
|
||||
padding: 5px;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
text-transform: capitalize;
|
||||
transition: all ease .3s;
|
||||
opacity: 0;
|
||||
}
|
||||
.auditable {
|
||||
background-color: #5cda9d;
|
||||
}
|
||||
.watch-only {
|
||||
background-color: #8686ff;
|
||||
}
|
||||
.auditable-watch-only {
|
||||
display: flex;
|
||||
> div {
|
||||
transition: all ease .3s;
|
||||
width: 100%;
|
||||
.content {
|
||||
transition: none;
|
||||
}
|
||||
&:first-child {
|
||||
background-color: #5cda9d;
|
||||
}
|
||||
&:last-child {
|
||||
background-color: #8686ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-accounts {
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
|
@ -57,12 +130,13 @@
|
|||
overflow-y: overlay;
|
||||
|
||||
.sidebar-account {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
cursor: pointer;
|
||||
padding: 2rem 3rem;
|
||||
|
||||
|
||||
.close-wallet-wrapper {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
|
@ -70,12 +144,13 @@
|
|||
button {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: -20px;
|
||||
padding: 0;
|
||||
height: auto;
|
||||
background: transparent;
|
||||
border: none;
|
||||
margin: -1.3rem 1.6rem;
|
||||
|
||||
|
||||
.icon {
|
||||
width: 1.3rem;
|
||||
height: 1.3rem;
|
||||
|
|
@ -86,7 +161,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.sidebar-account-row {
|
||||
display: flex;
|
||||
|
|
@ -205,7 +280,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
&:focus {
|
||||
|
|
@ -323,7 +398,7 @@
|
|||
font-size: 1.3rem;
|
||||
line-height: 0.7rem;
|
||||
padding-left: 0.7rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
|
|||
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 icons from '../../assets/icons/icons.json';
|
||||
|
||||
|
|
@ -107,6 +108,10 @@ export class SidebarComponent implements OnInit, OnDestroy {
|
|||
getUpdate() {
|
||||
this.backend.openUrlInBrowser('zano.org/downloads.html');
|
||||
}
|
||||
goToAuditableWalletHelpPage(e) {
|
||||
e.preventDefault();
|
||||
this.backend.openUrlInBrowser(AUDITABLE_WALLET_HELP_PAGE);
|
||||
}
|
||||
|
||||
logOut() {
|
||||
this.variablesService.stopCountdown();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<div class="chart-header">
|
||||
<div class="general">
|
||||
<div>
|
||||
<div *ngIf="(!variablesService.currentWallet.is_auditable && !variablesService.currentWallet.is_watch_only)
|
||||
|| (variablesService.currentWallet.is_auditable && !variablesService.currentWallet.is_watch_only)">
|
||||
<span class="label">{{ 'STAKING.TITLE' | translate }}</span>
|
||||
<span class="value">
|
||||
<app-staking-switch [wallet_id]="variablesService.currentWallet.wallet_id" [(staking)]="variablesService.currentWallet.staking"></app-staking-switch>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@
|
|||
<div class="tabs">
|
||||
<div class="tabs-header">
|
||||
<ng-container *ngFor="let tab of tabs; let index = index">
|
||||
<div class="tab" [class.active]="tab.active" [class.disabled]="(tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && (variablesService.daemon_state !== 2 || !variablesService.currentWallet.loaded)" (click)="changeTab(index)" (mouseover)="itemHovered(index, true)" (mouseleave)="itemHovered(index, false)">
|
||||
<div class="tab" [class.active]="tab.active"
|
||||
[class.disabled]="((tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && (variablesService.daemon_state !== 2 || !variablesService.currentWallet.loaded))
|
||||
|| ((tab.link === '/send' || tab.link === '/contracts') && variablesService.currentWallet.is_watch_only && variablesService.currentWallet.is_auditable)"
|
||||
(click)="changeTab(index)" (mouseover)="itemHovered(index, true)" (mouseleave)="itemHovered(index, false)">
|
||||
<i class="icon" [ngClass]="tab.icon" *ngIf="!tab.itemHovered; else svgAnimated"></i>
|
||||
<ng-template #svgAnimated>
|
||||
<div class="animated" [innerHTML]="tab.animated | safeHTML"></div>
|
||||
|
|
@ -47,7 +50,7 @@
|
|||
<div class="pagination">
|
||||
<button [disabled]="variablesService.currentWallet.currentPage === 1" (click)="setPage(variablesService.currentWallet.currentPage - 1)"><</button>
|
||||
<ng-container *ngFor="let page of variablesService.currentWallet.pages">
|
||||
<button [ngClass]="{ 'active': variablesService.currentWallet.currentPage === page }"
|
||||
<button [ngClass]="{ 'active': variablesService.currentWallet.currentPage === page }"
|
||||
(click)="setPage(page)">{{page}}</button>
|
||||
</ng-container>
|
||||
<button [disabled]="variablesService.currentWallet.currentPage === variablesService.currentWallet.totalPages" (click)="setPage(variablesService.currentWallet.currentPage + 1)">></button>
|
||||
|
|
|
|||
|
|
@ -135,7 +135,8 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
changeTab(index) {
|
||||
if ((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts' || this.tabs[index].link === '/staking') && (this.variablesService.daemon_state !== 2 || !this.variablesService.currentWallet.loaded)) {
|
||||
if (((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts' || this.tabs[index].link === '/staking') && (this.variablesService.daemon_state !== 2 || !this.variablesService.currentWallet.loaded))
|
||||
|| ((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts') && this.variablesService.currentWallet.is_watch_only && this.variablesService.currentWallet.is_auditable)) {
|
||||
return;
|
||||
}
|
||||
this.tabs.forEach((tab) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue