Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
8ab94858
Commit
8ab94858
authored
Jun 28, 2017
by
Pieterjan Vanhoof
Committed by
GitHub
Jun 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #120 from stratisproject/ui
- Wait on API to load UI - Add basic error handling to API calls
parents
ce03cf34
152d31ba
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
39 deletions
+50
-39
main.ts
Breeze.UI/main.ts
+6
-4
app.component.html
Breeze.UI/src/app/app.component.html
+2
-1
app.component.ts
Breeze.UI/src/app/app.component.ts
+9
-0
login.component.ts
Breeze.UI/src/app/login/login.component.ts
+7
-9
create.component.ts
Breeze.UI/src/app/setup/create/create.component.ts
+4
-3
recover.component.ts
Breeze.UI/src/app/setup/recover/recover.component.ts
+4
-3
dashboard.component.html
Breeze.UI/src/app/wallet/dashboard/dashboard.component.html
+0
-4
dashboard.component.ts
Breeze.UI/src/app/wallet/dashboard/dashboard.component.ts
+14
-12
history.component.ts
Breeze.UI/src/app/wallet/history/history.component.ts
+4
-3
No files found.
Breeze.UI/main.ts
View file @
8ab94858
...
...
@@ -9,6 +9,8 @@ const path = require('path');
const
url
=
require
(
'url'
);
const
os
=
require
(
'os'
);
var
apiProcess
;
let
serve
;
const
args
=
process
.
argv
.
slice
(
1
);
serve
=
args
.
some
(
val
=>
val
===
"--serve"
);
...
...
@@ -66,6 +68,7 @@ app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if
(
process
.
platform
!==
'darwin'
)
{
//apiProcess.kill();
app
.
quit
();
}
});
...
...
@@ -79,16 +82,15 @@ app.on('activate', function () {
});
function
startApi
()
{
var
apiProcess
;
const
spawn
=
require
(
'child_process'
).
spawn
;
const
exec
=
require
(
'child_process'
).
exec
;
//Start Breeze Daemon
let
apipath
=
path
.
join
(
__dirname
,
'.
.//..
//daemon//Breeze.Daemon'
);
let
apipath
=
path
.
join
(
__dirname
,
'.
//assets
//daemon//Breeze.Daemon'
);
if
(
os
.
platform
()
===
'win32'
)
{
apipath
=
path
.
join
(
__dirname
,
'.
\\
assets
\\
daemon
\\
Breeze.Daemon.exe'
);
}
apiProcess
=
spawn
(
apipath
+
' light -testnet'
,
{
apiProcess
=
exec
(
apipath
+
' light -testnet'
,
{
detached
:
true
});
...
...
Breeze.UI/src/app/app.component.html
View file @
8ab94858
<router-outlet></router-outlet>
\ No newline at end of file
<div
*
ngIf=
"loading"
>
Loading...
</div>
<router-outlet
*
ngIf=
"!loading"
></router-outlet>
Breeze.UI/src/app/app.component.ts
View file @
8ab94858
...
...
@@ -3,6 +3,9 @@ import { Router } from '@angular/router';
import
{
ApiService
}
from
'./shared/services/api.service'
;
import
'rxjs/add/operator/retryWhen'
;
import
'rxjs/add/operator/delay'
;
@
Component
({
selector
:
'app-root'
,
templateUrl
:
'./app.component.html'
,
...
...
@@ -13,8 +16,14 @@ export class AppComponent implements OnInit {
constructor
(
private
router
:
Router
,
private
apiService
:
ApiService
)
{}
private
errorMessage
:
any
;
private
responseMessage
:
any
;
private
loading
:
boolean
=
true
;
ngOnInit
()
{
this
.
apiService
.
getWalletFiles
().
retryWhen
(
errors
=>
errors
.
delay
(
2000
)).
subscribe
(()
=>
this
.
startApp
());
}
startApp
()
{
this
.
loading
=
false
;
this
.
router
.
navigate
([
'/login'
]);
}
}
Breeze.UI/src/app/login/login.component.ts
View file @
8ab94858
...
...
@@ -104,10 +104,10 @@ export class LoginComponent implements OnInit {
}
},
error
=>
{
let
errorMessage
=
<
any
>
error
;
if
(
error
.
status
>=
400
)
{
alert
(
errorMessage
);
console
.
log
(
errorMessage
);
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
)
...
...
@@ -125,12 +125,10 @@ export class LoginComponent implements OnInit {
}
},
error
=>
{
let
errorMessage
=
<
any
>
error
;
if
(
error
.
status
===
403
&&
error
.
json
().
errors
[
0
].
message
===
"Wrong password, please try again."
)
{
alert
(
"Wrong password, try again."
);
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
errorMessage
);
console
.
log
(
errorMessage
);
alert
(
error
);
}
}
)
...
...
Breeze.UI/src/app/setup/create/create.component.ts
View file @
8ab94858
...
...
@@ -98,9 +98,10 @@ export class CreateComponent {
}
},
error
=>
{
if
(
error
.
status
>=
400
)
{
let
errorMessage
=
error
;
console
.
log
(
errorMessage
);
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
)
...
...
Breeze.UI/src/app/setup/recover/recover.component.ts
View file @
8ab94858
...
...
@@ -112,9 +112,10 @@ export class RecoverComponent implements OnInit {
}
},
error
=>
{
if
(
error
.
status
>=
400
)
{
this
.
errorMessage
=
error
;
console
.
log
(
this
.
errorMessage
);
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
);
...
...
Breeze.UI/src/app/wallet/dashboard/dashboard.component.html
View file @
8ab94858
...
...
@@ -6,8 +6,6 @@
<div
class=
"p"
>
Unconfirmed Balance: {{unconfirmedBalance | coinNotation }}
</div>
</div>
<div
class=
"d-flex flex-column"
>
<!--<div>Current Value</div>
<div>Over 9000</div>-->
</div>
<div
class=
"d-flex flex-column ml-auto"
>
<div>
...
...
@@ -28,8 +26,6 @@
<th>
Timestamp
</th>
</thead>
<tr
*
ngFor=
"let transaction of transactions; let i=index"
>
<!--<td *ngIf="{{ transaction.amount }} < 0">SENT</td>
<td *ngIf="{{ transaction.amount }} > 0">RECEIVED</td>-->
<td
*
ngIf=
"i<5"
>
{{ transaction.type }}
</td>
<td
*
ngIf=
"i<5"
>
{{ transaction.amount | coinNotation }}
</td>
<td
*
ngIf=
"i<5"
>
{{ transaction.id }}
</td>
...
...
Breeze.UI/src/app/wallet/dashboard/dashboard.component.ts
View file @
8ab94858
...
...
@@ -50,17 +50,18 @@ export class DashboardComponent {
this
.
walletBalanceSubscription
=
this
.
apiService
.
getWalletBalance
(
walletInfo
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
let
balanceResponse
=
response
.
json
();
this
.
confirmedBalance
=
balanceResponse
.
balances
[
0
].
amountConfirmed
;
this
.
unconfirmedBalance
=
balanceResponse
.
balances
[
0
].
amountUnconfirmed
;
}
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
let
balanceResponse
=
response
.
json
();
this
.
confirmedBalance
=
balanceResponse
.
balances
[
0
].
amountConfirmed
;
this
.
unconfirmedBalance
=
balanceResponse
.
balances
[
0
].
amountUnconfirmed
;
}
},
error
=>
{
if
(
error
.
status
>=
400
)
{
let
errorMessage
=
<
any
>
error
;
console
.
log
(
errorMessage
);
}
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
)
;
...
...
@@ -78,9 +79,10 @@ export class DashboardComponent {
}
},
error
=>
{
if
(
error
.
status
>=
400
)
{
let
errorMessage
=
<
any
>
error
;
console
.
log
(
errorMessage
);
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
)
...
...
Breeze.UI/src/app/wallet/history/history.component.ts
View file @
8ab94858
...
...
@@ -41,9 +41,10 @@ export class HistoryComponent {
}
},
error
=>
{
if
(
error
.
status
>=
400
)
{
this
.
errorMessage
=
<
any
>
error
;
console
.
log
(
this
.
errorMessage
);
if
(
error
.
status
===
0
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment