resolved conflict

This commit is contained in:
Daniel Maya 2023-01-27 10:02:14 +01:00
commit d687524016
71 changed files with 12577 additions and 15643 deletions

View File

@ -285,11 +285,16 @@ server_dependencies=" \
java \ java \
bind-utils \ bind-utils \
whois \ whois \
cpanminus \
http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \ http://firefly.artica.es/centos7/xprobe2-0.3-12.2.x86_64.rpm \
http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \ http://firefly.artica.es/centos7/wmic-1.4-1.el7.x86_64.rpm \
https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm" https://firefly.artica.es/centos7/pandorawmic-1.0.0-1.x86_64.rpm"
execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies"
# install cpan dependencies
execute_cmd "cpanm -i Thread::Semaphore" "Installing Thread::Semaphore"
# SDK VMware perl dependencies # SDK VMware perl dependencies
vmware_dependencies=" \ vmware_dependencies=" \
http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \ http://firefly.artica.es/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \

View File

@ -4,7 +4,7 @@
####################################################### #######################################################
## Tested versions ## ## Tested versions ##
# Centos 8.4, 8.5 # Centos 8.4, 8.5
# Rocky 8.4, 8.5 # Rocky 8.4, 8.5, 8.6, 8.7
# Almalinuz 8.4, 8.5 # Almalinuz 8.4, 8.5
# RedHat 8.5 # RedHat 8.5
@ -14,24 +14,25 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='202209231' S_VERSION='202301251'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
[ "$TZ" ] || TZ="Europe/Madrid" [ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=57 [ "$MYVER" ] || MYVER=57
[ "$PHPVER" ] || PHPVER=8 [ "$PHPVER" ] || PHPVER=8
[ "$DBHOST" ] || DBHOST=127.0.0.1 [ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora [ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora [ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora [ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306 [ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root [ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora [ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0 [ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0 [ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") [ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
[ "$PANDORA_BETA" ] || PANDORA_BETA=0 [ "$PANDORA_BETA" ] || PANDORA_BETA=0
# Ansi color code variables # Ansi color code variables
@ -41,7 +42,6 @@ cyan="\e[0;36m"
reset="\e[0m" reset="\e[0m"
# Functions # Functions
execute_cmd () { execute_cmd () {
local cmd="$1" local cmd="$1"
local msg="$2" local msg="$2"
@ -76,7 +76,7 @@ check_cmd_status () {
check_pre_pandora () { check_pre_pandora () {
echo -en "${cyan}Checking environment ... ${reset}" echo -en "${cyan}Checking environment ... ${reset}"
rpm -qa | grep 'pandorafms_' &>> /dev/null && local fail=true rpm -qa | grep -v "pandorawmic" | grep 'pandorafms_' &>> /dev/null && local fail=true
[ -d "$PANDORA_CONSOLE" ] && local fail=true [ -d "$PANDORA_CONSOLE" ] && local fail=true
[ -f /usr/bin/pandora_server ] && local fail=true [ -f /usr/bin/pandora_server ] && local fail=true
@ -137,7 +137,10 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora [ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM #advicing BETA PROGRAM
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}" INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
echo -e $INSTALLING_VER
# Connectivity # Connectivity
check_repo_connection check_repo_connection
@ -467,6 +470,8 @@ query_cache_size = 64M
query_cache_min_res_unit = 2k query_cache_min_res_unit = 2k
query_cache_limit = 256K query_cache_limit = 256K
#skip-log-bin
sql_mode="" sql_mode=""
[mysqld_safe] [mysqld_safe]
@ -477,6 +482,7 @@ EO_CONFIG_F
if [ "$MYVER" -eq '80' ] ; then if [ "$MYVER" -eq '80' ] ; then
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf
fi fi
execute_cmd "systemctl restart mysqld" "Configuring database engine" execute_cmd "systemctl restart mysqld" "Configuring database engine"
@ -485,11 +491,18 @@ fi
export MYSQL_PWD=$DBPASS export MYSQL_PWD=$DBPASS
#Define packages #Define packages
if [ "$PANDORA_BETA" -eq '0' ] ; then if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_BETA" -ne '0' ] ; then fi
# if beta is enable
if [ "$PANDORA_BETA" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"

View File

@ -16,7 +16,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy WORKDIR=/opt/pandora/deploy
S_VERSION='2022052501' S_VERSION='202301251'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start rm -f $LOGFILE &> /dev/null # remove last log before start
@ -34,6 +34,8 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0 [ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g") [ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$PANDORA_BETA" ] || PANDORA_BETA=0 [ "$PANDORA_BETA" ] || PANDORA_BETA=0
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
# Ansi color code variables # Ansi color code variables
red="\e[0;91m" red="\e[0;91m"
@ -134,7 +136,10 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora [ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM #advicing BETA PROGRAM
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}" INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
echo -e $INSTALLING_VER
# Connectivity # Connectivity
check_repo_connection check_repo_connection
@ -272,14 +277,19 @@ echo -en "${cyan}Installing phantomjs...${reset}"
/usr/bin/phantomjs --version &>> "$LOGFILE" /usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs" check_cmd_status "Error Installing phanromjs"
# create symlink for fping
rm -f /usr/sbin/fping &>> "$LOGFILE"
ln -s /usr/bin/fping /usr/sbin/fping &>> "$LOGFILE"
# Chrome # Chrome
rm -f /usr/bin/chromium-browser &>> "$LOGFILE"
execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome" execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome"
execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome" execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome"
execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink" execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink"
# SDK VMware perl dependencies # SDK VMware perl dependencies
vmware_dependencies=" \ vmware_dependencies="\
lib32z1 \ lib32z1 \
lib32z1 \ lib32z1 \
build-essential \ build-essential \
uuid uuid-dev \ uuid uuid-dev \
@ -350,16 +360,22 @@ systemctl stop apparmor &>> "$LOGFILE"
systemctl disable apparmor &>> "$LOGFILE" systemctl disable apparmor &>> "$LOGFILE"
#install mysql #install mysql
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password password $DBROOTPASS") &>> "$LOGFILE" execute_cmd "curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb" "Downloading Percona repository for MySQL8"
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password_again password $DBROOTPASS") &>> "$LOGFILE" execute_cmd "apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb" "Installing Percona repository for MySQL8"
echo -en "${cyan}Installing MySql Server...${reset}" execute_cmd "percona-release setup ps80" "Configuring Percona repository for MySQL8"
env DEBIAN_FRONTEND=noninteractive apt install -y mysql-server &>> "$LOGFILE"
echo -en "${cyan}Installing Percona Server for MySQL8...${reset}"
env DEBIAN_FRONTEND=noninteractive apt install -y percona-server-server &>> "$LOGFILE"
check_cmd_status "Error Installing MySql Server" check_cmd_status "Error Installing MySql Server"
#Configuring Database #Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysql" "Starting database engine" execute_cmd "systemctl start mysql" "Starting database engine"
echo """
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DBROOTPASS';
""" | mysql -uroot &>> "$LOGFILE"
export MYSQL_PWD=$DBROOTPASS export MYSQL_PWD=$DBROOTPASS
echo -en "${cyan}Creating Pandora FMS database...${reset}" echo -en "${cyan}Creating Pandora FMS database...${reset}"
@ -399,11 +415,12 @@ max_connections = 100
key_buffer_size=4M key_buffer_size=4M
read_buffer_size=128K read_buffer_size=128K
read_rnd_buffer_size=128K read_rnd_buffer_size=128K
sort_buffer_size=128K sort_buffer_size=128K
join_buffer_size=4M join_buffer_size=4M
skip-log-bin
sql_mode="" sql_mode=""
log-error=/var/log/mysql/error.log log-error=/var/log/mysql/error.log
@ -417,11 +434,17 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin
#Define packages #Define packages
if [ "$PANDORA_BETA" -eq '0' ] ; then if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_agent_linux-7.0NG.tar.gz"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
elif [ "$PANDORA_BETA" -ne '0' ] ; then fi
if [ "$PANDORA_BETA" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz" [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz" [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.768-230123 Version: 7.0NG.768-230127
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.768-230123" pandora_version="7.0NG.768-230127"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.768'; use constant AGENT_VERSION => '7.0NG.768';
use constant AGENT_BUILD => '230123'; use constant AGENT_BUILD => '230127';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.768 %define version 7.0NG.768
%define release 230123 %define release 230127
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.768 %define version 7.0NG.768
%define release 230123 %define release 230127
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.768" PI_VERSION="7.0NG.768"
PI_BUILD="230123" PI_BUILD="230127"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{230123} {230127}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.768 Build 230123") #define PANDORA_VERSION ("7.0NG.768 Build 230127")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.768(Build 230123))" VALUE "ProductVersion", "(7.0NG.768(Build 230127))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.768-230123 Version: 7.0NG.768-230127
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.768-230123" pandora_version="7.0NG.768-230127"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -0,0 +1,14 @@
START TRANSACTION;
CREATE TABLE IF NOT EXISTS `tsesion_filter` (
`id_filter` INT NOT NULL AUTO_INCREMENT,
`id_name` TEXT NULL,
`text` TEXT NULL,
`period` TEXT NULL,
`ip` TEXT NULL,
`type` TEXT NULL,
`user` TEXT NULL,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;

Binary file not shown.

Binary file not shown.

View File

@ -1283,9 +1283,13 @@ foreach ($modules as $module) {
} }
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
// Check module relatonships to show warning message.
$url = htmlentities('index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo']);
// Delete module. // Delete module.
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'" $data[9] = '<a href="#"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'; onClick="get_children_modules(false, \''.$module['id_agente_modulo'].'\', \''.$url.'\')">';
$data[9] .= html_print_image( $data[9] .= html_print_image(
'images/cross.png', 'images/cross.png',
true, true,
@ -1309,8 +1313,7 @@ foreach ($modules as $module) {
} }
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module" echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module" id="form_multiple_delete">';
onsubmit="if (! confirm (\''.__('Are you sure?').'\')) return false">';
} }
html_print_table($table); html_print_table($table);
@ -1344,6 +1347,8 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
false, false,
'class="sub next"' 'class="sub next"'
); );
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';
} }
@ -1352,7 +1357,18 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
<script type="text/javascript"> <script type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
$("input[name=submit_modules_action]").click(function (event) {
event.preventDefault();
var module_action = $('#module_action').val();
if(module_action !== 'delete') {
$("#form_multiple_delete").submit();
} else {
get_children_modules(true);
}
});
$('[id^=checkbox-id_delete]').change(function(){ $('[id^=checkbox-id_delete]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){ if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected'); $(this).parent().parent().removeClass('checkselected');
@ -1394,4 +1410,60 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
window.location = window.location + "&checked=true"; window.location = window.location + "&checked=true";
} }
} }
function get_children_modules(multiple, id_module, url) {
var selected_modules = [];
if(typeof(id_module) === 'undefined' && multiple === true) {
$("input[id^='checkbox-id_delete']:checked").each(function () {
selected_modules.push(this.value);
});
} else {
selected_modules = [id_module];
}
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
data: {
page: 'include/ajax/module',
get_children_modules: true,
parent_modulues: JSON.parse(JSON.stringify(selected_modules)),
},
success: function (data) {
delete_module_warning(data, multiple, id_module, url);
}
});
}
function delete_module_warning(children, multiple, id_module, url) {
var message = '<?php echo __('Are you sure?'); ?>';
var ret = false;
if(children != false) {
message += '<br><strong>' + '<?php echo __('This module has children modules.The following modules will also be deleted: '); ?>' + '</strong><ul>';
$.each(children, function (key, value) {
message += '<li>' + value['nombre'] + '</li>';
});
message += '</ul>';
}
confirmDialog({
title: "<?php echo __('Delete module'); ?>",
message: message,
onAccept: function() {
if(multiple === true) {
$("#form_multiple_delete").submit();
return true;
} else {
window.location.href = url;
}
}
});
return true;
}
</script> </script>

View File

@ -290,7 +290,7 @@ $search_text = (string) get_parameter('search_text');
$date_from = (string) get_parameter('date_from'); $date_from = (string) get_parameter('date_from');
$date_to = (string) get_parameter('date_to'); $date_to = (string) get_parameter('date_to');
$execution_type = (string) get_parameter('execution_type'); $execution_type = (string) get_parameter('execution_type');
$show_archived = (bool) get_parameter('archived'); $show_archived = (bool) get_parameter_switch('archived', false);
$agent_id = (int) get_parameter('agent_id'); $agent_id = (int) get_parameter('agent_id');
$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : ''); $agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
$module_id = (int) get_parameter('module_name_hidden'); $module_id = (int) get_parameter('module_name_hidden');
@ -313,12 +313,20 @@ $table_form = new StdClass();
$table_form->class = 'databox filters'; $table_form->class = 'databox filters';
$table_form->width = '100%'; $table_form->width = '100%';
$table_form->rowstyle = []; $table_form->rowstyle = [];
$table_form->cellstyle[0] = ['width: 100px;'];
$table_form->cellstyle[1] = ['width: 100px;'];
$table_form->cellstyle[1][2] = 'display: flex; align-items: center;';
$table_form->cellstyle[2] = ['width: 100px;'];
$table_form->cellstyle[3] = ['text-align: right;'];
$table_form->colspan[3][0] = 3;
$table_form->data = []; $table_form->data = [];
$row = []; $row = [];
// Search text. // Search text.
$row[] = __('Search').'&nbsp;'.html_print_input_text( $row[] = __('Search');
$row[] = html_print_input_text(
'search_text', 'search_text',
$search_text, $search_text,
'', '',
@ -356,7 +364,8 @@ $execution_type_fields = [
'periodically' => __('Periodically'), 'periodically' => __('Periodically'),
'cron' => __('Cron'), 'cron' => __('Cron'),
]; ];
$row[] = __('Execution type').'&nbsp;'.html_print_select( $row[] = __('Execution type');
$row[] = html_print_select(
$execution_type_fields, $execution_type_fields,
'execution_type', 'execution_type',
$execution_type, $execution_type,
@ -368,11 +377,11 @@ $row[] = __('Execution type').'&nbsp;'.html_print_select(
false false
); );
// Show past downtimes. // Show past downtimes.
$row[] = __('Show past downtimes').'&nbsp;'.html_print_checkbox( $row[] = __('Show past downtimes').'&nbsp;&nbsp;&nbsp;&nbsp;'.html_print_switch(
'archived', [
1, 'name' => 'archived',
$show_archived, 'value' => $show_archived,
true ]
); );
$table_form->data[] = $row; $table_form->data[] = $row;
@ -388,8 +397,8 @@ $params['return'] = true;
$params['print_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id; $params['hidden_input_idagent_value'] = $agent_id;
$agent_input = __('Agent').'&nbsp;'.ui_print_agent_autocomplete_input($params); $row[] = __('Agent');
$row[] = $agent_input; $row[] = ui_print_agent_autocomplete_input($params);
// Module. // Module.
$row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules( $row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules(
@ -402,6 +411,10 @@ $row[] = __('Module').'&nbsp;'.html_print_autocomplete_modules(
true true
); );
$table_form->data[] = $row;
$row = [];
$row[] = html_print_submit_button( $row[] = html_print_submit_button(
__('Search'), __('Search'),
'search', 'search',

View File

@ -177,7 +177,7 @@ switch ($activeTab) {
$background_color = (string) get_parameter('background_color'); $background_color = (string) get_parameter('background_color');
$width = (int) get_parameter('width'); $width = (int) get_parameter('width');
$height = (int) get_parameter('height'); $height = (int) get_parameter('height');
$visualConsoleName = (string) get_parameter('name'); $visualConsoleName = io_safe_input((string) get_parameter('name'));
$is_favourite = (int) get_parameter('is_favourite_sent'); $is_favourite = (int) get_parameter('is_favourite_sent');
$auto_adjust = (int) get_parameter('auto_adjust_sent'); $auto_adjust = (int) get_parameter('auto_adjust_sent');

View File

@ -1353,11 +1353,8 @@ $values = [
'Alert detail' => __('Alert detail'), 'Alert detail' => __('Alert detail'),
'External link' => __('External link'), 'External link' => __('External link'),
'Other' => __('Other'), 'Other' => __('Other'),
'Dashboard' => __('Dashboard'),
]; ];
if (!is_metaconsole()) {
$values['Dashboard'] = __('Dashboard');
}
$home_screen .= html_print_select( $home_screen .= html_print_select(
$values, $values,
@ -1372,7 +1369,14 @@ $home_screen .= html_print_select(
).'</div>'; ).'</div>';
$dashboards = Manager::getDashboards(-1, -1); $dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$id_usr
);
$dashboards_aux = []; $dashboards_aux = [];
if ($dashboards === false) { if ($dashboards === false) {
$dashboards = ['None' => 'None']; $dashboards = ['None' => 'None'];

View File

@ -333,6 +333,7 @@ if ($delete_user === true) {
$result = delete_user($id_user); $result = delete_user($id_user);
if ($result) { if ($result) {
delete_session_user($id_user);
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_USER_MANAGEMENT, AUDIT_LOG_USER_MANAGEMENT,
__('Deleted user %s', io_safe_output($id_user)) __('Deleted user %s', io_safe_output($id_user))

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 KiB

View File

@ -721,7 +721,7 @@ if ($get_agent_alerts_datatable === true) {
} }
break; break;
case 'lastFired': case 'last_fired':
switch ($sort) { switch ($sort) {
case 'asc': case 'asc':
$selectLastFiredasc = $selected; $selectLastFiredasc = $selected;

View File

@ -0,0 +1,457 @@
<?php
/**
* Manage AJAX response for event pages.
*
* @category Ajax
* @package Pandora FMS
* @subpackage Events
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 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.
global $config;
enterprise_include_once('include/functions_audit.php');
// Check access.
check_login();
if (! check_acl($config['id_user'], 0, 'ER')
&& ! check_acl($config['id_user'], 0, 'EW')
&& ! check_acl($config['id_user'], 0, 'EM')
) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access event viewer'
);
include 'general/noaccess.php';
return;
}
$save_filter_modal = get_parameter('save_filter_modal', 0);
$load_filter_modal = get_parameter('load_filter_modal', 0);
$get_filter_values = get_parameter('get_filter_values', 0);
$update_log_filter = get_parameter('update_log_filter', 0);
$save_log_filter = get_parameter('save_log_filter', 0);
$recover_aduit_log_select = get_parameter('recover_aduit_log_select', 0);
// Saves an event filter.
if ($save_log_filter) {
$values = [];
$values['id_name'] = get_parameter('id_name');
$values['text'] = get_parameter('text', '');
$values['period'] = get_parameter('period', '');
$values['ip'] = get_parameter('ip', '');
$values['type'] = get_parameter('type', -1);
$values['user'] = get_parameter('user', -1);
$exists = (bool) db_get_value_filter(
'id_filter',
'tsesion_filter',
['id_name' => $values['id_name']]
);
if ($exists) {
echo 'duplicate';
} else {
$result = db_process_sql_insert('tsesion_filter', $values);
if ($result === false) {
echo 'error';
} else {
echo $result;
}
}
}
if ($recover_aduit_log_select) {
echo json_encode(audit_get_audit_filter_select());
}
if ($update_log_filter) {
$values = [];
$id = get_parameter('id');
$values['text'] = get_parameter('text', '');
$values['period'] = get_parameter('period', '');
$values['ip'] = get_parameter('ip', '');
$values['type'] = get_parameter('type', -1);
$values['user'] = get_parameter('user', -1);
$result = db_process_sql_update(
'tsesion_filter',
$values,
['id_filter' => $id]
);
if ($result === false) {
echo 'error';
} else {
echo 'ok';
}
}
if ($get_filter_values) {
$id_filter = get_parameter('id');
$event_filter = audit_get_audit_log_filter($id_filter);
echo json_encode($event_filter);
}
if ($load_filter_modal) {
$filters = audit_get_audit_filter_select();
$user_groups_array = users_get_groups_for_select(
$config['id_user'],
$access,
true,
true,
false
);
echo '<div id="load-filter-select" class="load-filter-modal">';
$table = new StdClass;
$table->id = 'load_filter_form';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->class = 'databox';
if (is_metaconsole()) {
$table->cellspacing = 0;
$table->cellpadding = 0;
$table->class = 'databox filters';
}
$table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
$filter_id_width = '200px';
if (is_metaconsole()) {
$filter_id_width = '150px';
}
$data = [];
$table->rowid[3] = 'update_filter_row1';
$data[0] = __('Load filter').$jump;
$data[0] .= html_print_select(
$filters,
'filter_id',
'',
'',
__('None'),
0,
true,
false,
true,
'',
false,
'margin-left:5px; width:'.$filter_id_width.';'
);
$data[1] = html_print_submit_button(
__('Load filter'),
'load_filter',
false,
'class="sub upd" onclick="load_filter_values()"',
true
);
$data[1] .= html_print_input_hidden('load_filter', 1, true);
$table->data[] = $data;
$table->rowclass[] = '';
html_print_table($table);
echo '</div>';
?>
<script type="text/javascript">
function show_filter() {
$("#load-filter-select").dialog({
resizable: true,
draggable: true,
modal: false,
closeOnEscape: true,
width: 450
});
}
function load_filter_values() {
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
dataType: 'json',
data: {
page: 'include/ajax/audit_log',
get_filter_values: 1,
"id" : $('#filter_id :selected').val()
},
success: function(data) {
var options = "";
$.each(data,function(i,value){
if (i == 'text'){
$("#text-filter_text").val(value);
}
if (i == 'period'){
$("#text-filter_period").val(value);
}
if (i == 'ip'){
$("#text-filter_ip").val(value);
}
if (i == 'type'){
$("#filter_type").val(value).change();
}
if (i == 'user'){
$("#filter_user").val(value).change();
}
});
}
});
// Close dialog.
$("#load-filter-select").dialog('close');
}
$(document).ready (function() {
show_filter();
})
</script>
<?php
return;
}
if ($save_filter_modal) {
echo '<div id="save-filter-select" style="width:350px;">';
if (check_acl($config['id_user'], 0, 'EW') === 1 || check_acl($config['id_user'], 0, 'EM') === 1) {
echo '<div id="info_box"></div>';
$table = new StdClass;
$table->id = 'save_filter_form';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->class = 'databox';
if (is_metaconsole()) {
$table->class = 'databox filters';
$table->cellspacing = 0;
$table->cellpadding = 0;
}
$table->styleTable = 'font-weight: bold; text-align:left;';
if (!is_metaconsole()) {
$table->style[0] = 'width: 50%; width:50%;';
}
$data = [];
$table->rowid[0] = 'update_save_selector';
$data[0] = html_print_radio_button(
'filter_mode',
'new',
__('New filter'),
true,
true
);
$data[1] = html_print_radio_button(
'filter_mode',
'update',
__('Update filter'),
false,
true
);
$table->data[] = $data;
$table->rowclass[] = '';
$data = [];
$table->rowid[1] = 'save_filter_row1';
$data[0] = __('Filter name').$jump;
$data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
$data[1] = html_print_submit_button(
__('Save filter'),
'save_filter',
false,
'class="sub wand" onclick="save_new_filter();"',
true
);
$table->data[] = $data;
$table->rowclass[] = '';
$data = [];
$table->rowid[2] = 'save_filter_row2';
$table->data[] = $data;
$table->rowclass[] = '';
$data = [];
$table->rowid[3] = 'update_filter_row1';
$data[0] = __('Overwrite filter').$jump;
$_filters_update = audit_get_audit_filter_select();
$data[0] .= html_print_select(
$_filters_update,
'overwrite_filter',
'',
'',
'',
0,
true
);
$data[1] = html_print_submit_button(
__('Update filter'),
'update_filter',
false,
'class="sub upd" onclick="save_update_filter();"',
true
);
$table->data[] = $data;
$table->rowclass[] = '';
html_print_table($table);
} else {
include 'general/noaccess.php';
}
echo '</div>';
?>
<script type="text/javascript">
function show_save_filter() {
$('#save_filter_row1').show();
$('#save_filter_row2').show();
$('#update_filter_row1').hide();
// Filter save mode selector
$("[name='filter_mode']").click(function() {
if ($(this).val() == 'new') {
$('#save_filter_row1').show();
$('#save_filter_row2').show();
$('#submit-save_filter').show();
$('#update_filter_row1').hide();
}
else {
$('#save_filter_row1').hide();
$('#save_filter_row2').hide();
$('#update_filter_row1').show();
$('#submit-save_filter').hide();
}
});
$("#save-filter-select").dialog({
resizable: true,
draggable: true,
modal: false,
closeOnEscape: true
});
}
function save_new_filter() {
// If the filter name is blank show error
if ($('#text-id_name').val() == '') {
$('#info_box').html("<h3 class='error'><?php echo __('Filter name cannot be left blank'); ?></h3>");
return false;
}
var id_filter_save;
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
{
"page" : "include/ajax/audit_log",
"save_log_filter" : 1,
"id_name" : $("#text-id_name").val(),
"text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(),
"ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(),
},
function (data) {
$("#info_box").hide();
if (data == 'error') {
$("#info_box").filter(function(i, item) {
if ($(item).data('type_info_box') == "error_create_filter") {
return true;
}
else
return false;
}).show();
} else if (data == 'duplicate') {
$('#info_box').html("<h3 class='error'><?php echo __('Filter name already on use'); ?></h3>");
$('#info_box').show();
} else {
// Close dialog.
$("#save-filter-select").dialog('close');
}
}
);
}
// This updates an event filter
function save_update_filter() {
var id_filter_update = $("#overwrite_filter").val();
var name_filter_update = $("#overwrite_filter option[value='"+id_filter_update+"']").text();
jQuery.post ("<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
{"page" : "include/ajax/audit_log",
"update_log_filter" : 1,
"id" : $("#overwrite_filter :selected").val(),
"text" : $("#text-filter_text").val(),
"period" : $("#text-filter_period").val(),
"ip" : $('#text-filter_ip').val(),
"type" : $('#filter_type :selected').val(),
"user" : $('#filter_user :selected').val(),
},
function (data) {
$(".info_box").hide();
if (data == 'ok') {
$(".info_box").filter(function(i, item) {
if ($(item).data('type_info_box') == "success_update_filter") {
return true;
}
else
return false;
}).show();
}
else {
$(".info_box").filter(function(i, item) {
if ($(item).data('type_info_box') == "error_create_filter") {
return true;
}
else
return false;
}).show();
}
});
// Close dialog
$('.ui-dialog-titlebar-close').trigger('click');
return false;
}
$(document).ready(function (){
show_save_filter();
});
</script>
<?php
return;
}

View File

@ -1515,9 +1515,37 @@ if ($change_status === true) {
} }
if ($get_Acknowledged === true) { if ($get_Acknowledged === true) {
$event_id = get_parameter('event_id'); $event_id = (int) get_parameter('event_id', 0);
echo events_page_general_acknowledged($event_id); $server_id = (int) get_parameter('server_id', 0);
return;
$return = '';
try {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node = new Node($server_id);
$node->connect();
}
echo events_page_general_acknowledged($event_id);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
$return = false;
} finally {
if (is_metaconsole() === true
&& $server_id > 0
) {
$node->disconnect();
}
}
return $return;
} }
if ($change_owner === true) { if ($change_owner === true) {

View File

@ -340,7 +340,7 @@ if (is_ajax() === true) {
// Group. // Group.
$secondary_groups = ''; $secondary_groups = '';
$secondary = agents_get_secondary_groups($data['id_agente']); $secondary = enterprise_hook('agents_get_secondary_groups', [$data['id_agente']]);
if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) { if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) {
$secondary_groups = implode(', ', $secondary['for_select']); $secondary_groups = implode(', ', $secondary['for_select']);
$secondary_groups = ', '.$secondary_groups; $secondary_groups = ', '.$secondary_groups;
@ -353,19 +353,26 @@ if (is_ajax() === true) {
// Events. // Events.
echo '<div class="div-dialog">'; $result_graph_event = enterprise_hook(
echo graph_graphic_agentevents( 'graph_graphic_agentevents',
$id, [
100, $id,
40, 100,
SECONDS_1DAY, 40,
'', SECONDS_1DAY,
true, '',
false, true,
false, false,
1 false,
1,
]
); );
echo '</div>';
if ($result_graph_event !== -1) {
echo '<div class="div-dialog">';
echo $result_graph_event;
echo '</div>';
}
break; break;
} }
} }

View File

@ -61,6 +61,8 @@ if (check_login()) {
0 0
); );
$get_children_modules = (bool) get_parameter('get_children_modules', false);
$get_data_dataMatrix = (bool) get_parameter( $get_data_dataMatrix = (bool) get_parameter(
'get_data_dataMatrix', 'get_data_dataMatrix',
0 0
@ -1629,4 +1631,36 @@ if (check_login()) {
return; return;
} }
if ($get_children_modules === true) {
$parent_modules = get_parameter('parent_modulues', false);
$children_selected = [];
if ($parent_modules === false) {
$children_selected = false;
} else {
foreach ($parent_modules as $parent) {
$child_modules = get_children_module($parent_modules, ['nombre', 'id_agente_modulo'], true);
if ((bool) $child_modules === false) {
continue;
}
foreach ($child_modules as $child) {
$module_exist = in_array($child['id_agente_modulo'], $parent_modules);
$child_exist = in_array($child, $children_selected);
if ($module_exist === false && $child_exist === false) {
array_push($children_selected, $child);
}
}
}
}
if (empty($children_selected) === true) {
$children_selected = false;
}
echo json_encode($children_selected);
return;
}
} }

View File

@ -156,6 +156,26 @@ class AuditLog extends HTML
open_meta_frame(); open_meta_frame();
} }
$buttons = [];
$buttons[] = [
'id' => 'load-filter',
'class' => 'float-left margin-right-2 margin-left-2 sub config',
'text' => __('Load filter'),
'onclick' => '',
];
$buttons[] = [
'id' => 'save-filter',
'class' => 'float-left margin-right-2 sub wand',
'text' => __('Save filter'),
'onclick' => '',
];
// Modal for save/load filters.
echo '<div id="save-modal-filter" style="display:none"></div>';
echo '<div id="load-modal-filter" style="display:none"></div>';
// Load datatables user interface. // Load datatables user interface.
ui_print_datatable( ui_print_datatable(
[ [
@ -174,9 +194,10 @@ class AuditLog extends HTML
], ],
'search_button_class' => 'sub filter float-right', 'search_button_class' => 'sub filter float-right',
'form' => [ 'form' => [
'inputs' => [ 'extra_buttons' => $buttons,
'inputs' => [
[ [
'label' => __('Search'), 'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true),
'type' => 'text', 'type' => 'text',
'class' => 'w200px', 'class' => 'w200px',
'id' => 'filter_text', 'id' => 'filter_text',
@ -211,7 +232,9 @@ class AuditLog extends HTML
'type' => 'select_from_sql', 'type' => 'select_from_sql',
'nothing' => __('All'), 'nothing' => __('All'),
'nothing_value' => '-1', 'nothing_value' => '-1',
'sql' => 'SELECT id_user, id_user AS text FROM tusuario', 'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM"
AS id_user, "SYSTEM" AS text UNION SELECT "N/A"
AS id_user, "N/A" AS text',
'class' => 'mw250px', 'class' => 'mw250px',
'id' => 'filter_user', 'id' => 'filter_user',
'name' => 'filter_user', 'name' => 'filter_user',
@ -269,7 +292,10 @@ class AuditLog extends HTML
if (empty($this->filterText) === false) { if (empty($this->filterText) === false) {
$filter .= sprintf( $filter .= sprintf(
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", " AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR id_usuario LIKE '%%%s%%' OR fecha LIKE '%%%s%%' OR ip_origen LIKE '%%%s%%')",
$this->filterText,
$this->filterText,
$this->filterText,
$this->filterText, $this->filterText,
$this->filterText $this->filterText
); );
@ -366,38 +392,149 @@ class AuditLog extends HTML
// Javascript content. // Javascript content.
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function format(d) { var loading = 0;
var output = '';
if (d.extendedInfo === '') { function format(d) {
output = "<?php echo __('There is no additional information to display'); ?>"; var output = '';
} else {
output = d.extendedInfo; if (d.extendedInfo === '') {
output = "<?php echo __('There is no additional information to display'); ?>";
} else {
output = d.extendedInfo;
}
return output;
} }
return output; $(document).ready(function() {
} // Add event listener for opening and closing details
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
var tr = $(this).closest('tr');
var table = $("#<?php echo $this->tableId; ?>").DataTable();
var row = table.row(tr);
$(document).ready(function() { if (row.child.isShown()) {
// Add event listener for opening and closing details
$('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
var tr = $(this).closest('tr');
var table = $("#<?php echo $this->tableId; ?>").DataTable();
var row = table.row(tr);
if (row.child.isShown()) {
// This row is already open - close it // This row is already open - close it
row.child.hide(); row.child.hide();
tr.removeClass('shown'); tr.removeClass('shown');
} else { } else {
// Open this row // Open this row
row.child(format(row.data())).show(); row.child(format(row.data())).show();
tr.addClass('shown'); tr.addClass('shown');
} }
$('#audit_logs').css('table-layout','fixed');
$('#audit_logs').css('width','95% !important');
});
$('#save-filter').click(function() {
if ($('#save-filter-select').length) {
$('#save-filter-select').dialog({
width: "20%",
maxWidth: "25%",
title: "<?php echo __('Save filter'); ?>"
});
$('#info_box').html("");
$('#text-id_name').val("");
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
dataType: 'json',
data: {
page: 'include/ajax/audit_log',
recover_aduit_log_select: 1
},
success: function(data) {
var options = "";
$.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>";
});
$('#overwrite_filter').html(options);
$('#overwrite_filter').select2();
}
});
} else {
if (loading == 0) {
loading = 1
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
data: {
page: 'include/ajax/audit_log',
save_filter_modal: 1,
current_filter: $('#latest_filter_id').val()
},
success: function(data) {
$('#save-modal-filter')
.empty()
.html(data);
loading = 0;
$('#save-filter-select').dialog({
width: "20%",
maxWidth: "25%",
title: "<?php echo __('Save filter'); ?>"
});
}
});
}
}
});
$('#save_filter_form-0-1, #radiobtn0002').click(function(){
$('#overwrite_filter').select2();
});
/* Filter management */
$('#load-filter').click(function (){
if($('#load-filter-select').length) {
$('#load-filter-select').dialog({width: "20%",
maxWidth: "25%",
title: "<?php echo __('Load filter'); ?>"
});
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
dataType: 'json',
data: {
page: 'include/ajax/audit_log',
recover_aduit_log_select: 1
},
success: function(data) {
var options = "";
$.each(data,function(key,value){
options += "<option value='"+key+"'>"+value+"</option>";
});
$('#filter_id').html(options);
$('#filter_id').select2();
}
});
} else {
if (loading == 0) {
loading = 1
$.ajax({
method: 'POST',
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
data: {
page: 'include/ajax/audit_log',
load_filter_modal: 1
},
success: function (data){
$('#load-modal-filter')
.empty()
.html(data);
loading = 0;
$('#load-filter-select').dialog({
width: "20%",
maxWidth: "25%",
title: "<?php echo __('Load filter'); ?>"
});
}
});
}
}
});
}); });
}); </script>
</script>
<?php <?php
// EOF Javascript content. // EOF Javascript content.
return ob_get_clean(); return ob_get_clean();

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC230123'; $build_version = 'PC230127';
$pandora_version = 'v7.0NG.768'; $pandora_version = 'v7.0NG.768';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -805,6 +805,7 @@ define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management'); define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management'); define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
define('AUDIT_LOG_UMC', 'Warp Manager'); define('AUDIT_LOG_UMC', 'Warp Manager');
define('AUDIT_LOG_NMS_VIOLATION', 'NMS Violation');
// MIMEs. // MIMEs.
define( define(

View File

@ -226,7 +226,7 @@ function format_numeric($number, $decimals=1)
global $config; global $config;
// Translate to float in case there are characters in the string so // Translate to float in case there are characters in the string so
// fmod doesn't throw a notice // fmod doesn't throw a notice.
$number = (float) $number; $number = (float) $number;
if ($number == 0) { if ($number == 0) {
@ -234,10 +234,20 @@ function format_numeric($number, $decimals=1)
} }
if (fmod($number, 1) > 0) { if (fmod($number, 1) > 0) {
return number_format($number, $decimals, $config['decimal_separator'], $config['thousand_separator']); return number_format(
$number,
$decimals,
$config['decimal_separator'],
($config['thousand_separator'] ?? ',')
);
} }
return number_format($number, 0, $config['decimal_separator'], $config['thousand_separator']); return number_format(
$number,
0,
$config['decimal_separator'],
($config['thousand_separator'] ?? ',')
);
} }

View File

@ -496,9 +496,13 @@ function events_update_status($id_evento, $status, $filter=null)
// No groups option direct update. // No groups option direct update.
$update_sql = sprintf( $update_sql = sprintf(
'UPDATE tevento 'UPDATE tevento
SET estado = %d SET estado = %d,
ack_utimestamp = %d,
id_usuario = "%s"
WHERE id_evento = %d', WHERE id_evento = %d',
$status, $status,
time(),
$config['id_user'],
$id_evento $id_evento
); );
break; break;
@ -4732,7 +4736,7 @@ function events_page_general($event)
$data = []; $data = [];
$data[0] = __('Owner'); $data[0] = __('Owner');
if (empty($event['owner_user']) === true) { if ($event['owner_user'] == -1) {
$data[1] = '<i>'.__('N/A').'</i>'; $data[1] = '<i>'.__('N/A').'</i>';
} else { } else {
$user_owner = db_get_value( $user_owner = db_get_value(
@ -4797,14 +4801,15 @@ function events_page_general($event)
$data = []; $data = [];
$table_general->rowid[7] = 'general_status'; $table_general->rowid[count($table_general->data)] = 'general_status';
$table_general->cellclass[count($table_general->data)][1] = 'general_status';
$data[0] = __('Status'); $data[0] = __('Status');
$data[1] = $event_st['title']; $data[1] = $event_st['title'];
$data[2] = html_print_image($event_st['img'], true); $data[2] = html_print_image($event_st['img'], true);
$table_general->data[] = $data; $table_general->data[] = $data;
// If event is validated, show who and when acknowleded it. // If event is validated, show who and when acknowleded it.
$table_general->cellclass[8][1] = 'general_acknowleded'; $table_general->cellclass[count($table_general->data)][1] = 'general_acknowleded';
$data = []; $data = [];
$data[0] = __('Acknowledged by'); $data[0] = __('Acknowledged by');
@ -4825,7 +4830,17 @@ function events_page_general($event)
} }
} }
$data[1] = $user_ack.'&nbsp;(&nbsp;'.date($config['date_format'], $event['ack_utimestamp_raw']).'&nbsp;)&nbsp;'; $data[1] = $user_ack.'&nbsp;(&nbsp;';
if ($event['ack_utimestamp_raw'] !== false
&& $event['ack_utimestamp_raw'] !== 'false'
) {
$data[1] .= date(
$config['date_format'],
$event['ack_utimestamp_raw']
);
}
$data[1] .= '&nbsp;)&nbsp;';
} else { } else {
$data[1] = '<i>'.__('N/A').'</i>'; $data[1] = '<i>'.__('N/A').'</i>';
} }
@ -4932,9 +4947,9 @@ function events_page_general_acknowledged($event_id)
{ {
global $config; global $config;
$Acknowledged = ''; $Acknowledged = '';
$event = db_get_all_rows_filter('tevento', 'id_evento', $event_id); $event = db_get_row('tevento', 'id_evento', $event_id);
hd($event['ack_utimestamp'], true);
if ($event) { if ($event !== false && $event['estado'] == 1) {
$user_ack = db_get_value( $user_ack = db_get_value(
'fullname', 'fullname',
'tusuario', 'tusuario',
@ -4946,7 +4961,17 @@ function events_page_general_acknowledged($event_id)
$user_ack = $config['id_user']; $user_ack = $config['id_user'];
} }
$Acknowledged = $user_ack.'&nbsp;(&nbsp;'.date($config['date_format'], $event['ack_utimestamp_raw']).'&nbsp;)&nbsp;'; $Acknowledged = $user_ack.'&nbsp;(&nbsp;';
if ($event['ack_utimestamp'] !== false
&& $event['ack_utimestamp'] !== 'false'
) {
$Acknowledged .= date(
$config['date_format'],
$event['ack_utimestamp']
);
}
$Acknowledged .= '&nbsp;)&nbsp;';
} else { } else {
$Acknowledged = 'N/A'; $Acknowledged = 'N/A';
} }

View File

@ -811,6 +811,27 @@ if (is_ajax()) {
); );
} }
$image_about = ui_get_full_url('/images/custom_logo/logo-default-pandorafms.png', false, false, false);
if (enterprise_installed() === false) {
if ($config['style'] === 'pandora_black') {
$image_about = 'images/custom_logo/'.HEADER_LOGO_BLACK_CLASSIC;
} else if ($config['style'] === 'pandora') {
$image_about = 'images/custom_logo/'.HEADER_LOGO_DEFAULT_CLASSIC;
}
} else {
if ($config['style'] === 'pandora_black' && $config['custom_logo'] === HEADER_LOGO_DEFAULT_CLASSIC) {
$config['custom_logo'] = HEADER_LOGO_BLACK_CLASSIC;
} else if ($config['style'] === 'pandora' && $config['custom_logo'] === HEADER_LOGO_BLACK_CLASSIC) {
$config['custom_logo'] = HEADER_LOGO_DEFAULT_CLASSIC;
}
$image_about = 'images/custom_logo/'.$config['custom_logo'];
if (file_exists(ENTERPRISE_DIR.'/'.$image_about) === true) {
$image_about = ENTERPRISE_DIR.'/'.$image_about;
}
}
$dialog = ' $dialog = '
<div id="about-tabs" class="invisible overflow-hidden"> <div id="about-tabs" class="invisible overflow-hidden">
<ul> <ul>
@ -827,7 +848,7 @@ if (is_ajax()) {
<tbody> <tbody>
<tr> <tr>
<th style="width: 40%;"> <th style="width: 40%;">
<img src="'.ui_get_full_url('/images/custom_logo/'.$config['custom_logo'], false, false, false).'" alt="logo" width="70%"> <img src="'.$image_about.'" alt="logo" width="70%">
</th> </th>
<th style="width: 60%; text-align: left;"> <th style="width: 60%; text-align: left;">
<h1>'.$product_name.'</h1> <h1>'.$product_name.'</h1>

View File

@ -3992,16 +3992,28 @@ function recursive_get_dt_from_modules_tree(&$f_modules, $modules, $deep)
* Get the module data from a children * Get the module data from a children
* *
* @param integer $id_module Id module * @param integer $id_module Id module
* @param boolean $recursive Recursive children search.
* @return array Children module data * @return array Children module data
*/ */
function get_children_module($id_module) function get_children_module($id_module, $fields=false, $recursion=false)
{ {
$children_module_data = db_get_all_rows_sql( $children_module_data = db_get_all_rows_filter(
'SELECT * 'tagente_modulo',
FROM tagente_modulo ['parent_module_id' => $id_module],
WHERE parent_module_id = '.$id_module $fields
); );
if ($children_module_data !== false && $recursion === true) {
foreach ($children_module_data as $child) {
$niece = get_children_module($child['id_agente_modulo'], $fields, false);
if ((bool) $niece === false) {
continue;
} else {
$children_module_data = array_merge($children_module_data, $niece);
}
}
}
return $children_module_data; return $children_module_data;
} }

View File

@ -8802,24 +8802,27 @@ function reporting_availability($report, $content, $date=false, $time=false)
$data = []; $data = [];
$style = io_safe_output($content['style']); $style = io_safe_output($content['style']);
if ($style['hide_notinit_agents']) {
$aux_id_agents = $agents;
$i = 0;
foreach ($items as $item) {
$utimestamp = db_get_value(
'utimestamp',
'tagente_datos',
'id_agente_modulo',
$item['id_agent_module'],
true
);
if (($utimestamp === false)
|| (intval($utimestamp) > intval($datetime_to))
) {
unset($items[$i]);
}
$i++; if (is_array($style)) {
if ($style['hide_notinit_agents']) {
$aux_id_agents = $agents;
$i = 0;
foreach ($items as $item) {
$utimestamp = db_get_value(
'utimestamp',
'tagente_datos',
'id_agente_modulo',
$item['id_agent_module'],
true
);
if (($utimestamp === false)
|| (intval($utimestamp) > intval($datetime_to))
) {
unset($items[$i]);
}
$i++;
}
} }
} }

View File

@ -6597,10 +6597,10 @@ function ui_print_comments($comments)
$rest_time = (time() - $last_comment['utimestamp']); $rest_time = (time() - $last_comment['utimestamp']);
$time_last = (($rest_time / 60) / 60); $time_last = (($rest_time / 60) / 60);
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].''; $comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$last_comment['comment'].'';
if (strlen($comentario) > '200px') { if (strlen($comentario) > '200px') {
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], $config['thousand_separator']).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...'; $comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'&nbsp; Hours &nbsp;('.$last_comment['id_user'].'):&nbsp;'.$short_comment.'...';
} }
} }

View File

@ -142,13 +142,21 @@ function users_get_groups_for_select(
null null
); );
if ($id_groups !== null) { if ($id_groups !== null && empty($id_groups) === false) {
$children = groups_get_children($id_groups); $children = [];
foreach ($children as $child) { foreach ($id_groups as $key => $id_group) {
unset($user_groups[$child['id_grupo']]); $children[] = groups_get_children($id_group);
} }
unset($user_groups[$id_groups]); if (empty($children) === false) {
foreach ($children as $child) {
unset($user_groups[$child['id_grupo']]);
}
}
foreach ($id_groups as $key => $id_group) {
unset($user_groups[$id_group]);
}
} }
if (empty($user_groups)) { if (empty($user_groups)) {
@ -811,6 +819,20 @@ function users_get_users_by_group($id_group, $um=false, $disabled=true)
} }
/**
* Delete session user if exist
*
* @param string $id_user User id.
*
* @return boolean Return .
*/
function delete_session_user($id_user)
{
$sql = "DELETE FROM tsessions_php where data like '%\"".$id_user."\"%'";
return db_process_sql($sql);
}
function users_has_profile_without_UM($id_user, $id_groups) function users_has_profile_without_UM($id_user, $id_groups)
{ {
$sql = sprintf( $sql = sprintf(

View File

@ -336,19 +336,17 @@ function event_change_status(event_ids, server_id) {
} }
if (data.status == "status_ok") { if (data.status == "status_ok") {
// if (typeof dt_events !== "undefined") {
// dt_events.draw(false);
// }
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
data: { data: {
page: "include/ajax/events", page: "include/ajax/events",
get_Acknowledged: 1, get_Acknowledged: 1,
event_id: event_ids event_id: event_ids,
server_id: server_id
}, },
success: function(response) { success: function(response) {
$("#table4-9-1").html(response); $(".general_acknowleded").html(response);
} }
}); });
@ -356,15 +354,6 @@ function event_change_status(event_ids, server_id) {
.DataTable() .DataTable()
.draw(false); .draw(false);
$("#notification_status_success").show(); $("#notification_status_success").show();
if (new_status == 1) {
$("#extended_event_general_page table td.general_acknowleded").text(
data.user
);
} else {
$("#extended_event_general_page table td.general_acknowleded").text(
"N/A"
);
}
$("#general_status") $("#general_status")
.find(".general_status") .find(".general_status")

View File

@ -1027,6 +1027,7 @@ class ClusterWizard extends \HTML
foreach ($aa_modules as $module) { foreach ($aa_modules as $module) {
$inputs[] = [ $inputs[] = [
'block_id' => 'from-to-threshold', 'block_id' => 'from-to-threshold',
'label' => '<b>'.$module->name().'</b>',
'class' => 'flex-row line w100p', 'class' => 'flex-row line w100p',
'direct' => 1, 'direct' => 1,
'block_content' => [ 'block_content' => [

View File

@ -675,7 +675,8 @@ class Manager implements PublicLogin
int $offset=-1, int $offset=-1,
int $limit=-1, int $limit=-1,
bool $favourite=false, bool $favourite=false,
bool $slideshow=false bool $slideshow=false,
string $id_user=''
):array { ):array {
global $config; global $config;
@ -693,11 +694,15 @@ class Manager implements PublicLogin
$sql_where .= 'AND td.cells_slideshow = 1'; $sql_where .= 'AND td.cells_slideshow = 1';
} }
if (empty($id_user) === true) {
$id_user = $config['id_user'];
}
// Check ACl. // Check ACl.
if (\is_user_admin($config['id_user']) !== true) { if (\is_user_admin($id_user) !== true) {
// Non-admin user can see dashboards of his groups and 'AR' profile. // Non-admin user can see dashboards of his groups and 'AR' profile.
$group_list = \users_get_groups( $group_list = \users_get_groups(
$config['id_user'], $id_user,
'RR', 'RR',
true true
); );
@ -727,7 +732,7 @@ class Manager implements PublicLogin
GROUP BY td.id GROUP BY td.id
ORDER BY name%s", ORDER BY name%s",
$string_groups, $string_groups,
$config['id_user'], $id_user,
$sql_where, $sql_where,
$sql_limit $sql_limit
); );
@ -746,7 +751,7 @@ class Manager implements PublicLogin
WHERE td.id_group = 0 AND td.id_user = '%s' %s WHERE td.id_group = 0 AND td.id_user = '%s' %s
GROUP BY td.id GROUP BY td.id
ORDER BY name%s", ORDER BY name%s",
$config['id_user'], $id_user,
$sql_where, $sql_where,
$sql_limit $sql_limit
); );

View File

@ -357,7 +357,7 @@ final class Container extends Model
$config['dbpass'].$row['id'].$config['id_user'] $config['dbpass'].$row['id'].$config['id_user']
); );
return \io_safe_output($row); return $row;
} }

View File

@ -1771,8 +1771,8 @@ class Item extends CachedModel
$imageSrc = static::issetInArray( $imageSrc = static::issetInArray(
$data, $data,
[ [
'image',
'imageSrc', 'imageSrc',
'image',
'backgroundColor', 'backgroundColor',
'backgroundType', 'backgroundType',
'valueType', 'valueType',

View File

@ -15,200 +15,383 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
@font-face {
h1 { font-family: "Circular Std Book";
font: bold 1em; src: url("../../fonts/CircularStd-Book.woff") format("woff");
font-size: 18px; font-weight: 500;
color: #ffffff; font-style: normal;
text-align: center; font-display: swap;
}
h2 {
font: Verdana;
font-size: 16px;
} }
div#install_container { @font-face {
font-family: "Circular Std";
src: url("../../CircularStd-Medium.woff") format("woff");
font-weight: 500;
font-style: normal;
font-display: swap;
}
html {
background-image: url("../../images/installer-background.jpg");
background-position: center;
background-size: cover;
}
#install_container {
max-width: 1000px;
margin: 0 auto; margin: 0 auto;
margin-top: 45px; margin-top: 50px;
width: 650px; background-color: #131727;
color: white;
font-family: "Circular Std Book";
border-radius: 10px;
} }
div#logo_img { #wizard {
padding: 20px;
overflow: hidden;
}
.title {
font-size: 40px;
font-weight: 400;
}
.subtitle {
font-size: 30px;
font-weight: 400;
}
.text {
font-size: 17px;
}
.content-footer {
padding: 20px;
display: flex;
align-items: center;
justify-content: space-between;
}
.header {
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: space-between;
}
.title-pandora {
margin: 0px;
font-size: 18px;
}
.steps {
display: flex;
align-items: center;
}
.step {
font-size: 17px;
border: 1px solid #8a96a6;
color: #8a96a6;
border-radius: 30px;
width: 30px;
height: 30px;
text-align: center; text-align: center;
width: 100%; display: flex;
color: #666; align-items: center;
justify-content: center;
} }
div#wizard { .step.active {
text-align: left; background-color: #82b92e;
margin-top: 1em; color: #ffffff;
border-color: #82b92e;
width: 650px;
padding-left: 0px;
padding-top: 0px;
padding-bottom: 20px;
background-color: #ffffff;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
position: relative;
} }
.step-separator {
div#wizard a img { min-width: 15px;
padding-right: 30px; margin: 0px 5px;
border-color: #8a96a6;
} }
.build-banner {
div#wizard > input { color: #8a96a6;
padding-right: 30px; font-size: 13px;
float: right; font-weight: 300;
margin-left: 20px;
}
#foot_install {
border-top: 1px solid white;
margin-top: 20px; margin-top: 20px;
} }
.signature {
div#install_box, color: #8a96a6;
div#install_img { font-size: 13px;
padding-right: 20px; font-weight: 300;
margin-top: 0px; margin-right: auto;
width: 80%; margin-left: 10px;
margin: 0px auto;
} }
.link {
div#install_box {
background: F3F3F3;
border: 1px solid #ccc;
padding: 10px 25px;
margin-top: 40px;
}
div#install_box h2 {
color: #82b92e; color: #82b92e;
text-transform: uppercase; text-decoration: none;
} }
.signature a {
div#install_img {
margin-bottom: 25px;
margin-left: 25px;
}
div#foot_install {
font-size: 7pt;
color: #fff;
margin-top: #000;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 20px;
padding-right: 20px;
text-align: center;
}
div#foot_install a {
color: #ccc;
}
input#step4,
input#step4:hover {
width: 70px;
height: 16px;
border: 0px;
background-color: #fafafa;
}
div.warn {
min-height: 24px;
background: url(../../images/icono_warning_install.png) no-repeat 0% -2px;
color: #222;
margin-top: 14px;
padding: 2px 1px 6px 40px;
}
div.info {
min-height: 24px;
background: url(../../images/icono_info_install.png) no-repeat 0% -2px;
color: #222;
margin-top: 14px;
padding: 2px 1px 6px 40px;
}
div.err {
min-height: 24px;
background: url(../../images/icono_critical_install.png) no-repeat 0% -2px;
color: #cc0000;
margin-top: 14px;
padding: 2px 1px 6px 40px;
}
span.arr {
background: url(../../images/arrow.png) no-repeat;
margin-top: 2px;
margin-left: 5px;
padding: 2px 1px 6px 15px;
display: block;
font-size: 8.5pt;
}
body,
td {
font-size: 9pt;
line-height: 15px;
}
body {
background-color: #555555;
}
div.installation_step {
position: static;
float: right;
top: 7px;
right: 10px;
color: #666;
margin-top: 14px;
margin-right: 12px;
}
.btn_install_next {
transition-property: background-color, color;
transition-duration: 1s;
transition-timing-function: ease-out;
-webkit-transition-property: background-color, color;
-webkit-transition-duration: 1s;
-o-transition-property: background-color, color;
-o-transition-duration: 1s;
margin: 10px;
padding: 8px 20px 8px 20px;
background-color: transparent;
border: 1px solid #82b92e;
font: 1em Verdana;
font-size: 11pt;
color: #82b92e; color: #82b92e;
border-radius: 0%; text-decoration: none;
} }
.btn_install_next:hover { .btn_primary {
color: white;
background-color: #82b92e;
border: 20px;
font-size: 15px;
border-radius: 6px;
padding: 10px 20px;
cursor: pointer; cursor: pointer;
transition-property: background-color, color; text-decoration: none;
transition-duration: 1s; }
transition-timing-function: ease-out; .btn_primary.outline {
-webkit-transition-property: background-color, color; background-color: transparent;
-webkit-transition-duration: 1s; border: 1px solid white;
-o-transition-property: background-color, color; }
-o-transition-duration: 1s; .info {
background: #d6e2ff;
color: #454545;
font-size: 15px;
border-radius: 5px;
padding: 15px;
position: relative;
margin: 25px 0px;
}
.info::before {
content: "|";
color: blue;
position: absolute;
left: 4px;
top: 50%;
transform: translateY(-50%);
height: 77%;
background: blue;
border-radius: 12px;
width: 4px;
}
.warn {
background: #fffbdf;
color: #454545;
font-size: 15px;
border-radius: 5px;
padding: 15px;
position: relative;
margin: 25px 0px;
}
.warn::before {
content: "|";
color: #dd9900;
position: absolute;
left: 4px;
top: 50%;
transform: translateY(-50%);
height: 77%;
background: #dd9900;
border-radius: 12px;
width: 4px;
}
.err {
background: #fbdada;
color: #454545;
font-size: 15px;
border-radius: 5px;
padding: 15px;
position: relative;
margin: 25px 0px;
}
.err::before {
content: "|";
color: red;
position: absolute;
left: 4px;
top: 50%;
transform: translateY(-50%);
height: 77%;
background: red;
border-radius: 12px;
width: 4px;
}
.check-table {
background-color: #0f111b;
color: #c1ccdc;
padding: 10px;
width: 100%;
border-radius: 8px;
margin-top: 20px;
}
.check-table td {
padding: 5px 0px;
}
.incomplete {
color: red;
}
.checked {
color: #82b92e;
}
.row {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.reverse {
flex-direction: row-reverse;
}
.col-md-6 {
width: 47%;
position: relative;
padding: 0px 10px;
}
.content-animation {
display: flex;
height: 94%;
bottom: 0;
position: absolute;
right: 0;
width: 90%;
}
.content-animation::before {
content: "";
width: 120%;
position: absolute;
height: 103%;
background-image: linear-gradient(225deg, #731dd854 0%, #2eb9b83d 100%);
top: 0;
left: 0;
border-top-left-radius: 100px;
}
.popuphero {
margin-top: 48px;
margin-left: -26px;
}
.popupgear1 img,
.popupgear2 img {
height: 176px;
position: absolute;
}
.popupgear1 img {
margin: 0px 0px 0px 129px;
animation: rotar1 10s infinite linear;
}
.popupgear2 img {
margin: 130px 0px 0px 0px;
animation: rotar2 10s infinite linear;
}
.popuplaptop img {
height: 352px;
position: absolute;
margin: 115px 0px 0px 0px;
}
.login {
font-size: 14px;
padding: 8px 10px;
border-radius: 5px;
border: 0px;
width: 100%;
}
.input-label {
color: #8a96a6;
font-size: 13px;
margin-top: 5px;
margin-bottom: 5px;
}
.example-message {
color: #8a96a6;
font-size: 8px;
}
.login[type="checkbox"] {
width: auto;
}
.table-config-database td {
text-align: left;
}
.table-config-database td.inline {
display: flex;
align-items: center;
justify-content: flex-start;
}
.table-config-database td.inline .input-label {
margin-left: 10px;
}
@keyframes rotar1 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes rotar2 {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-360deg);
}
}
@media (max-width: 768px) {
.col-md-6 {
width: 100%;
}
.hide-phone {
display: none;
}
}
/* SWITCH */
.switch {
position: relative;
display: inline-block;
width: 33px;
height: 12px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: 0.4s;
transition: 0.4s;
}
.slider:before {
position: absolute;
content: "";
height: 19px;
width: 19px;
left: 0px;
background-color: white;
-webkit-transition: 0.4s;
transition: 0.4s;
transform: translateY(-50%);
top: 50%;
}
input:checked + .slider {
background-color: #82b92e; background-color: #82b92e;
} }
.btn_install_next_text {
transition-property: background-color, color; input:focus + .slider {
transition-duration: 1s; box-shadow: 0 0 1px #82b92e;
transition-timing-function: ease-out;
-webkit-transition-property: background-color, color;
-webkit-transition-duration: 1s;
-o-transition-property: background-color, color;
-o-transition-duration: 1s;
color: #82b92e;
}
.btn_install_next:hover .btn_install_next_text {
transition-property: background-color, color;
transition-duration: 1s;
transition-timing-function: ease-out;
-webkit-transition-property: background-color, color;
-webkit-transition-duration: 1s;
-o-transition-property: background-color, color;
-o-transition-duration: 1s;
color: white;
} }
:focus { input:checked + .slider:before {
outline: 0; -webkit-transform: translate(15px, -50%);
-ms-transform: translate(15px, -50%);
transform: translate(15px, -50%);
} }
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
/* POPUP */ /* POPUP */
.popup-lightbox { .popup-lightbox {
position: fixed; position: fixed;
@ -218,6 +401,7 @@ div.installation_step {
background-color: #000; background-color: #000;
opacity: 0.6; opacity: 0.6;
visibility: hidden; visibility: hidden;
top: 0;
} }
.popup { .popup {
@ -227,17 +411,22 @@ div.installation_step {
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%);
background-color: #fff;
z-index: 9999; z-index: 9999;
display: none; display: none;
font-family: "Circular Std Book";
}
.popup .btn_primary.outline {
color: #82b92e;
border-color: #82b92e;
margin: 0px 20px;
} }
.popup-title { .popup-title {
background-color: #82b92e; background-color: #82b92e;
padding: 10px 20px; padding: 10px 20px;
color: #fff; color: #fff;
font-size: 12pt; font-size: 12pt;
text-align: center; text-align: center;
border-radius: 10px 10px 0px 0px;
} }
.popup-inner { .popup-inner {
@ -246,6 +435,7 @@ div.installation_step {
/* overflow-y: scroll;*/ /* overflow-y: scroll;*/
padding: 25px 35px; padding: 25px 35px;
font-size: 11pt; font-size: 11pt;
border-radius: 0px 0px 10px 10px;
} }
.popup-button-green { .popup-button-green {

View File

@ -1210,3 +1210,92 @@ input[type="image"] {
.mono { .mono {
font-family: source-code, mono, monospace; font-family: source-code, mono, monospace;
} }
* table about dialog */ .table-about {
background-color: #222 !important;
width: 100%;
border-collapse: collapse;
border-color: #222 !important;
}
.table-about th {
background-color: #222 !important;
width: 100%;
}
.table-about h1 {
text-transform: none !important;
font-size: 28px !important;
color: white;
margin-top: 34px;
margin-left: 9px;
}
.table-about h2 {
text-transform: none !important;
font-size: 15px !important;
margin-bottom: 5px;
margin-left: 9px;
color: #95a3bf;
}
.table-about h2 span {
color: #95a3bf;
font-size: large;
font-weight: bolder;
}
.table-about p {
color: white;
font-size: 15px;
font-weight: normal;
margin: 7px;
margin-left: 9px;
}
.table-about p span {
color: white;
font-size: 15px;
font-weight: bold;
margin: 9px;
margin-left: 0px;
}
.table-about p.about-last-p {
padding-bottom: 17px;
}
.table-about .about-last-tr {
border-bottom: 1px solid #eaeaea;
}
.about-copyright-div {
width: 100%;
height: 100%;
}
p.trademark-copyright {
width: 90%;
color: #8a96a6;
font-size: 13px;
margin-top: 20px;
margin-bottom: 0px;
text-align: center !important;
position: absolute;
bottom: 0;
}
#about-tabs,
#tab-general-view {
padding-bottom: 0px;
margin-bottom: 0px;
}
#about-tabs {
overflow: hidden;
}
#tab-database {
height: 80%;
overflow: auto;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1480,7 +1480,7 @@ if (!empty($result)) {
'agent_small', 'agent_small',
false, false,
true, true,
false, true,
'[&hellip;]', '[&hellip;]',
'font-size:7.5pt;' 'font-size:7.5pt;'
); );

View File

@ -31,6 +31,7 @@ global $config;
$headerTitle = __('User detail editor'); $headerTitle = __('User detail editor');
// Load the header. // Load the header.
require $config['homedir'].'/operation/users/user_edit_header.php'; require $config['homedir'].'/operation/users/user_edit_header.php';
use PandoraFMS\Dashboard\Manager;
if (is_metaconsole() === false) { if (is_metaconsole() === false) {
include 'include/javascript/timezonepicker/includes/parser.inc'; include 'include/javascript/timezonepicker/includes/parser.inc';
@ -442,7 +443,13 @@ if (!$meta) {
$home_screen .= html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false).'</div>'; $home_screen .= html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false).'</div>';
$dashboards = get_user_dashboards($config['id_user']); $dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$config['id_user']
);
$dashboards_aux = []; $dashboards_aux = [];
if ($dashboards === false) { if ($dashboards === false) {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.768 %define version 7.0NG.768
%define release 230123 %define release 230127
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.768 %define version 7.0NG.768
%define release 230123 %define release 230127
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.768 %define version 7.0NG.768
%define release 230123 %define release 230127
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.768-230123 Version: 7.0NG.768-230127
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.768-230123" pandora_version="7.0NG.768-230127"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.768"; my $pandora_version = "7.0NG.768";
my $pandora_build = "230123"; my $pandora_build = "230127";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.768"; my $pandora_version = "7.0NG.768";
my $pandora_build = "230123"; my $pandora_build = "230127";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.768 %define version 7.0NG.768
%define release 230123 %define release 230127
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.768 %define version 7.0NG.768
%define release 230123 %define release 230127
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.768" PI_VERSION="7.0NG.768"
PI_BUILD="230123" PI_BUILD="230127"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.768 Build 230123"; my $version = "7.0NG.768 Build 230127";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.768 Build 230123"; my $version = "7.0NG.768 Build 230127";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);

File diff suppressed because it is too large Load Diff

View File

@ -29,28 +29,29 @@
"@types/jest": "^24.9.1", "@types/jest": "^24.9.1",
"@typescript-eslint/eslint-plugin": "^1.13.0", "@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0", "@typescript-eslint/parser": "^1.13.0",
"awesome-typescript-loader": "^5.2.1", "clean-webpack-plugin": "^4.0.0",
"clean-webpack-plugin": "^2.0.2", "css-loader": "^6.7.3",
"css-loader": "^2.1.1",
"d3-shape": "^1.3.7", "d3-shape": "^1.3.7",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-config-prettier": "^4.3.0", "eslint-config-prettier": "^4.3.0",
"eslint-plugin-prettier": "^3.4.0", "eslint-plugin-prettier": "^3.4.0",
"file-loader": "^3.0.1", "file-loader": "^6.2.0",
"jest": "^24.9.0", "jest": "^29.3.1",
"mini-css-extract-plugin": "^0.5.0", "mini-css-extract-plugin": "^2.7.2",
"npm-watch": "^0.11.0", "npm-watch": "^0.11.0",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"ts-jest": "^24.3.0", "ts-jest": "^29.0.3",
"typescript": "^3.9.9", "typescript": "^4.9.4",
"url-loader": "^1.1.2", "webpack": "^5.75.0",
"webpack": "^4.46.0", "webpack-cli": "^5.0.1",
"webpack-cli": "^3.3.12", "webpack-dev-server": "^4.11.1"
"webpack-dev-server": "^3.11.2"
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
"last 2 versions" "last 2 versions"
] ],
"devDependencies": {
"ts-loader": "^9.4.2"
}
} }

