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

     1  module Components.NodeSync exposing (view)
     2  
     3  import Api.Point as Point
     4  import Components.NodeOptions exposing (NodeOptions, oToInputO)
     5  import Element exposing (..)
     6  import Element.Border as Border
     7  import UI.Icon as Icon
     8  import UI.NodeInputs as NodeInputs
     9  import UI.Style exposing (colors)
    10  import UI.ViewIf exposing (viewIf)
    11  
    12  
    13  view : NodeOptions msg -> Element msg
    14  view o =
    15      let
    16          disabled =
    17              Point.getBool o.node.points Point.typeDisabled ""
    18      in
    19      column
    20          [ width fill
    21          , Border.widthEach { top = 2, bottom = 0, left = 0, right = 0 }
    22          , Border.color colors.black
    23          , spacing 6
    24          ]
    25      <|
    26          wrappedRow [ spacing 10 ]
    27              [ Icon.sync
    28              , text <|
    29                  Point.getText o.node.points Point.typeDescription ""
    30              , viewIf disabled <| text "(disabled)"
    31              ]
    32              :: (if o.expDetail then
    33                      let
    34                          opts =
    35                              oToInputO o 100
    36  
    37                          textInput =
    38                              NodeInputs.nodeTextInput opts "0"
    39  
    40                          textNumber =
    41                              NodeInputs.nodeNumberInput opts "0"
    42  
    43                          checkboxInput =
    44                              NodeInputs.nodeCheckboxInput opts "0"
    45  
    46                          counterWithReset =
    47                              NodeInputs.nodeCounterWithReset opts "0"
    48                      in
    49                      [ textInput Point.typeDescription "Description" ""
    50                      , textInput Point.typeURI "URI" "nats://myserver:4222, ws://myserver"
    51                      , textInput Point.typeAuthToken "Auth Token" ""
    52                      , textNumber Point.typePeriod "Sync Period (s)"
    53                      , checkboxInput Point.typeDisabled "Disabled"
    54                      , counterWithReset Point.typeSyncCount Point.typeSyncCountReset "Sync Count"
    55                      ]
    56  
    57                  else
    58                      []
    59                 )