remove unused / obsolete / unmaintained modules (#4298)
mostly this is chronicles-tail and its (extensive) dependencies along with the simulation monitoring dashboard that is not maintained
This commit is contained in:
parent
8297b962cc
commit
02b48fafad
|
@ -133,31 +133,6 @@
|
|||
url = https://github.com/status-im/nim-snappy.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/asynctools"]
|
||||
path = vendor/asynctools
|
||||
url = https://github.com/cheatfate/asynctools.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/karax"]
|
||||
path = vendor/karax
|
||||
url = https://github.com/pragmagic/karax.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/jswebsockets"]
|
||||
path = vendor/jswebsockets
|
||||
url = https://github.com/stisa/jswebsockets.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/websocket.nim"]
|
||||
path = vendor/websocket.nim
|
||||
url = https://github.com/niv/websocket.nim.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/nim-chronicles-tail"]
|
||||
path = vendor/nim-chronicles-tail
|
||||
url = https://github.com/status-im/nim-chronicles-tail.git
|
||||
ignore = untracked
|
||||
branch = master
|
||||
[submodule "vendor/nimbus-security-resources"]
|
||||
path = vendor/nimbus-security-resources
|
||||
url = https://github.com/status-im/nimbus-security-resources.git
|
||||
|
|
|
@ -1,189 +0,0 @@
|
|||
import
|
||||
strformat, jsconsole, jsffi,
|
||||
karax/[karax, kdom, karaxdsl, vdom],
|
||||
chronicles_tail/jsplugins
|
||||
|
||||
# Make sure that the Karax instance in the plugin is the same one
|
||||
# as the Karax instance in the enclosing chronicle-tail page.
|
||||
kxi = getKarax()
|
||||
|
||||
type EventsTable = ref object of VComponent
|
||||
|
||||
proc renderNetworkEvents(page: VComponent): VNode =
|
||||
result = buildHtml:
|
||||
table:
|
||||
tr:
|
||||
th: text "Time"
|
||||
th: text "Nodes"
|
||||
|
||||
const
|
||||
columnWidth = 320
|
||||
timestampsHeight = 50
|
||||
eventsMargin = 10
|
||||
|
||||
var
|
||||
eventsTable = newComponent(EventsTable, renderNetworkEvents)
|
||||
protocolMessages = newJsAssoc[cstring, JsAssoc[cstring, cstring]]()
|
||||
|
||||
pendingEvents = newSeq[TailEvent]()
|
||||
freedColumns = newSeq[int]()
|
||||
columnBottoms = newSeq[int]()
|
||||
peerToColumnTable = newJsAssoc[cstring, int]()
|
||||
lastTimestampBottom = timestampsHeight
|
||||
|
||||
proc startsWith*(a, b: cstring): bool {.importcpp: "startsWith", nodecl.}
|
||||
|
||||
proc getMsgName(protocol: cstring, msgId: int): cstring =
|
||||
protocolMessages[protocol][cast[cstring](msgId)]
|
||||
|
||||
proc renderEvent(ev: TailEvent): cstring =
|
||||
var res = newStringOfCap(1024)
|
||||
let eventType = ev.msg
|
||||
|
||||
res.add &"""<div class="event {eventType}">"""
|
||||
|
||||
template addField(class, value) =
|
||||
res.add "<div class=\"" & class & "\">"
|
||||
res.addEscaped $value
|
||||
res.add "</div>"
|
||||
|
||||
if eventType.startsWith(cstring("peer_")):
|
||||
addField "peer", ev.peer
|
||||
addField "port", ev.port
|
||||
else:
|
||||
addField "msgName", getMsgName(ev.protocol, ev.msgId)
|
||||
res.addAsHtml ev.data
|
||||
|
||||
res.add """</div>"""
|
||||
return cstring(res)
|
||||
|
||||
proc selectColumn(ev: TailEvent): int =
|
||||
let key = cast[cstring](ev.port)# & ev.peer
|
||||
kout ev.msg, key
|
||||
|
||||
if ev.msg in [cstring"peer_accepted", "peer_connected"]:
|
||||
if freedColumns.len > 0:
|
||||
result = freedColumns.pop()
|
||||
else:
|
||||
result = columnBottoms.len
|
||||
columnBottoms.add(timestampsHeight)
|
||||
peerToColumnTable[key] = result
|
||||
|
||||
elif ev.msg == cstring("peer_disconnected"):
|
||||
result = peerToColumnTable[key]
|
||||
discard jsDelete peerToColumnTable[key]
|
||||
freedColumns.add result
|
||||
|
||||
else:
|
||||
result = peerToColumnTable[key]
|
||||
|
||||
template pixels(n: int): cstring =
|
||||
cast[cstring](n) & "px"
|
||||
|
||||
proc addEvent(ev: TailEvent) =
|
||||
var
|
||||
row = document.createElement("tr")
|
||||
timeElem = document.createElement("td")
|
||||
eventElem = document.createElement("td")
|
||||
eventsTable = eventsTable.dom
|
||||
eventsCount = eventsTable.children.len
|
||||
lastEventRow = eventsTable.children[eventsCount - 1]
|
||||
|
||||
row.class = if eventsCount mod 2 == 0: "even" else: "odd"
|
||||
|
||||
# Hide the element initially, so we can safely measure its size.
|
||||
# It has to be added to the DOM before it can be measured.
|
||||
row.style.visibility = "hidden"
|
||||
row.appendChild(timeElem)
|
||||
row.appendChild(eventElem)
|
||||
|
||||
timeElem.innerHtml = ev.ts
|
||||
timeElem.class = "time"
|
||||
|
||||
eventElem.innerHTML = renderEvent(ev)
|
||||
|
||||
eventsTable.appendChild(row)
|
||||
let rowHeight = row.offsetHeight
|
||||
let eventColumn = selectColumn(ev)
|
||||
let timestampOffset = max(lastTimestampBottom, columnBottoms[eventColumn])
|
||||
let prevTimestampOffset = lastTimestampBottom - timestampsHeight
|
||||
|
||||
lastTimestampBottom = timestampOffset + timestampsHeight
|
||||
columnBottoms[eventColumn] += rowHeight + eventsMargin
|
||||
|
||||
# Make sure the event data is in the right column and that it
|
||||
# can overflow past the row height:
|
||||
eventElem.style.paddingLeft = pixels(eventColumn * columnWidth)
|
||||
|
||||
# Position the row in its right place and show it:
|
||||
lastEventRow.style.height = pixels(timestampOffset - prevTimestampOffset)
|
||||
row.style.top = pixels(timestampOffset)
|
||||
row.style.visibility = ""
|
||||
|
||||
proc networkSectionContent: VNode =
|
||||
result = buildHtml(tdiv(id = "network")):
|
||||
text "Network section"
|
||||
eventsTable
|
||||
|
||||
proc tailEventFilter(ev: TailEvent): bool =
|
||||
if ev.topics != "p2pdump":
|
||||
return false
|
||||
|
||||
if ev.msg == "p2p_protocols":
|
||||
protocolMessages = cast[type(protocolMessages)](ev.data)
|
||||
else:
|
||||
if eventsTable.dom == nil:
|
||||
pendingEvents.add ev
|
||||
else:
|
||||
addEvent ev
|
||||
|
||||
return true
|
||||
|
||||
proc addPending =
|
||||
if eventsTable.dom != nil and pendingEvents.len > 0:
|
||||
defer: pendingEvents.setLen(0)
|
||||
for ev in pendingEvents:
|
||||
addEvent ev
|
||||
|
||||
let interval = window.setInterval(addPending, 1000)
|
||||
|
||||
proc addStyles(styles: cstring) =
|
||||
var s = document.createElement("style")
|
||||
s.appendChild document.createTextNode(styles)
|
||||
document.head.appendChild(s)
|
||||
|
||||
once:
|
||||
addStyles cstring"""
|
||||
#network > table {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#network .event {
|
||||
border: 1px solid blue;
|
||||
}
|
||||
|
||||
#network .event table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#network > table > tr {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
border-left: 1px solid red;
|
||||
}
|
||||
|
||||
#network .time {
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
#network .event {
|
||||
width: 320px;
|
||||
}
|
||||
"""
|
||||
|
||||
addSection("Network", networkSectionContent)
|
||||
addEventFilter(tailEventFilter)
|
||||
|
||||
kxi.redraw()
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit c478bb74268c65e7400e81f49d26f82d20f1f57a
|
|
@ -1 +0,0 @@
|
|||
Subproject commit ff0ceecc4c071fa8aecbf223d678ac54af120f8d
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 32de202845762607a55332c2d138aca1327bf37b
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 2139c6c3d6820997a8dd1ea9af7c175efdef5401
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 28cc44c8defc0b248b3abbc8205759b69a98f7f6
|
Loading…
Reference in New Issue