github.com/simpleiot/simpleiot@v0.18.3/frontend/src/Components/NodeOneWire.elm (about) 1 module Components.NodeOneWire 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.oneWire 28 , text <| 29 Point.getText o.node.points Point.typeDescription "" 30 , viewIf disabled <| text "(disabled)" 31 ] 32 :: (if o.expDetail then 33 let 34 labelWidth = 35 180 36 37 opts = 38 oToInputO o labelWidth 39 40 textInput = 41 NodeInputs.nodeTextInput opts "0" 42 43 numberInput = 44 NodeInputs.nodeNumberInput opts "0" 45 46 counterWithReset = 47 NodeInputs.nodeCounterWithReset opts "0" 48 49 checkboxInput = 50 NodeInputs.nodeCheckboxInput opts "0" 51 52 index = 53 Point.getValue o.node.points Point.typeIndex "" 54 in 55 [ el [ paddingEach { top = 0, right = 0, bottom = 0, left = 70 } ] <| 56 text <| 57 "Bus #: " 58 ++ String.fromFloat index 59 , textInput Point.typeDescription "Description" "" 60 , numberInput Point.typeDebug "Debug level (0-9)" 61 , numberInput Point.typePollPeriod "Poll period (ms)" 62 , checkboxInput Point.typeDisabled "Disabled" 63 , counterWithReset Point.typeErrorCount Point.typeErrorCountReset "Error Count" 64 ] 65 66 else 67 [] 68 )