dashboard: Show system stats

This commit is contained in:
Johannes Zellner
2023-12-04 00:31:38 +01:00
parent 4d29592450
commit 7a730c445b
4 changed files with 79 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
/* global angular */
/* global $ */
/* global TASK_TYPES */
/* global Chart */
angular.module('Application').controller('SystemController', ['$scope', '$location', '$timeout', 'Client', function ($scope, $location, $timeout, Client) {
@@ -9,6 +10,8 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
$scope.config = Client.getConfig();
$scope.memory = null;
$scope.cpus = null;
$scope.info = null;
$scope.volumesById = {};
// https://stackoverflow.com/questions/1484506/random-color-generator
@@ -321,6 +324,20 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
};
Client.onReady(function () {
Client.cpus(function (error, cpus) {
if (error) console.error(error);
$scope.cpus = cpus;
});
Client.systemInfo(function (error, info) {
if (error) console.error(error);
// prettify for UI
info.uptimeSecs = moment.duration(info.uptimeSecs, 'seconds').locale(navigator.language).humanize();
$scope.info = info;
});
Client.memory(function (error, memory) {
if (error) console.error(error);