From 373d8a03031da53c9d64f97cdcf5403775352ffa Mon Sep 17 00:00:00 2001 From: Roland Banks Date: Thu, 25 Jul 2024 15:53:14 +0700 Subject: [PATCH] Add support for Device Status Widgets --- .../Converters/WidgetConverter.cs | 1 + .../Dashboards/DeviceStatusWidget.cs | 26 +++++++++++++++++++ LogicMonitor.Api/Dashboards/Widget.cs | 2 +- LogicMonitor.Api/LogicMonitor.Api.csproj | 3 +-- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 LogicMonitor.Api/Dashboards/DeviceStatusWidget.cs diff --git a/LogicMonitor.Api/Converters/WidgetConverter.cs b/LogicMonitor.Api/Converters/WidgetConverter.cs index 75505773..791259b9 100644 --- a/LogicMonitor.Api/Converters/WidgetConverter.cs +++ b/LogicMonitor.Api/Converters/WidgetConverter.cs @@ -34,6 +34,7 @@ protected override Widget Create(Type objectType, JObject jObject) "netflowgraph" => new NetflowGraphWidget(), "groupnetflow" => new GroupNetflowWidget(), "dynamictable" => new DynamicTableWidget(), + "devicestatus" => new DeviceStatusWidget(), _ => throw new NotSupportedException($"WidgetConverter.cs needs updating to include {type} widgets."), }; } diff --git a/LogicMonitor.Api/Dashboards/DeviceStatusWidget.cs b/LogicMonitor.Api/Dashboards/DeviceStatusWidget.cs new file mode 100644 index 00000000..e1a3891f --- /dev/null +++ b/LogicMonitor.Api/Dashboards/DeviceStatusWidget.cs @@ -0,0 +1,26 @@ +namespace LogicMonitor.Api.Dashboards; + +/// +/// A Device Status Widget +/// +[DataContract] +public class DeviceStatusWidget : Widget, IWidget +{ + /// + /// The Device ID + /// + [DataMember(Name = "deviceId")] + public string DeviceId { get; set; } = string.Empty; + + /// + /// The Device Display Name + /// + [DataMember(Name = "deviceDisplayName")] + public string DeviceDisplayName { get; set; } = string.Empty; + + /// + /// The Display Settings + /// + [DataMember(Name = "displaySettings")] + public DisplaySettings DisplaySettings { get; set; } = new(); +} \ No newline at end of file diff --git a/LogicMonitor.Api/Dashboards/Widget.cs b/LogicMonitor.Api/Dashboards/Widget.cs index 0a625ca3..3824df29 100644 --- a/LogicMonitor.Api/Dashboards/Widget.cs +++ b/LogicMonitor.Api/Dashboards/Widget.cs @@ -9,7 +9,7 @@ namespace LogicMonitor.Api.Dashboards; public class Widget : NamedItem, IHasEndpoint, IWidget { /// - /// alert | batchjob | flash | gmap | ngraph | ograph | cgraph | sgraph | netflowgraph | groupNetflowGraph | netflow | groupNetflow | html | bigNumber | gauge | pieChart | table | dynamicTable | deviceSLA | text | statsd | deviceStatus | serviceAlert | noc | websiteOverview | websiteOverallStatus | websiteIndividualStatus | websiteSLA | savedMap + /// alert | batchjob | flash | gmap | ngraph | ograph | cgraph | sgraph | netflowgraph | groupNetflowGraph | netflow | groupNetflow | html | bigNumber | gauge | pieChart | table | dynamicTable | deviceSLA | text | statsd | deviceStatus | serviceAlert | noc | websiteOverview | websiteOverallStatus | websiteIndividualStatus | websiteSLA | savedMap | devicestatus /// [DataMember(Name = "type")] public string Type { get; set; } = string.Empty; diff --git a/LogicMonitor.Api/LogicMonitor.Api.csproj b/LogicMonitor.Api/LogicMonitor.Api.csproj index cc66f85f..dcb4b73c 100644 --- a/LogicMonitor.Api/LogicMonitor.Api.csproj +++ b/LogicMonitor.Api/LogicMonitor.Api.csproj @@ -28,8 +28,7 @@ - Version 204 support added - Added ApiToken.LastAuthenticatedIp. + Add support for Device Status Widgets 57aaa0e7-815d-4065-9339-f3f070bed01e