mirror of
https://github.com/fluencelabs/dashboard
synced 2025-06-30 15:11:39 +00:00
blueprint page, link to blueprint
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<link rel="favicon" type="image/ico" href="favicon.ico" />
|
<link rel="favicon" type="image/ico" href="favicon.ico" />
|
||||||
|
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
16
src/BlueprintPage/Model.elm
Normal file
16
src/BlueprintPage/Model.elm
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
module BlueprintPage.Model exposing (..)
|
||||||
|
|
||||||
|
import Blueprints.Model exposing (Blueprint)
|
||||||
|
import Modules.Model exposing (Module)
|
||||||
|
|
||||||
|
|
||||||
|
type alias BlueprintViewInfo =
|
||||||
|
{ name : String
|
||||||
|
, id : String
|
||||||
|
, author : String
|
||||||
|
, authorPeerId : String
|
||||||
|
, description : String
|
||||||
|
, website : String
|
||||||
|
, blueprint : Blueprint
|
||||||
|
, modules : List Module
|
||||||
|
}
|
73
src/BlueprintPage/View.elm
Normal file
73
src/BlueprintPage/View.elm
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
module BlueprintPage.View exposing (..)
|
||||||
|
|
||||||
|
import BlueprintPage.Model exposing (BlueprintViewInfo)
|
||||||
|
import Blueprints.Model exposing (Blueprint)
|
||||||
|
import Dict exposing (Dict)
|
||||||
|
import Html exposing (Html, article, div, span, text)
|
||||||
|
import Interface.View exposing (instanceView)
|
||||||
|
import Model exposing (Model)
|
||||||
|
import Modules.Model exposing (Module)
|
||||||
|
import Palette exposing (classes)
|
||||||
|
import Service.Model exposing (Interface)
|
||||||
|
|
||||||
|
|
||||||
|
view : Model -> String -> Html msg
|
||||||
|
view model id =
|
||||||
|
let
|
||||||
|
blueprintInfo =
|
||||||
|
blueprintToInfo model id
|
||||||
|
in
|
||||||
|
case blueprintInfo of
|
||||||
|
Just mi ->
|
||||||
|
div [ classes "cf ph2-ns" ]
|
||||||
|
[ span [ classes "fl w-100 f1 lh-title dark-red" ] [ text ("Blueprint: " ++ mi.name) ]
|
||||||
|
, span [ classes "fl w-100 light-red" ] [ text mi.id ]
|
||||||
|
, viewInfo mi
|
||||||
|
]
|
||||||
|
|
||||||
|
Nothing ->
|
||||||
|
div [ classes "cf ph2-ns" ]
|
||||||
|
[ span [ classes "fl w-100 f1 lh-title dark-red" ] [ text "Module not found" ]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
blueprintToInfo : Model -> String -> Maybe BlueprintViewInfo
|
||||||
|
blueprintToInfo model id =
|
||||||
|
case (Dict.get id model.blueprints) of
|
||||||
|
Just bp ->
|
||||||
|
let
|
||||||
|
modules = bp.dependencies |> List.map (\d -> Dict.get d model.modules) |> List.filterMap identity
|
||||||
|
in
|
||||||
|
Just { name = bp.name
|
||||||
|
, id = id
|
||||||
|
, author = "Fluence Labs"
|
||||||
|
, authorPeerId = "fluence_labs_peer_id"
|
||||||
|
, description = "Excelent blueprint"
|
||||||
|
, website = "https://github.com/fluencelabs/"
|
||||||
|
, blueprint = bp
|
||||||
|
, modules = modules
|
||||||
|
}
|
||||||
|
|
||||||
|
Nothing ->
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
viewInfo : BlueprintViewInfo -> Html msg
|
||||||
|
viewInfo blueprintInfo =
|
||||||
|
article [ classes "cf" ]
|
||||||
|
[ div [ classes "fl w-30 gray mv1" ] [ text "AUTHOR" ]
|
||||||
|
, div [ classes "fl w-70 mv1" ] [ span [ classes "fl w-100 black b" ] [ text blueprintInfo.author ], span [ classes "fl w-100 black" ] [ text blueprintInfo.authorPeerId ] ]
|
||||||
|
, div [ classes "fl w-30 gray mv1" ] [ text "DESCRIPTION" ]
|
||||||
|
, div [ classes "fl w-70 mv1" ] [ span [ classes "fl w-100 black" ] [ text blueprintInfo.description ] ]
|
||||||
|
, div [ classes "fl w-30 gray mv1" ] [ text "INTERFACE" ]
|
||||||
|
, div [ classes "fl w-70 mv1" ] (blueprintInfo.modules |> List.map (\m -> viewToggledInterface True m.name m.interface))
|
||||||
|
]
|
||||||
|
|
||||||
|
viewToggledInterface : Bool -> String -> Interface -> Html msg
|
||||||
|
viewToggledInterface isOpen name interface =
|
||||||
|
div []
|
||||||
|
([ text name
|
||||||
|
] ++
|
||||||
|
instanceView interface)
|
||||||
|
|
@ -6,3 +6,11 @@ type alias Blueprint =
|
|||||||
, id : String
|
, id : String
|
||||||
, name : String
|
, name : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
type alias BlueprintInfo =
|
||||||
|
{ name : String
|
||||||
|
, author : String
|
||||||
|
, instanceNumber : Int
|
||||||
|
, id: String
|
||||||
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
module Services.View exposing (..)
|
module Blueprints.View exposing (..)
|
||||||
|
|
||||||
import Blueprints.Model exposing (Blueprint)
|
import Blueprints.Model exposing (Blueprint, BlueprintInfo)
|
||||||
import Dict exposing (Dict)
|
import Dict exposing (Dict)
|
||||||
import Html exposing (Html, div, text)
|
import Html exposing (Html, a, div, text)
|
||||||
import Html.Attributes exposing (attribute)
|
import Html.Attributes exposing (attribute)
|
||||||
import Model exposing (Model, PeerData)
|
import Model exposing (Model, PeerData)
|
||||||
import Palette exposing (classes)
|
import Palette exposing (classes)
|
||||||
import Services.Model exposing (Service, ServiceInfo)
|
import Service.Model exposing (Service)
|
||||||
import Utils.Utils exposing (instancesText)
|
import Utils.Utils exposing (instancesText)
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,13 @@ view model =
|
|||||||
getBlueprintsToServices model.blueprints model.discoveredPeers
|
getBlueprintsToServices model.blueprints model.discoveredPeers
|
||||||
|
|
||||||
info =
|
info =
|
||||||
Dict.values allBps |> List.map (\( bp, servicesByPeers ) -> { name = bp.name, author = "Fluence Labs", instanceNumber = List.length (servicesByPeers |> List.map (\( _, s ) -> s) |> List.concat) })
|
Dict.values allBps |> List.map (\( bp, servicesByPeers ) ->
|
||||||
|
{ name = bp.name
|
||||||
|
, id = bp.id
|
||||||
|
, author = "Fluence Labs"
|
||||||
|
, instanceNumber = List.length (servicesByPeers |> List.map (\( _, s ) -> s) |> List.concat)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
servicesView =
|
servicesView =
|
||||||
List.map viewService info
|
List.map viewService info
|
||||||
@ -25,13 +31,13 @@ view model =
|
|||||||
div [ classes "cf ph1-ns" ] servicesView
|
div [ classes "cf ph1-ns" ] servicesView
|
||||||
|
|
||||||
|
|
||||||
viewService : ServiceInfo -> Html msg
|
viewService : BlueprintInfo -> Html msg
|
||||||
viewService service =
|
viewService blueprint =
|
||||||
div [ classes "fl w-third-ns pa2" ]
|
div [ classes "fl w-third-ns pa2" ]
|
||||||
[ div [ attribute "href" "#", classes "fl w-100 link dim black mw5 dt hide-child ba b-black pa4 br2 solid" ]
|
[ a [ attribute "href" ("/blueprint/" ++ blueprint.id), classes "fl w-100 link dim black mw5 dt hide-child ba b-black pa4 br2 solid" ]
|
||||||
[ div [ classes "w-100 mb2 b" ] [ text service.name ]
|
[ div [ classes "w-100 mb2 b" ] [ text blueprint.name ]
|
||||||
, div [ classes "w-100 mb4" ] [ text ("By " ++ service.author) ]
|
, div [ classes "w-100 mb4" ] [ text ("By " ++ blueprint.author) ]
|
||||||
, div [ classes "w-100" ] [ instancesText service.instanceNumber ]
|
, div [ classes "w-100" ] [ instancesText blueprint.instanceNumber ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
module HubPage.View exposing (..)
|
module HubPage.View exposing (..)
|
||||||
|
|
||||||
|
import Blueprints.View
|
||||||
import Html exposing (Html, a, div, h1, h3, span, text)
|
import Html exposing (Html, a, div, h1, h3, span, text)
|
||||||
import Html.Attributes exposing (attribute)
|
import Html.Attributes exposing (attribute)
|
||||||
import Instances.View
|
import Instances.View
|
||||||
import Model exposing (Model)
|
import Model exposing (Model)
|
||||||
import Modules.View
|
import Modules.View
|
||||||
import Palette exposing (classes, redFont)
|
import Palette exposing (classes, redFont)
|
||||||
import Services.View
|
|
||||||
|
|
||||||
|
|
||||||
view : Model -> Html msg
|
view : Model -> Html msg
|
||||||
@ -14,8 +14,8 @@ view model =
|
|||||||
div []
|
div []
|
||||||
[ h1 [ redFont ] [ text "Developer Hub" ]
|
[ h1 [ redFont ] [ text "Developer Hub" ]
|
||||||
, welcomeText
|
, welcomeText
|
||||||
, h3 [] [ text "Featured Services" ]
|
, h3 [] [ text "Featured Blueprints" ]
|
||||||
, Services.View.view model
|
, Blueprints.View.view model
|
||||||
, h3 [] [ text "Featured Modules" ]
|
, h3 [] [ text "Featured Modules" ]
|
||||||
, Modules.View.view model
|
, Modules.View.view model
|
||||||
, h3 [] [ text "Service Instances" ]
|
, h3 [] [ text "Service Instances" ]
|
||||||
|
@ -2,13 +2,13 @@ module Instances.View exposing (..)
|
|||||||
|
|
||||||
import Blueprints.Model exposing (Blueprint)
|
import Blueprints.Model exposing (Blueprint)
|
||||||
import Dict exposing (Dict)
|
import Dict exposing (Dict)
|
||||||
import Html exposing (Html, a, div, table, tbody, td, text, th, thead, tr)
|
import Html exposing (Html, div, table, tbody, td, text, th, thead, tr)
|
||||||
import Html.Attributes exposing (attribute)
|
import Html.Attributes exposing (attribute)
|
||||||
import Instances.Model exposing (Instance)
|
import Instances.Model exposing (Instance)
|
||||||
import Model exposing (Model)
|
import Model exposing (Model)
|
||||||
import Nodes.Model exposing (Identify)
|
import Nodes.Model exposing (Identify)
|
||||||
import Palette exposing (classes)
|
import Palette exposing (classes)
|
||||||
import Services.Model exposing (Service)
|
import Service.Model exposing (Service)
|
||||||
|
|
||||||
|
|
||||||
toInstance : String -> Identify -> Dict String Blueprint -> Service -> Instance
|
toInstance : String -> Identify -> Dict String Blueprint -> Service -> Instance
|
||||||
@ -41,8 +41,8 @@ view model =
|
|||||||
viewTable : List Instance -> Html msg
|
viewTable : List Instance -> Html msg
|
||||||
viewTable instances =
|
viewTable instances =
|
||||||
div [ classes "pa1" ]
|
div [ classes "pa1" ]
|
||||||
[ div [ classes "" ]
|
[ div [ classes "mw8" ]
|
||||||
[ table [ classes "f6 w-100 mw8 center", attribute "cellspacing" "0" ]
|
[ table [ classes "f6 w-100 center", attribute "cellspacing" "0" ]
|
||||||
[ thead []
|
[ thead []
|
||||||
[ tr [ classes "stripe-dark" ]
|
[ tr [ classes "stripe-dark" ]
|
||||||
[ th [ classes "fw6 tl pa3 bg-white" ] [ text "SERVICE" ]
|
[ th [ classes "fw6 tl pa3 bg-white" ] [ text "SERVICE" ]
|
||||||
@ -61,7 +61,7 @@ viewInstance : Instance -> Html msg
|
|||||||
viewInstance instance =
|
viewInstance instance =
|
||||||
tr [ classes "stripe-dark" ]
|
tr [ classes "stripe-dark" ]
|
||||||
[ td [ classes "pa3" ] [ text instance.name ]
|
[ td [ classes "pa3" ] [ text instance.name ]
|
||||||
, td [] [ a [ attribute "href" ("/service/" ++ instance.instance), classes "pa3 link dim hide-child" ] [ text instance.instance ] ]
|
, td [ classes "pa3" ] [ text instance.instance ]
|
||||||
, td [ classes "pa3" ] [ text instance.peerId ]
|
, td [ classes "pa3" ] [ text instance.peerId ]
|
||||||
, td [ classes "pa3" ] [ text instance.ip ]
|
, td [ classes "pa3" ] [ text instance.ip ]
|
||||||
]
|
]
|
||||||
|
51
src/Interface/View.elm
Normal file
51
src/Interface/View.elm
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
module Interface.View exposing (..)
|
||||||
|
|
||||||
|
import Html exposing (Html, div, span, text)
|
||||||
|
import Palette exposing (classes)
|
||||||
|
import Service.Model exposing (Interface, Record, Signature)
|
||||||
|
import String.Interpolate exposing (interpolate)
|
||||||
|
|
||||||
|
|
||||||
|
instanceView : Interface -> List (Html msg)
|
||||||
|
instanceView interface =
|
||||||
|
recordsView interface.record_types ++ signaturesView interface.function_signatures
|
||||||
|
|
||||||
|
|
||||||
|
recordsView : List Record -> List (Html msg)
|
||||||
|
recordsView record =
|
||||||
|
record |> List.sortBy .name |> List.map recordView
|
||||||
|
|
||||||
|
|
||||||
|
recordView : Record -> Html msg
|
||||||
|
recordView record =
|
||||||
|
div [ classes "i" ]
|
||||||
|
([ span [ classes "fl w-100 mt2" ] [ text (record.name ++ " {") ] ]
|
||||||
|
++ fieldsView record.fields
|
||||||
|
++ [ span [ classes "fl w-100 mb2" ] [ text "}" ] ]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
fieldsView : List (List String) -> List (Html msg)
|
||||||
|
fieldsView fields =
|
||||||
|
fields |> List.map (\f -> span [ classes "fl w-100 ml2" ] [ text (String.join ": " f) ])
|
||||||
|
|
||||||
|
|
||||||
|
signaturesView : List Signature -> List (Html msg)
|
||||||
|
signaturesView signatures =
|
||||||
|
signatures |> List.sortBy .name |> List.map signatureView
|
||||||
|
|
||||||
|
|
||||||
|
signatureView : Signature -> Html msg
|
||||||
|
signatureView signature =
|
||||||
|
div [ classes "i fl w-100 mv2" ]
|
||||||
|
[ text (interpolate "fn {0}({1}) -> {2}" [ signature.name, argumentsToString signature.arguments, outputToString signature.output_types ]) ]
|
||||||
|
|
||||||
|
|
||||||
|
argumentsToString : List (List String) -> String
|
||||||
|
argumentsToString arguments =
|
||||||
|
String.join ", " (arguments |> List.map (String.join ": "))
|
||||||
|
|
||||||
|
|
||||||
|
outputToString : List String -> String
|
||||||
|
outputToString output =
|
||||||
|
output |> List.head |> Maybe.withDefault "void"
|
@ -26,8 +26,6 @@ import Route
|
|||||||
import Subscriptions exposing (subscriptions)
|
import Subscriptions exposing (subscriptions)
|
||||||
import Update exposing (update)
|
import Update exposing (update)
|
||||||
import Url
|
import Url
|
||||||
import Url.Parser
|
|
||||||
import Utils.TaskExtras exposing (run)
|
|
||||||
import View exposing (view)
|
import View exposing (view)
|
||||||
|
|
||||||
|
|
||||||
@ -57,6 +55,7 @@ init flags url key =
|
|||||||
, discoveredPeers = Dict.empty
|
, discoveredPeers = Dict.empty
|
||||||
, modules = Dict.empty
|
, modules = Dict.empty
|
||||||
, blueprints = Dict.empty
|
, blueprints = Dict.empty
|
||||||
|
, toggledInterface = Nothing
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
( emptyModel, Route.routeCommand emptyModel r )
|
( emptyModel, Route.routeCommand emptyModel r )
|
||||||
|
@ -21,13 +21,13 @@ import Browser.Navigation as Nav
|
|||||||
import Dict exposing (Dict)
|
import Dict exposing (Dict)
|
||||||
import Modules.Model exposing (Module)
|
import Modules.Model exposing (Module)
|
||||||
import Nodes.Model exposing (Identify, emptyIdentify)
|
import Nodes.Model exposing (Identify, emptyIdentify)
|
||||||
import Services.Model exposing (Service)
|
import Service.Model exposing (Service)
|
||||||
import Url
|
import Url
|
||||||
|
|
||||||
|
|
||||||
type Route
|
type Route
|
||||||
= Page String
|
= Page String
|
||||||
| Service String
|
| Blueprint String
|
||||||
| Module String
|
| Module String
|
||||||
| Peer String
|
| Peer String
|
||||||
|
|
||||||
@ -54,4 +54,5 @@ type alias Model =
|
|||||||
, discoveredPeers : Dict String PeerData
|
, discoveredPeers : Dict String PeerData
|
||||||
, modules : Dict String Module
|
, modules : Dict String Module
|
||||||
, blueprints : Dict String Blueprint
|
, blueprints : Dict String Blueprint
|
||||||
|
, toggledInterface : Maybe String
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,11 @@ module ModulePage.View exposing (..)
|
|||||||
|
|
||||||
import Dict exposing (Dict)
|
import Dict exposing (Dict)
|
||||||
import Html exposing (Html, article, div, span, text)
|
import Html exposing (Html, article, div, span, text)
|
||||||
|
import Interface.View exposing (instanceView)
|
||||||
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)
|
||||||
import Services.Model exposing (Record, Signature)
|
|
||||||
import String.Interpolate exposing (interpolate)
|
|
||||||
|
|
||||||
|
|
||||||
view : Model -> String -> Html msg
|
view : Model -> String -> Html msg
|
||||||
@ -64,45 +63,5 @@ viewInfo moduleInfo =
|
|||||||
, div [ classes "fl w-30 gray mv1" ] [ text "DESCRIPTION" ]
|
, div [ classes "fl w-30 gray mv1" ] [ text "DESCRIPTION" ]
|
||||||
, div [ classes "fl w-70 mv1" ] [ span [ classes "fl w-100 black" ] [ text moduleInfo.description ] ]
|
, div [ classes "fl w-70 mv1" ] [ span [ classes "fl w-100 black" ] [ text moduleInfo.description ] ]
|
||||||
, div [ classes "fl w-30 gray mv1" ] [ text "INTERFACE" ]
|
, div [ classes "fl w-30 gray mv1" ] [ text "INTERFACE" ]
|
||||||
, div [ classes "fl w-70 mv1" ] [ span [ classes "fl w-100 black" ] (recordsView moduleInfo.moduleInfo.interface.record_types ++ signaturesView moduleInfo.moduleInfo.interface.function_signatures) ]
|
, div [ classes "fl w-70 mv1" ] [ span [ classes "fl w-100 black" ] (instanceView moduleInfo.moduleInfo.interface) ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
recordsView : List Record -> List (Html msg)
|
|
||||||
recordsView record =
|
|
||||||
record |> List.sortBy .name |> List.map recordView
|
|
||||||
|
|
||||||
|
|
||||||
recordView : Record -> Html msg
|
|
||||||
recordView record =
|
|
||||||
div [ classes "i" ]
|
|
||||||
([ span [ classes "fl w-100 mt2" ] [ text (record.name ++ " {") ] ]
|
|
||||||
++ fieldsView record.fields
|
|
||||||
++ [ span [ classes "fl w-100 mb2" ] [ text "}" ] ]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
fieldsView : List (List String) -> List (Html msg)
|
|
||||||
fieldsView fields =
|
|
||||||
fields |> List.map (\f -> span [ classes "fl w-100 ml2" ] [ text (String.join ": " f) ])
|
|
||||||
|
|
||||||
|
|
||||||
signaturesView : List Signature -> List (Html msg)
|
|
||||||
signaturesView signatures =
|
|
||||||
signatures |> List.sortBy .name |> List.map signatureView
|
|
||||||
|
|
||||||
|
|
||||||
signatureView : Signature -> Html msg
|
|
||||||
signatureView signature =
|
|
||||||
div [ classes "i fl w-100 mv2" ]
|
|
||||||
[ text (interpolate "fn {0}({1}) -> {2}" [ signature.name, argumentsToString signature.arguments, outputToString signature.output_types ]) ]
|
|
||||||
|
|
||||||
|
|
||||||
argumentsToString : List (List String) -> String
|
|
||||||
argumentsToString arguments =
|
|
||||||
String.join ", " (arguments |> List.map (String.join ": "))
|
|
||||||
|
|
||||||
|
|
||||||
outputToString : List String -> String
|
|
||||||
outputToString output =
|
|
||||||
output |> List.head |> Maybe.withDefault "void"
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Modules.Model exposing (..)
|
module Modules.Model exposing (..)
|
||||||
|
|
||||||
import Services.Model exposing (Interface)
|
import Service.Model exposing (Interface)
|
||||||
|
|
||||||
|
|
||||||
type alias Module =
|
type alias Module =
|
||||||
|
@ -11,4 +11,4 @@ type Msg
|
|||||||
| LinkClicked UrlRequest
|
| LinkClicked UrlRequest
|
||||||
| AquamarineEvent Port.ReceiveEvent
|
| AquamarineEvent Port.ReceiveEvent
|
||||||
| RelayChanged String
|
| RelayChanged String
|
||||||
| Click String
|
| ToggleInterface String
|
||||||
|
@ -6,7 +6,7 @@ import Dict exposing (Dict)
|
|||||||
import Json.Encode exposing (Value)
|
import Json.Encode exposing (Value)
|
||||||
import Modules.Model exposing (Module)
|
import Modules.Model exposing (Module)
|
||||||
import Nodes.Model exposing (Identify)
|
import Nodes.Model exposing (Identify)
|
||||||
import Services.Model exposing (Service)
|
import Service.Model exposing (Service)
|
||||||
|
|
||||||
|
|
||||||
type alias SendParticle =
|
type alias SendParticle =
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
module Route exposing (..)
|
module Route exposing (..)
|
||||||
|
|
||||||
import AirScripts.DiscoverPeers as DiscoverPeers
|
import AirScripts.DiscoverPeers as DiscoverPeers
|
||||||
|
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
|
||||||
import Model exposing (Model, Route(..))
|
import Model exposing (Model, Route(..))
|
||||||
@ -14,7 +15,7 @@ routeParser =
|
|||||||
oneOf
|
oneOf
|
||||||
[ map Peer (s "peer" </> string)
|
[ map Peer (s "peer" </> string)
|
||||||
, map Module (s "module" </> string)
|
, map Module (s "module" </> string)
|
||||||
, map Service (s "service" </> string)
|
, map Blueprint (s "blueprint" </> string)
|
||||||
, map Page string
|
, map Page string
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -44,14 +45,13 @@ routeView model route =
|
|||||||
Peer peer ->
|
Peer peer ->
|
||||||
text peer
|
text peer
|
||||||
|
|
||||||
Service serviceId ->
|
Blueprint id ->
|
||||||
text serviceId
|
BlueprintPage.view model id
|
||||||
|
|
||||||
Module moduleName ->
|
Module moduleName ->
|
||||||
ModulePage.view model moduleName
|
ModulePage.view model moduleName
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
routeCommand : Model -> Route -> Cmd msg
|
routeCommand : Model -> Route -> Cmd msg
|
||||||
routeCommand m r =
|
routeCommand m r =
|
||||||
case r of
|
case r of
|
||||||
@ -61,7 +61,7 @@ routeCommand m r =
|
|||||||
Peer _ ->
|
Peer _ ->
|
||||||
sendAir (DiscoverPeers.air m.peerId m.relayId)
|
sendAir (DiscoverPeers.air m.peerId m.relayId)
|
||||||
|
|
||||||
Service string ->
|
Blueprint string ->
|
||||||
sendAir (DiscoverPeers.air m.peerId m.relayId)
|
sendAir (DiscoverPeers.air m.peerId m.relayId)
|
||||||
|
|
||||||
Module string ->
|
Module string ->
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Services.Air exposing (..)
|
module Service.Air exposing (..)
|
||||||
|
|
||||||
import Air exposing (Air)
|
import Air exposing (Air)
|
||||||
import AirScripts.CallPeers
|
import AirScripts.CallPeers
|
@ -1,4 +1,4 @@
|
|||||||
module Services.Model exposing (..)
|
module Service.Model exposing (..)
|
||||||
|
|
||||||
|
|
||||||
type alias Signature =
|
type alias Signature =
|
||||||
@ -26,10 +26,3 @@ type alias Service =
|
|||||||
, blueprint_id : String
|
, blueprint_id : String
|
||||||
, interface : Interface
|
, interface : Interface
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type alias ServiceInfo =
|
|
||||||
{ name : String
|
|
||||||
, author : String
|
|
||||||
, instanceNumber : Int
|
|
||||||
}
|
|
@ -28,7 +28,7 @@ import Msg exposing (..)
|
|||||||
import Nodes.Model exposing (Identify)
|
import Nodes.Model exposing (Identify)
|
||||||
import Port exposing (sendAir)
|
import Port exposing (sendAir)
|
||||||
import Route
|
import Route
|
||||||
import Services.Model exposing (Service)
|
import Service.Model exposing (Service)
|
||||||
import Url
|
import Url
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ update msg model =
|
|||||||
cmd =
|
cmd =
|
||||||
Route.routeCommand model route
|
Route.routeCommand model route
|
||||||
in
|
in
|
||||||
( { model | url = url, page = route }, cmd )
|
( { model | url = url, page = route, toggledInterface = Nothing }, cmd )
|
||||||
|
|
||||||
LinkClicked urlRequest ->
|
LinkClicked urlRequest ->
|
||||||
case urlRequest of
|
case urlRequest of
|
||||||
@ -93,15 +93,8 @@ update msg model =
|
|||||||
in
|
in
|
||||||
( model, Cmd.none )
|
( model, Cmd.none )
|
||||||
|
|
||||||
Click command ->
|
ToggleInterface id ->
|
||||||
case command of
|
( { model | toggledInterface = Just id }, Cmd.none )
|
||||||
"get_all" ->
|
|
||||||
( model
|
|
||||||
, sendAir (AirScripts.GetAll.air model.peerId model.relayId (Dict.keys model.discoveredPeers))
|
|
||||||
)
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
( model, Cmd.none )
|
|
||||||
|
|
||||||
RelayChanged relayId ->
|
RelayChanged relayId ->
|
||||||
( { model | relayId = relayId }, Cmd.none )
|
( { model | relayId = relayId }, Cmd.none )
|
||||||
|
@ -17,8 +17,8 @@ limitations under the License.
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
import Browser exposing (Document, UrlRequest(..))
|
import Browser exposing (Document, UrlRequest(..))
|
||||||
import Html exposing (Html, div, header, text)
|
import Html exposing (Html, div, header)
|
||||||
import Html.Events exposing (onClick)
|
import Html.Attributes exposing (style)
|
||||||
import Model exposing (Model, Route(..))
|
import Model exposing (Model, Route(..))
|
||||||
import Msg exposing (..)
|
import Msg exposing (..)
|
||||||
import Palette exposing (classes)
|
import Palette exposing (classes)
|
||||||
@ -39,15 +39,14 @@ body : Model -> Html Msg
|
|||||||
body model =
|
body model =
|
||||||
layout <|
|
layout <|
|
||||||
List.concat
|
List.concat
|
||||||
[ [ header [ classes "w-100 bt bb b--black-10" ] [ routeView model model.page ] ]
|
[ [ header [ classes "w-100" ] [ routeView model model.page ] ]
|
||||||
++ [ header [ classes "w-100 bt bb b--black-10", onClick (Click "get_all") ] [ text "GET ALL" ] ]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
layout : List (Html Msg) -> Html Msg
|
layout : List (Html Msg) -> Html Msg
|
||||||
layout elms =
|
layout elms =
|
||||||
div [ classes "mw9 center w-70" ]
|
div [ classes "mw9 center w-70" ]
|
||||||
[ div [ classes "fl w-100 pa2" ]
|
[ div [ classes "fl w-100 pa2", style "font-family" "Roboto+Mono" ]
|
||||||
([]
|
([]
|
||||||
++ elms
|
++ elms
|
||||||
)
|
)
|
||||||
|
@ -7,4 +7,9 @@
|
|||||||
*/
|
*/
|
||||||
[data-elm-hot="true"] {
|
[data-elm-hot="true"] {
|
||||||
height: inherit;
|
height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
font-size: 48px;
|
||||||
}
|
}
|
Reference in New Issue
Block a user