View File

@ -736,7 +736,7 @@ export default class VisualConsole {
context.containerRef.append(itemInstance.elementRef); context.containerRef.append(itemInstance.elementRef);
return itemInstance; return itemInstance;
} catch (error) { } catch (error) {
console.error("Error creating a new element:", error.message); console.error("Error creating a new element:", (error as Error).message);
} }
return; return;
} }
@ -773,7 +773,10 @@ export default class VisualConsole {
try { try {
this.elementsById[item.id].props = decodeProps(item); this.elementsById[item.id].props = decodeProps(item);
} catch (error) { } catch (error) {
console.error("Error updating an element:", error.message); console.error(
"Error updating an element:",
(error as Error).message
);
} }
} }
} }
@ -794,7 +797,7 @@ export default class VisualConsole {
...decodeProps(item) ...decodeProps(item)
}; };
} catch (error) { } catch (error) {
console.error("Error updating element:", error.message); console.error("Error updating element:", (error as Error).message);
} }
// Re-build relations. // Re-build relations.

View File

@ -223,16 +223,11 @@ export default class Odometer extends Item<OdometerProps> {
let script = document.createElement("script"); let script = document.createElement("script");
script.type = "text/javascript"; script.type = "text/javascript";
script.onload = function() { script.onload = () => {
odometerB.style.transform = `rotate(${rotate}turn)`; odometerB.style.transform = `rotate(${rotate}turn)`;
}; };
var url_pandora = window.location.pathname.split("/")[1];
if (typeof this.props.metaconsoleId !== "undefined") { script.src = `${document.dir}/${url_pandora}/include/javascript/pandora_alerts.js`;
script.src = "./../../include/javascript/pandora_alerts.js";
} else {
script.src = "./include/javascript/pandora_alerts.js";
}
odometerA.appendChild(h1); odometerA.appendChild(h1);
odometerA.appendChild(h2); odometerA.appendChild(h2);
odometerContainer.appendChild(odometerB); odometerContainer.appendChild(odometerB);
@ -325,9 +320,7 @@ export default class Odometer extends Item<OdometerProps> {
} }
private getCoords(percent: number, radio: number): string { private getCoords(percent: number, radio: number): string {
if (this.props.minMaxValue === "") { if (this.props.minMaxValue !== "") {
percent = percent;
} else {
const minMax = JSON.parse(this.props.minMaxValue); const minMax = JSON.parse(this.props.minMaxValue);
if (minMax["min"] === percent) { if (minMax["min"] === percent) {
percent = 0; percent = 0;

View File

@ -1,5 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"outDir": "./dist/",
"target": "es5", "target": "es5",
"module": "es6", "module": "es6",
"strict": true, "strict": true,

View File

@ -1,8 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require("path"); const path = require("path");
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const CleanWebpackPlugin = require("clean-webpack-plugin");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const dev = process.env.NODE_ENV !== "production"; const dev = process.env.NODE_ENV !== "production";
@ -21,7 +19,9 @@ module.exports = {
output: { output: {
path: buildPath, // The files will be created here. path: buildPath, // The files will be created here.
// filename: dev ? "vc.[name].min.js" : "vc.[name].[chunkhash:8].min.js" // filename: dev ? "vc.[name].min.js" : "vc.[name].[chunkhash:8].min.js"
filename: "vc.[name].min.js" filename: "vc.[name].min.js",
assetModuleFilename: "[name][ext]",
clean: true
}, },
devtool: "source-map", devtool: "source-map",
resolve: { resolve: {
@ -31,19 +31,27 @@ module.exports = {
rules: [ rules: [
// Loader for the Typescript compiler. // Loader for the Typescript compiler.
{ {
test: /\.ts$/, test: /\.(ts)x?$/,
loader: "awesome-typescript-loader" exclude: /node_modules|\.d\.ts$/, // this line as well
use: {
loader: "ts-loader",
options: {
compilerOptions: {
noEmit: false
}
}
}
}, },
// This loader builds a main CSS file from all the CSS imports across the files. // This loader builds a main CSS file from all the CSS imports across the files.
{ {
test: /\.css$/, test: /\.css$/,
loader: [ use: [
// https://github.com/webpack-contrib/mini-css-extract-plugin // https://github.com/webpack-contrib/mini-css-extract-plugin
{ {
loader: MiniCssExtractPlugin.loader, loader: MiniCssExtractPlugin.loader,
options: { options: {
hot: true, // if you want HMR - we try to automatically inject hot reloading but if it's not working, add it to the config //hot: true // if you want HMR - we try to automatically inject hot reloading but if it's not working, add it to the config
reloadAll: true // when desperation kicks in - this is a brute force HMR flag //reloadAll: true // when desperation kicks in - this is a brute force HMR flag
} }
}, },
// https://webpack.js.org/loaders/css-loader // https://webpack.js.org/loaders/css-loader
@ -52,20 +60,6 @@ module.exports = {
options: { options: {
sourceMap: true sourceMap: true
} }
},
// To post process CSS and add some things like prefixes to the rules. e.g.: -webkit-...
// https://github.com/postcss/postcss-loader
{
loader: "postcss-loader",
options: {
plugins: () => [
// Moved to package.json (?)
// // To improve the support for old browsers.
// require("autoprefixer")({
// browsers: ["> 1%", "last 2 versions"]
// })
]
}
} }
] ]
}, },
@ -74,32 +68,25 @@ module.exports = {
// https://webpack.js.org/loaders/url-loader // https://webpack.js.org/loaders/url-loader
{ {
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: "url-loader", type: "asset",
options: { generator: {
limit: 10000, filename: "[name][ext]"
// name: "[name].[hash:8].[ext]"
name: "[name].[ext]"
} }
} }
] ]
}, },
plugins: [ plugins: [
// This plugin will remove all files inside Webpack's output.path directory,
// as well as all unused webpack assets after every successful rebuild.
new CleanWebpackPlugin(),
// Options for the plugin which extract the CSS files to build a main file. // Options for the plugin which extract the CSS files to build a main file.
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output // Options similar to the same options in webpackOptions.output
// both options are optional // both options are optional
// filename: dev ? "vc.[name].css" : "vc.[name].[contenthash:8].css", // filename: dev ? "vc.[name].css" : "vc.[name].[contenthash:8].css",
filename: "vc.[name].css", filename: "vc.[name].css"
// Disable to remove warnings about conflicting order between imports.
orderWarning: true
}) })
], ],
// Static server which runs the playground on npm start. // Static server which runs the playground on npm start.
devServer: { devServer: {
open: true, open: true,
contentBase: "playground" static: path.join(__dirname, "playground")
} }
}; };