instances table

This commit is contained in:
DieMyst 2020-11-30 14:27:39 +03:00
parent 9dff17528f
commit 17fc387e8e
3 changed files with 51 additions and 5 deletions

View File

@ -1,6 +1,7 @@
module HubPage.View exposing (..)
import Html exposing (Html)
import Instances.View
import Model exposing (Model)
import Modules.View
import Services.View
@ -10,4 +11,5 @@ view model =
Html.div []
[ Services.View.view model
, Modules.View.view model
, Instances.View.view model
]

View File

@ -2,8 +2,7 @@ module Instances.Model exposing (..)
type alias Instance =
{}
type alias Model =
{}
{ name: String
, instance: String
, peerId: String
, ip: String}

View File

@ -1 +1,46 @@
module Instances.View exposing (..)
import Html exposing (Html, div, table, tbody, td, text, th, thead, tr)
import Html.Attributes exposing (attribute)
import Instances.Model exposing (Instance)
import Model exposing (Model)
import Palette exposing (classes)
view : Model -> Html msg
view model =
let
instances =
[ { name = "SQLite", instance = "efrer3434g", peerId = "kljn35kfj4n5kjgn4k5jgn45kj", ip = "123.123.123.123" }
, { name = "SQLite", instance = "efrer3434g", peerId = "kljn35kfj4n5kjgn4k5jgn45kj", ip = "123.123.123.123" }
, { name = "SQLite", instance = "efrer3434g", peerId = "kljn35kfj4n5kjgn4k5jgn45kj", ip = "123.123.123.123" }
, { name = "SQLite", instance = "efrer3434g", peerId = "kljn35kfj4n5kjgn4k5jgn45kj", ip = "123.123.123.123" }
]
in
viewTable instances
viewTable : List Instance -> Html msg
viewTable instances =
div [classes "pa4"]
[ div [classes "overflow-auto"]
[ table [classes "f6 w-100 mw8 center", attribute "cellspacing" "0"]
[ thead []
[ tr [ classes "stripe-dark" ]
[ th [ classes "fw6 tl pa3 bg-white" ] [ text "SERVICE"]
, th [ classes "fw6 tl pa3 bg-white" ] [ text "INSTANCE"]
, th [ classes "fw6 tl pa3 bg-white" ] [ text "NODE"]
, th [ classes "fw6 tl pa3 bg-white" ] [ text "IP"]
]
]
, tbody [ classes "lh-copy" ] (instances |> List.map viewInstance)
]
]
]
viewInstance : Instance -> Html msg
viewInstance instance =
tr [ classes "stripe-dark" ]
[ td [ classes "pa3" ] [ text instance.name ]
, td [ classes "pa3" ] [ text instance.instance ]
, td [ classes "pa3" ] [ text instance.peerId ]
, td [ classes "pa3" ] [ text instance.ip ]
]