solved merge conflict mr 28.sql

Former-commit-id: 687cf5c37f15648421843b5d2908351fc2f3c032
This commit is contained in:
Luis Calvo 2019-05-16 10:15:46 +02:00
commit 702926cf85
51 changed files with 2907 additions and 1204 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.734-190513 Version: 7.0NG.734-190516
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.734-190513" pandora_version="7.0NG.734-190516"
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

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.734'; use constant AGENT_VERSION => '7.0NG.734';
use constant AGENT_BUILD => '190513'; use constant AGENT_BUILD => '190516';
# 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_unix %define name pandorafms_agent_unix
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190513 %define release 190516
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_unix %define name pandorafms_agent_unix
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190513 %define release 190516
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.734" PI_VERSION="7.0NG.734"
PI_BUILD="190513" PI_BUILD="190516"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{190513} {190516}
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.734(Build 190513)") #define PANDORA_VERSION ("7.0NG.734(Build 190516)")
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.734(Build 190513))" VALUE "ProductVersion", "(7.0NG.734(Build 190516))"
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.734-190513 Version: 7.0NG.734-190516
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.734-190513" pandora_version="7.0NG.734-190516"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -998,20 +998,23 @@ function process_upload_xml($xml)
{ {
$hook_enterprise = enterprise_include('extensions/resource_registration/functions.php'); $hook_enterprise = enterprise_include('extensions/resource_registration/functions.php');
// Extract component // Extract component.
process_upload_xml_component($xml); process_upload_xml_component($xml);
$group_filter = get_parameter('group'); $group_filter = get_parameter('group');
// Extract visual map // Extract visual map.
process_upload_xml_visualmap($xml, $group_filter); process_upload_xml_visualmap($xml, $group_filter);
// Extract policies // Extract policies.
if ($hook_enterprise === true) { if ($hook_enterprise === true) {
process_upload_xml_policy($xml, $group_filter); $centralized_management = !is_central_policies_on_node();
if ($centralized_management) {
process_upload_xml_policy($xml, $group_filter);
}
} }
// Extract reports // Extract reports.
process_upload_xml_report($xml, $group_filter); process_upload_xml_report($xml, $group_filter);
} }
@ -1038,6 +1041,11 @@ function resource_registration_extension_main()
return; return;
} }
$centralized_management = !is_central_policies_on_node();
if (!$centralized_management) {
ui_print_warning_message(__('This node is configured with centralized mode. Go to metaconsole to create a policy.'));
}
echo '<div class=notify>'; echo '<div class=notify>';
echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__("You can get more resurces in our <a href='http://pandorafms.com/Library/Library/'>Public Resource Library</a>"); echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'<br> <br>'.__("You can get more resurces in our <a href='http://pandorafms.com/Library/Library/'>Public Resource Library</a>");
echo '</div>'; echo '</div>';

View File

