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
c35b3160
Commit
c35b3160
authored
7 years ago
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add status bar
parent
ba3dc48b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
0 deletions
+94
-0
status-bar.component.html
...ze.UI/src/app/wallet/status-bar/status-bar.component.html
+6
-0
status-bar.component.scss
...ze.UI/src/app/wallet/status-bar/status-bar.component.scss
+0
-0
status-bar.component.spec.ts
...UI/src/app/wallet/status-bar/status-bar.component.spec.ts
+25
-0
status-bar.component.ts
Breeze.UI/src/app/wallet/status-bar/status-bar.component.ts
+63
-0
No files found.
Breeze.UI/src/app/wallet/status-bar/status-bar.component.html
0 → 100644
View file @
c35b3160
<div
class=
"status"
>
<ul
class=
"list-inline align-self-center row"
>
<li
class=
"list-inline-item pending"
><i
class=
"icon-syncr"
></i></li>
<li
class=
"list-inline-item"
>
{{ percentSynced }}%
</li>
</ul>
</div>
This diff is collapsed.
Click to expand it.
Breeze.UI/src/app/wallet/status-bar/status-bar.component.scss
0 → 100644
View file @
c35b3160
This diff is collapsed.
Click to expand it.
Breeze.UI/src/app/wallet/status-bar/status-bar.component.spec.ts
0 → 100644
View file @
c35b3160
import
{
async
,
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
StatusBarComponent
}
from
'./status-bar.component'
;
describe
(
'StatusBarComponent'
,
()
=>
{
let
component
:
StatusBarComponent
;
let
fixture
:
ComponentFixture
<
StatusBarComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
StatusBarComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
StatusBarComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should be created'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
This diff is collapsed.
Click to expand it.
Breeze.UI/src/app/wallet/status-bar/status-bar.component.ts
0 → 100644
View file @
c35b3160
import
{
Component
,
OnInit
,
OnDestroy
}
from
'@angular/core'
;
import
{
ApiService
}
from
'../../shared/services/api.service'
;
import
{
GlobalService
}
from
'../../shared/services/global.service'
;
import
{
WalletInfo
}
from
'../../shared/classes/wallet-info'
;
import
{
Observable
}
from
'rxjs/Rx'
;
import
{
Subscription
}
from
'rxjs/Subscription'
;
@
Component
({
selector
:
'status-bar'
,
templateUrl
:
'./status-bar.component.html'
,
styleUrls
:
[
'./status-bar.component.scss'
]
})
export
class
StatusBarComponent
implements
OnInit
{
private
generalWalletInfoSubscription
:
Subscription
;
private
lastBlockSyncedHeight
:
number
;
private
chainTip
:
number
;
private
connectedNodes
:
number
=
0
;
private
percentSynced
:
number
=
100
;
constructor
(
private
apiService
:
ApiService
,
private
globalService
:
GlobalService
)
{
}
ngOnInit
()
{
this
.
getGeneralWalletInfo
()
}
ngOnDestroy
()
{
this
.
generalWalletInfoSubscription
.
unsubscribe
();
}
getGeneralWalletInfo
()
{
let
walletInfo
=
new
WalletInfo
(
this
.
globalService
.
getWalletName
(),
this
.
globalService
.
getCoinType
())
this
.
generalWalletInfoSubscription
=
this
.
apiService
.
getGeneralInfo
(
walletInfo
)
.
subscribe
(
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
let
generalWalletInfoResponse
=
response
.
json
();
this
.
lastBlockSyncedHeight
=
generalWalletInfoResponse
.
lastBlockSyncedHeight
;
this
.
chainTip
=
generalWalletInfoResponse
.
chainTip
;
this
.
connectedNodes
=
generalWalletInfoResponse
.
connectedNodes
;
this
.
percentSynced
=
(
this
.
chainTip
/
this
.
lastBlockSyncedHeight
)
*
100
}
},
error
=>
{
console
.
log
(
error
);
if
(
error
.
status
===
0
)
{
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
].
description
);
}
}
}
)
;
}
}
This diff is collapsed.
Click to expand it.
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