Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
samourai-dojo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nickodev
samourai-dojo
Commits
50ba4d36
Commit
50ba4d36
authored
Oct 09, 2020
by
kenshin-samourai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add visual indicator for desynchronized chaintips on status screen
parent
9205ed1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
static/admin/dmt/status/status.js
static/admin/dmt/status/status.js
+27
-0
No files found.
static/admin/dmt/status/status.js
View file @
50ba4d36
const
statusScript
=
{
initPage
:
function
()
{
this
.
chaintipBitcoind
=
0
this
.
chaintipIndexer
=
0
this
.
chaintipDb
=
0
// Refresh API status
setInterval
(()
=>
{
this
.
refreshApiStatus
()},
60000
)
// Refresh PushTx status
...
...
@@ -31,6 +34,8 @@ const statusScript = {
const
blocks
=
apiStatus
[
'
blocks
'
]
if
(
blocks
)
{
this
.
chaintipBitcoind
=
blocks
this
.
chaintipDb
=
blocks
$
(
'
#db-chaintip
'
).
text
(
blocks
)
$
(
'
#tracker-chaintip
'
).
text
(
blocks
)
this
.
setStatusIndicator
(
'
#db-status-ind
'
,
'
ok
'
)
...
...
@@ -43,6 +48,7 @@ const statusScript = {
if
(
apiStatus
[
'
indexer
'
])
{
const
indexerMaxHeight
=
apiStatus
[
'
indexer
'
][
'
maxHeight
'
]
if
(
indexerMaxHeight
)
{
this
.
chaintipIndexer
=
indexerMaxHeight
$
(
'
#indexer-chaintip
'
).
text
(
indexerMaxHeight
)
this
.
setStatusIndicator
(
'
#indexer-status-ind
'
,
'
ok
'
)
}
else
{
...
...
@@ -55,6 +61,8 @@ const statusScript = {
if
(
indexerUrl
)
$
(
'
#indexer-url
'
).
text
(
indexerUrl
)
}
this
.
checkChaintips
()
//lib_msg.cleanMessagesUi()
}
}).
catch
(
e
=>
{
...
...
@@ -82,12 +90,14 @@ const statusScript = {
this
.
setStatusIndicator
(
'
#node-status-ind
'
,
'
ok
'
)
const
uptime
=
lib_cmn
.
timePeriod
(
data
[
'
uptime
'
])
$
(
'
#node-uptime
'
).
text
(
uptime
)
this
.
chaintipBitcoind
=
data
[
'
bitcoind
'
][
'
blocks
'
]
$
(
'
#node-chaintip
'
).
text
(
data
[
'
bitcoind
'
][
'
blocks
'
])
$
(
'
#node-version
'
).
text
(
data
[
'
bitcoind
'
][
'
version
'
])
const
network
=
data
[
'
bitcoind
'
][
'
testnet
'
]
==
true
?
'
testnet
'
:
'
mainnet
'
$
(
'
#node-network
'
).
text
(
network
)
$
(
'
#node-conn
'
).
text
(
data
[
'
bitcoind
'
][
'
conn
'
])
$
(
'
#node-relay-fee
'
).
text
(
data
[
'
bitcoind
'
][
'
relayfee
'
])
this
.
checkChaintips
()
//lib_msg.cleanMessagesUi()
}
}).
catch
(
e
=>
{
...
...
@@ -96,6 +106,20 @@ const statusScript = {
})
},
checkChaintips
:
function
()
{
if
(
this
.
chaintipBitcoind
>
this
.
chaintipDb
)
{
this
.
setStatusIndicator
(
'
#db-status-ind
'
,
'
desynchronized
'
)
this
.
setStatusIndicator
(
'
#tracker-status-ind
'
,
'
desynchronized
'
)
}
if
(
this
.
chaintipBitcoind
>
this
.
chaintipIndexer
)
{
this
.
setStatusIndicator
(
'
#indexer-status-ind
'
,
'
desynchronized
'
)
}
else
if
(
this
.
chaintipBitcoind
<
this
.
chaintipIndexer
)
{
this
.
setStatusIndicator
(
'
#node-status-ind
'
,
'
desynchronized
'
)
this
.
setStatusIndicator
(
'
#db-status-ind
'
,
'
desynchronized
'
)
this
.
setStatusIndicator
(
'
#tracker-status-ind
'
,
'
desynchronized
'
)
}
},
setStatusIndicator
:
function
(
id
,
status
)
{
if
(
status
==
'
ok
'
)
{
$
(
id
).
html
(
'
✓
'
)
...
...
@@ -103,6 +127,9 @@ const statusScript = {
}
else
if
(
status
==
'
ko
'
)
{
$
(
id
).
html
(
'
X
'
)
$
(
id
).
css
(
'
color
'
,
'
#f77c7c
'
)
}
else
if
(
status
==
'
desynchronized
'
)
{
$
(
id
).
html
(
'
✓
'
)
$
(
id
).
css
(
'
color
'
,
'
#f0c649
'
)
}
else
{
$
(
id
).
html
(
'
-
'
)
$
(
id
).
css
(
'
color
'
,
'
#efefef
'
)
...
...
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