0 people like it.
    Like the snippet!
  
  Creating Azure dashboard clock component with Farmer
  Example of shaping an anonymous-object-as-JSON structure for an Azure dashboard using strong typing and minimal code using Farmer F#  https://compositionalit.github.io/farmer/
  |  1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
 | // #r "nuget: Farmer"
open Farmer
open Farmer.Builders
/// TimeZone
let timezoneInfo =
    // System.TimeZoneInfo.FindSystemTimeZoneById "W. Europe Standard Time" // Germany
    // System.TimeZoneInfo.FindSystemTimeZoneById "Central Standard Time" // US Central time
    System.TimeZoneInfo.FindSystemTimeZoneById "GMT Standard Time" // UK
/// Azure ARM-template dasboard that creates a clock of selected timezone
let clockPart (tz:System.TimeZoneInfo): Farmer.Arm.Dashboard.LensMetadata =
    {   ``type`` = "Extension/HubsExtension/PartType/ClockPart"
        settings =
            {| content = {| settings =
                            {|  timezoneId = tz.Id
                                timeFormat = "HH:mm"
                                version = 1 |} |} |} |> box
        inputs = []
        filters = None
        asset = Unchecked.defaultof<Farmer.Arm.Dashboard.LensAsset>
        isAdapter = System.Nullable()
        defaultMenuItemId = null
    }
/// Positins in the screen
let positions : Farmer.Arm.Dashboard.LensPosition list = [
    { x = 5; y = 3; colSpan = 2; rowSpan = 2 } 
]
let lenspart = clockPart timezoneInfo
let dashboardGraph = 
    dashboard { 
        name "Monitoring-clock"
        title "Monitoring-clock"
        add_custom_lens({ position = positions.Head; metadata = lenspart })
    }
//let deployment = arm {
//    location deployLocation
//    add_resource dashboardGraph
//    // ...
//}
 | 
val timezoneInfo : System.TimeZoneInfo
 TimeZone
namespace System
type TimeZoneInfo =
  interface IEquatable<TimeZoneInfo>
  interface ISerializable
  interface IDeserializationCallback
  new : id: string * baseUtcOffset: TimeSpan * displayName: string * standardDisplayName: string * daylightDisplayName: string * adjustmentRules: AdjustmentRule [] * disableDaylightSavingTime: bool -> unit + 2 overloads
  member CompareAdjustmentRuleToDateTime : rule: AdjustmentRule * previousRule: AdjustmentRule * dateTime: DateTime * dateOnly: DateTime * dateTimeisUtc: bool -> int
  member ConvertFromUtc : dateTime: DateTime * daylightDelta: TimeSpan * baseUtcOffsetDelta: TimeSpan -> DateTime
  member ConvertToFromUtc : dateTime: DateTime * daylightDelta: TimeSpan * baseUtcOffsetDelta: TimeSpan * convertToUtc: bool -> DateTime
  member ConvertToUtc : dateTime: DateTime * daylightDelta: TimeSpan * baseUtcOffsetDelta: TimeSpan -> DateTime
  member Equals : other: TimeZoneInfo -> bool + 1 overload
  member GetAdjustmentRuleForAmbiguousOffsets : adjustedTime: DateTime * ruleIndex: byref<Nullable<int>> -> AdjustmentRule
  ...
System.TimeZoneInfo.FindSystemTimeZoneById(id: string) : System.TimeZoneInfo
val clockPart : tz:System.TimeZoneInfo -> 'a
 Azure ARM-template dasboard that creates a clock of selected timezone
val tz : System.TimeZoneInfo
property System.TimeZoneInfo.Id: string with get
val box : value:'T -> obj
union case Option.None: Option<'T>
module Unchecked
from Microsoft.FSharp.Core.Operators
val defaultof<'T> : 'T
Multiple items
type Nullable =
  static member Compare<'T (requires default constructor and value type and 'T :> ValueType)> : n1: Nullable<'T> * n2: Nullable<'T> -> int
  static member Equals<'T (requires default constructor and value type and 'T :> ValueType)> : n1: Nullable<'T> * n2: Nullable<'T> -> bool
  static member GetUnderlyingType : nullableType: Type -> Type
--------------------
[<Struct>]
type Nullable<'T (requires default constructor and value type and 'T :> ValueType)> =
  new : value: 'T -> unit
  member Equals : other: obj -> bool
  member GetHashCode : unit -> int
  member GetValueOrDefault : unit -> 'T + 1 overload
  member ToString : unit -> string
  static member op_Explicit : value: Nullable<'T> -> 'T
  static member op_Implicit : value: 'T -> Nullable<'T>
  val hasValue : bool
  val value : 'T
  member HasValue : bool
  ...
--------------------
System.Nullable ()
System.Nullable(value: 'T) : System.Nullable<'T>
val positions : obj list
 Positins in the screen
type 'T list = List<'T>
val lenspart : obj
val dashboardGraph : obj
property List.Head: obj with get
  
  
  More information