From 5bbe17af5455b66ca80c6a5fadb4a26e9d589326 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 12 Sep 2018 22:46:58 +0100 Subject: [PATCH] Start work on getting an overview page that will be entry point with shiny graphs and numbers before jumping over to search page --- .../views/logviewer/overview.controller.js | 99 +++++++++++++++++++ .../src/views/logviewer/overview.html | 85 ++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 src/Umbraco.Web.UI.Client/src/views/logviewer/overview.controller.js create mode 100644 src/Umbraco.Web.UI.Client/src/views/logviewer/overview.html diff --git a/src/Umbraco.Web.UI.Client/src/views/logviewer/overview.controller.js b/src/Umbraco.Web.UI.Client/src/views/logviewer/overview.controller.js new file mode 100644 index 0000000000..281d228bfd --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/logviewer/overview.controller.js @@ -0,0 +1,99 @@ +(function () { + "use strict"; + + function LogViewerOverviewController($q, $location, logViewerResource) { + + var vm = this; + vm.loading = false; + vm.searches = []; + vm.numberOfErrors = 0; + vm.commonLogMessages = []; + vm.commonLogMessagesCount = 10; + + // ChartJS Options - for count/overview of log distribution + vm.logTypeLabels = ["Info", "Debug", "Warning", "Error", "Critical"]; + vm.logTypeData = [0, 0, 0, 0, 0]; + vm.logTypeColors = [ '#dcdcdc', '#97bbcd', '#46bfbd', '#fdb45c', '#f7464a']; + vm.chartOptions = { + legend: { + display: true, + position: 'left' + } + }; + + //functions + vm.searchLogQuery = searchLogQuery; + + + function init() { + + vm.loading = true; + + var savedSearches = logViewerResource.getSavedSearches().then(function (data) { + vm.searches = data; + }, + // fallback to some defaults if error from API response + function () { + vm.searches = [ + { + "name": "Find all logs where the Level is NOT Verbose and NOT Debug", + "query": "Not(@Level='Verbose') and Not(@Level='Debug')" + }, + { + "name": "Find all logs that has an exception property (Warning, Error & Critical with Exceptions)", + "query": "Has(@Exception)" + }, + { + "name": "Find all logs that have the property 'Duration'", + "query": "Has(Duration)" + }, + { + "name": "Find all logs that have the property 'Duration' and the duration is greater than 1000ms", + "query": "Has(Duration) and Duration > 1000" + }, + { + "name": "Find all logs that are from the namespace 'Umbraco.Core'", + "query": "StartsWith(SourceContext, 'Umbraco.Core')" + }, + { + "name": "Find all logs that use a specific log message template", + "query": "@MessageTemplate = '[Timing {TimingId}] {EndMessage} ({TimingDuration}ms)'" + } + ] + }); + + var numOfErrors = logViewerResource.getNumberOfErrors().then(function (data) { + vm.numberOfErrors = data; + }); + + var logCounts = logViewerResource.getLogLevelCounts().then(function (data) { + vm.logTypeData = []; + vm.logTypeData.push(data.Information); + vm.logTypeData.push(data.Debug); + vm.logTypeData.push(data.Warning); + vm.logTypeData.push(data.Error); + vm.logTypeData.push(data.Fatal); + }); + + var commonMsgs = logViewerResource.getMessageTemplates().then(function(data){ + vm.commonLogMessages = data; + }); + + //Set loading indicatior to false when these 3 queries complete + $q.all([savedSearches, numOfErrors, logCounts, commonMsgs]).then(function(data) { + vm.loading = false; + }); + + } + + function searchLogQuery(logQuery){ + $location.path("/developer/logViewer/search").search({lq: logQuery}); + } + + init(); + + } + + angular.module("umbraco").controller("Umbraco.Editors.LogViewer.OverviewController", LogViewerOverviewController); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/logviewer/overview.html b/src/Umbraco.Web.UI.Client/src/views/logviewer/overview.html new file mode 100644 index 0000000000..1ba9a6d3ff --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/logviewer/overview.html @@ -0,0 +1,85 @@ +
+ + + + + + + + + +
+
+ + + Saved Searches + + + + + + + + + +
+ All Logs +
+ {{search.name}} +
+
+
+ + + + Common Log Messages + + Total Unique Message types: {{ vm.commonLogMessages.length }} + + + + + + + +
+ {{ template.MessageTemplate }} + + {{ template.Count }} +
+ Show More +
+
+
+ +
+ + + Number of Errors + + {{ vm.numberOfErrors }} + + + + + + Log Types + + + + + +
+
+
+
+
\ No newline at end of file