From 88c8f39480436ab30a58e1af79a7fe76f0beff5d Mon Sep 17 00:00:00 2001
From: djbadders <34887832+djbadders@users.noreply.github.com>
Date: Thu, 4 Feb 2021 22:57:54 +0000
Subject: [PATCH] Add active single market settings to SMS tool tip
---
Monitor/Pages/_get/TickerWidgets.cshtml | 6 +++++-
Monitor/Pages/_get/TickerWidgets.cshtml.cs | 21 +++++++++++++++------
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/Monitor/Pages/_get/TickerWidgets.cshtml b/Monitor/Pages/_get/TickerWidgets.cshtml
index fa948f6..659d4ed 100644
--- a/Monitor/Pages/_get/TickerWidgets.cshtml
+++ b/Monitor/Pages/_get/TickerWidgets.cshtml
@@ -3,13 +3,17 @@
@{
Layout = null;
+ // Single market settings tool tip
int activeSingleSettings = Model.MarketsWithSingleSettings.Count;
string singleSettingInfoIcon = "";
if (activeSingleSettings > 0) {
- singleSettingInfoIcon = "Single Market Settings active for:
-" + Core.Helper.SystemHelper.ConvertListToTokenString(Model.MarketsWithSingleSettings, "
-", true) + "\" data-template=\"\">";
+ singleSettingInfoIcon = "Single Market Settings active for:
" + Core.Helper.SystemHelper.ConvertListToTokenString(Model.MarketsWithSingleSettings, "
", true) + "\" data-template=\"\">";
}
+
+ // Global setting tool tip
string globalSettingInfoIcon = "Instance: " + Model.PTMagicConfiguration.GeneralSettings.Application.InstanceName + "\" data-template=\"\">";
+ // Health indicator
DateTime lastRuntime = Model.Summary.LastRuntime;
double elapsedSecondsSinceRuntime = DateTime.UtcNow.Subtract(lastRuntime).TotalSeconds;
double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0;
diff --git a/Monitor/Pages/_get/TickerWidgets.cshtml.cs b/Monitor/Pages/_get/TickerWidgets.cshtml.cs
index 2788b4d..3f65652 100644
--- a/Monitor/Pages/_get/TickerWidgets.cshtml.cs
+++ b/Monitor/Pages/_get/TickerWidgets.cshtml.cs
@@ -21,14 +21,23 @@ namespace Monitor.Pages {
private void BindData() {
// Get markets with active single settings
- foreach (string key in Summary.MarketSummary.Keys) {
- if (Summary.MarketSummary[key].ActiveSingleSettings != null) {
- if (Summary.MarketSummary[key].ActiveSingleSettings.Count > 0) {
- MarketsWithSingleSettings.Add(key);
- }
+ var MarketsWithSingleSettingsData = from x in Summary.MarketSummary
+ where x.Value.ActiveSingleSettings != null
+ && x.Value.ActiveSingleSettings.Count > 0
+ orderby x.Key ascending
+ select x;
+
+ foreach (var market in MarketsWithSingleSettingsData) {
+ // Get the name of all active single market settings
+ string activeSettings = string.Empty;
+ foreach (var singleSetting in market.Value.ActiveSingleSettings)
+ {
+ activeSettings += (", " + singleSetting.SettingName);
}
+ activeSettings = activeSettings.Substring(2); // Chop the unrequired comma
+
+ MarketsWithSingleSettings.Add(String.Format("{0} : {1}", market.Key, activeSettings));
}
- MarketsWithSingleSettings.Sort();
}
}
}