shadows, known peers

This commit is contained in:
DieMyst 2020-12-04 12:21:09 +03:00
parent 4d05ad47b4
commit c863157bc1
12 changed files with 80 additions and 33 deletions

6
package-lock.json generated
View File

@ -6835,9 +6835,9 @@
"dev": true "dev": true
}, },
"fluence": { "fluence": {
"version": "0.7.86", "version": "0.7.92",
"resolved": "https://registry.npmjs.org/fluence/-/fluence-0.7.86.tgz", "resolved": "https://registry.npmjs.org/fluence/-/fluence-0.7.92.tgz",
"integrity": "sha512-h0RYWwSf56bxQpW+z3o0tHH7UCwYy3khhZGwkGyrP6rxD5YM55r/Xc+8n+OAgxVpBBcPxFUWuxblm+UH65cZvw==", "integrity": "sha512-BgJyTkYuOQr5xDHpbFKG8lIT5ThChfoHjejqg6Ra4lpk6M1ecbSc9H58+p7AjGxQFipSe4OQCrcAaejv8Sy5WA==",
"requires": { "requires": {
"@fluencelabs/aquamarine-stepper": "0.0.13", "@fluencelabs/aquamarine-stepper": "0.0.13",
"async": "3.2.0", "async": "3.2.0",

View File

@ -20,7 +20,7 @@
}, },
"homepage": "https://github.com/fluencelabs/fluence-admin#readme", "homepage": "https://github.com/fluencelabs/fluence-admin#readme",
"dependencies": { "dependencies": {
"fluence": "0.7.86", "fluence": "0.7.92",
"tachyons": "^4.12.0" "tachyons": "^4.12.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -3,7 +3,6 @@ module AirScripts.GetAll exposing (..)
import Air exposing (Air, callBI, fold, next, par, relayEvent, seq, set) import Air exposing (Air, callBI, fold, next, par, relayEvent, seq, set)
import Json.Encode exposing (list, string) import Json.Encode exposing (list, string)
air : String -> String -> List String -> Air air : String -> String -> List String -> Air
air peerId relayId peers = air peerId relayId peers =
let let
@ -14,27 +13,63 @@ air peerId relayId peers =
set "relayId" <| string relayId set "relayId" <| string relayId
peersSet = peersSet =
set "peers" <| list string peers set "knownPeers" <| list string peers
airScript = askRelay = (\innerAir ->
par
(seq
(callBI "relayId" ( "op", "identity" ) [] Nothing)
(askAllAndSend "relayId")
)
innerAir
)
askPeers = (\innerAir ->
par
(fold "knownPeers" "p" <|
par
(seq
(callBI "p" ( "op", "identity" ) [] Nothing)
(askAllAndSend "p")
)
(next "p")
)
innerAir
)
findAndAskNeighbours =
seq seq
(callBI "relayId" ( "op", "identity" ) [] Nothing) (callBI "relayId" ( "op", "identity" ) [] Nothing)
(fold "peers" "p" <| (seq
par (callBI "relayId" ( "dht", "neighborhood" ) [ "clientId" ] (Just "neigh"))
(seq (fold "neigh" "n" <|
(callBI "p" ( "op", "identify" ) [] (Just "ident")) par
(seq (seq
(callBI "p" ( "dist", "get_blueprints" ) [] (Just "blueprints")) (callBI "n" ( "dht", "neighborhood" ) [ "clientId" ] (Just "moreNeigh"))
(seq (fold "moreNeigh" "mp" <|
(callBI "p" ( "dist", "get_modules" ) [] (Just "modules")) par
(seq (askAllAndSend "mp")
(callBI "p" ( "srv", "get_interfaces" ) [] (Just "interfaces")) (next "mp")
(relayEvent "all_info" [ "p", "ident", "interfaces", "blueprints", "modules" ])
)
) )
) )
) (next "n")
(next "p") ))
)
in in
clientIdSet <| relayIdSet <| peersSet <| airScript clientIdSet <| relayIdSet <| peersSet <| (askRelay <| askPeers <| findAndAskNeighbours)
askAllAndSend : String -> Air
askAllAndSend var =
(seq
(callBI var ( "op", "identify" ) [] (Just "ident"))
(seq
(callBI var ( "dist", "get_blueprints" ) [] (Just "blueprints"))
(seq
(callBI var ( "dist", "get_modules" ) [] (Just "modules"))
(seq
(callBI var ( "srv", "get_interfaces" ) [] (Just "interfaces"))
(relayEvent "all_info" [ var, "ident", "interfaces", "blueprints", "modules" ])
)
)
)
)

View File

@ -100,7 +100,7 @@ viewToggledInterface isOpen name interface =
[] []
in in
div [] div []
([ div [ classes "fl w-100 shadow-2 bg-near-white pa2 mv2 pointer", onClick (ToggleInterface name) ] ([ div [ classes "fl w-100 light-shadow bg-near-white pa2 mv2 pointer", onClick (ToggleInterface name) ]
[ span [ classes "fl mh2 pv1 tl" ] [ text name ] [ span [ classes "fl mh2 pv1 tl" ] [ text name ]
, div [ classes "o-40 f4 tr pr3" ] , div [ classes "o-40 f4 tr pr3" ]
[ if isOpen then [ if isOpen then

View File

@ -4,6 +4,7 @@ module Config exposing (..)
type alias Config = type alias Config =
{ peerId : String { peerId : String
, relayId : String , relayId : String
, knownPeers : List String
} }

View File

@ -56,6 +56,7 @@ init flags url key =
, modules = Dict.empty , modules = Dict.empty
, blueprints = Dict.empty , blueprints = Dict.empty
, toggledInterface = Nothing , toggledInterface = Nothing
, knownPeers = flags.knownPeers
} }
in in
( emptyModel, Route.routeCommand emptyModel r ) ( emptyModel, Route.routeCommand emptyModel r )

View File

@ -55,4 +55,5 @@ type alias Model =
, modules : Dict String Module , modules : Dict String Module
, blueprints : Dict String Blueprint , blueprints : Dict String Blueprint
, toggledInterface : Maybe String , toggledInterface : Maybe String
, knownPeers : List String
} }

View File

@ -1,15 +1,15 @@
module ModulePage.View exposing (..) module ModulePage.View exposing (..)
import Dict exposing (Dict) import Dict exposing (Dict)
import Html exposing (Html, a, article, div, h3, span, text) import Html exposing (Html, a, article, div, h1, h3, span, text)
import Html.Attributes exposing (attribute) import Html.Attributes exposing (attribute)
import Info exposing (getDescription, getSite, modulesDescription) import Info exposing (getDescription, getSite)
import Instances.View import Instances.View
import Interface.View exposing (interfaceView) import Interface.View exposing (interfaceView)
import Model exposing (Model) import Model exposing (Model)
import ModulePage.Model exposing (ModuleViewInfo) import ModulePage.Model exposing (ModuleViewInfo)
import Modules.Model exposing (Module) import Modules.Model exposing (Module)
import Palette exposing (classes) import Palette exposing (classes, redFont)
view : Model -> String -> Html msg view : Model -> String -> Html msg
@ -32,7 +32,7 @@ view model id =
in in
div [ classes "fl w-100 cf ph2-ns" ] div [ classes "fl w-100 cf ph2-ns" ]
[ div [ classes "fl w-100 mb2 pt2" ] [ div [ classes "fl w-100 mb2 pt2" ]
[ span [ classes "fl w-100 f1 lh-title dark-red" ] [ text ("Module: " ++ mi.name) ] [ h1 [ redFont, classes "f2 lh-copy ma0 mt4" ] [ text ("Module: " ++ mi.name) ]
] ]
, div [ classes "fl w-100 bg-white mt2 ph4 pt3 mb4 pb2 br3" ] [ viewInfo mi ] , div [ classes "fl w-100 bg-white mt2 ph4 pt3 mb4 pb2 br3" ] [ viewInfo mi ]
, h3 [ classes "pt3" ] [ text ("Instances (" ++ String.fromInt instanceNum ++ ")") ] , h3 [ classes "pt3" ] [ text ("Instances (" ++ String.fromInt instanceNum ++ ")") ]

View File

@ -1,6 +1,6 @@
module Route exposing (..) module Route exposing (..)
import AirScripts.DiscoverPeers as DiscoverPeers import AirScripts.GetAll as GetAll
import BlueprintPage.View as BlueprintPage import BlueprintPage.View as BlueprintPage
import Html exposing (Html, text) import Html exposing (Html, text)
import HubPage.View as HubPage import HubPage.View as HubPage
@ -53,13 +53,13 @@ routeCommand : Model -> Route -> Cmd msg
routeCommand m r = routeCommand m r =
case r of case r of
Page _ -> Page _ ->
sendAir (DiscoverPeers.air m.peerId m.relayId) sendAir (GetAll.air m.peerId m.relayId m.knownPeers)
Peer _ -> Peer _ ->
sendAir (DiscoverPeers.air m.peerId m.relayId) sendAir (GetAll.air m.peerId m.relayId m.knownPeers)
Blueprint _ -> Blueprint _ ->
sendAir (DiscoverPeers.air m.peerId m.relayId) sendAir (GetAll.air m.peerId m.relayId m.knownPeers)
Module _ -> Module _ ->
sendAir (DiscoverPeers.air m.peerId m.relayId) sendAir (GetAll.air m.peerId m.relayId m.knownPeers)

View File

@ -40,7 +40,7 @@ body model =
layout <| layout <|
List.concat List.concat
[ [ header [ classes "w-100" ] [ [ header [ classes "w-100" ]
[ div [ classes "fl pa2 pb1 bg-white w-100" ] [ div [ classes "fl pa2 pb1 bg-white w-100 one-edge-shadow" ]
[ div [ classes "fl mv1 pl3", style "max-width" "96px" ] [ div [ classes "fl mv1 pl3", style "max-width" "96px" ]
[ a [ attribute "href" "/" ] [ a [ attribute "href" "/" ]
[ img [ classes "v-mid dib mw-100 h-auto", attribute "src" "/images/logo_new.svg" ] [] [ img [ classes "v-mid dib mw-100 h-auto", attribute "src" "/images/logo_new.svg" ] []

View File

@ -32,6 +32,7 @@ function genFlags(peerId: string): any {
return { return {
peerId, peerId,
relayId: relays[relayIdx].peerId, relayId: relays[relayIdx].peerId,
knownPeers: relays.map((v) => v.peerId)
}; };
} }

View File

@ -32,4 +32,12 @@ h1 {
.medium-roboto { .medium-roboto {
font-weight: 500; font-weight: 500;
}
.light-shadow {
box-shadow: 0px 1px 3px 1px rgba( 0, 0, 0, 0.1 );
}
.one-edge-shadow {
box-shadow: 0px 1px 6px 1px rgba( 0, 0, 0, 0.1 );
} }