github.com/simpleiot/simpleiot@v0.18.3/frontend/src/Components/NodeCanBus.elm (about) 1 module Components.NodeCanBus 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 Round 8 import UI.Icon as Icon 9 import UI.NodeInputs as NodeInputs 10 import UI.Style exposing (colors) 11 import UI.ViewIf exposing (viewIf) 12 13 14 view : NodeOptions msg -> Element msg 15 view o = 16 let 17 disabled = 18 Point.getBool o.node.points Point.typeDisabled "" 19 in 20 column 21 [ width fill 22 , Border.widthEach { top = 2, bottom = 0, left = 0, right = 0 } 23 , Border.color colors.black 24 , spacing 6 25 ] 26 <| 27 wrappedRow [ spacing 10 ] 28 [ Icon.serialDev 29 , text <| 30 Point.getText o.node.points Point.typeDescription "" 31 , viewIf disabled <| text "(disabled)" 32 ] 33 :: (if o.expDetail then 34 let 35 labelWidth = 36 180 37 38 opts = 39 oToInputO o labelWidth 40 41 textInput = 42 NodeInputs.nodeTextInput opts "0" 43 44 checkboxInput = 45 NodeInputs.nodeCheckboxInput opts "0" 46 47 counterWithReset = 48 NodeInputs.nodeCounterWithReset opts "0" 49 in 50 [ textInput Point.typeDescription "Description" "" 51 , textInput Point.typeDevice "Device" "can0" 52 , textInput Point.typeBitRate "Bit rate" "250000" 53 , el [ width (px labelWidth) ] <| 54 el [ alignRight ] <| 55 text <| 56 "Messages in db: " 57 ++ String.fromFloat (Round.roundNum 2 (Point.getValue o.node.points Point.typeMsgsInDb "0")) 58 , el [ width (px labelWidth) ] <| 59 el [ alignRight ] <| 60 text <| 61 "Signals in db: " 62 ++ String.fromFloat (Round.roundNum 2 (Point.getValue o.node.points Point.typeSignalsInDb "0")) 63 , counterWithReset Point.typeMsgsRecvdDb Point.typeMsgsRecvdDbReset "Db msgs recieved" 64 , counterWithReset Point.typeMsgsRecvdOther Point.typeMsgsRecvdOtherReset "Other msgs recvd" 65 , checkboxInput Point.typeDisabled "Disabled" 66 , NodeInputs.nodeKeyValueInput opts Point.typeTag "Tags" "Add Tag" 67 ] 68 69 else 70 [] 71 )