github.com/simpleiot/simpleiot@v0.18.3/frontend/src/Components/NodeNetworkManagerDevice.elm (about)

     1  module Components.NodeNetworkManagerDevice exposing (view)
     2  
     3  import Api.Point as Point
     4  import Components.NodeOptions exposing (NodeOptions)
     5  import Element exposing (..)
     6  import Element.Border as Border
     7  import UI.Icon as Icon
     8  import UI.Style as Style
     9  
    10  
    11  view : NodeOptions msg -> Element msg
    12  view o =
    13      column
    14          [ width fill
    15          , Border.widthEach { top = 2, bottom = 0, left = 0, right = 0 }
    16          , Border.color Style.colors.black
    17          , spacing 6
    18          ]
    19      <|
    20          let
    21              interface =
    22                  Point.getText o.node.points "interface" ""
    23          in
    24          wrappedRow [ spacing 10 ]
    25              [ Icon.radioReceiver
    26              , text <|
    27                  interface
    28              ]
    29              :: (if o.expDetail then
    30                      let
    31                          state =
    32                              Point.getText o.node.points "state" ""
    33  
    34                          ipv4Gateway =
    35                              Point.getText o.node.points "ipv4Gateway" ""
    36  
    37                          stateDisplay =
    38                              String.replace "NmDeviceState" "" state
    39  
    40                          ipv4Addresses =
    41                              Point.getTextArray o.node.points "ipv4Addresses"
    42  
    43                          ipv4Netmasks =
    44                              Point.getTextArray o.node.points "ipv4Netmasks"
    45  
    46                          ipv4Nameservers =
    47                              Point.getTextArray o.node.points "ipv4Nameservers"
    48                      in
    49                      [ textDisplay "State" stateDisplay
    50                      , textDisplay "IPv4 Gateway" ipv4Gateway
    51                      ]
    52                          ++ List.map
    53                              (\a ->
    54                                  textDisplay "IPv4 Addr" a
    55                              )
    56                              ipv4Addresses
    57                          ++ List.map
    58                              (\a ->
    59                                  textDisplay "IPv4 Netmask" a
    60                              )
    61                              ipv4Netmasks
    62                          ++ List.map
    63                              (\a ->
    64                                  textDisplay "IPv4 NameServers" a
    65                              )
    66                              ipv4Nameservers
    67  
    68                  else
    69                      []
    70                 )
    71  
    72  
    73  textDisplay : String -> String -> Element msg
    74  textDisplay label value =
    75      el [ paddingEach { top = 0, right = 0, bottom = 0, left = 50 } ] <|
    76          text <|
    77              label
    78                  ++ ": "
    79                  ++ value