@ -1,9 +1,17 @@
START TRANSACTION;
START TRANSACTION; ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal'); ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');
DELETE FROM `tevent_response` WHERE `name` LIKE 'Create&#x20;Integria&#x20;IMS&#x20;incident&#x20;from&#x20;event'; DELETE FROM `tevent_response` WHERE `name` LIKE 'Create&#x20;Integria&#x20;IMS&#x20;incident&#x20;from&#x20;event';
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome&#x20;to&#x20;Pandora&#x20;FMS&#x20;Console', '&amp;lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;font-size:&#x20;13px;&quot;&amp;gt;Hello,&#x20;congratulations,&#x20;if&#x20;you&apos;ve&#x20;arrived&#x20;here&#x20;you&#x20;already&#x20;have&#x20;an&#x20;operational&#x20;monitoring&#x20;console.&#x20;Remember&#x20;that&#x20;our&#x20;forums&#x20;and&#x20;online&#x20;documentation&#x20;are&#x20;available&#x20;24x7&#x20;to&#x20;get&#x20;you&#x20;out&#x20;of&#x20;any&#x20;trouble.&#x20;You&#x20;can&#x20;replace&#x20;this&#x20;message&#x20;with&#x20;a&#x20;personalized&#x20;one&#x20;at&#x20;Admin&#x20;tools&#x20;-&amp;amp;gt;&#x20;Site&#x20;news.&amp;lt;/p&amp;gt;&#x20;',NOW());
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_login_user` VARCHAR(60); ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_login_user` VARCHAR(60);
ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_login_pass` VARCHAR(45); ALTER TABLE `tusuario` ADD COLUMN `ehorus_user_login_pass` VARCHAR(45);

View File

@ -761,6 +761,23 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
PRIMARY KEY(`id_rc`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------
-- Table `tnews`
-- ----------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tnews` (
`id_news` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`author` varchar(255) NOT NULL DEFAULT '',
`subject` varchar(255) NOT NULL DEFAULT '',
`text` TEXT NOT NULL,
`timestamp` DATETIME NOT NULL DEFAULT 0,
`id_group` int(10) NOT NULL default 0,
`modal` tinyint(1) DEFAULT 0,
`expire` tinyint(1) DEFAULT 0,
`expire_timestamp` DATETIME NOT NULL DEFAULT 0,
PRIMARY KEY(`id_news`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE treport_content_template ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; ALTER TABLE treport_content_template ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default '0'; ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default '0';
ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300'; ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300';
@ -778,6 +795,7 @@ ALTER TABLE `treport_content_template` ADD COLUMN `checks_in_ok_status` TINYINT(
ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template) -- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
@ -1197,6 +1215,7 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket'; UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket';
UPDATE `talert_commands` SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.', `fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1; UPDATE `talert_commands` SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.', `fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1;
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0; ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
ALTER TABLE `talert_commands` ADD COLUMN `fields_hidden` text;
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1; UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
@ -1395,7 +1414,6 @@ UPDATE treport_custom_sql SET `sql` = 'select&#x20;t1.alias&#x20;as&#x20;agent_n
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Table `treport_content` -- Table `treport_content`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0';
ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0'; ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0';
ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300'; ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
@ -1416,6 +1434,7 @@ ALTER TABLE `treport_content` ADD COLUMN `checks_in_ok_status` TINYINT(1) DEFAUL
ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `unknown_checks` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `agent_max_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1'; ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule_relationship` -- Table `tmodule_relationship`
@ -2107,8 +2126,15 @@ ALTER TABLE `tnetflow_filter` DROP COLUMN `output`;
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report"; UPDATE tuser_task set parameters = 'a:5:{i:0;a:6:{s:11:\"description\";s:28:\"Report pending to be created\";s:5:\"table\";s:7:\"treport\";s:8:\"field_id\";s:9:\"id_report\";s:10:\"field_name\";s:4:\"name\";s:4:\"type\";s:3:\"int\";s:9:\"acl_group\";s:8:\"id_group\";}i:1;a:2:{s:11:\"description\";s:46:\"Send to email addresses (separated by a comma)\";s:4:\"type\";s:4:\"text\";}i:2;a:2:{s:11:\"description\";s:7:\"Subject\";s:8:\"optional\";i:1;}i:3;a:3:{s:11:\"description\";s:7:\"Message\";s:4:\"type\";s:4:\"text\";s:8:\"optional\";i:1;}i:4;a:2:{s:11:\"description\";s:11:\"Report Type\";s:4:\"type\";s:11:\"report_type\";}}' where function_name = "cron_task_generate_report";
------------------------------------------------------------------------
------ ADD message in table 'tnews'
------------------------------------------------------------------------
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome&#x20;to&#x20;Pandora&#x20;FMS&#x20;Console', '&amp;lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;font-size:&#x20;13px;&quot;&amp;gt;Hello,&#x20;congratulations,&#x20;if&#x20;you&apos;ve&#x20;arrived&#x20;here&#x20;you&#x20;already&#x20;have&#x20;an&#x20;operational&#x20;monitoring&#x20;console.&#x20;Remember&#x20;that&#x20;our&#x20;forums&#x20;and&#x20;online&#x20;documentation&#x20;are&#x20;available&#x20;24x7&#x20;to&#x20;get&#x20;you&#x20;out&#x20;of&#x20;any&#x20;trouble.&#x20;You&#x20;can&#x20;replace&#x20;this&#x20;message&#x20;with&#x20;a&#x20;personalized&#x20;one&#x20;at&#x20;Admin&#x20;tools&#x20;-&amp;amp;gt;&#x20;Site&#x20;news.&amp;lt;/p&amp;gt;&#x20;',NOW());
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Alter table `talert_templates` -- Alter table `talert_templates`
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal'); ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM('regex','max_min','max','min','equal','not_equal','warning','critical','onchange','unknown','always','not_normal');

View File

@ -197,12 +197,15 @@ if (!empty($all_data)) {
} }
foreach ($news as $article) { foreach ($news as $article) {
$text = io_safe_output($article['text']); $text_bbdd = io_safe_output($article['text']);
$text = html_entity_decode($text_bbdd);
echo '<tr><th class="green_title">'.$article['subject'].'</th></tr>'; echo '<tr><th class="green_title">'.$article['subject'].'</th></tr>';
echo '<tr><td>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</td></tr>'; echo '<tr><td>'.__('by').' <b>'.$article['author'].'</b> <i>'.ui_print_timestamp($article['timestamp'], true).'</i> '.$comparation_suffix.'</td></tr>';
echo '<tr><td class="datos">'; echo '<tr><td class="datos">';
if ($article['id_news'] == 1) {
echo '<center><img src="./images/welcome_image.png" alt="img colabora con nosotros - Support" width="191" height="207"></center>';
}
echo nl2br($text); echo nl2br($text);
echo '</td></tr>'; echo '</td></tr>';
} }

View File

@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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.
// Load global vars // Load global vars.
global $config; global $config;
require_once $config['homedir'].'/include/functions_alerts.php'; require_once $config['homedir'].'/include/functions_alerts.php';
@ -46,7 +46,7 @@ if (is_ajax()) {
$id = (int) get_parameter('id', 0); $id = (int) get_parameter('id', 0);
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1); $get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
// If command ID is not provided, check for action id // If command ID is not provided, check for action id.
if ($id == 0) { if ($id == 0) {
$id_action = (int) get_parameter('id_action'); $id_action = (int) get_parameter('id_action');
$id = alerts_get_alert_action_alert_command_id($id_action); $id = alerts_get_alert_action_alert_command_id($id_action);
@ -59,10 +59,12 @@ if (is_ajax()) {
$command['description'] = io_safe_input(str_replace("\r\n", '<br>', io_safe_output($command['description']))); $command['description'] = io_safe_input(str_replace("\r\n", '<br>', io_safe_output($command['description'])));
} }
// Descriptions are stored in json // Descriptions are stored in json.
$fields_descriptions = empty($command['fields_descriptions']) ? '' : json_decode(io_safe_output($command['fields_descriptions']), true); $fields_descriptions = empty($command['fields_descriptions']) ? '' : json_decode(io_safe_output($command['fields_descriptions']), true);
// Fields values are stored in json // Fields values are stored in json.
$fields_values = empty($command['fields_values']) ? '' : io_safe_output(json_decode($command['fields_values'], true)); $fields_values = empty($command['fields_values']) ? '' : io_safe_output(json_decode($command['fields_values'], true));
// Fields hidden conditions are stored in json.
$fields_hidden_checked = empty($command['fields_hidden']) ? '' : io_safe_output(json_decode($command['fields_hidden'], true));
$fields_rows = []; $fields_rows = [];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -72,18 +74,20 @@ if (is_ajax()) {
$field_description = $fields_descriptions[($i - 1)]; $field_description = $fields_descriptions[($i - 1)];
$field_value = $fields_values[($i - 1)]; $field_value = $fields_values[($i - 1)];
$field_hidden = $fields_hidden_checked[($i - 1)];
if (!empty($field_description)) { if (!empty($field_description)) {
// If the value is 5, this because severity in snmp alerts is not permit to show // If the value is 5, this because severity in snmp alerts is not permit to show.
if (($i > 5) && ($command['id'] == 3)) { if (($i > 5) && ($command['id'] == 3)) {
$fdesc = $field_description.' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), ($i - 1)).'</span>'; $fdesc = $field_description.' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), ($i - 1)).'</span>';
} else { } else {
$fdesc = $field_description.' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), $i).'</span>'; $fdesc = $field_description.' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), $i).'</span>';
} }
// If the field is the number one, print the help message // If the field is the number one, print the help message.
if ($i == 1) { if ($i == 1) {
// If our context is snmpconsole, show snmp_alert helps // If our context is snmpconsole, show snmp_alert helps.
if ((isset($_SERVER['HTTP_REFERER'])) && ( preg_match('/snmp_alert/', $_SERVER['HTTP_REFERER']) > 0 )) { if ((isset($_SERVER['HTTP_REFERER'])) && ( preg_match('/snmp_alert/', $_SERVER['HTTP_REFERER']) > 0 )) {
$fdesc .= ui_print_help_icon('snmp_alert_field1', true); $fdesc .= ui_print_help_icon('snmp_alert_field1', true);
} else { } else {
@ -91,7 +95,7 @@ if (is_ajax()) {
} }
} }
} else { } else {
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it // If the macro hasn't description and doesnt appear in command, set with empty description to dont show it.
if (($i > 5) && ($command['id'] == 3)) { if (($i > 5) && ($command['id'] == 3)) {
if (substr_count($command['command'], '_field'.($i - 1).'_') > 0) { if (substr_count($command['command'], '_field'.($i - 1).'_') > 0) {
$fdesc = sprintf(__('Field %s'), ($i - 1)); $fdesc = sprintf(__('Field %s'), ($i - 1));
@ -107,9 +111,11 @@ if (is_ajax()) {
} }
} }
$style = ((int) $field_hidden === 1) ? '-webkit-text-security: disc;' : '';
if (!empty($field_value)) { if (!empty($field_value)) {
$field_value = io_safe_output($field_value); $field_value = io_safe_output($field_value);
// HTML type // HTML type.
if (preg_match('/^_html_editor_$/i', $field_value)) { if (preg_match('/^_html_editor_$/i', $field_value)) {
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>'; $editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
$editor_type_chkbx .= __('Basic').ui_print_help_tip(__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'), true); $editor_type_chkbx .= __('Basic').ui_print_help_tip(__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'), true);
@ -148,7 +154,7 @@ if (is_ajax()) {
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true); $editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true);
$editor_type_chkbx .= '</small></b></div>'; $editor_type_chkbx .= '</small></b></div>';
$rfield = $editor_type_chkbx; $rfield = $editor_type_chkbx;
// Select type // Select type.
} else { } else {
$fields_value_select = []; $fields_value_select = [];
$fv = explode(';', $field_value); $fv = explode(';', $field_value);
@ -200,7 +206,7 @@ if (is_ajax()) {
1, 1,
1, 1,
$fv[0], $fv[0],
'style="min-height:40px" class="fields"', 'style="min-height:40px; '.$style.'" class="fields"',
true true
); );
$rfield = html_print_textarea( $rfield = html_print_textarea(
@ -208,7 +214,7 @@ if (is_ajax()) {
1, 1,
1, 1,
$fv[0], $fv[0],
'style="min-height:40px" class="fields_recovery"', 'style="min-height:40px; '.$style.'" class="fields_recovery',
true true
); );
} }
@ -219,7 +225,7 @@ if (is_ajax()) {
1, 1,
1, 1,
'', '',
'style="min-height:40px" class="fields"', 'style="min-height:40px; '.$style.'" class="fields"',
true true
); );
$rfield = html_print_textarea( $rfield = html_print_textarea(
@ -227,13 +233,13 @@ if (is_ajax()) {
1, 1,
1, 1,
'', '',
'style="min-height:40px" class="fields_recovery"', 'style="min-height:40px; '.$style.'" class="fields_recovery"',
true true
); );
} }
// The empty descriptions will be ignored // The empty descriptions will be ignored.
if ($fdesc == '') { if ($fdesc == '') {
$fields_rows[$i] = ''; $fields_rows[$i] = '';
} else { } else {
@ -248,7 +254,7 @@ if (is_ajax()) {
} }
} }
// If command is PandoraFMS event, field 5 must be empty because "severity" must be set by the alert // If command is PandoraFMS event, field 5 must be empty because "severity" must be set by the alert.
if ($command['id'] == 3) { if ($command['id'] == 3) {
$fields_rows[5] = ''; $fields_rows[5] = '';
} }
@ -268,7 +274,7 @@ if ($update_command) {
return; return;
} }
// Header // Header.
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
@ -283,16 +289,19 @@ if ($create_command) {
$fields_descriptions = []; $fields_descriptions = [];
$fields_values = []; $fields_values = [];
$fields_hidden = [];
$info_fields = ''; $info_fields = '';
$values = []; $values = [];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$fields_descriptions[] = (string) get_parameter('field'.$i.'_description'); $fields_descriptions[] = (string) get_parameter('field'.$i.'_description');
$fields_values[] = (string) get_parameter('field'.$i.'_values'); $fields_values[] = (string) get_parameter('field'.$i.'_values');
$fields_hidden[] = get_parameter('field'.$i.'_hide');
$info_fields .= ' Field'.$i.': '.$fields_values[($i - 1)]; $info_fields .= ' Field'.$i.': '.$fields_values[($i - 1)];
} }
$values['fields_values'] = io_json_mb_encode($fields_values); $values['fields_values'] = io_json_mb_encode($fields_values);
$values['fields_descriptions'] = io_json_mb_encode($fields_descriptions); $values['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
$values['fields_hidden'] = io_json_mb_encode($fields_hidden);
$values['description'] = $description; $values['description'] = $description;
$values['id_group'] = $id_group; $values['id_group'] = $id_group;
@ -316,7 +325,7 @@ if ($create_command) {
db_pandora_audit('Command management', 'Fail try to create alert command', false, false); db_pandora_audit('Command management', 'Fail try to create alert command', false, false);
} }
// Show errors // Show errors.
if (!isset($messageAction)) { if (!isset($messageAction)) {
$messageAction = __('Could not be created'); $messageAction = __('Could not be created');
} }
@ -340,7 +349,7 @@ if ($create_command) {
if ($delete_command) { if ($delete_command) {
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');
// Internal commands cannot be deleted // Internal commands cannot be deleted.
if (alerts_get_alert_command_internal($id)) { if (alerts_get_alert_command_internal($id)) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
@ -368,17 +377,17 @@ if ($delete_command) {
if ($copy_command) { if ($copy_command) {
$id = (int) get_parameter('id'); $id = (int) get_parameter('id');
// Get the info from the source command // Get the info from the source command.
$command_to_copy = db_get_row('talert_commands', 'id', $id); $command_to_copy = db_get_row('talert_commands', 'id', $id);
if ($command_to_copy === false) { if ($command_to_copy === false) {
ui_print_error_message(__("Command with id $id does not found.")); ui_print_error_message(__("Command with id $id does not found."));
} else { } else {
// Prepare to insert the copy with same values // Prepare to insert the copy with same values.
unset($command_to_copy['id']); unset($command_to_copy['id']);
$command_to_copy['name'] .= __(' (copy)'); $command_to_copy['name'] .= __(' (copy)');
$result = db_process_sql_insert('talert_commands', $command_to_copy); $result = db_process_sql_insert('talert_commands', $command_to_copy);
// Print the result // Print the result.
ui_print_result_message( ui_print_result_message(
$result, $result,
__('Successfully copied'), __('Successfully copied'),

View File

@ -11,7 +11,7 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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.
// Load global vars // Load global vars.
global $config; global $config;
require_once $config['homedir'].'/include/functions_alerts.php'; require_once $config['homedir'].'/include/functions_alerts.php';
@ -35,7 +35,7 @@ $id = (int) get_parameter('id');
$pure = get_parameter('pure', 0); $pure = get_parameter('pure', 0);
$alert = []; $alert = [];
// Header // Header.
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
@ -65,16 +65,19 @@ if ($update_command) {
$fields_descriptions = []; $fields_descriptions = [];
$fields_values = []; $fields_values = [];
$fields_hidden = [];
$info_fields = ''; $info_fields = '';
$values = []; $values = [];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$fields_descriptions[] = (string) get_parameter('field'.$i.'_description'); $fields_descriptions[] = (string) get_parameter('field'.$i.'_description');
$fields_values[] = (string) get_parameter('field'.$i.'_values'); $fields_values[] = (string) get_parameter('field'.$i.'_values');
$fields_hidden[] = get_parameter('field'.$i.'_hide');
$info_fields .= ' Field'.$i.': '.$fields_values[($i - 1)]; $info_fields .= ' Field'.$i.': '.$fields_values[($i - 1)];
} }
$values['fields_values'] = io_json_mb_encode($fields_values); $values['fields_values'] = io_json_mb_encode($fields_values);
$values['fields_descriptions'] = io_json_mb_encode($fields_descriptions); $values['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
$values['fields_hidden'] = io_json_mb_encode($fields_hidden);
$values['name'] = $name; $values['name'] = $name;
$values['command'] = $command; $values['command'] = $command;
@ -129,6 +132,7 @@ if ($id) {
$id_group = $alert['id_group']; $id_group = $alert['id_group'];
$fields_descriptions = $alert['fields_descriptions']; $fields_descriptions = $alert['fields_descriptions'];
$fields_values = $alert['fields_values']; $fields_values = $alert['fields_values'];
$fields_hidden = $alert['fields_hidden'];
} }
if (!empty($fields_descriptions)) { if (!empty($fields_descriptions)) {
@ -139,6 +143,10 @@ if (!empty($fields_values)) {
$fields_values = json_decode($fields_values, true); $fields_values = json_decode($fields_values, true);
} }
if (!empty($fields_hidden)) {
$fields_hidden = json_decode($fields_hidden, true);
}
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters';
@ -153,6 +161,7 @@ $table->style = [];
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold';
$table->style[4] = 'font-weight: bold';
} }
$table->size = []; $table->size = [];
@ -190,7 +199,7 @@ $table->data['description'][1] = html_print_textarea('description', 10, 30, $des
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i); $table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
// Only show help on first row // Only show help on first row.
if ($i == 1) { if ($i == 1) {
$table->data['field'.$i][0] .= ui_print_help_icon('alert_fields_description', true); $table->data['field'.$i][0] .= ui_print_help_icon('alert_fields_description', true);
} }
@ -201,11 +210,11 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$field_description = ''; $field_description = '';
} }
$table->data['field'.$i][1] = html_print_input_text('field'.$i.'_description', $field_description, '', 35, 255, true); $table->data['field'.$i][1] = html_print_input_text('field'.$i.'_description', $field_description, '', 30, 255, true);
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i); $table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
// Only show help on first row // Only show help on first row.
if ($i == 1) { if ($i == 1) {
$table->data['field'.$i][2] .= ui_print_help_icon('alert_fields_values', true); $table->data['field'.$i][2] .= ui_print_help_icon('alert_fields_values', true);
} }
@ -216,7 +225,17 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$field_values = ''; $field_values = '';
} }
$table->data['field'.$i][3] = html_print_input_text('field'.$i.'_values', $field_values, '', 65, 255, true); if (!empty($fields_hidden)) {
$selected = (bool) $fields_hidden[($i - 1)];
} else {
$selected = false;
}
$table->data['field'.$i][3] = html_print_input_text('field'.$i.'_values', $field_values, '', 55, 255, true, false, false, '', 'field_value');
$table->data['field'.$i][4] = __('Hide');
$table->data['field'.$i][5] = html_print_checkbox_extended('field'.$i.'_hide', 1, $selected, false, 'cursor: \'pointer\'', 'class="hide_inputs"', true);
} }
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">';
@ -236,3 +255,27 @@ echo '</div>';
echo '</form>'; echo '</form>';
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
$(document).ready (function () {
$(".hide_inputs").each(function(index) {
var $input_in_row = $(this).closest('tr').find('.field_value');
if($(this).is(':checked')) {
$input_in_row.prop('style', '-webkit-text-security: disc;');
} else {
$input_in_row.prop('style', '');
}
});
$(".hide_inputs").click(function() {
var $input_in_row = $(this).closest('tr').find('.field_value');
if($(this).is(':checked')) {
$input_in_row.prop('style', '-webkit-text-security: disc;');
} else {
$input_in_row.prop('style', '');
}
});
});
</script>

File diff suppressed because it is too large Load Diff

View File

@ -52,9 +52,8 @@ $table_enable->style['name'] = 'font-weight: bold';
// Enable eHorus. // Enable eHorus.
$row = []; $row = [];
$row['name'] = ('Enable eHorus'); $row['name'] = __('Enable eHorus');
$row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true); $row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true);
$row['button'] = html_print_submit_button(('Update'), 'update_button', false, 'class="sub upd"', true);
$table_enable->data['ehorus_enabled'] = $row; $table_enable->data['ehorus_enabled'] = $row;
// Remote config table. // Remote config table.
@ -159,10 +158,11 @@ echo '</div>';
echo '<legend>'.__('eHorus API').'</legend>'; echo '<legend>'.__('eHorus API').'</legend>';
html_print_input_hidden('update_config', 1); html_print_input_hidden('update_config', 1);
html_print_table($table_remote); html_print_table($table_remote);
echo '<div class="action-buttons" style="width: '.$table_remote->width.'">';
html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"');
echo '</div>';
echo '</fieldset>'; echo '</fieldset>';
echo '</div>';
echo '<div class="action-buttons" style="width: '.$table_remote->width.'">';
html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"');
echo '</div>'; echo '</div>';
echo '</form>'; echo '</form>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

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

