improvement on infrastructure page

This commit is contained in:
gabryon99 2020-11-20 12:03:57 +01:00
parent e5caeb551b
commit 0fc0a24f51
7 changed files with 87 additions and 44 deletions

View file

@ -2,6 +2,7 @@ $(document).ready(function() {
const MAX_RECIPIENTS = 3;
const DEFAULT_MEASUREMENT = "cicmp";
const INFRASTRUCTURE_ENDPOINT = "/lua/rest/v1/get/system/data.lua";
const getMeasurementRegex = (measurement) => {
switch (measurement) {
@ -378,12 +379,12 @@ $(document).ready(function() {
render: function(href, type, row) {
if (type === 'display') {
if (href == "" || href == undefined) return "";
if(row.alerted) {
return ` ${href} <i class="fas fa-exclamation-triangle" style="color: #f0ad4e;"></i>`
return `${href} <i class="fas fa-exclamation-triangle" style="color: #f0ad4e;"></i>`
}
else {
return `${href}`
}
return href;
}
// The raw data must be returned here for sorting
return(href);
@ -435,7 +436,7 @@ $(document).ready(function() {
},
{
data: 'last_mesurement_time',
className: 'dt-body-right dt-head-center'
className: 'text-center'
},
{
data: 'last_ip',
@ -443,7 +444,7 @@ $(document).ready(function() {
},
{
data: 'last_measure',
className: 'dt-body-right dt-head-center',
className: 'text-center',
sortable: false,
render: function(data, type, row) {
if(type === 'display' || type === 'filter') {

View file

@ -120,6 +120,7 @@
i18n.not_alerted = "{{ i18n("active_monitoring_stats.not_alerted")}}";
i18n.no_recipients = "{{i18n('pools.no_recipients')}}";
i18n.some_recipients = "{{i18n('pools.some_recipients')}}";
i18n.infrastructure = "{{ i18n('infrastructure_dashboard.infrastructure') }}"
let get_host = "{{ am_stats.get_host }}";
let am_csrf = "{{ ntop.getRandomCSRFValue()}}";

View file

@ -72,7 +72,7 @@ local title = i18n("graphs.active_monitoring")
local host_label = ""
if (host ~= nil) then
host_label = "(" .. host.label .. ")"
host_label = ui_utils.format_label_am(host.label)
end
if auth.has_capability(auth.capabilities.active_monitoring) then

View file

@ -12,6 +12,9 @@ local json = require("dkjson")
local plugins_utils = require("plugins_utils")
local am_utils = plugins_utils.loadModule("active_monitoring", "am_utils")
local ui_utils = require("ui_utils")
local active_monitoring_pools = require("active_monitoring_pools")
local am_pool = active_monitoring_pools:create()
local assigned_members = am_pool:get_assigned_members()
@ -89,7 +92,7 @@ for key, am_host in pairs(am_hosts) do
res[#res + 1] = {
key = key,
url = am_host.label,
url = ui_utils.format_label_am(am_host.label),
host = am_host.host,
alerted = alerted,
measurement = am_host.measurement,