mirror of
https://github.com/fluencelabs/dashboard
synced 2024-12-04 23:30:20 +00:00
discoveredPeers
This commit is contained in:
parent
7863879122
commit
25bf8e4740
@ -54,7 +54,7 @@ init flags url key =
|
||||
, url = url
|
||||
, key = key
|
||||
, page = r
|
||||
, loadedPeers = Dict.empty
|
||||
, discoveredPeers = Dict.empty
|
||||
}
|
||||
in
|
||||
( emptyModel, Route.routeCommand emptyModel r )
|
||||
|
@ -36,5 +36,5 @@ type alias Model =
|
||||
, key : Nav.Key
|
||||
, url : Url.Url
|
||||
, page : Route
|
||||
, loadedPeers : Dict String PeerData
|
||||
, discoveredPeers : Dict String PeerData
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ limitations under the License.
|
||||
import Air
|
||||
import Browser
|
||||
import Browser.Navigation as Nav
|
||||
import Dict
|
||||
import Model exposing (Model)
|
||||
import Msg exposing (..)
|
||||
import Port exposing (sendAir)
|
||||
@ -51,11 +52,29 @@ update msg model =
|
||||
( model, Nav.load href )
|
||||
|
||||
AquamarineEvent { name, args } ->
|
||||
let
|
||||
a =
|
||||
Debug.log "event in ELM" name
|
||||
in
|
||||
( model, Cmd.none )
|
||||
case name of
|
||||
"peers_discovered" ->
|
||||
let
|
||||
b =
|
||||
Debug.log "args" args
|
||||
|
||||
up p =
|
||||
case p of
|
||||
Nothing ->
|
||||
Just { interfaces = [] }
|
||||
|
||||
Just x ->
|
||||
Just x
|
||||
in
|
||||
-- TODO get data from args, propagate
|
||||
( { model | discoveredPeers = Dict.update "abc" up model.discoveredPeers }, Cmd.none )
|
||||
|
||||
_ ->
|
||||
let
|
||||
a =
|
||||
Debug.log "event in ELM" name
|
||||
in
|
||||
( model, Cmd.none )
|
||||
|
||||
Click ->
|
||||
( model
|
||||
|
@ -40,14 +40,15 @@ function genFlags(peerId: string): any {
|
||||
|
||||
// If the relay is ever changed, an event shall be sent to elm
|
||||
let client = await Fluence.connect(relays[relayIdx].multiaddr, pid)
|
||||
Fluence.setLogLevel("debug")
|
||||
|
||||
let app = Elm.Main.init({
|
||||
node: document.getElementById('root'),
|
||||
flags: flags
|
||||
});
|
||||
|
||||
let eventService = new ServiceOne("event", (fnName, args: any[]) => {
|
||||
console.log("event service called: " + fnName)
|
||||
console.log("event service called: ", fnName)
|
||||
console.log("event service args: ", args)
|
||||
|
||||
app.ports.eventReceiver.send({name: fnName, args})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user