PTMagic/Monitor/Pages/_get/TickerWidgets.cshtml

61 lines
3.2 KiB
Plaintext
Raw Permalink Normal View History

2018-05-22 10:11:50 +02:00
@page
@model TickerWidgetsModel
@{
Layout = null;
// Single market settings tool tip
2018-05-22 10:11:50 +02:00
int activeSingleSettings = Model.MarketsWithSingleSettings.Count;
string singleSettingInfoIcon = "";
if (activeSingleSettings > 0) {
singleSettingInfoIcon = "<i class=\"fa fa-info-circle text-muted\" data-toggle=\"tooltip\" data-placement=\"top\" data-html=\"true\" title=\"<b>Single Market Settings active for:</b><br />" + Core.Helper.SystemHelper.ConvertListToTokenString(Model.MarketsWithSingleSettings, "<br />", true) + "\" data-template=\"<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner tooltip-200 text-left'></div></div>\"></i>";
2018-05-22 10:11:50 +02:00
}
// Global setting tool tip
2021-08-30 06:02:50 +02:00
string globalIconColor = "text-success";
string globalSettingInfoIcon = "<i class=\"fa fa-info-circle text-muted\" data-toggle=\"tooltip\" data-placement=\"top\" data-html=\"true\" title=\"<b>Instance: </b>" + Model.PTMagicConfiguration.GeneralSettings.Application.InstanceName + "\" data-template=\"<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner tooltip-100 text-left'></div></div>\"></i>";
if (Model.PTData.Properties.Shorting)
{
globalIconColor = "text-danger";
}
2018-05-22 10:11:50 +02:00
// Health indicator
2018-05-22 10:11:50 +02:00
DateTime lastRuntime = Model.Summary.LastRuntime;
double elapsedSecondsSinceRuntime = DateTime.UtcNow.Subtract(lastRuntime).TotalSeconds;
2018-05-22 10:11:50 +02:00
double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0;
2021-08-30 06:02:50 +02:00
string healthIconColor = "text-success";
2018-05-22 10:11:50 +02:00
string ptMagicHealthIcon = "fa-heartbeat";
2021-02-10 08:47:07 +01:00
string ptMagicHealthTooltip = "PT Magic is alive and healthy! Time elapsed since last run: " + Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins.";
2021-02-01 09:28:22 +01:00
if (elapsedSecondsSinceRuntime > (intervalSeconds * 2)) {
2018-05-22 10:11:50 +02:00
ptMagicHealthIcon = "fa-exclamation-triangle";
2021-02-10 08:47:07 +01:00
ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs! Time elapsed since last run: " + Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins.";
2021-08-30 06:02:50 +02:00
healthIconColor = "text-danger";
2018-05-22 10:11:50 +02:00
}
2024-01-27 18:39:47 +01:00
if (Model.IsAnalyzerRunning()) {
ptMagicHealthIcon = "fa-cog fa-spin";
}
2018-05-22 10:11:50 +02:00
}
2021-08-30 06:02:50 +02:00
<div class="card-box card-box-mini card-box-ptmagic-outlined @globalIconColor">
2020-09-17 06:03:16 +02:00
<span data-toggle="tooltip" data-placement="bottom" title="Active global setting">
2021-02-01 09:28:22 +01:00
@Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.CurrentGlobalSetting.SettingName)</span><span class = "header-title"><a href="StatusSummary">@Html.Raw(" " + globalSettingInfoIcon)</a></span>
2019-03-18 16:56:38 +01:00
</div>
2020-09-17 06:03:16 +02:00
<div class="card-box card-box-mini card-box-ptmagic-outlined">
<span data-toggle="tooltip" data-placement="bottom" title="Active single market settings"><b>SMS: </b></span><span class = "header-title"><a href="ManageSMS">@Html.Raw(activeSingleSettings + " " + singleSettingInfoIcon)</a></span>
2018-05-22 10:11:50 +02:00
</div>
2021-08-30 06:02:50 +02:00
<div class="card-box card-box-mini card-box-ptmagic-status-outlined @healthIconColor" data-toggle="tooltip" data-placement="bottom" title="@ptMagicHealthTooltip">
<i class="fa @ptMagicHealthIcon @healthIconColor"></i>
2018-05-22 10:11:50 +02:00
</div>
<script type="text/javascript">
(function ($) {
'use strict';
$('[role="tooltip"]').remove();
$('[data-toggle="tooltip"]').tooltip();
$('.text-autocolor').autocolor(false);
})(jQuery);
</script>