mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Fixes with scroll in agents and modules
This commit is contained in:
parent
e2d6b30d51
commit
f6a8fdf085
@ -1,15 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
// Pandora FMS - http://pandorafms.com
|
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||||
// ==================================================
|
/**
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Agent view for mobile
|
||||||
// Please see http://pandorafms.org for full contribution list
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* @category Mobile
|
||||||
// modify it under the terms of the GNU General Public License
|
* @package Pandora FMS
|
||||||
// as published by the Free Software Foundation for version 2.
|
* @subpackage Community
|
||||||
// This program is distributed in the hope that it will be useful,
|
* @version 1.0.0
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* @license See below
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
// GNU General Public License for more details.
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
require_once '../include/functions_users.php';
|
require_once '../include/functions_users.php';
|
||||||
|
|
||||||
class Agent
|
class Agent
|
||||||
@ -41,7 +59,7 @@ class Agent
|
|||||||
var isgentoo = /Gentoo/i.test(navigator.userAgent);
|
var isgentoo = /Gentoo/i.test(navigator.userAgent);
|
||||||
var iscentos = /CentOS/i.test(navigator.userAgent);
|
var iscentos = /CentOS/i.test(navigator.userAgent);
|
||||||
var issuse = /SUSE/i.test(navigator.userAgent);
|
var issuse = /SUSE/i.test(navigator.userAgent);
|
||||||
|
|
||||||
if(!(ismobile) && !(iswindows) && !(ismac) && !(isubuntu) && !(isfedora) && !(isredhat) && !(isdebian) && !(isgentoo) && !(iscentos)
|
if(!(ismobile) && !(iswindows) && !(ismac) && !(isubuntu) && !(isfedora) && !(isredhat) && !(isdebian) && !(isgentoo) && !(iscentos)
|
||||||
&& !(issuse)){
|
&& !(issuse)){
|
||||||
window.location.href = '".$config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$this->id."';
|
window.location.href = '".$config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$this->id."';
|
||||||
@ -256,10 +274,9 @@ class Agent
|
|||||||
SECONDS_1DAY,
|
SECONDS_1DAY,
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
false,
|
|
||||||
true,
|
true,
|
||||||
1,
|
500,
|
||||||
''
|
1
|
||||||
);
|
);
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
@ -1,15 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
// Pandora FMS - http://pandorafms.com
|
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||||
// ==================================================
|
/**
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Agents list view for mobile
|
||||||
// Please see http://pandorafms.org for full contribution list
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* @category Mobile
|
||||||
// modify it under the terms of the GNU General Public License
|
* @package Pandora FMS
|
||||||
// as published by the Free Software Foundation for version 2.
|
* @subpackage Community
|
||||||
// This program is distributed in the hope that it will be useful,
|
* @version 1.0.0
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* @license See below
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
// GNU General Public License for more details.
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
class Agents
|
class Agents
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -67,7 +85,7 @@ class Agents
|
|||||||
|
|
||||||
$listAgents = $this->getListAgents($page, true);
|
$listAgents = $this->getListAgents($page, true);
|
||||||
|
|
||||||
if (!empty($listAgents['agents'])) {
|
if (empty($listAgents['agents']) === false) {
|
||||||
$end = 0;
|
$end = 0;
|
||||||
|
|
||||||
$agents = [];
|
$agents = [];
|
||||||
@ -96,7 +114,7 @@ class Agents
|
|||||||
$system = System::getInstance();
|
$system = System::getInstance();
|
||||||
$user = User::getInstance();
|
$user = User::getInstance();
|
||||||
|
|
||||||
// Default
|
// Default.
|
||||||
$filters = [
|
$filters = [
|
||||||
'free_search' => '',
|
'free_search' => '',
|
||||||
'status' => -1,
|
'status' => -1,
|
||||||
@ -104,7 +122,7 @@ class Agents
|
|||||||
];
|
];
|
||||||
|
|
||||||
$serialized_filters = (string) $system->getRequest('agents_filter');
|
$serialized_filters = (string) $system->getRequest('agents_filter');
|
||||||
if (!empty($serialized_filters)) {
|
if (empty($serialized_filters) === true) {
|
||||||
$filters_unsafe = json_decode(base64_decode($serialized_filters, true), true);
|
$filters_unsafe = json_decode(base64_decode($serialized_filters, true), true);
|
||||||
if ($filters_unsafe) {
|
if ($filters_unsafe) {
|
||||||
$filters = $system->safeInput($filters_unsafe);
|
$filters = $system->safeInput($filters_unsafe);
|
||||||
@ -144,8 +162,8 @@ class Agents
|
|||||||
$filters['group'] = $this->group;
|
$filters['group'] = $this->group;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($filters)) {
|
if (empty($filters) === false) {
|
||||||
// Store the filter
|
// Store the filter.
|
||||||
$this->serializedFilters = base64_encode(json_encode($system->safeOutput($filters)));
|
$this->serializedFilters = base64_encode(json_encode($system->safeOutput($filters)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +278,7 @@ class Agents
|
|||||||
|
|
||||||
$search_sql = '';
|
$search_sql = '';
|
||||||
|
|
||||||
if (!empty($this->free_search)) {
|
if (empty($this->free_search) === false) {
|
||||||
$search_sql = " AND (
|
$search_sql = " AND (
|
||||||
alias LIKE '%".$this->free_search."%'
|
alias LIKE '%".$this->free_search."%'
|
||||||
OR nombre LIKE '%".$this->free_search."%'
|
OR nombre LIKE '%".$this->free_search."%'
|
||||||
@ -461,15 +479,13 @@ class Agents
|
|||||||
"<script type=\"text/javascript\">
|
"<script type=\"text/javascript\">
|
||||||
var load_more_rows = 1;
|
var load_more_rows = 1;
|
||||||
var page = 1;
|
var page = 1;
|
||||||
|
|
||||||
function custom_scroll() {
|
function custom_scroll() {
|
||||||
|
|
||||||
if (load_more_rows) {
|
if (load_more_rows) {
|
||||||
if ($(this).scrollTop() + $(this).height()
|
if ($(this).scrollTop() + $(this).height()
|
||||||
>= ($(document).height() - 100)) {
|
>= ($(document).height() - 100)) {
|
||||||
|
|
||||||
load_more_rows = 0;
|
load_more_rows = 0;
|
||||||
|
|
||||||
postvars = {};
|
postvars = {};
|
||||||
postvars[\"action\"] = \"ajax\";
|
postvars[\"action\"] = \"ajax\";
|
||||||
postvars[\"parameter1\"] = \"agents\";
|
postvars[\"parameter1\"] = \"agents\";
|
||||||
@ -479,7 +495,7 @@ class Agents
|
|||||||
postvars[\"free_search\"] = $(\"input[name='free_search']\").val();
|
postvars[\"free_search\"] = $(\"input[name='free_search']\").val();
|
||||||
postvars[\"page\"] = page;
|
postvars[\"page\"] = page;
|
||||||
page++;
|
page++;
|
||||||
|
|
||||||
$.post(\"index.php\",
|
$.post(\"index.php\",
|
||||||
postvars,
|
postvars,
|
||||||
function (data) {
|
function (data) {
|
||||||
@ -499,23 +515,26 @@ class Agents
|
|||||||
\"<td class='cell_6'>\" + agent[8] + \"</td>\" +
|
\"<td class='cell_6'>\" + agent[8] + \"</td>\" +
|
||||||
\"</tr>\");
|
\"</tr>\");
|
||||||
});
|
});
|
||||||
|
|
||||||
load_more_rows = 1;
|
load_more_rows = 1;
|
||||||
refresh_link_listener_list_agents();
|
refresh_link_listener_list_agents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
\"json\");
|
\"json\");
|
||||||
|
// Clean
|
||||||
|
$('#loading_rows').remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
// Be sure of fill all of screen first.
|
||||||
|
custom_scroll();
|
||||||
|
|
||||||
$(window).bind(\"scroll\", function () {
|
$(window).bind(\"scroll\", function () {
|
||||||
custom_scroll();
|
custom_scroll();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).on(\"touchmove\", function(event) {
|
$(window).on(\"touchmove\", function(event) {
|
||||||
custom_scroll();
|
custom_scroll();
|
||||||
});
|
});
|
||||||
|
@ -1,15 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
// Pandora FMS - http://pandorafms.com
|
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||||
// ==================================================
|
/**
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
* Modules list view for mobile
|
||||||
// Please see http://pandorafms.org for full contribution list
|
*
|
||||||
// This program is free software; you can redistribute it and/or
|
* @category Mobile
|
||||||
// modify it under the terms of the GNU General Public License
|
* @package Pandora FMS
|
||||||
// as published by the Free Software Foundation for version 2.
|
* @subpackage Community
|
||||||
// This program is distributed in the hope that it will be useful,
|
* @version 1.0.0
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* @license See below
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
*
|
||||||
// GNU General Public License for more details.
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Begin.
|
||||||
class Modules
|
class Modules
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -106,7 +124,7 @@ class Modules
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($filters['status'])) {
|
if (isset($filters['status'])) {
|
||||||
$this->status = $filters['status'];
|
$this->status = (int) $filters['status'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($filters['name'])) {
|
if (isset($filters['name'])) {
|
||||||
@ -143,7 +161,7 @@ class Modules
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->status = $system->getRequest('status', __('Status'));
|
$this->status = $system->getRequest('status', __('Status'));
|
||||||
if (($this->status === __('Status')) || ($this->status == AGENT_MODULE_STATUS_ALL)) {
|
if (($this->status === __('Status')) || ((int) $this->status === AGENT_MODULE_STATUS_ALL)) {
|
||||||
$this->status = AGENT_MODULE_STATUS_ALL;
|
$this->status = AGENT_MODULE_STATUS_ALL;
|
||||||
} else {
|
} else {
|
||||||
$this->default = false;
|
$this->default = false;
|
||||||
@ -390,35 +408,28 @@ class Modules
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Part SQL fro Status
|
// Part SQL fro Status
|
||||||
if ($this->status == AGENT_MODULE_STATUS_NORMAL) {
|
if ((int) $this->status == AGENT_MODULE_STATUS_NORMAL) {
|
||||||
// Normal
|
// Normal.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado = 0
|
$sql_conditions .= ' AND tagente_estado.estado = 0
|
||||||
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ';
|
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ';
|
||||||
} else if ($this->status == AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
} else if ((int) $this->status === AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
||||||
// Critical
|
// Critical.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0';
|
$sql_conditions .= ' AND tagente_estado.estado = 1 AND utimestamp > 0';
|
||||||
} else if ($this->status == AGENT_MODULE_STATUS_WARNING) {
|
} else if ((int) $this->status === AGENT_MODULE_STATUS_WARNING) {
|
||||||
// Warning
|
// Warning.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0';
|
$sql_conditions .= ' AND tagente_estado.estado = 2 AND utimestamp > 0';
|
||||||
} else if ($this->status == AGENT_MODULE_STATUS_NOT_NORMAL) {
|
} else if ((int) $this->status === AGENT_MODULE_STATUS_NOT_NORMAL) {
|
||||||
// Not normal
|
// Not normal.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado <> 0';
|
$sql_conditions .= ' AND tagente_estado.estado <> 0';
|
||||||
} else if ($this->status == AGENT_MODULE_STATUS_UNKNOWN) {
|
} else if ((int) $this->status === AGENT_MODULE_STATUS_UNKNOWN) {
|
||||||
// Unknown
|
// Unknown.
|
||||||
$sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0';
|
$sql_conditions .= ' AND tagente_estado.estado = 3 AND tagente_estado.utimestamp <> 0';
|
||||||
} else if ($this->status == AGENT_MODULE_STATUS_NOT_INIT) {
|
} else if ((int) $this->status === AGENT_MODULE_STATUS_NOT_INIT) {
|
||||||
// Not init
|
// Not init.
|
||||||
$sql_conditions .= ' AND tagente_estado.utimestamp = 0
|
$sql_conditions .= ' AND tagente_estado.utimestamp = 0
|
||||||
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)';
|
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->status != AGENT_MODULE_STATUS_NOT_INIT) {
|
|
||||||
// When filter is not "not init"
|
|
||||||
// Not show not init modules. It's only operation view
|
|
||||||
$sql_conditions .= ' AND (tagente_estado.utimestamp != 0
|
|
||||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->tag > 0) {
|
if ($this->tag > 0) {
|
||||||
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
$sql_conditions .= ' AND tagente_modulo.id_agente_modulo IN (
|
||||||
SELECT ttag_module.id_agente_modulo
|
SELECT ttag_module.id_agente_modulo
|
||||||
@ -435,7 +446,7 @@ class Modules
|
|||||||
SELECT ttag_module.id_tag
|
SELECT ttag_module.id_tag
|
||||||
FROM ttag_module
|
FROM ttag_module
|
||||||
WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo))
|
WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo))
|
||||||
AS tags,
|
AS tags,
|
||||||
tagente_modulo.id_agente_modulo,
|
tagente_modulo.id_agente_modulo,
|
||||||
tagente.intervalo AS agent_interval,
|
tagente.intervalo AS agent_interval,
|
||||||
tagente.nombre AS agent_name,
|
tagente.nombre AS agent_name,
|
||||||
@ -476,6 +487,7 @@ class Modules
|
|||||||
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo'.$sql_conditions_all;
|
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo'.$sql_conditions_all;
|
||||||
|
|
||||||
$sql_limit = 'ORDER BY tagente.nombre ASC ';
|
$sql_limit = 'ORDER BY tagente.nombre ASC ';
|
||||||
|
|
||||||
if (!$this->all_modules) {
|
if (!$this->all_modules) {
|
||||||
$sql_limit = ' LIMIT '.(int) ($page * $system->getPageSize()).','.(int) $system->getPageSize();
|
$sql_limit = ' LIMIT '.(int) ($page * $system->getPageSize()).','.(int) $system->getPageSize();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user