mirror of
https://github.com/fluencelabs/dashboard
synced 2025-03-16 13:30:48 +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 Json.Encode exposing (list, string)
|
||||
|
||||
|
||||
askRelaySchema : Air
|
||||
askRelaySchema =
|
||||
(seq
|
||||
seq
|
||||
(callBI "relayId" ( "op", "identity" ) [] Nothing)
|
||||
(askAllAndSend "relayId")
|
||||
)
|
||||
|
||||
|
||||
askRelayScript : String -> String -> Air
|
||||
askRelayScript peerId relayId =
|
||||
@ -19,18 +20,19 @@ askRelayScript peerId relayId =
|
||||
relayIdSet =
|
||||
set "relayId" <| string relayId
|
||||
in
|
||||
clientIdSet <| relayIdSet <| askRelaySchema
|
||||
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 =
|
||||
@ -44,7 +46,8 @@ askPeersScript peerId relayId peers =
|
||||
peersSet =
|
||||
set "knownPeers" <| list string peers
|
||||
in
|
||||
clientIdSet <| relayIdSet <| peersSet <| askPeersSchema
|
||||
clientIdSet <| relayIdSet <| peersSet <| askPeersSchema
|
||||
|
||||
|
||||
findAndAskNeighboursSchema : Air
|
||||
findAndAskNeighboursSchema =
|
||||
@ -63,9 +66,11 @@ findAndAskNeighboursSchema =
|
||||
)
|
||||
)
|
||||
(next "n")
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
findAndAskNeighboursScript : String -> String ->Air
|
||||
|
||||
findAndAskNeighboursScript : String -> String -> Air
|
||||
findAndAskNeighboursScript peerId relayId =
|
||||
let
|
||||
clientIdSet =
|
||||
@ -74,7 +79,8 @@ findAndAskNeighboursScript peerId relayId =
|
||||
relayIdSet =
|
||||
set "relayId" <| string relayId
|
||||
in
|
||||
clientIdSet <| relayIdSet <| findAndAskNeighboursSchema
|
||||
clientIdSet <| relayIdSet <| findAndAskNeighboursSchema
|
||||
|
||||
|
||||
air : String -> String -> List String -> Air
|
||||
air peerId relayId peers =
|
||||
@ -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 =
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -39,8 +39,7 @@ view model id =
|
||||
|
||||
Nothing ->
|
||||
div [ classes "cf ph2-ns" ]
|
||||
[
|
||||
]
|
||||
[]
|
||||
|
||||
|
||||
blueprintToInfo : Model -> String -> Maybe BlueprintViewInfo
|
||||
|
@ -36,11 +36,12 @@ 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 ]
|
||||
, div [ classes "w-100 mb4 fw4 gray-font" ] [ text "By ", span [classes "lucida-in normal"] [text blueprint.author] ]
|
||||
, div [ classes "w-100 mb4 fw4 gray-font" ] [ text "By ", span [ classes "lucida-in normal" ] [ text blueprint.author ] ]
|
||||
, div [ classes "w-100 mt1 lucida gray-font" ] [ instancesText blueprint.instanceNumber ]
|
||||
]
|
||||
]
|
||||
|
@ -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 "."
|
||||
|
26
src/Info.elm
26
src/Info.elm
@ -1,30 +1,32 @@
|
||||
module Info exposing (..)
|
||||
|
||||
|
||||
|
||||
import Dict exposing (Dict)
|
||||
|
||||
|
||||
type alias ModuleDescription =
|
||||
{ site: String
|
||||
, description: String
|
||||
{ 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
|
||||
[ ("sqlite3", { site = "https://github.com/fluencelabs/sqlite", description = "A database that ported on Wasm"})
|
||||
, ("history", { site = "https://github.com/fluencelabs/aqua-demo/tree/master/services/history", description = "Middleware that stores history (i.e. chat messages) in sqlite"})
|
||||
, ("user-list", { site = "https://github.com/fluencelabs/aqua-demo/tree/master/services/user-list", description = "Middleware that stores users with their auth (i.e. chat members) in sqlite"})
|
||||
, ("redis", { site = "https://github.com/fluencelabs/redis", description = "A database that ported on Wasm"})
|
||||
, ("curl", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/curl", description = "Module that call 'curl' command"})
|
||||
, ("facade", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/facade", description = "An API facade for Url-Downloader app"})
|
||||
, ("local_storage", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/local_storage", description = "Could be used to store data"})
|
||||
]
|
||||
[ ( "sqlite3", { site = "https://github.com/fluencelabs/sqlite", description = "A database that ported on Wasm" } )
|
||||
, ( "history", { site = "https://github.com/fluencelabs/aqua-demo/tree/master/services/history", description = "Middleware that stores history (i.e. chat messages) in sqlite" } )
|
||||
, ( "user-list", { site = "https://github.com/fluencelabs/aqua-demo/tree/master/services/user-list", description = "Middleware that stores users with their auth (i.e. chat members) in sqlite" } )
|
||||
, ( "redis", { site = "https://github.com/fluencelabs/redis", description = "A database that ported on Wasm" } )
|
||||
, ( "curl", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/curl", description = "Module that call 'curl' command" } )
|
||||
, ( "facade", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/facade", description = "An API facade for Url-Downloader app" } )
|
||||
, ( "local_storage", { site = "https://github.com/fluencelabs/fce/tree/master/examples/url-downloader/local_storage", description = "Could be used to store data" } )
|
||||
]
|
||||
|
@ -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
|
||||
@ -69,8 +71,8 @@ viewTable instances =
|
||||
viewInstance : Instance -> Html msg
|
||||
viewInstance instance =
|
||||
tr [ classes "table-red-row" ]
|
||||
[ td [ classes "ph3" ] [ p [classes "ws-normal"] [ a [ attribute "href" ("/blueprint/" ++ instance.blueprintId), classes "black" ] [text instance.name ]]]
|
||||
, td [ classes "ph3" ] [ p [classes "ws-normal"] [text instance.instance ]]
|
||||
, td [ classes "ph3 dn dtc-ns" ] [ p [classes "ws-normal"] [text (shortHashRaw 8 instance.peerId) ]]
|
||||
, td [ classes "ph3 dn dtc-ns" ] [ p [classes "ws-normal"] [text instance.ip ]]
|
||||
[ td [ classes "ph3" ] [ p [ classes "ws-normal" ] [ a [ attribute "href" ("/blueprint/" ++ instance.blueprintId), classes "black" ] [ text instance.name ] ] ]
|
||||
, td [ classes "ph3" ] [ p [ classes "ws-normal" ] [ text instance.instance ] ]
|
||||
, td [ classes "ph3 dn dtc-ns" ] [ p [ classes "ws-normal" ] [ text (shortHashRaw 8 instance.peerId) ] ]
|
||||
, td [ classes "ph3 dn dtc-ns" ] [ p [ classes "ws-normal" ] [ text instance.ip ] ]
|
||||
]
|
||||
|
@ -39,8 +39,9 @@ signatureView : Signature -> Html msg
|
||||
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 ]) ]
|
||||
, span [ classes "fw5" ] [ text signature.name ]
|
||||
, text (interpolate "({0}) -> {1}" [ argumentsToString signature.arguments, outputToString signature.output_types ])
|
||||
]
|
||||
|
||||
|
||||
argumentsToString : List (List String) -> String
|
||||
|
@ -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 " 123") ] [ text moduleInfo.description ] ]
|
||||
|
@ -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,12 +62,14 @@ 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 ]
|
||||
, div [ classes "fl w-100 mt1 lucida gray-font2" ] [ instancesText moduleInfo.instanceNumber ]
|
||||
, div [ classes "fl w-100 mt1 lucida gray-font2" ] [ instancesText moduleInfo.instanceNumber ]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
@ -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
|
||||
|
16
src/View.elm
16
src/View.elm
@ -41,16 +41,20 @@ body model =
|
||||
List.concat
|
||||
[ [ header [ classes "w-100" ]
|
||||
[ div [ classes "w-100 fl pv2 bg-white one-edge-shadow" ]
|
||||
[ div [ classes "mw8-ns center ph3"]
|
||||
[ div [ classes "mw8-ns center ph3" ]
|
||||
[ div [ classes "fl mv1 pl3" ]
|
||||
[ a [ attribute "href" "/" ]
|
||||
[ img [ classes "mw-100", style "height" "30px"
|
||||
, attribute "src" "/images/logo_new.svg"
|
||||
, style "position" "relative"
|
||||
, style "top" "0.16rem" ] []
|
||||
[ img
|
||||
[ classes "mw-100"
|
||||
, style "height" "30px"
|
||||
, attribute "src" "/images/logo_new.svg"
|
||||
, style "position" "relative"
|
||||
, 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