From d90426eb64071b7271f93369f6606ca36f1dd3fc Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Tue, 12 Jul 2016 13:32:16 +0100 Subject: [PATCH] Adds a button to manually trigger Health Checks. Adds disabled state & inactive CSS class to ensure it cannot be triggered again whilst checks taking place. --- .../developer/healthcheck.controller.js | 51 ++++++++++++++----- .../dashboard/developer/healthcheck.html | 2 + 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js index e335ddd365..d9c0d0774b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.controller.js @@ -19,22 +19,38 @@ vm.checkAllInGroup = checkAllInGroup; vm.openGroup = openGroup; vm.setViewState = setViewState; + vm.triggerChecks = triggerChecks; + vm.checksRunning = false; - // Get a (grouped) list of all health checks - healthCheckResource.getAllChecks().then( - function(response) { + vm.totalGroups = 0; + vm.totalGroupsChecked = 0; - // set number of checks which has been executed - for (var i = 0; i < response.length; i++) { - var group = response[i]; - group.checkCounter = 0; - checkAllInGroup(group, group.checks); + function triggerChecks(){ + + //Reset counter - inczse + + //Checks running - hide button that triggers check + //So we can't invoke multiple times & make further blocking requests + vm.checksRunning = true; + + // Get a (grouped) list of all health checks + healthCheckResource.getAllChecks().then( + function(response) { + + //Total number of groups + vm.totalGroups = response.length; + + // set number of checks which has been executed + for (var i = 0; i < response.length; i++) { + var group = response[i]; + group.checkCounter = 0; + checkAllInGroup(group, group.checks); + } + + vm.groups = response; } - - vm.groups = response; - - } - ); + ); + } function setGroupGlobalResultType(group) { @@ -104,6 +120,15 @@ if (group.checkCounter === checks.length) { setGroupGlobalResultType(group); group.loading = false; + + //This group of checks run - increment counter by one + vm.totalGroupsChecked++; + + //Once we have all done all checks for this group + //Verify if this was last group or not with counters & reset button + if(vm.totalGroups === vm.totalGroupsChecked){ + vm.checksRunning = false; + } } }); diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html b/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html index 2c60fa6868..1135d14c73 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/healthcheck.html @@ -3,6 +3,8 @@

The health checker evaluates various areas of your site for best practice settings, configuration, potential problems, etc. You can easily fix problems by pressing a button.
You can add your own health checks, have a look at the documentation for more information about custom health checks.

+ +