From 06a3823c57cab4aba5f20dbfe314d32de6e4b3da Mon Sep 17 00:00:00 2001 From: master3395 Date: Fri, 10 Apr 2026 18:48:53 +0200 Subject: [PATCH] Dashboard Top Process: silent refresh, 10s interval, no 2s table flash Stop tying process list to chart poll; background refresh updates rows without loading spinner. First load still shows spinner once. --- .../baseTemplate/custom-js/system-status.js | 31 ++++++++++++++----- .../baseTemplate/custom-js/system-status.js | 31 ++++++++++++++----- .../baseTemplate/custom-js/system-status.js | 31 ++++++++++++++----- 3 files changed, 72 insertions(+), 21 deletions(-) diff --git a/baseTemplate/static/baseTemplate/custom-js/system-status.js b/baseTemplate/static/baseTemplate/custom-js/system-status.js index cac0c7a35..ddb9f6f13 100644 --- a/baseTemplate/static/baseTemplate/custom-js/system-status.js +++ b/baseTemplate/static/baseTemplate/custom-js/system-status.js @@ -1004,8 +1004,14 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { $scope.topProcesses = []; $scope.loadingTopProcesses = true; $scope.errorTopProcesses = ''; - $scope.refreshTopProcesses = function() { - $scope.loadingTopProcesses = true; + /** + * @param {boolean} silent If true, refresh rows in place without clearing the table (no loading spinner). + */ + $scope.refreshTopProcesses = function(silent) { + silent = !!silent; + if (!silent) { + $scope.loadingTopProcesses = true; + } var h = { headers: { 'X-CSRFToken': (typeof getCookie === 'function') ? getCookie('csrftoken') : '' } }; $http.get('/base/getTopProcesses', h).then(function (response) { $scope.loadingTopProcesses = false; @@ -1014,9 +1020,12 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { } else { $scope.topProcesses = []; } + $scope.errorTopProcesses = ''; }, function (err) { $scope.loadingTopProcesses = false; - $scope.errorTopProcesses = 'Failed to load top processes.'; + if (!silent) { + $scope.errorTopProcesses = 'Failed to load top processes.'; + } }); }; @@ -1800,7 +1809,9 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { // For rate calculation var lastRx = null, lastTx = null, lastDiskRead = null, lastDiskWrite = null, lastCPU = null; var lastCPUTimes = null; - var pollInterval = 2000; // ms + var pollInterval = 2000; // ms (charts / dashboard stats) + /** Top Process list: slower refresh, silent updates (no table flash). */ + var topProcessPollIntervalMs = 10000; var maxPoints = 30; // Expose so switchTab can create charts on first tab click if they weren't created at load @@ -2323,7 +2334,6 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { // Initial setup - fetch stats immediately pollDashboardStats(); - $scope.refreshTopProcesses(); $scope.refreshSSHLogins(); $scope.refreshSSHLogs(); @@ -2341,16 +2351,23 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { $scope.hideSystemCharts = true; }); - // Start polling for all stats (data feeds charts) + // Start polling for all stats (data feeds charts). Top Process is polled separately (slower, silent). function pollAll() { pollDashboardStats(); pollTraffic(); pollDiskIO(); pollCPU(); - $scope.refreshTopProcesses(); $timeout(pollAll, pollInterval); } pollAll(); + + function scheduleTopProcessPoll() { + $timeout(function() { + $scope.refreshTopProcesses(true); + scheduleTopProcessPoll(); + }, topProcessPollIntervalMs); + } + scheduleTopProcessPoll(); }, 800); // SSH User Activity Modal diff --git a/public/static/baseTemplate/custom-js/system-status.js b/public/static/baseTemplate/custom-js/system-status.js index 7c786ffea..7d850e594 100644 --- a/public/static/baseTemplate/custom-js/system-status.js +++ b/public/static/baseTemplate/custom-js/system-status.js @@ -1004,8 +1004,14 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { $scope.topProcesses = []; $scope.loadingTopProcesses = true; $scope.errorTopProcesses = ''; - $scope.refreshTopProcesses = function() { - $scope.loadingTopProcesses = true; + /** + * @param {boolean} silent If true, refresh rows in place without clearing the table (no loading spinner). + */ + $scope.refreshTopProcesses = function(silent) { + silent = !!silent; + if (!silent) { + $scope.loadingTopProcesses = true; + } var h = { headers: { 'X-CSRFToken': (typeof getCookie === 'function') ? getCookie('csrftoken') : '' } }; $http.get('/base/getTopProcesses', h).then(function (response) { $scope.loadingTopProcesses = false; @@ -1014,9 +1020,12 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { } else { $scope.topProcesses = []; } + $scope.errorTopProcesses = ''; }, function (err) { $scope.loadingTopProcesses = false; - $scope.errorTopProcesses = 'Failed to load top processes.'; + if (!silent) { + $scope.errorTopProcesses = 'Failed to load top processes.'; + } }); }; @@ -1788,7 +1797,9 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { // For rate calculation var lastRx = null, lastTx = null, lastDiskRead = null, lastDiskWrite = null, lastCPU = null; var lastCPUTimes = null; - var pollInterval = 2000; // ms + var pollInterval = 2000; // ms (charts / dashboard stats) + /** Top Process list: slower refresh, silent updates (no table flash). */ + var topProcessPollIntervalMs = 10000; var maxPoints = 30; // Expose so switchTab can create charts on first tab click if they weren't created at load @@ -2311,7 +2322,6 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { // Initial setup - fetch stats immediately pollDashboardStats(); - $scope.refreshTopProcesses(); $scope.refreshSSHLogins(); $scope.refreshSSHLogs(); @@ -2329,16 +2339,23 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { $scope.hideSystemCharts = true; }); - // Start polling for all stats (data feeds charts) + // Start polling for all stats (data feeds charts). Top Process is polled separately (slower, silent). function pollAll() { pollDashboardStats(); pollTraffic(); pollDiskIO(); pollCPU(); - $scope.refreshTopProcesses(); $timeout(pollAll, pollInterval); } pollAll(); + + function scheduleTopProcessPoll() { + $timeout(function() { + $scope.refreshTopProcesses(true); + scheduleTopProcessPoll(); + }, topProcessPollIntervalMs); + } + scheduleTopProcessPoll(); }, 800); // SSH User Activity Modal diff --git a/static/baseTemplate/custom-js/system-status.js b/static/baseTemplate/custom-js/system-status.js index c6bb9cc4f..1cc7b9e75 100644 --- a/static/baseTemplate/custom-js/system-status.js +++ b/static/baseTemplate/custom-js/system-status.js @@ -1004,8 +1004,14 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { $scope.topProcesses = []; $scope.loadingTopProcesses = true; $scope.errorTopProcesses = ''; - $scope.refreshTopProcesses = function() { - $scope.loadingTopProcesses = true; + /** + * @param {boolean} silent If true, refresh rows in place without clearing the table (no loading spinner). + */ + $scope.refreshTopProcesses = function(silent) { + silent = !!silent; + if (!silent) { + $scope.loadingTopProcesses = true; + } var h = { headers: { 'X-CSRFToken': (typeof getCookie === 'function') ? getCookie('csrftoken') : '' } }; $http.get('/base/getTopProcesses', h).then(function (response) { $scope.loadingTopProcesses = false; @@ -1014,9 +1020,12 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { } else { $scope.topProcesses = []; } + $scope.errorTopProcesses = ''; }, function (err) { $scope.loadingTopProcesses = false; - $scope.errorTopProcesses = 'Failed to load top processes.'; + if (!silent) { + $scope.errorTopProcesses = 'Failed to load top processes.'; + } }); }; @@ -1677,7 +1686,9 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { // For rate calculation var lastRx = null, lastTx = null, lastDiskRead = null, lastDiskWrite = null, lastCPU = null; var lastCPUTimes = null; - var pollInterval = 2000; // ms + var pollInterval = 2000; // ms (charts / dashboard stats) + /** Top Process list: slower refresh, silent updates (no table flash). */ + var topProcessPollIntervalMs = 10000; var maxPoints = 30; // Expose so switchTab can create charts on first tab click if they weren't created at load @@ -2200,7 +2211,6 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { // Initial setup - fetch stats immediately pollDashboardStats(); - $scope.refreshTopProcesses(); $scope.refreshSSHLogins(); $scope.refreshSSHLogs(); @@ -2218,16 +2228,23 @@ var dashboardStatsControllerFn = function ($scope, $http, $timeout) { $scope.hideSystemCharts = true; }); - // Start polling for all stats (data feeds charts) + // Start polling for all stats (data feeds charts). Top Process is polled separately (slower, silent). function pollAll() { pollDashboardStats(); pollTraffic(); pollDiskIO(); pollCPU(); - $scope.refreshTopProcesses(); $timeout(pollAll, pollInterval); } pollAll(); + + function scheduleTopProcessPoll() { + $timeout(function() { + $scope.refreshTopProcesses(true); + scheduleTopProcessPoll(); + }, topProcessPollIntervalMs); + } + scheduleTopProcessPoll(); }, 800); // SSH User Activity Modal