View daten.xml
<appStatus>
<box box_id='6974-1' Box_id_visual='Stadtwerke Halle' Access_Limitiation='123' Access_Type='3' Access_Type_Notes_Line1='Gustav-Anlauf-Straße 7&#10;06108 Halle (Saale)' Access_Type_Notes_Line2='' box_state_user='1' Location_Longitude='11.972364873569774' Location_Latitude='51.48240363722654' Power_7kW='' Power_8-22kW='' Power_23-120kW='' DC-AC='' Usability='1' OpeningHours_switch='' user_value_switch='1' Box_State_i7='1' Plug_XML_01='0' Plug_XML_02='1' Plug_XML_03='0' Plug_XML_04='0' Plug_XML_05='0' Plug_XML_06='0' Plug_XML_07='0' Plug_XML_08='0' Plug_XML_52='0' Plug_XML_53='0' Plug_XML_54='0' Plug_XML_55='0' />
<box box_id='6974-2' Box_id_visual='Stadtwerke Halle' Access_Limitiation='123' Access_Type='3' Access_Type_Notes_Line1='Gustav-Anlauf-Straße 7&#10;06108 Halle (Saale)' Access_Type_Notes_Line2='' box_state_user='1' Location_Longitude='11.972407788914097' Location_Latitude='51.48231009702875' Power_7kW='' Power_8-22kW='' Power_23-120kW='' DC-AC='1' Usability='1' OpeningHours_switch='' use
View gist:e8879c7c9f97fbb5ca41b7bdb5b7ed40
let dataSales = {
labels = [| "Heutiger Tagesumsatz"; "30-Tage-Durchschnitt" |]
datasets =
[|
{ label = "Sales"
fill = false
backgroundColor = "rgb(214, 138, 16)"
borderColor = "rgb(214, 138, 16)"
borderCapStyle = "butt"
borderDash = [||]
View usage.fs
ChartComponent.bar [
BarChartProperties.Options
{ responsive = true
maintainAspectRatio = false
scales =
{ yAxes =
[| { ticks = { beginAtZero = true } } |]
}
legend =
{ display = false
View ChartComponent.fs
module ChartComponent
open System
open Elmish
open Fable.Core.JsInterop
open Fable.Core
open Fable.Import
open Fable.Helpers.React
module R = Fable.Helpers.React
View mapComponent.js
import { withScriptjs, withGoogleMap, GoogleMap, TrafficLayer, Marker } from "react-google-maps";
const { SearchBox } = require("react-google-maps/lib/components/places/SearchBox");
import React, {Component, Children} from 'react';
const TrafficMapComponent = withScriptjs(withGoogleMap((props) =>
<GoogleMap
defaultZoom={props.defaultZoom}
onZoomChanged={props.onZoomChanged}
onIdle={props.onIdle}
defaultCenter={props.defaultCenter}
View Fable.Helpers.ReactGoogleMaps.fs
module Fable.Helpers.ReactGoogleMaps
open Fable.Core
open Fable.Import
open Fable.Core.JsInterop
module Coordinates =
type [<Pojo>] Position = {
lat: float
View gist:b7149e7cbd76726432e18a3b311188a6
open Giraffe.TokenRouter
....
let notfound = NOT_FOUND "Page not found"
choose [
GET >=>
router notfound [
View Update.fs
let update (msg:Msg) model : Model*Cmd<Msg> =
match msg with
| ...
| Error exn ->
printfn "error: %A" exn.Message
model, Cmd.none
| Noop _ ->
model, Cmd.none
View Msg.fs
type Msg =
| ...
| ServerMsg of Elmish.WebSocket.WebSocketMsg<SocketEvent>
| Noop of unit
| Error of exn
| Send of StartSocket
View Init.fs
let initModel user =
let ws = Elmish.WebSocket.createAuthenticated ("ws://localhost:8085/websocket", user.Token)
{ ChargingPoints = [||]
Reservations = Map.empty
WebSocket = ws
Connected = false
User = user },
Cmd.batch [
Cmd.ofPromise getChargingPoints () ChargingPointsLoaded Error
Elmish.WebSocket.Cmd.Configure ws ServerMsg