View File

@ -1762,16 +1762,22 @@ function array_key_to_offset($array, $key)
/** /**
* Make a snmpwalk and return it. * Make a snmpwalk and return it.
* *
* @param string $ip_target The target address. * @param string $ip_target The target address.
* @param string $snmp_version Version of the snmp: 1,2,2c or 3. * @param string $snmp_version Version of the snmp: 1,2,2c or 3.
* @param string $snmp_community. * @param string $snmp_community Snmp_community.
* @param string $snmp3_auth_user. * @param string $snmp3_auth_user Snmp3_auth_user.
* @param string $snmp3_security_level. * @param string $snmp3_security_level Snmp3_security_level.
* @param string $snmp3_auth_method. * @param string $snmp3_auth_method Snmp3_auth_method.
* @param string $snmp3_auth_pass. * @param string $snmp3_auth_pass Snmp3_auth_pass.
* @param string $snmp3_privacy_method. * @param string $snmp3_privacy_method Snmp3_privacy_method.
* @param string $snmp3_privacy_pass. * @param string $snmp3_privacy_pass Snmp3_privacy_pass.
* @param integer $quick_print 0 for all details, 1 for only value. * @param integer $quick_print To get all details 0, 1: only value.
* @param string $base_oid Base_oid.
* @param string $snmp_port Snmp_port.
* @param integer $server_to_exec Server_to_exec.
* @param string $extra_arguments Extra_arguments.
* @param string $format Format to apply, for instance, to
* retrieve hex-dumps: --hexOutputLength.
* *
* @return array SNMP result. * @return array SNMP result.
*/ */
@ -1789,7 +1795,8 @@ function get_snmpwalk(
$base_oid='', $base_oid='',
$snmp_port='', $snmp_port='',
$server_to_exec=0, $server_to_exec=0,
$extra_arguments='' $extra_arguments='',
$format='-Oa'
) { ) {
global $config; global $config;
@ -1840,15 +1847,15 @@ function get_snmpwalk(
case '3': case '3':
switch ($snmp3_security_level) { switch ($snmp3_security_level) {
case 'authNoPriv': case 'authNoPriv':
$command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; $command_str = $snmpwalk_bin.' -m ALL '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break; break;
case 'noAuthNoPriv': case 'noAuthNoPriv':
$command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; $command_str = $snmpwalk_bin.' -m ALL '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break; break;
default: default:
$command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; $command_str = $snmpwalk_bin.' -m ALL '.$format.' '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break; break;
} }
break; break;
@ -1857,7 +1864,7 @@ function get_snmpwalk(
case '2c': case '2c':
case '1': case '1':
default: default:
$command_str = $snmpwalk_bin.' -m ALL '.$extra_arguments.' -Oa -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; $command_str = $snmpwalk_bin.' -m ALL '.$extra_arguments.' '.$format.' -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir;
break; break;
} }
@ -2668,7 +2675,7 @@ function get_news($arguments)
case 'mysql': case 'mysql':
case 'postgresql': case 'postgresql':
$sql = sprintf( $sql = sprintf(
"SELECT subject,timestamp,text,author "SELECT id_news,subject,timestamp,text,author
FROM tnews WHERE id_group IN (%s) AND FROM tnews WHERE id_group IN (%s) AND
modal = %s AND modal = %s AND
(expire = 0 OR (expire = 1 AND expire_timestamp > '%s')) (expire = 0 OR (expire = 1 AND expire_timestamp > '%s'))

View File

@ -1646,7 +1646,7 @@ function events_get_agent(
$sql_where, $sql_where,
0, 0,
1000, 1000,
is_metaconsole(), (is_metaconsole() && $id_server) ? true : false,
false, false,
false, false,
$history $history

View File

@ -19,8 +19,14 @@ function parse_alert_command(command, classs) {
var regex = new RegExp(field, "gi"); var regex = new RegExp(field, "gi");
command = command.replace(regex, $(this).val()); if ($(this).css("-webkit-text-security") == "disc") {
var hidden_character = "*";
var hidden_string = hidden_character.repeat($(this).val().length);
command = command.replace(regex, hidden_string);
} else {
command = command.replace(regex, $(this).val());
}
nfield++; nfield++;
}); });

View File

@ -125,4 +125,35 @@ final class EventsHistory extends Item
} }
/**
* Generate a link to something related with the item.
*
* @param array $data Visual Console Item's data structure.
*
* @return mixed The link or a null value.
*
* @override Item::buildLink.
*/
protected static function buildLink(array $data)
{
// Get the linked agent and module Ids.
$linkedModule = static::extractLinkedModule($data);
$agentId = static::parseIntOr($linkedModule['agentId'], null);
$moduleId = static::parseIntOr($linkedModule['moduleId'], null);
$baseUrl = \ui_get_full_url('index.php');
return $baseUrl.'?'.http_build_query(
[
'sec' => 'eventos',
'sec2' => 'operation/events/events',
'id_agent' => $agentId,
'module_search_hidden' => $moduleId,
'event_view_hr' => (static::extractMaxTime($data) / 3600),
'status' => -1,
]
);
}
} }

