mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-28 05:42:57 +03:00
Better handling of refresh time in the web ui
This commit is contained in:
parent
68d10873bb
commit
e408a2a202
@ -7,5 +7,8 @@ import template from "./view.html";
|
||||
export default angular.module("glancesApp").component("glances", {
|
||||
controller: GlancesController,
|
||||
controllerAs: 'vm',
|
||||
templateUrl: template,
|
||||
bindings: {
|
||||
refreshTime: "<"
|
||||
},
|
||||
templateUrl: template
|
||||
});
|
||||
|
@ -4,6 +4,10 @@ export default function GlancesController($scope, GlancesStats, hotkeys, ARGUMEN
|
||||
vm.dataLoaded = false;
|
||||
vm.arguments = ARGUMENTS;
|
||||
|
||||
vm.$onInit = function () {
|
||||
GlancesStats.init(vm.refreshTime);
|
||||
};
|
||||
|
||||
$scope.$on('data_refreshed', function (event, data) {
|
||||
vm.hasGpu = data.stats.gpu.length > 0;
|
||||
vm.dataLoaded = true;
|
||||
|
@ -2,7 +2,7 @@
|
||||
import angular from "angular";
|
||||
import "angular-hotkeys";
|
||||
|
||||
export default angular.module("glancesApp", ["glances.config", "cfp.hotkeys"])
|
||||
export default angular.module("glancesApp", ["cfp.hotkeys"])
|
||||
|
||||
.value("CONFIG", {})
|
||||
.value("ARGUMENTS", {})
|
||||
@ -18,6 +18,4 @@ export default angular.module("glancesApp", ["glances.config", "cfp.hotkeys"])
|
||||
$rootScope.$on("data_refreshed", function (event, data) {
|
||||
$rootScope.title = `${data.stats.system.hostname} - Glances`;
|
||||
});
|
||||
|
||||
GlancesStats.init();
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
import angular from "angular";
|
||||
|
||||
function GlancesStats ($http, $q, $rootScope, $timeout, GlancesPluginHelper, REFRESH_TIME, CONFIG, ARGUMENTS) {
|
||||
function GlancesStats ($http, $q, $rootScope, $timeout, GlancesPluginHelper, CONFIG, ARGUMENTS) {
|
||||
|
||||
var _data = false;
|
||||
|
||||
@ -10,7 +10,7 @@ function GlancesStats ($http, $q, $rootScope, $timeout, GlancesPluginHelper, REF
|
||||
}
|
||||
|
||||
// load config/limit/arguments and execute stats/views auto refresh
|
||||
this.init = function () {
|
||||
this.init = function (REFRESH_TIME) {
|
||||
var refreshData = function () {
|
||||
return $q.all([
|
||||
getAllStats(),
|
||||
|
17
glances/outputs/static/public/glances.js
vendored
17
glances/outputs/static/public/glances.js
vendored
@ -829,7 +829,7 @@ module.exports = __webpack_require__.p + "9a360c92ce9bda60a8da6389741dcfbf.png";
|
||||
|
||||
|
||||
|
||||
/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_angular___default.a.module("glancesApp", ["glances.config", "cfp.hotkeys"])
|
||||
/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_angular___default.a.module("glancesApp", ["cfp.hotkeys"])
|
||||
|
||||
.value("CONFIG", {})
|
||||
.value("ARGUMENTS", {})
|
||||
@ -845,8 +845,6 @@ module.exports = __webpack_require__.p + "9a360c92ce9bda60a8da6389741dcfbf.png";
|
||||
$rootScope.$on("data_refreshed", function (event, data) {
|
||||
$rootScope.title = `${data.stats.system.hostname} - Glances`;
|
||||
});
|
||||
|
||||
GlancesStats.init();
|
||||
}));
|
||||
|
||||
|
||||
@ -38764,7 +38762,7 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
||||
|
||||
|
||||
|
||||
function GlancesStats ($http, $q, $rootScope, $timeout, GlancesPluginHelper, REFRESH_TIME, CONFIG, ARGUMENTS) {
|
||||
function GlancesStats ($http, $q, $rootScope, $timeout, GlancesPluginHelper, CONFIG, ARGUMENTS) {
|
||||
|
||||
var _data = false;
|
||||
|
||||
@ -38773,7 +38771,7 @@ function GlancesStats ($http, $q, $rootScope, $timeout, GlancesPluginHelper, REF
|
||||
}
|
||||
|
||||
// load config/limit/arguments and execute stats/views auto refresh
|
||||
this.init = function () {
|
||||
this.init = function (REFRESH_TIME) {
|
||||
var refreshData = function () {
|
||||
return $q.all([
|
||||
getAllStats(),
|
||||
@ -39874,7 +39872,10 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
||||
/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_angular___default.a.module("glancesApp").component("glances", {
|
||||
controller: __WEBPACK_IMPORTED_MODULE_1__controller__["a" /* default */],
|
||||
controllerAs: 'vm',
|
||||
templateUrl: __WEBPACK_IMPORTED_MODULE_2__view_html___default.a,
|
||||
bindings: {
|
||||
refreshTime: "<"
|
||||
},
|
||||
templateUrl: __WEBPACK_IMPORTED_MODULE_2__view_html___default.a
|
||||
}));
|
||||
|
||||
|
||||
@ -39890,6 +39891,10 @@ function GlancesController($scope, GlancesStats, hotkeys, ARGUMENTS) {
|
||||
vm.dataLoaded = false;
|
||||
vm.arguments = ARGUMENTS;
|
||||
|
||||
vm.$onInit = function () {
|
||||
GlancesStats.init(vm.refreshTime);
|
||||
};
|
||||
|
||||
$scope.$on('data_refreshed', function (event, data) {
|
||||
vm.hasGpu = data.stats.gpu.length > 0;
|
||||
vm.dataLoaded = true;
|
||||
|
2
glances/outputs/static/public/glances.map.js
vendored
2
glances/outputs/static/public/glances.map.js
vendored
File diff suppressed because one or more lines are too long
@ -8,14 +8,9 @@
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<script type="text/javascript" src="glances.js"></script>
|
||||
<script>
|
||||
angular
|
||||
.module('glances.config', [])
|
||||
.constant('REFRESH_TIME', {{ refresh_time }});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<glances></glances>
|
||||
<glances refresh-time="{{ refresh_time }}"></glances>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user