got error compiling this test script
Closed this issue · 2 comments
jkone27 commented
#r "nuget:FSharp.Data"
#r "nuget:Feliz.ViewEngine"
#r "nuget:Suave"
open FSharp.Data
open Feliz.ViewEngine
open Suave
open Suave.Filters
open Suave.Operators
open Suave.Successful
// Define JSON providers for Slack, Bitbucket, and Atlassian APIs
type SlackStatusCheckProvider = JsonProvider<"https://status.slack.com/api/v2.0.0/current">
type BitbucketStatusCheckProvider = JsonProvider<"https://bqlf8qjztdtr.statuspage.io/api/v2/status.json">
type AtlassianStatusCheckProvider = JsonProvider<"https://status.atlassian.com/api/v2/status.json">
// Function to get the service status (UP or DOWN)
let okStatuses = [ "ok"; "operational" ]
let isServiceUp (status: string) =
match okStatuses |> Seq.tryFind (fun ok -> status.ToLower().Contains(ok)) with
|Some(ok) -> true
|None -> false
let getCurrentStatuses () =
// Load status data for each service
let slackStatus = SlackStatusCheckProvider.Load("https://status.slack.com/api/v2.0.0/current")
let bitbucketStatus = BitbucketStatusCheckProvider.Load("https://bqlf8qjztdtr.statuspage.io/api/v2/status.json")
let atlassianStatus = AtlassianStatusCheckProvider.Load("https://status.atlassian.com/api/v2/status.json")
// Get service status for each service
let slackStatusStr = isServiceUp slackStatus.Status
let bitbucketStatusStr = isServiceUp bitbucketStatus.Status.Description
let atlassianStatusStr = isServiceUp atlassianStatus.Status.Description
// get the service statuses
[
"Slack", slackStatusStr
"Bitbucket", bitbucketStatusStr
"Atlassian", atlassianStatusStr
]
let jsScript =
"""
setTimeout(function(){
window.location.reload();
}, 5000);
"""
let renderView statuses =
// show it in HTML
Html.h1 "IS IT UP?"
Html.script [
prop.text jsScript
]
Html.section [
Html.article [
for service,isUp in statuses do
let status = if isUp then "UP" else "DOWN"
Html.p $"{service}: is {status}"
]
]
|> Render.htmlView
let server =
path "/" >=> GET >=>
OK (getCurrentStatuses () |> renderView)
startWebServer defaultConfig server
with error
fflat ./aggregatedStatus.fsx
compiling ./aggregatedStatus.fsx...
Unhandled exception: System.NotImplementedException: The method or operation is not implemented.
at BuildCommand.Handle(ParseResult result) in /mnt/g/repos/fflat/bflat/src/bflat/BuildCommand.cs:line 169
at CommandBase.Invoke(InvocationContext context) in /mnt/g/repos/fflat/bflat/src/bflat/CommandBase.cs:line 24
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
Unhandled exception. System.Exception: One or more errors occurred. (compilation failed)
at Program.main(String[] argv) in /mnt/g/repos/fflat/src/fflat/Program.fs:line 214
ieviev commented
ieviev commented