diff --git a/src/AirScripts/GetAll.elm b/src/AirScripts/GetAll.elm index d0863a4..21f5aab 100644 --- a/src/AirScripts/GetAll.elm +++ b/src/AirScripts/GetAll.elm @@ -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 = ) ) ) - ) diff --git a/src/BlueprintPage/View.elm b/src/BlueprintPage/View.elm index 36880e7..995678b 100644 --- a/src/BlueprintPage/View.elm +++ b/src/BlueprintPage/View.elm @@ -39,8 +39,7 @@ view model id = Nothing -> div [ classes "cf ph2-ns" ] - [ - ] + [] blueprintToInfo : Model -> String -> Maybe BlueprintViewInfo diff --git a/src/Blueprints/View.elm b/src/Blueprints/View.elm index bae269e..624355c 100644 --- a/src/Blueprints/View.elm +++ b/src/Blueprints/View.elm @@ -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 ] ] ] diff --git a/src/HubPage/View.elm b/src/HubPage/View.elm index ee76ee5..eacee4d 100644 --- a/src/HubPage/View.elm +++ b/src/HubPage/View.elm @@ -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 "." diff --git a/src/Info.elm b/src/Info.elm index c1d9d75..e2646b9 100644 --- a/src/Info.elm +++ b/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"}) - ] \ No newline at end of file + [ ( "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" } ) + ] diff --git a/src/Instances/View.elm b/src/Instances/View.elm index ce8f2e8..9939560 100644 --- a/src/Instances/View.elm +++ b/src/Instances/View.elm @@ -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 ] ] ] diff --git a/src/Interface/View.elm b/src/Interface/View.elm index 0b28d3b..c61c906 100644 --- a/src/Interface/View.elm +++ b/src/Interface/View.elm @@ -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 diff --git a/src/ModulePage/View.elm b/src/ModulePage/View.elm index a76f90b..a8b88d8 100644 --- a/src/ModulePage/View.elm +++ b/src/ModulePage/View.elm @@ -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 ] ] diff --git a/src/Modules/View.elm b/src/Modules/View.elm index a4df706..755e53c 100644 --- a/src/Modules/View.elm +++ b/src/Modules/View.elm @@ -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 ] ] ] ] diff --git a/src/Route.elm b/src/Route.elm index 5287270..d5a4dab 100644 --- a/src/Route.elm +++ b/src/Route.elm @@ -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 diff --git a/src/View.elm b/src/View.elm index 3e63713..f75d75f 100644 --- a/src/View.elm +++ b/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" ] ] ] ] ] ]