View File

@ -383,22 +383,22 @@ final class Group extends Item
// Critical. // Critical.
$html .= '<div style="'.$valueStyle.'background-color: #FC4444;">'; $html .= '<div style="'.$valueStyle.'background-color: #FC4444;">';
$html .= \number_format($agentStats['critical']).'%'; $html .= \number_format($agentStats['critical'], 2).'%';
$html .= '</div>'; $html .= '</div>';
$html .= '<div style="'.$nameStyle.'">'.__('Critical').'</div>'; $html .= '<div style="'.$nameStyle.'">'.__('Critical').'</div>';
// Warning. // Warning.
$html .= '<div style="'.$valueStyle.'background-color: #f8db3f;">'; $html .= '<div style="'.$valueStyle.'background-color: #f8db3f;">';
$html .= \number_format($agentStats['warning']).'%'; $html .= \number_format($agentStats['warning'], 2).'%';
$html .= '</div>'; $html .= '</div>';
$html .= '<div style="'.$nameStyle.'">'.__('Warning').'</div>'; $html .= '<div style="'.$nameStyle.'">'.__('Warning').'</div>';
// Normal. // Normal.
$html .= '<div style="'.$valueStyle.'background-color: #84b83c;">'; $html .= '<div style="'.$valueStyle.'background-color: #84b83c;">';
$html .= \number_format($agentStats['normal']).'%'; $html .= \number_format($agentStats['normal'], 2).'%';
$html .= '</div>'; $html .= '</div>';
$html .= '<div style="'.$nameStyle.'">'.__('Normal').'</div>'; $html .= '<div style="'.$nameStyle.'">'.__('Normal').'</div>';
// Unknown. // Unknown.
$html .= '<div style="'.$valueStyle.'background-color: #9d9ea0;">'; $html .= '<div style="'.$valueStyle.'background-color: #9d9ea0;">';
$html .= \number_format($agentStats['unknown']).'%'; $html .= \number_format($agentStats['unknown'], 2).'%';
$html .= '</div>'; $html .= '</div>';
$html .= '<div style="'.$nameStyle.'">'.__('Unknown').'</div>'; $html .= '<div style="'.$nameStyle.'">'.__('Unknown').'</div>';

