This commit is contained in:
DieMyst 2020-12-09 10:20:08 +03:00
parent 7c7768cbee
commit aca851004a
11 changed files with 85 additions and 56 deletions

View File

@ -3,12 +3,13 @@ module AirScripts.GetAll exposing (..)
import Air exposing (Air, callBI, fold, next, par, relayEvent, seq, set)
import Json.Encode exposing (list, string)
askRelaySchema : Air
askRelaySchema =
(seq
seq
(callBI "relayId" ( "op", "identity" ) [] Nothing)
(askAllAndSend "relayId")
)
askRelayScript : String -> String -> Air
askRelayScript peerId relayId =
@ -21,16 +22,17 @@ askRelayScript peerId relayId =
in
clientIdSet <| relayIdSet <| askRelaySchema
askPeersSchema : Air
askPeersSchema =
(fold "knownPeers" "p" <|
fold "knownPeers" "p" <|
par
(seq
(callBI "p" ( "op", "identity" ) [] Nothing)
(askAllAndSend "p")
)
(next "p")
)
askPeersScript : String -> String -> List String -> Air
askPeersScript peerId relayId peers =
@ -46,6 +48,7 @@ askPeersScript peerId relayId peers =
in
clientIdSet <| relayIdSet <| peersSet <| askPeersSchema
findAndAskNeighboursSchema : Air
findAndAskNeighboursSchema =
seq
@ -63,7 +66,9 @@ findAndAskNeighboursSchema =
)
)
(next "n")
))
)
)
findAndAskNeighboursScript : String -> String -> Air
findAndAskNeighboursScript peerId relayId =
@ -76,6 +81,7 @@ findAndAskNeighboursScript peerId relayId =
in
clientIdSet <| relayIdSet <| findAndAskNeighboursSchema
air : String -> String -> List String -> Air
air peerId relayId peers =
let
@ -88,23 +94,24 @@ air peerId relayId peers =
peersSet =
set "knownPeers" <| list string peers
askRelay = (\innerAir ->
askRelay =
\innerAir ->
par
askRelaySchema
innerAir
)
askPeers = (\innerAir ->
askPeers =
\innerAir ->
par
askPeersSchema
innerAir
)
in
clientIdSet <| relayIdSet <| peersSet <| (askRelay <| askPeers <| findAndAskNeighboursSchema)
askAllAndSend : String -> Air
askAllAndSend var =
(seq
seq
(callBI var ( "op", "identify" ) [] (Just "ident"))
(seq
(callBI var ( "dist", "get_blueprints" ) [] (Just "blueprints"))
@ -116,4 +123,3 @@ askAllAndSend var =
)
)
)
)

View File

@ -39,8 +39,7 @@ view model id =
Nothing ->
div [ classes "cf ph2-ns" ]
[
]
[]
blueprintToInfo : Model -> String -> Maybe BlueprintViewInfo

View File

