mirror of
https://github.com/fluencelabs/dashboard
synced 2025-05-17 01:41:21 +00:00
format
This commit is contained in:
parent
7c7768cbee
commit
aca851004a
@ -3,12 +3,13 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
askRelaySchema : Air
|
askRelaySchema : Air
|
||||||
askRelaySchema =
|
askRelaySchema =
|
||||||
(seq
|
seq
|
||||||
(callBI "relayId" ( "op", "identity" ) [] Nothing)
|
(callBI "relayId" ( "op", "identity" ) [] Nothing)
|
||||||
(askAllAndSend "relayId")
|
(askAllAndSend "relayId")
|
||||||
)
|
|
||||||
|
|
||||||
askRelayScript : String -> String -> Air
|
askRelayScript : String -> String -> Air
|
||||||
askRelayScript peerId relayId =
|
askRelayScript peerId relayId =
|
||||||
@ -21,16 +22,17 @@ askRelayScript peerId relayId =
|
|||||||
in
|
in
|
||||||
clientIdSet <| relayIdSet <| askRelaySchema
|
clientIdSet <| relayIdSet <| askRelaySchema
|
||||||
|
|
||||||
|
|
||||||
askPeersSchema : Air
|
askPeersSchema : Air
|
||||||
askPeersSchema =
|
askPeersSchema =
|
||||||
(fold "knownPeers" "p" <|
|
fold "knownPeers" "p" <|
|
||||||
par
|
par
|
||||||
(seq
|
(seq
|
||||||
(callBI "p" ( "op", "identity" ) [] Nothing)
|
(callBI "p" ( "op", "identity" ) [] Nothing)
|
||||||
(askAllAndSend "p")
|
(askAllAndSend "p")
|
||||||
)
|
)
|
||||||
(next "p")
|
(next "p")
|
||||||
)
|
|
||||||
|
|
||||||
askPeersScript : String -> String -> List String -> Air
|
askPeersScript : String -> String -> List String -> Air
|
||||||
askPeersScript peerId relayId peers =
|
askPeersScript peerId relayId peers =
|
||||||
@ -46,6 +48,7 @@ askPeersScript peerId relayId peers =
|
|||||||
in
|
in
|
||||||
clientIdSet <| relayIdSet <| peersSet <| askPeersSchema
|
clientIdSet <| relayIdSet <| peersSet <| askPeersSchema
|
||||||
|
|
||||||
|
|
||||||
findAndAskNeighboursSchema : Air
|
findAndAskNeighboursSchema : Air
|
||||||
findAndAskNeighboursSchema =
|
findAndAskNeighboursSchema =
|
||||||
seq
|
seq
|
||||||
@ -63,7 +66,9 @@ findAndAskNeighboursSchema =
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
(next "n")
|
(next "n")
|
||||||
))
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
findAndAskNeighboursScript : String -> String -> Air
|
findAndAskNeighboursScript : String -> String -> Air
|
||||||
findAndAskNeighboursScript peerId relayId =
|
findAndAskNeighboursScript peerId relayId =
|
||||||
@ -76,6 +81,7 @@ findAndAskNeighboursScript peerId relayId =
|
|||||||
in
|
in
|
||||||
clientIdSet <| relayIdSet <| findAndAskNeighboursSchema
|
clientIdSet <| relayIdSet <| findAndAskNeighboursSchema
|
||||||
|
|
||||||
|
|
||||||
air : String -> String -> List String -> Air
|
air : String -> String -> List String -> Air
|
||||||
air peerId relayId peers =
|
air peerId relayId peers =
|
||||||
let
|
let
|
||||||
@ -88,23 +94,24 @@ air peerId relayId peers =
|
|||||||
peersSet =
|
peersSet =
|
||||||
set "knownPeers" <| list string peers
|
set "knownPeers" <| list string peers
|
||||||
|
|
||||||
askRelay = (\innerAir ->
|
askRelay =
|
||||||
|
\innerAir ->
|
||||||
par
|
par
|
||||||
askRelaySchema
|
askRelaySchema
|
||||||
innerAir
|
innerAir
|
||||||
)
|
|
||||||
|
|
||||||
askPeers = (\innerAir ->
|
askPeers =
|
||||||
|
\innerAir ->
|
||||||
par
|
par
|
||||||
askPeersSchema
|
askPeersSchema
|
||||||
innerAir
|
innerAir
|
||||||
)
|
|
||||||
in
|
in
|
||||||
clientIdSet <| relayIdSet <| peersSet <| (askRelay <| askPeers <| findAndAskNeighboursSchema)
|
clientIdSet <| relayIdSet <| peersSet <| (askRelay <| askPeers <| findAndAskNeighboursSchema)
|
||||||
|
|
||||||
|
|
||||||
askAllAndSend : String -> Air
|
askAllAndSend : String -> Air
|
||||||
askAllAndSend var =
|
askAllAndSend var =
|
||||||
(seq
|
seq
|
||||||
(callBI var ( "op", "identify" ) [] (Just "ident"))
|
(callBI var ( "op", "identify" ) [] (Just "ident"))
|
||||||
(seq
|
(seq
|
||||||
(callBI var ( "dist", "get_blueprints" ) [] (Just "blueprints"))
|
(callBI var ( "dist", "get_blueprints" ) [] (Just "blueprints"))
|
||||||
@ -116,4 +123,3 @@ askAllAndSend var =
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
@ -39,8 +39,7 @@ view model id =
|
|||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
div [ classes "cf ph2-ns" ]
|
div [ classes "cf ph2-ns" ]
|
||||||
[
|
[]
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
blueprintToInfo : Model -> String -> Maybe BlueprintViewInfo
|
blueprintToInfo : Model -> String -> Maybe BlueprintViewInfo
|
||||||
|
@ -36,7 +36,8 @@ view model =
|
|||||||
viewService : BlueprintInfo -> Html msg
|
viewService : BlueprintInfo -> Html msg
|
||||||
viewService blueprint =
|
viewService blueprint =
|
||||||
div [ classes "fl w-100 w-third-ns pr3 lucida" ]
|
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"
|
, 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 ]
|
[ div [ classes "w-100 mb3 pt1 b f3 overflow-hidden" ] [ text blueprint.name ]
|
||||||
|
@ -29,6 +29,7 @@ welcomeText =
|
|||||||
[ span []
|
[ 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 "
|
[ 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" ]
|
, a [ attribute "href" "https://fluence-labs.readme.io/docs" ] [ text "Documentation" ]
|
||||||
|
|
||||||
--, text " and "
|
--, text " and "
|
||||||
--, a [ attribute "href" "/" ] [ text "Tutorials" ]
|
--, a [ attribute "href" "/" ] [ text "Tutorials" ]
|
||||||
, text "."
|
, text "."
|
||||||
|
@ -1,22 +1,24 @@
|
|||||||
module Info exposing (..)
|
module Info exposing (..)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import Dict exposing (Dict)
|
import Dict exposing (Dict)
|
||||||
|
|
||||||
|
|
||||||
type alias ModuleDescription =
|
type alias ModuleDescription =
|
||||||
{ site : String
|
{ site : String
|
||||||
, description : String
|
, description : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getSite : String -> String
|
getSite : String -> String
|
||||||
getSite name =
|
getSite name =
|
||||||
modulesDescription |> Dict.get name |> Maybe.map .site |> Maybe.withDefault ""
|
modulesDescription |> Dict.get name |> Maybe.map .site |> Maybe.withDefault ""
|
||||||
|
|
||||||
|
|
||||||
getDescription : String -> String
|
getDescription : String -> String
|
||||||
getDescription name =
|
getDescription name =
|
||||||
modulesDescription |> Dict.get name |> Maybe.map .description |> Maybe.withDefault "Awesome module without description"
|
modulesDescription |> Dict.get name |> Maybe.map .description |> Maybe.withDefault "Awesome module without description"
|
||||||
|
|
||||||
|
|
||||||
modulesDescription : Dict String ModuleDescription
|
modulesDescription : Dict String ModuleDescription
|
||||||
modulesDescription =
|
modulesDescription =
|
||||||
Dict.fromList
|
Dict.fromList
|
||||||
|
@ -17,9 +17,11 @@ toInstance peerId identify blueprints service =
|
|||||||
bp =
|
bp =
|
||||||
blueprints |> Dict.get service.blueprint_id
|
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 =
|
ip =
|
||||||
List.head identify.external_addresses
|
List.head identify.external_addresses
|
||||||
|
@ -40,7 +40,8 @@ signatureView signature =
|
|||||||
div [ classes "i f6 fl w-100 mv2" ]
|
div [ classes "i f6 fl w-100 mv2" ]
|
||||||
[ text "fn "
|
[ text "fn "
|
||||||
, span [ classes "fw5" ] [ text signature.name ]
|
, 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
|
argumentsToString : List (List String) -> String
|
||||||
|
@ -42,8 +42,7 @@ view model id =
|
|||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
div [ classes "cf ph2-ns" ]
|
div [ classes "cf ph2-ns" ]
|
||||||
[
|
[]
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
moduleToInfo : Dict String Module -> String -> Maybe ModuleViewInfo
|
moduleToInfo : Dict String Module -> String -> Maybe ModuleViewInfo
|
||||||
@ -71,9 +70,14 @@ moduleToInfo modules id =
|
|||||||
in
|
in
|
||||||
info
|
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 : ModuleViewInfo -> Html msg
|
||||||
viewInfo moduleInfo =
|
viewInfo moduleInfo =
|
||||||
@ -83,7 +87,12 @@ viewInfo moduleInfo =
|
|||||||
[ span [ classes "fl w-100 black b lucida" ] [ text moduleInfo.author ] ]
|
[ 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-20-ns gray mv3" ] [ text "WEBSITE" ]
|
||||||
, div [ classes "fl w-100 w-80-ns mv3 lucida" ]
|
, 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-20-ns gray mv3" ] [ text "DESCRIPTION" ]
|
||||||
, div [ classes "fl w-100 w-80-ns mv3 lucida" ]
|
, div [ classes "fl w-100 w-80-ns mv3 lucida" ]
|
||||||
[ span [ classes "fl w-100 black", property "innerHTML" (string " 123") ] [ text moduleInfo.description ] ]
|
[ span [ classes "fl w-100 black", property "innerHTML" (string " 123") ] [ text moduleInfo.description ] ]
|
||||||
|
@ -12,9 +12,9 @@ import Utils.Utils exposing (instancesText)
|
|||||||
|
|
||||||
getModuleShortInfo : Model -> List ModuleShortInfo
|
getModuleShortInfo : Model -> List ModuleShortInfo
|
||||||
getModuleShortInfo model =
|
getModuleShortInfo model =
|
||||||
getAllModules model.modules model.discoveredPeers |>
|
getAllModules model.modules model.discoveredPeers
|
||||||
Dict.toList |>
|
|> Dict.toList
|
||||||
List.map (\( _, ( moduleInfo, peers ) ) -> { moduleInfo = moduleInfo, instanceNumber = List.length peers })
|
|> List.map (\( _, ( moduleInfo, peers ) ) -> { moduleInfo = moduleInfo, instanceNumber = List.length peers })
|
||||||
|
|
||||||
|
|
||||||
getAllModules : Dict String Module -> Dict String PeerData -> Dict String ( Module, List String )
|
getAllModules : Dict String Module -> Dict String PeerData -> Dict String ( Module, List String )
|
||||||
@ -62,8 +62,10 @@ view modules =
|
|||||||
viewService : ModuleShortInfo -> Html msg
|
viewService : ModuleShortInfo -> Html msg
|
||||||
viewService moduleInfo =
|
viewService moduleInfo =
|
||||||
div [ classes "fl w-100 w-third-ns pr3" ]
|
div [ classes "fl w-100 w-third-ns pr3" ]
|
||||||
[ a [ attribute "href" ("/module/" ++ moduleInfo.moduleInfo.name),
|
[ a
|
||||||
classes "fl w-100 bg-white black mw6 mr2 mb3 hide-child pa2 element-box ba b--white pl3" ]
|
[ 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" ]
|
[ p [ classes "tl di" ]
|
||||||
[ div [ classes "fl b w-100 mb1 fw5 overflow-hidden" ]
|
[ div [ classes "fl b w-100 mb1 fw5 overflow-hidden" ]
|
||||||
[ text moduleInfo.moduleInfo.name ]
|
[ text moduleInfo.moduleInfo.name ]
|
||||||
|
@ -48,6 +48,7 @@ routeView model route =
|
|||||||
Module moduleName ->
|
Module moduleName ->
|
||||||
ModulePage.view model moduleName
|
ModulePage.view model moduleName
|
||||||
|
|
||||||
|
|
||||||
getAllCmd : String -> String -> List String -> Cmd msg
|
getAllCmd : String -> String -> List String -> Cmd msg
|
||||||
getAllCmd peerId relayId knownPeers =
|
getAllCmd peerId relayId knownPeers =
|
||||||
Cmd.batch
|
Cmd.batch
|
||||||
@ -56,6 +57,7 @@ getAllCmd peerId relayId knownPeers =
|
|||||||
, sendAir (GetAll.findAndAskNeighboursScript peerId relayId)
|
, sendAir (GetAll.findAndAskNeighboursScript peerId relayId)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
routeCommand : Model -> Route -> Cmd msg
|
routeCommand : Model -> Route -> Cmd msg
|
||||||
routeCommand m r =
|
routeCommand m r =
|
||||||
case r of
|
case r of
|
||||||
|
10
src/View.elm
10
src/View.elm
@ -44,13 +44,17 @@ body model =
|
|||||||
[ div [ classes "mw8-ns center ph3" ]
|
[ div [ classes "mw8-ns center ph3" ]
|
||||||
[ div [ classes "fl mv1 pl3" ]
|
[ div [ classes "fl mv1 pl3" ]
|
||||||
[ a [ attribute "href" "/" ]
|
[ a [ attribute "href" "/" ]
|
||||||
[ img [ classes "mw-100", style "height" "30px"
|
[ img
|
||||||
|
[ classes "mw-100"
|
||||||
|
, style "height" "30px"
|
||||||
, attribute "src" "/images/logo_new.svg"
|
, attribute "src" "/images/logo_new.svg"
|
||||||
, style "position" "relative"
|
, 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" ] ] ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user