Commit f7e763d8 authored by Pieterjan Vanhoof's avatar Pieterjan Vanhoof Committed by GitHub

Merge pull request #155 from stratisproject/ui

Fix tray error, add copy button to transaction details, fix send component error handling
parents 4608f1d6 2c30d23c
...@@ -56,7 +56,7 @@ function createWindow() { ...@@ -56,7 +56,7 @@ function createWindow() {
// Emitted when the window is going to close. // Emitted when the window is going to close.
mainWindow.on('close', function () { mainWindow.on('close', function () {
if (process.platform !== 'darwin') { if (process.platform !== 'darwin' && !serve) {
var http = require('http'); var http = require('http');
const options = { const options = {
hostname: 'localhost', hostname: 'localhost',
...@@ -141,9 +141,18 @@ function createTray() { ...@@ -141,9 +141,18 @@ function createTray() {
var iconPath var iconPath
if (os.platform() === 'win32') { if (os.platform() === 'win32') {
iconPath = __dirname + '/assets/images/breeze-logo-tray.ico'; if (serve) {
iconPath = '.\src\assets\images\breeze-logo-tray.ico';
} else {
iconPath = path.join(__dirname + '\\assets\\images\\breeze-logo-tray.png');
}
} else { } else {
iconPath = __dirname + '/assets/images/breeze-logo-tray.png'; if (serve) {
iconPath = './src/assets/images/breeze-logo-tray.png';
} else {
iconPath = path.join(__dirname + '//assets//images//breeze-logo-tray.png');
}
} }
appIcon = new Tray(iconPath); appIcon = new Tray(iconPath);
......
...@@ -97,12 +97,19 @@ export class SendComponent { ...@@ -97,12 +97,19 @@ export class SendComponent {
} }
}, },
error => { error => {
if (error.status >= 400) { console.log(error);
this.errorMessage = error; if (error.status === 0) {
console.log(this.errorMessage); alert("Something went wrong while connecting to the API. Please restart the application.");
} else if (error.status >= 400) {
if (!error.json().errors[0]) {
console.log(error);
}
else {
alert(error.json().errors[0].message);
}
} }
}, },
() => this.sendTransaction(this.responseMessage.hex) () => this.sendTransaction("123")
) )
; ;
}; };
...@@ -127,7 +134,6 @@ export class SendComponent { ...@@ -127,7 +134,6 @@ export class SendComponent {
.subscribe( .subscribe(
response => { response => {
if (response.status >= 200 && response.status < 400){ if (response.status >= 200 && response.status < 400){
console.log(response.status);
this.activeModal.close("Close clicked"); this.activeModal.close("Close clicked");
} }
}, },
...@@ -140,7 +146,7 @@ export class SendComponent { ...@@ -140,7 +146,7 @@ export class SendComponent {
console.log(error); console.log(error);
} }
else { else {
alert(error.json().errors[0].description); alert(error.json().errors[0].message);
} }
} }
} }
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
<ul class="list-inline row"> <ul class="list-inline row">
<li class="list-inline-item col blockLabel">Transaction ID</li> <li class="list-inline-item col blockLabel">Transaction ID</li>
<li class="list-inline-item col-9 blockText blockID"><code>{{ transaction.id }}</code></li> <li class="list-inline-item col-9 blockText blockID"><code>{{ transaction.id }}</code></li>
<span class="float-right"><a ngxClipboard [cbContent]="transaction.id" (click)="onCopiedClick()">copy</a></span>
<span class="badge badge-success list-inline-item col blockLabel" *ngIf="copied">The transaction ID has been copied to your clipboard.</span>
</ul> </ul>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
......
...@@ -10,12 +10,15 @@ import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; ...@@ -10,12 +10,15 @@ import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
export class TransactionDetailsComponent implements OnInit { export class TransactionDetailsComponent implements OnInit {
@Input() transaction; @Input() transaction;
constructor(public activeModal: NgbActiveModal) {}
constructor(public activeModal: NgbActiveModal) { private copied: boolean = false;
ngOnInit() {
} }
ngOnInit() { private onCopiedClick() {
this.copied = true;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment