From 2f5b2f9a928740462c5fed3fcb6fa28d77e63b6c Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Wed, 17 Apr 2019 22:56:31 +0200 Subject: [PATCH] WIP --- crawl/CrawlNetwork.cs | 8 +- http/SkyScannerHttpApplication.cs | 8 +- templates/static/checks/issues.html | 124 ++++++++++++++++++++-------- templates/static/css/style.css | 50 +++++++++-- 4 files changed, 143 insertions(+), 47 deletions(-) diff --git a/crawl/CrawlNetwork.cs b/crawl/CrawlNetwork.cs index f0d7946..922d507 100644 --- a/crawl/CrawlNetwork.cs +++ b/crawl/CrawlNetwork.cs @@ -44,11 +44,13 @@ namespace ln.skyscanner.crawl Name = String.Format("Subnet crawl {0} [{1}]", subnet.Network, network); } + private int maxScanWidth = 28; + public override void RunJob() { - if (Network.Width < 26) + if (Network.Width < maxScanWidth) { - SplitJob(Network.Divide(26 - (int)Network.Width).Select((n) => new CrawlNetwork(Crawler, Subnet, n)).ToArray()); + SplitJob(Network.Divide(maxScanWidth - (int)Network.Width).Select((n) => new CrawlNetwork(Crawler, Subnet, n)).ToArray()); return; } @@ -101,7 +103,7 @@ namespace ln.skyscanner.crawl Subnet.NextScan = startTime + TimeSpan.FromHours(24); } - SkyScanner.Instance.Entities.CrawledHosts.Upsert(Subnet); + SkyScanner.Instance.Entities.CrawledSubnets.Upsert(Subnet); } public override int GetHashCode() diff --git a/http/SkyScannerHttpApplication.cs b/http/SkyScannerHttpApplication.cs index a62dd7a..2a3819f 100644 --- a/http/SkyScannerHttpApplication.cs +++ b/http/SkyScannerHttpApplication.cs @@ -16,7 +16,7 @@ namespace ln.skyscanner.http public SkyScanner SkyScanner { get; } public String BasePath { get; private set; } - public String TemplatesBasePath => Path.Combine(BasePath, "templates","static"); + public String TemplatesBasePath { get; private set; } ReflectiveResource refChecker; ReflectiveResource refEntities; @@ -26,6 +26,12 @@ namespace ln.skyscanner.http SkyScanner = skyScanner; BasePath = Path.GetFullPath("."); + TemplatesBasePath = Path.Combine(BasePath, "templates", "static"); + + /* Development hint */ + if (Directory.Exists("../../templates/static")) + TemplatesBasePath = Path.Combine(BasePath, "..", "..", "templates", "static"); + DirectoryResource staticTemplates = new DirectoryResource(RootResource, TemplatesBasePath); diff --git a/templates/static/checks/issues.html b/templates/static/checks/issues.html index 2e8305b..0a29ef1 100644 --- a/templates/static/checks/issues.html +++ b/templates/static/checks/issues.html @@ -1,8 +1,11 @@ <%frame "frame.html"%> -

Aktuelle Störfälle

- -
+

Aktuelle Störfälle ()

+
+ Kritisch: + Warnungen:
+
+

- -
-
-
-
-
+
+
+
+
+
+
+
+
+
-

-
- Last Check:
- Current State for:
-
-
+
+
+ Last Check:
+ Current State for:
+
+
+
+
+
@@ -41,14 +50,15 @@
diff --git a/templates/static/css/style.css b/templates/static/css/style.css index 810d0c4..3cf8ffc 100644 --- a/templates/static/css/style.css +++ b/templates/static/css/style.css @@ -145,18 +145,22 @@ button { } .flex { - display: flex; + display: flex; + position: relative; } .flex.row { flex-direction: row; } + .flex.column { flex-direction: column; } .flex > div { - margin: 4px; + margin: 4px; + display: inline-block; + } .skylogo { @@ -324,6 +328,8 @@ fieldset > label { } .issue-box { + display: block; + border-radius: 6px 6px 0px 0px; border: 3px solid silver; } @@ -339,9 +345,15 @@ fieldset > label { padding: 4px; } +.issue-box #History { + max-height: 80px; + overflow-x: hidden; + overflow-y: auto; +} + .issue-WARN { - border-color: yellow; - background-color: yellow; + border-color: #C0C000; + background-color: #C0C000; color: black; } .issue-CRITICAL { @@ -353,11 +365,35 @@ fieldset > label { #CheckState { font-size: 20px; } -#CheckState.WARN, span#WARN { - color: yellow; +#CheckState.WARN, span#nWARN { + color: #C0C000; } -#CheckState.CRITICAL, span#CRITICAL{ +#CheckState.CRITICAL, span#nCRITICAL{ color: RED; + margin-right: 12px; +} + +#PerfValues > span, #History > span { + display: inline-block; + width: 100%; +} + +#History > span { + color: green; + margin-right: 24px; +} + +#PerfValues > .WARN, #History > .WARN { + color: #C0C000; +} + +#PerfValues > .CRITICAL, #History > .CRITICAL { + color: white; + background-color: red; +} + +span#nWARN, span#nCRITICAL { + font-size: 24px; } .performance-value > div {