View File

@ -226,12 +226,8 @@ final class Percentile extends Item
); );
} }
// Cast to float.
$moduleValue = (float) $moduleValue;
// Store the module value. // Store the module value.
$data['value'] = $moduleValue; $data['value'] = (float) \number_format((float) $moduleValue, (int) $config['graph_precision'], '.', '');
$unit = \modules_get_unit($moduleId); $unit = \modules_get_unit($moduleId);
if (empty($unit) === false) { if (empty($unit) === false) {
$data['unit'] = \io_safe_output($unit); $data['unit'] = \io_safe_output($unit);

View File

@ -230,8 +230,8 @@ final class StaticGraph extends Item
if (!$isBooleanModule if (!$isBooleanModule
|| ($isBooleanModule && $showLastValueTooltip !== 'default') || ($isBooleanModule && $showLastValueTooltip !== 'default')
) { ) {
if (is_numeric($value)) { if (\is_numeric($value)) {
$imgTitle .= __('Last value: ').\remove_right_zeros($value); $imgTitle .= __('Last value: ').\remove_right_zeros(\number_format((float) $value, (int) $config['graph_precision']));
} else { } else {
$imgTitle .= __('Last value: ').$value; $imgTitle .= __('Last value: ').$value;
} }

View File

@ -72,6 +72,10 @@
/* Analog clock */ /* Analog clock */
.visual-console-item .analogic-clock {
text-align: center;
}
.visual-console-item .analogic-clock .hour-hand { .visual-console-item .analogic-clock .hour-hand {
-webkit-animation: rotate-hour 43200s infinite linear; -webkit-animation: rotate-hour 43200s infinite linear;
animation: rotate-hour 43200s infinite linear; animation: rotate-hour 43200s infinite linear;

View File

@ -1 +1 @@
{"version":3,"sources":["webpack:///main.css","webpack:///styles.css"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,4BAA4B;EAC5B,0BAA0B;EAC1B,2BAA2B;AAC7B;;AAEA;EACE,kBAAkB;EAClB,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,2BAAuB;EAAvB,8BAAuB;MAAvB,2BAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;EACnB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;ACfA;EACE,wBAAwB;EACxB,0BAA2B;AAC7B;;AAEA,kBAAkB;;AAElB;EACE,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,4BAAsB;EAAtB,6BAAsB;MAAtB,0BAAsB;UAAtB,sBAAsB;EACtB,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,0BAAqB;MAArB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;AACrB;;AAEA;EACE,6DAA6D;EAC7D,eAAe;;EAEf,0BAA0B;EAC1B,mCAAmC;EACnC,kCAAkC;EAClC,kCAAkC;EAClC,wCAAwC;AAC1C;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,eAAe;AACjB;;AAEA,iBAAiB;;AAEjB;EACE,qDAA6C;UAA7C,6CAA6C;AAC/C;;AAEA;EACE,sDAA8C;UAA9C,8CAA8C;AAChD;;AAEA;EACE,oDAA4C;UAA5C,4CAA4C;AAC9C","file":"vc.main.css","sourcesContent":["#visual-console-container {\n margin: 0px auto;\n position: relative;\n background-repeat: no-repeat;\n background-size: 100% 100%;\n background-position: center;\n}\n\n.visual-console-item {\n position: absolute;\n display: flex;\n flex-direction: initial;\n justify-items: center;\n align-items: center;\n user-select: text;\n}\n","@font-face {\n font-family: Alarm Clock;\n src: url(./alarm-clock.ttf);\n}\n\n/* Digital clock */\n\n.visual-console-item .digital-clock {\n display: flex;\n flex-direction: column;\n justify-content: center;\n justify-items: center;\n align-content: center;\n align-items: center;\n}\n\n.visual-console-item .digital-clock > span {\n font-family: \"Alarm Clock\", \"Courier New\", Courier, monospace;\n font-size: 50px;\n\n /* To improve legibility */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n text-shadow: rgba(0, 0, 0, 0.01) 0 0 1px;\n}\n\n.visual-console-item .digital-clock > span.date {\n font-size: 25px;\n}\n\n.visual-console-item .digital-clock > span.timezone {\n font-size: 25px;\n}\n\n/* Analog clock */\n\n.visual-console-item .analogic-clock .hour-hand {\n animation: rotate-hour 43200s infinite linear;\n}\n\n.visual-console-item .analogic-clock .minute-hand {\n animation: rotate-minute 3600s infinite linear;\n}\n\n.visual-console-item .analogic-clock .second-hand {\n animation: rotate-second 60s infinite linear;\n}\n"],"sourceRoot":""} {"version":3,"sources":["webpack:///main.css","webpack:///styles.css"],"names":[],"mappings":"AAAA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,4BAA4B;EAC5B,wBAAwB;AAC1B;;AAEA;EACE,kBAAkB;EAClB,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,2BAAuB;EAAvB,8BAAuB;MAAvB,2BAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;EACnB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;ACdA;EACE,wBAAwB;EACxB,0BAA2B;AAC7B;;AAEA,kBAAkB;;AAElB;EACE,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,4BAAsB;EAAtB,6BAAsB;MAAtB,0BAAsB;UAAtB,sBAAsB;EACtB,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,qBAAqB;EACrB,0BAAqB;MAArB,qBAAqB;EACrB,yBAAmB;MAAnB,sBAAmB;UAAnB,mBAAmB;AACrB;;AAEA;EACE,6DAA6D;EAC7D,eAAe;;EAEf,0BAA0B;EAC1B,mCAAmC;EACnC,kCAAkC;EAClC,kCAAkC;EAClC,wCAAwC;AAC1C;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,eAAe;AACjB;;AAEA,iBAAiB;;AAEjB;EACE,kBAAkB;AACpB;;AAEA;EACE,qDAA6C;UAA7C,6CAA6C;AAC/C;;AAEA;EACE,sDAA8C;UAA9C,8CAA8C;AAChD;;AAEA;EACE,oDAA4C;UAA5C,4CAA4C;AAC9C","file":"vc.main.css","sourcesContent":["#visual-console-container {\n margin: 0px auto;\n position: relative;\n background-repeat: no-repeat;\n background-size: contain;\n}\n\n.visual-console-item {\n position: absolute;\n display: flex;\n flex-direction: initial;\n justify-items: center;\n align-items: center;\n user-select: text;\n}\n","@font-face {\n font-family: Alarm Clock;\n src: url(./alarm-clock.ttf);\n}\n\n/* Digital clock */\n\n.visual-console-item .digital-clock {\n display: flex;\n flex-direction: column;\n justify-content: center;\n justify-items: center;\n align-content: center;\n align-items: center;\n}\n\n.visual-console-item .digital-clock > span {\n font-family: \"Alarm Clock\", \"Courier New\", Courier, monospace;\n font-size: 50px;\n\n /* To improve legibility */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n text-shadow: rgba(0, 0, 0, 0.01) 0 0 1px;\n}\n\n.visual-console-item .digital-clock > span.date {\n font-size: 25px;\n}\n\n.visual-console-item .digital-clock > span.timezone {\n font-size: 25px;\n}\n\n/* Analog clock */\n\n.visual-console-item .analogic-clock {\n text-align: center;\n}\n\n.visual-console-item .analogic-clock .hour-hand {\n animation: rotate-hour 43200s infinite linear;\n}\n\n.visual-console-item .analogic-clock .minute-hand {\n animation: rotate-minute 3600s infinite linear;\n}\n\n.visual-console-item .analogic-clock .second-hand {\n animation: rotate-second 60s infinite linear;\n}\n"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.734'; $version = '7.0NG.734';
$build = '190513'; $build = '190516';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.734 %define version 7.0NG.734
%define release 190513 %define release 190516
# 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.734 %define version 7.0NG.734
%define release 190513 %define release 190516
# 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.734 %define version 7.0NG.734
%define release 190513 %define release 190516
%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

@ -14,7 +14,7 @@
-- 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.
-- PLEASE NO NOT USE MULTILINE COMMENTS -- PLEASE NO NOT USE MULTILINE COMMENTS
-- Because Pandora Installer don't understand them -- Because Pandora Installer don't understand them
-- and fails creating database !!! -- and fails creating database !!!
@ -378,6 +378,7 @@ CREATE TABLE IF NOT EXISTS `talert_commands` (
`internal` tinyint(1) default 0, `internal` tinyint(1) default 0,
`fields_descriptions` TEXT, `fields_descriptions` TEXT,
`fields_values` TEXT, `fields_values` TEXT,
`fields_hidden` TEXT,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -1435,6 +1436,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`unknown_checks` TINYINT(1) DEFAULT '1', `unknown_checks` TINYINT(1) DEFAULT '1',
`agent_max_value` TINYINT(1) DEFAULT '1', `agent_max_value` TINYINT(1) DEFAULT '1',
`agent_min_value` TINYINT(1) DEFAULT '1', `agent_min_value` TINYINT(1) DEFAULT '1',
`current_month` TINYINT(1) DEFAULT '1',
PRIMARY KEY(`id_rc`), PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE ON UPDATE CASCADE ON DELETE CASCADE
@ -2974,6 +2976,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`unknown_checks` TINYINT(1) DEFAULT '1', `unknown_checks` TINYINT(1) DEFAULT '1',
`agent_max_value` TINYINT(1) DEFAULT '1', `agent_max_value` TINYINT(1) DEFAULT '1',
`agent_min_value` TINYINT(1) DEFAULT '1', `agent_min_value` TINYINT(1) DEFAULT '1',
`current_month` TINYINT(1) DEFAULT '1',
PRIMARY KEY(`id_rc`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -345,8 +345,7 @@ INSERT INTO `tperfil` VALUES (1,'Operator&#x20;&#40;Read&#41;',0,1,0,1,0,0,0,0,0
-- Dumping data for table `tnews` -- Dumping data for table `tnews`
-- --
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome to Pandora FMS!','This is the Pandora FMS Console. A lot of new features have been added since last version. Please read the documentation about it, and feel free to test any option.\r\n\r\nThe Pandora FMS Team.',NOW()); INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (1,'admin','Welcome&#x20;to&#x20;Pandora&#x20;FMS&#x20;Console', '&amp;lt;p&#x20;style=&quot;text-align:&#x20;center;&#x20;font-size:&#x20;13px;&quot;&amp;gt;Hello,&#x20;congratulations,&#x20;if&#x20;you&apos;ve&#x20;arrived&#x20;here&#x20;you&#x20;already&#x20;have&#x20;an&#x20;operational&#x20;monitoring&#x20;console.&#x20;Remember&#x20;that&#x20;our&#x20;forums&#x20;and&#x20;online&#x20;documentation&#x20;are&#x20;available&#x20;24x7&#x20;to&#x20;get&#x20;you&#x20;out&#x20;of&#x20;any&#x20;trouble.&#x20;You&#x20;can&#x20;replace&#x20;this&#x20;message&#x20;with&#x20;a&#x20;personalized&#x20;one&#x20;at&#x20;Admin&#x20;tools&#x20;-&amp;amp;gt;&#x20;Site&#x20;news.&amp;lt;/p&amp;gt;&#x20;',NOW());
INSERT INTO `tnews` (`id_news`, `author`, `subject`, `text`, `timestamp`) VALUES (2,'admin','New Pandora FMS Agent Features','Feel free to test our new features for both Windows and Linux agents: Proxy and Broker modes.',NOW());
INSERT INTO tmodule VALUES (1,'Agent&#x20;module'); INSERT INTO tmodule VALUES (1,'Agent&#x20;module');
INSERT INTO tmodule VALUES (2,'Network&#x20;module'); INSERT INTO tmodule VALUES (2,'Network&#x20;module');

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.734-190513 Version: 7.0NG.734-190516
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.734-190513" pandora_version="7.0NG.734-190516"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -45,7 +45,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.734"; my $pandora_version = "7.0NG.734";
my $pandora_build = "190513"; my $pandora_build = "190516";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -32,7 +32,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.734"; my $pandora_version = "7.0NG.734";
my $pandora_build = "190513"; my $pandora_build = "190516";
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.734 %define version 7.0NG.734
%define release 190513 %define release 190516
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.734 %define version 7.0NG.734
%define release 190513 %define release 190516
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.734 PS190513"; my $version = "7.0NG.734 PS190516";
# 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.734 PS190513"; my $version = "7.0NG.734 PS190516";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);

View File

@ -218,6 +218,12 @@ export default class Clock extends Item<ClockProps> {
const { width, height } = this.getElementSize(); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation const { width, height } = this.getElementSize(); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation
// Calculate font size to adapt the font to the item size.
const baseTimeFontSize = 20; // Per 100px of width.
const dateFontSizeMultiplier = 0.5;
const dateFontSize =
(baseTimeFontSize * dateFontSizeMultiplier * width) / 100;
const div = document.createElement("div"); const div = document.createElement("div");
div.className = "analogic-clock"; div.className = "analogic-clock";
div.style.width = `${width}px`; div.style.width = `${width}px`;
@ -468,6 +474,16 @@ export default class Clock extends Item<ClockProps> {
// Add the clock to the container // Add the clock to the container
div.append(svg); div.append(svg);
// Date.
if (this.props.clockFormat === "datetime") {
const dateElem: HTMLSpanElement = document.createElement("span");
dateElem.className = "date";
dateElem.textContent = humanDate(date, "default");
dateElem.style.fontSize = `${dateFontSize}px`;
if (this.props.color) dateElem.style.color = this.props.color;
div.append(dateElem);
}
return div; return div;
} }

View File

@ -35,6 +35,10 @@
/* Analog clock */ /* Analog clock */
.visual-console-item .analogic-clock {
text-align: center;
}
.visual-console-item .analogic-clock .hour-hand { .visual-console-item .analogic-clock .hour-hand {
animation: rotate-hour 43200s infinite linear; animation: rotate-hour 43200s infinite linear;
} }

View File

@ -115,6 +115,15 @@ export default class Percentile extends Item<PercentileProps> {
// SVG container. // SVG container.
const svg = document.createElementNS(svgNS, "svg"); const svg = document.createElementNS(svgNS, "svg");
var formatValue;
if (this.props.value != null) {
if (Intl) {
formatValue = Intl.NumberFormat("en-EN").format(this.props.value);
} else {
formatValue = this.props.value;
}
}
switch (this.props.percentileType) { switch (this.props.percentileType) {
case "progress-bar": case "progress-bar":
{ {
@ -142,9 +151,11 @@ export default class Percentile extends Item<PercentileProps> {
text.setAttribute("fill", colors.text); text.setAttribute("fill", colors.text);
if (this.props.valueType === "value") { if (this.props.valueType === "value") {
text.style.fontSize = "6pt";
text.textContent = this.props.unit text.textContent = this.props.unit
? `${this.props.value} ${this.props.unit}` ? `${formatValue} ${this.props.unit}`
: `${this.props.value}`; : `${formatValue}`;
} else { } else {
text.textContent = `${progress}%`; text.textContent = `${progress}%`;
} }
@ -215,21 +226,24 @@ export default class Percentile extends Item<PercentileProps> {
text.setAttribute("font-weight", "bold"); text.setAttribute("font-weight", "bold");
text.setAttribute("fill", colors.text); text.setAttribute("fill", colors.text);
if (this.props.valueType === "value") { if (this.props.valueType === "value" && this.props.value != null) {
// Show value and unit in 1 (no unit) or 2 lines. // Show value and unit in 1 (no unit) or 2 lines.
if (this.props.unit && this.props.unit.length > 0) { if (this.props.unit && this.props.unit.length > 0) {
const value = document.createElementNS(svgNS, "tspan"); const value = document.createElementNS(svgNS, "tspan");
value.setAttribute("x", "0"); value.setAttribute("x", "0");
value.setAttribute("dy", "1em"); value.setAttribute("dy", "1em");
value.textContent = `${this.props.value}`; value.textContent = `${formatValue}`;
value.style.fontSize = "8pt";
const unit = document.createElementNS(svgNS, "tspan"); const unit = document.createElementNS(svgNS, "tspan");
unit.setAttribute("x", "0"); unit.setAttribute("x", "0");
unit.setAttribute("dy", "1em"); unit.setAttribute("dy", "1em");
unit.textContent = `${this.props.unit}`; unit.textContent = `${this.props.unit}`;
unit.style.fontSize = "8pt";
text.append(value, unit); text.append(value, unit);
text.setAttribute("transform", "translate(50 33)"); text.setAttribute("transform", "translate(50 33)");
} else { } else {
text.textContent = `${this.props.value}`; text.textContent = `${formatValue}`;
text.style.fontSize = "8pt";
text.setAttribute("transform", "translate(50 50)"); text.setAttribute("transform", "translate(50 50)");
} }
} else { } else {