From 57db098d7fcbd909eadd24bd4f41818d5f90bdd7 Mon Sep 17 00:00:00 2001 From: git Date: Tue, 10 Jul 2018 22:54:38 +0200 Subject: [PATCH] added chart data route --- EDEngineer.Server/CommanderChart.fs | 2 -- EDEngineer.Server/Server.fs | 12 ++++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/EDEngineer.Server/CommanderChart.fs b/EDEngineer.Server/CommanderChart.fs index a538e2a6..77b82236 100644 --- a/EDEngineer.Server/CommanderChart.fs +++ b/EDEngineer.Server/CommanderChart.fs @@ -5,8 +5,6 @@ open Newtonsoft.Json open EDEngineer.Models.Utils open EDEngineer.Models open EDEngineer.Models.Operations -open EDEngineer.Models.State -open NodaTime open XPlot.Plotly open System open System.Collections.Generic diff --git a/EDEngineer.Server/Server.fs b/EDEngineer.Server/Server.fs index 8c0608ee..3c0f5104 100644 --- a/EDEngineer.Server/Server.fs +++ b/EDEngineer.Server/Server.fs @@ -329,6 +329,18 @@ let start (token, return result |> OK }))) + GET >=> pathScan "/%s/chartData%s" (fun (commander, format) -> + (request(fun request -> + cmdr { + let! state = stateRoute commander + let! f = FormatExtractor request format + let! l = LanguageExtractor <| request.queryParam "lang" + let settings = jsonSettingsGetter.Invoke(commander) + + let result = CommanderChart.chartData commander logDirectory settings translator l + return (result, l) |> FormatPicker(f) |> OK >=> MimeType(f) + }))) + OPTIONS >=> fun context -> context |> (