@ -36,7 +36,8 @@ view model =
viewService : BlueprintInfo -> Html msg
viewService blueprint =
div [ classes "fl w-100 w-third-ns pr3 lucida" ]
[ a [ attribute "href" ("/blueprint/" ++ blueprint.id)
[ a
[ attribute "href" ("/blueprint/" ++ blueprint.id)
, classes "fl w-100 bg-white black mw6 mr3 mb3 hide-child pv3 pl4 br3 element-box ba b--white no-underline"
]
[ div [ classes "w-100 mb3 pt1 b f3 overflow-hidden" ] [ text blueprint.name ]

View File

@ -29,6 +29,7 @@ welcomeText =
[ span []
[ text "Welcome to the Fluence Developer Hub! Start building with composing existing services or explore featured modules to create your custom services. Learn more about how to build applications in "
, a [ attribute "href" "https://fluence-labs.readme.io/docs" ] [ text "Documentation" ]
--, text " and "
--, a [ attribute "href" "/" ] [ text "Tutorials" ]
, text "."

View File

@ -1,22 +1,24 @@
module Info exposing (..)
import Dict exposing (Dict)
type alias ModuleDescription =
{ site : String
, description : String
}
getSite : String -> String
getSite name =
modulesDescription |> Dict.get name |> Maybe.map .site |> Maybe.withDefault ""
getDescription : String -> String
getDescription name =
modulesDescription |> Dict.get name |> Maybe.map .description |> Maybe.withDefault "Awesome module without description"
modulesDescription : Dict String ModuleDescription
modulesDescription =
Dict.fromList

View File

@ -17,9 +17,11 @@ toInstance peerId identify blueprints service =
bp =
blueprints |> Dict.get service.blueprint_id
name = bp |> Maybe.map .name |> Maybe.withDefault "unknown"
name =
bp |> Maybe.map .name |> Maybe.withDefault "unknown"
blueprintId = bp |> Maybe.map .id |> Maybe.withDefault "#"
blueprintId =
bp |> Maybe.map .id |> Maybe.withDefault "#"
ip =
List.head identify.external_addresses

View File

@ -40,7 +40,8 @@ signatureView signature =
div [ classes "i f6 fl w-100 mv2" ]
[ text "fn "
, span [ classes "fw5" ] [ text signature.name ]
, text (interpolate "({0}) -> {1}" [ argumentsToString signature.arguments, outputToString signature.output_types ]) ]
, text (interpolate "({0}) -> {1}" [ argumentsToString signature.arguments, outputToString signature.output_types ])
]
argumentsToString : List (List String) -> String

View File

@ -42,8 +42,7 @@ view model id =
Nothing ->
div [ classes "cf ph2-ns" ]
[
]
[]
moduleToInfo : Dict String Module -> String -> Maybe ModuleViewInfo
@ -71,9 +70,14 @@ moduleToInfo modules id =
in
info
resString = String.fromChar (Char.fromCode 160)
empty = span [ ] [ text resString ]
resString =
String.fromChar (Char.fromCode 160)
empty =
span [] [ text resString ]
viewInfo : ModuleViewInfo -> Html msg
viewInfo moduleInfo =
@ -83,7 +87,12 @@ viewInfo moduleInfo =
[ span [ classes "fl w-100 black b lucida" ] [ text moduleInfo.author ] ]
, div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "WEBSITE" ]
, div [ classes "fl w-100 w-80-ns mv3 lucida" ]
[ if moduleInfo.website == "" then empty else a [ attribute "href" moduleInfo.website, classes "fl w-100 fluence-red" ] [ text moduleInfo.website ] ]
[ if moduleInfo.website == "" then
empty
else
a [ attribute "href" moduleInfo.website, classes "fl w-100 fluence-red" ] [ text moduleInfo.website ]
]
, div [ classes "fl w-100 w-20-ns gray mv3" ] [ text "DESCRIPTION" ]
, div [ classes "fl w-100 w-80-ns mv3 lucida" ]
[ span [ classes "fl w-100 black", property "innerHTML" (string "&nbsp;123") ] [ text moduleInfo.description ] ]

View File

@ -12,9 +12,9 @@ import Utils.Utils exposing (instancesText)
getModuleShortInfo : Model -> List ModuleShortInfo
getModuleShortInfo model =
getAllModules model.modules model.discoveredPeers |>
Dict.toList |>
List.map (\( _, ( moduleInfo, peers ) ) -> { moduleInfo = moduleInfo, instanceNumber = List.length peers })
getAllModules model.modules model.discoveredPeers
|> Dict.toList
|> List.map (\( _, ( moduleInfo, peers ) ) -> { moduleInfo = moduleInfo, instanceNumber = List.length peers })
getAllModules : Dict String Module -> Dict String PeerData -> Dict String ( Module, List String )
@ -62,8 +62,10 @@ view modules =
viewService : ModuleShortInfo -> Html msg
viewService moduleInfo =
div [ classes "fl w-100 w-third-ns pr3" ]
[ a [ attribute "href" ("/module/" ++ moduleInfo.moduleInfo.name),
classes "fl w-100 bg-white black mw6 mr2 mb3 hide-child pa2 element-box ba b--white pl3" ]
[ a
[ attribute "href" ("/module/" ++ moduleInfo.moduleInfo.name)
, classes "fl w-100 bg-white black mw6 mr2 mb3 hide-child pa2 element-box ba b--white pl3"
]
[ p [ classes "tl di" ]
[ div [ classes "fl b w-100 mb1 fw5 overflow-hidden" ]
[ text moduleInfo.moduleInfo.name ]

View File

@ -48,6 +48,7 @@ routeView model route =
Module moduleName ->
ModulePage.view model moduleName
getAllCmd : String -> String -> List String -> Cmd msg
getAllCmd peerId relayId knownPeers =
Cmd.batch
@ -56,6 +57,7 @@ getAllCmd peerId relayId knownPeers =
, sendAir (GetAll.findAndAskNeighboursScript peerId relayId)
]
routeCommand : Model -> Route -> Cmd msg
routeCommand m r =
case r of

View File

@ -44,13 +44,17 @@ body model =
[ div [ classes "mw8-ns center ph3" ]
[ div [ classes "fl mv1 pl3" ]
[ a [ attribute "href" "/" ]
[ img [ classes "mw-100", style "height" "30px"
[ img
[ classes "mw-100"
, style "height" "30px"
, attribute "src" "/images/logo_new.svg"
, style "position" "relative"
, style "top" "0.16rem" ] []
, style "top" "0.16rem"
]
[]
]
]
, div [ classes "fl pl5 h-auto" ] [ p [ classes "h-100 m-auto fw4" ] [ text "Developer Hub" ] ]
, div [ classes "fl pl5 h-auto" ] [ p [ classes "h-100 m-auto fw4" ] [ a [ attribute "href" "/", classes "link black" ] [ text "Developer Hub" ] ] ]
]
]
]