Merge branch 'ent-2441-despliegue-de-agentes-desde-pandora' into 'develop'
Ent 2441 despliegue de agentes desde pandora See merge request artica/pandorafms!2596
This commit is contained in:
commit
68c45a9f4f
|
@ -12,4 +12,40 @@ ALTER TABLE `tmodule_relationship` ADD COLUMN `type` ENUM('direct', 'failover')
|
|||
|
||||
ALTER TABLE `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
|
||||
|
||||
COMMIT;
|
||||
CREATE TABLE `tagent_repository` (
|
||||
`id` SERIAL,
|
||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||
`version` VARCHAR(10) DEFAULT '',
|
||||
`path` text,
|
||||
`uploaded_by` VARCHAR(100) DEFAULT '',
|
||||
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
|
||||
`last_err` text,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `tdeployment_hosts` (
|
||||
`id` SERIAL,
|
||||
`id_cs` VARCHAR(100),
|
||||
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
|
||||
`target_agent_version_id` BIGINT UNSIGNED,
|
||||
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
||||
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
|
||||
`last_err` text,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
|
||||
ON UPDATE CASCADE ON DELETE SET NULL,
|
||||
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -2220,3 +2220,44 @@ CREATE TABLE IF NOT EXISTS `tcredential_store` (
|
|||
-- Table `treport_content_sla_combined`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `treport_content_sla_combined` ADD `id_agent_module_failover` int(10) unsigned NOT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_repository`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE `tagent_repository` (
|
||||
`id` SERIAL,
|
||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||
`version` VARCHAR(10) DEFAULT '',
|
||||
`path` text,
|
||||
`uploaded_by` VARCHAR(100) DEFAULT '',
|
||||
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
|
||||
`last_err` text,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tdeployment_hosts`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tdeployment_hosts` (
|
||||
`id` SERIAL,
|
||||
`id_cs` VARCHAR(100),
|
||||
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
|
||||
`target_agent_version_id` BIGINT UNSIGNED,
|
||||
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
||||
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
|
||||
`last_err` text,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
|
||||
ON UPDATE CASCADE ON DELETE SET NULL,
|
||||
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -524,8 +524,10 @@ if (enterprise_installed()) {
|
|||
);
|
||||
$safe_mode_modules = [];
|
||||
$safe_mode_modules[0] = __('Any');
|
||||
foreach ($sql_modules as $m) {
|
||||
$safe_mode_modules[$m['id_module']] = $m['name'];
|
||||
if (is_array($sql_modules)) {
|
||||
foreach ($sql_modules as $m) {
|
||||
$safe_mode_modules[$m['id_module']] = $m['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$table_adv_safe = '<div class="label_select_simple label_simple_items"><p class="input_label input_label_simple">'.__('Safe operation mode').': '.ui_print_help_tip(
|
||||
|
|
|
@ -369,7 +369,7 @@ echo '</div>';
|
|||
text = err.message;
|
||||
failed = 1;
|
||||
}
|
||||
if (!failed && data['error']) {
|
||||
if (!failed && data['error'] != undefined) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = data['error'];
|
||||
failed = 1;
|
||||
|
@ -522,12 +522,10 @@ echo '</div>';
|
|||
|
||||
function calculate_inputs() {
|
||||
if ($('#product :selected').val() == "CUSTOM") {
|
||||
$('#div-username label').text('<?php echo __('Username'); ?>');
|
||||
$('#div-username label').text('<?php echo __('User'); ?>');
|
||||
$('#div-password label').text('<?php echo __('Password'); ?>');
|
||||
$('#div-extra_1 label').text('<?php echo __('Extra'); ?>');
|
||||
$('#div-extra_2 label').text('<?php echo __('Extra (2)'); ?>');
|
||||
$('#div-extra_1').show();
|
||||
$('#div-extra_2').show();
|
||||
$('#div-extra_1').hide();
|
||||
$('#div-extra_2').hide();
|
||||
} else if ($('#product :selected').val() == "AWS") {
|
||||
$('#div-username label').text('<?php echo __('Access key ID'); ?>');
|
||||
$('#div-password label').text('<?php echo __('Secret access key'); ?>');
|
||||
|
@ -557,8 +555,8 @@ echo '</div>';
|
|||
success: function(data) {
|
||||
$('#form_new').html(data);
|
||||
$('#id_group').val(0);
|
||||
// By default AWS.
|
||||
$('#product').val('AWS');
|
||||
// By default CUSTOM.
|
||||
$('#product').val('CUSTOM');
|
||||
calculate_inputs();
|
||||
|
||||
$('#product').on('change', function() {
|
||||
|
@ -590,9 +588,6 @@ echo '</div>';
|
|||
text: 'OK',
|
||||
click: function(e) {
|
||||
var values = {};
|
||||
|
||||
console.log($('#form_new'));
|
||||
|
||||
$('#form_new :input').each(function() {
|
||||
values[this.name] = btoa($(this).val());
|
||||
});
|
||||
|
|
|
@ -24,23 +24,24 @@ $menu_godmode['class'] = 'godmode';
|
|||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub = [];
|
||||
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Discovery Main');
|
||||
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
|
||||
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=app']['text'] = __('Applications');
|
||||
$sub['godmode/servers/discovery&wiz=app']['id'] = 'app';
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=cloud']['text'] = __('Cloud');
|
||||
$sub['godmode/servers/discovery&wiz=cloud']['id'] = 'cloud';
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=ctask']['text'] = __('Console task');
|
||||
$sub['godmode/servers/discovery&wiz=ctask']['id'] = 'ctask';
|
||||
|
||||
$sub2 = [];
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
|
||||
enterprise_hook('hostdevices_submenu');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
|
||||
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
|
||||
|
||||
enterprise_hook('applications_menu');
|
||||
enterprise_hook('cloud_menu');
|
||||
enterprise_hook('console_task_menu');
|
||||
|
||||
// Add to menu.
|
||||
$menu_godmode['discovery']['text'] = __('Discovery');
|
||||
|
@ -128,6 +129,7 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
|||
$sub['godmode/modules/manage_network_templates']['id'] = 'Module templates';
|
||||
enterprise_hook('inventory_submenu');
|
||||
enterprise_hook('autoconfiguration_menu');
|
||||
enterprise_hook('agent_repository_menu');
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
|
|
|
@ -42,7 +42,19 @@ function get_wiz_class($str)
|
|||
return 'ConsoleTasks';
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
// Main, show header.
|
||||
ui_print_page_header(
|
||||
__('Discovery'),
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
GENERIC_SIZE_TEXT,
|
||||
''
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +93,7 @@ function cl_load_cmp($a, $b)
|
|||
$classes = glob($config['homedir'].'/godmode/wizards/*.class.php');
|
||||
if (enterprise_installed()) {
|
||||
$ent_classes = glob(
|
||||
$config['homedir'].'/enterprise/godmode/wizards/*.class.php'
|
||||
$config['homedir'].'/'.ENTERPRISE_DIR.'/godmode/wizards/*.class.php'
|
||||
);
|
||||
if ($ent_classes === false) {
|
||||
$ent_classes = [];
|
||||
|
@ -130,7 +142,7 @@ if ($classname_selected === null) {
|
|||
}
|
||||
}
|
||||
|
||||
// Show hints if there is no task
|
||||
// Show hints if there is no task.
|
||||
if (get_parameter('discovery_hint', 0)) {
|
||||
ui_require_css_file('discovery-hint');
|
||||
ui_print_info_message(__('You must create a task first'));
|
||||
|
|
|
@ -418,6 +418,7 @@ class DiscoveryTaskList extends Wizard
|
|||
$table->align[9] = 'left';
|
||||
|
||||
foreach ($recon_tasks as $task) {
|
||||
$no_operations = false;
|
||||
$data = [];
|
||||
$server_name = servers_get_name($task['id_recon_server']);
|
||||
|
||||
|
@ -552,6 +553,17 @@ class DiscoveryTaskList extends Wizard
|
|||
$data[6] .= __('Discovery.App.Oracle');
|
||||
break;
|
||||
|
||||
case DISCOVERY_DEPLOY_AGENTS:
|
||||
// Internal deployment task.
|
||||
$no_operations = true;
|
||||
$data[6] = html_print_image(
|
||||
'images/deploy.png',
|
||||
true,
|
||||
['title' => __('Agent deployment')]
|
||||
).' ';
|
||||
$data[6] .= __('Discovery.Agent.Deployment');
|
||||
break;
|
||||
|
||||
case DISCOVERY_HOSTDEVICES:
|
||||
default:
|
||||
if ($task['id_recon_script'] == 0) {
|
||||
|
@ -595,71 +607,75 @@ class DiscoveryTaskList extends Wizard
|
|||
$data[8] = __('Not executed yet');
|
||||
}
|
||||
|
||||
if ($task['disabled'] != 2) {
|
||||
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/eye.png',
|
||||
true
|
||||
);
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
|
||||
if ($task['disabled'] != 2 && $task['utimestamp'] > 0
|
||||
&& $task['type'] != DISCOVERY_APP_MYSQL
|
||||
&& $task['type'] != DISCOVERY_APP_ORACLE
|
||||
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
|
||||
) {
|
||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/dynamic_network_icon.png',
|
||||
true
|
||||
);
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$task['id_group'],
|
||||
'PM'
|
||||
)
|
||||
) {
|
||||
if ($ipam === true) {
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
|
||||
$tipam_task_id
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
if (!$no_operations) {
|
||||
if ($task['disabled'] != 2) {
|
||||
$data[9] = '<a href="#" onclick="progress_task_list('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/eye.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
);
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
|
||||
if ($task['disabled'] != 2 && $task['utimestamp'] > 0
|
||||
&& $task['type'] != DISCOVERY_APP_MYSQL
|
||||
&& $task['type'] != DISCOVERY_APP_ORACLE
|
||||
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
|
||||
) {
|
||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/dynamic_network_icon.png',
|
||||
true
|
||||
).'</a>';
|
||||
);
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$task['id_group'],
|
||||
'PM'
|
||||
)
|
||||
) {
|
||||
if ($ipam === true) {
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=%d',
|
||||
$tipam_task_id
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=delete&id='.$tipam_task_id
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true
|
||||
).'</a>';
|
||||
} else {
|
||||
// Check if is a H&D, Cloud or Application or IPAM.
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||
$this->getTargetWiz($task, $recon_script_data),
|
||||
$task['id_rt']
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true
|
||||
).'</a>';
|
||||
}
|
||||
} else {
|
||||
// Check if is a H&D, Cloud or Application or IPAM.
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
sprintf(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&%s&task=%d',
|
||||
$this->getTargetWiz($task, $recon_script_data),
|
||||
$task['id_rt']
|
||||
)
|
||||
).'">'.html_print_image(
|
||||
'images/config.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] .= '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&delete=1&task='.$task['id_rt']
|
||||
).'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true
|
||||
).'</a>';
|
||||
$data[9] = '';
|
||||
}
|
||||
} else {
|
||||
$data[9] = '';
|
||||
$data[9] = '-';
|
||||
}
|
||||
|
||||
$table->cellclass[][9] = 'action_buttons';
|
||||
|
|
|
@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/class/CustomNetScan.class.php';
|
|||
require_once $config['homedir'].'/include/class/ManageNetScanScripts.class.php';
|
||||
|
||||
enterprise_include_once('include/class/CSVImportAgents.class.php');
|
||||
enterprise_include_once('include/class/DeploymentCenter.class.php');
|
||||
enterprise_include_once('include/functions_hostdevices.php');
|
||||
|
||||
/**
|
||||
|
@ -127,6 +128,12 @@ class HostDevices extends Wizard
|
|||
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
|
||||
'label' => __('Import CSV'),
|
||||
];
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=deploy',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
|
||||
'label' => __('Agent deployment'),
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[] = [
|
||||
|
@ -149,11 +156,30 @@ class HostDevices extends Wizard
|
|||
),
|
||||
'label' => __('Discovery'),
|
||||
],
|
||||
[
|
||||
'link' => ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
|
||||
),
|
||||
'label' => __('Host & Devices'),
|
||||
'selected' => true,
|
||||
],
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true));
|
||||
ui_print_page_header(
|
||||
__('Host & devices'),
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
GENERIC_SIZE_TEXT,
|
||||
'',
|
||||
$this->printHeader(true)
|
||||
);
|
||||
|
||||
$this->printBigButtonsList($buttons);
|
||||
return;
|
||||
|
@ -167,6 +193,14 @@ class HostDevices extends Wizard
|
|||
);
|
||||
return $csv_importer->runCSV();
|
||||
}
|
||||
|
||||
if ($mode === 'deploy') {
|
||||
$deployObject = new DeploymentCenter(
|
||||
$this->page,
|
||||
$this->breadcrum
|
||||
);
|
||||
return $deployObject->run();
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode === 'customnetscan') {
|
||||
|
@ -785,6 +819,7 @@ class HostDevices extends Wizard
|
|||
}).change();';
|
||||
|
||||
$this->printFormAsGrid($form);
|
||||
$this->printGoBackButton($this->url.'&page='.($this->page - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -877,6 +912,7 @@ class HostDevices extends Wizard
|
|||
];
|
||||
|
||||
$this->printFormAsList($form);
|
||||
$this->printGoBackButton($this->url.'&mode=netscan&task='.$this->task['id_rt'].'&page='.($this->page - 1));
|
||||
}
|
||||
|
||||
if ($this->page == 2) {
|
||||
|
|
|
@ -296,241 +296,20 @@ class Wizard
|
|||
*/
|
||||
public function printInput($data)
|
||||
{
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/functions_html.php';
|
||||
|
||||
if (is_array($data) === false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
switch ($data['type']) {
|
||||
case 'text':
|
||||
return html_print_input_text(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['alt']) === true) ? $data['alt'] : ''),
|
||||
((isset($data['size']) === true) ? $data['size'] : 50),
|
||||
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
|
||||
((isset($data['return']) === true) ? $data['return'] : true),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['function']) === true) ? $data['function'] : ''),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
|
||||
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
|
||||
);
|
||||
|
||||
case 'image':
|
||||
return html_print_input_image(
|
||||
$data['name'],
|
||||
$data['src'],
|
||||
$data['value'],
|
||||
((isset($data['style']) === true) ? $data['style'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['options']) === true) ? $data['options'] : false)
|
||||
);
|
||||
|
||||
case 'text_extended':
|
||||
return html_print_input_text_extended(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
$data['id'],
|
||||
$data['alt'],
|
||||
$data['size'],
|
||||
$data['maxlength'],
|
||||
$data['disabled'],
|
||||
$data['script'],
|
||||
$data['attributes'],
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['password']) === true) ? $data['password'] : false),
|
||||
((isset($data['function']) === true) ? $data['function'] : '')
|
||||
);
|
||||
|
||||
case 'password':
|
||||
return html_print_input_password(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['alt']) === true) ? $data['alt'] : ''),
|
||||
((isset($data['size']) === true) ? $data['size'] : 50),
|
||||
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : '')
|
||||
);
|
||||
|
||||
case 'text':
|
||||
return html_print_input_text(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['alt']) === true) ? $data['alt'] : ''),
|
||||
((isset($data['size']) === true) ? $data['size'] : 50),
|
||||
((isset($data['maxlength']) === true) ? $data['maxlength'] : 255),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['function']) === true) ? $data['function'] : ''),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
|
||||
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
|
||||
);
|
||||
|
||||
case 'image':
|
||||
return html_print_input_image(
|
||||
$data['name'],
|
||||
$data['src'],
|
||||
$data['value'],
|
||||
((isset($data['style']) === true) ? $data['style'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['options']) === true) ? $data['options'] : false)
|
||||
);
|
||||
|
||||
case 'hidden':
|
||||
return html_print_input_hidden(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : false)
|
||||
);
|
||||
|
||||
case 'hidden_extended':
|
||||
return html_print_input_hidden_extended(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
$data['id'],
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : false)
|
||||
);
|
||||
|
||||
case 'color':
|
||||
return html_print_input_color(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['class']) === true) ? $data['class'] : false),
|
||||
((isset($data['return']) === true) ? $data['return'] : false)
|
||||
);
|
||||
|
||||
case 'file':
|
||||
return html_print_input_file(
|
||||
$data['name'],
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['options']) === true) ? $data['options'] : false)
|
||||
);
|
||||
|
||||
case 'select':
|
||||
return html_print_select(
|
||||
$data['fields'],
|
||||
$data['name'],
|
||||
((isset($data['selected']) === true) ? $data['selected'] : ''),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
|
||||
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['multiple']) === true) ? $data['multiple'] : false),
|
||||
((isset($data['sort']) === true) ? $data['sort'] : true),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['style']) === true) ? $data['style'] : false),
|
||||
((isset($data['option_style']) === true) ? $data['option_style'] : false),
|
||||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['modal']) === true) ? $data['modal'] : false),
|
||||
((isset($data['message']) === true) ? $data['message'] : ''),
|
||||
((isset($data['select_all']) === true) ? $data['select_all'] : false)
|
||||
);
|
||||
|
||||
case 'select_from_sql':
|
||||
return html_print_select_from_sql(
|
||||
$data['sql'],
|
||||
$data['name'],
|
||||
((isset($data['selected']) === true) ? $data['selected'] : ''),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
|
||||
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : '0'),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['multiple']) === true) ? $data['multiple'] : false),
|
||||
((isset($data['sort']) === true) ? $data['sort'] : true),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['style']) === true) ? $data['style'] : false),
|
||||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['trucate_size']) === true) ? $data['trucate_size'] : GENERIC_SIZE_TEXT)
|
||||
);
|
||||
|
||||
case 'select_groups':
|
||||
return html_print_select_groups(
|
||||
((isset($data['id_user']) === true) ? $data['id_user'] : false),
|
||||
((isset($data['privilege']) === true) ? $data['privilege'] : 'AR'),
|
||||
((isset($data['returnAllGroup']) === true) ? $data['returnAllGroup'] : true),
|
||||
$data['name'],
|
||||
((isset($data['selected']) === true) ? $data['selected'] : ''),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
|
||||
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['multiple']) === true) ? $data['multiple'] : false),
|
||||
((isset($data['sort']) === true) ? $data['sort'] : true),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['style']) === true) ? $data['style'] : false),
|
||||
((isset($data['option_style']) === true) ? $data['option_style'] : false),
|
||||
((isset($data['id_group']) === true) ? $data['id_group'] : false),
|
||||
((isset($data['keys_field']) === true) ? $data['keys_field'] : 'id_grupo'),
|
||||
((isset($data['strict_user']) === true) ? $data['strict_user'] : false),
|
||||
((isset($data['delete_groups']) === true) ? $data['delete_groups'] : false),
|
||||
((isset($data['include_groups']) === true) ? $data['include_groups'] : false),
|
||||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['simple_multiple_options']) === true) ? $data['simple_multiple_options'] : false)
|
||||
);
|
||||
|
||||
case 'submit':
|
||||
return '<div class="action-buttons" style="width: 100%">'.html_print_submit_button(
|
||||
((isset($data['label']) === true) ? $data['label'] : 'OK'),
|
||||
((isset($data['name']) === true) ? $data['name'] : ''),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false)
|
||||
).'</div>';
|
||||
|
||||
case 'checkbox':
|
||||
return html_print_checkbox(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['checked']) === true) ? $data['checked'] : false),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['disabled_hidden']) === true) ? $data['disabled_hidden'] : false)
|
||||
);
|
||||
|
||||
case 'switch':
|
||||
return html_print_switch($data);
|
||||
|
||||
case 'interval':
|
||||
return html_print_extended_select_for_time(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['nothing']) === true) ? $data['nothing'] : ''),
|
||||
((isset($data['nothing_value']) === true) ? $data['nothing_value'] : 0),
|
||||
((isset($data['size']) === true) ? $data['size'] : false),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['style']) === true) ? $data['selected'] : false),
|
||||
((isset($data['unique']) === true) ? $data['unique'] : false)
|
||||
);
|
||||
|
||||
case 'textarea':
|
||||
return html_print_textarea(
|
||||
$data['name'],
|
||||
$data['rows'],
|
||||
$data['columns'],
|
||||
((isset($data['value']) === true) ? $data['value'] : ''),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : '')
|
||||
);
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
$input = html_print_input(($data + ['return' => true]), 'div', true);
|
||||
if ($input === false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '';
|
||||
return $input;
|
||||
}
|
||||
|
||||
|
||||
|
@ -556,6 +335,7 @@ class Wizard
|
|||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'class' => 'w100p',
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Go back'),
|
||||
|
@ -594,13 +374,24 @@ class Wizard
|
|||
|
||||
if (is_array($input['block_content']) === true) {
|
||||
// Print independent block of inputs.
|
||||
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
|
||||
$output .= '<ul class="wizard">';
|
||||
if ($input['wrapper']) {
|
||||
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
||||
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
|
||||
} else {
|
||||
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
|
||||
}
|
||||
|
||||
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
||||
foreach ($input['block_content'] as $input) {
|
||||
$output .= $this->printBlock($input, $return);
|
||||
}
|
||||
|
||||
$output .= '</ul></li>';
|
||||
// Close block.
|
||||
if ($input['wrapper']) {
|
||||
$output .= '</ul></'.$input['wrapper'].'>';
|
||||
} else {
|
||||
$output .= '</ul></li>';
|
||||
}
|
||||
} else {
|
||||
if ($input['arguments']['type'] != 'hidden') {
|
||||
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
|
||||
|
@ -648,7 +439,7 @@ class Wizard
|
|||
if (is_array($input['block_content']) === true) {
|
||||
// Print independent block of inputs.
|
||||
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
|
||||
$output .= '<ul class="wizard">';
|
||||
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
||||
foreach ($input['block_content'] as $input) {
|
||||
$output .= $this->printBlockAsGrid($input, $return);
|
||||
}
|
||||
|
@ -751,7 +542,7 @@ class Wizard
|
|||
if (is_array($input['block_content']) === true) {
|
||||
// Print independent block of inputs.
|
||||
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
|
||||
$output .= '<ul class="wizard">';
|
||||
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
||||
foreach ($input['block_content'] as $input) {
|
||||
$output .= $this->printBlockAsList($input, $return);
|
||||
}
|
||||
|
@ -797,10 +588,11 @@ class Wizard
|
|||
$form = $data['form'];
|
||||
$inputs = $data['inputs'];
|
||||
$js = $data['js'];
|
||||
$rawjs = $data['js_block'];
|
||||
$cb_function = $data['cb_function'];
|
||||
$cb_args = $data['cb_args'];
|
||||
|
||||
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head = '<form id="'.$form['id'].'" class="discovery '.$form['class'].'" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head .= '" '.$form['extra'].'>';
|
||||
|
||||
if ($return === false) {
|
||||
|
@ -844,6 +636,9 @@ class Wizard
|
|||
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
|
||||
$output .= '</form>';
|
||||
$output .= '<script>'.$js.'</script>';
|
||||
if ($rawjs) {
|
||||
$output .= $rawjs;
|
||||
}
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
|
@ -869,10 +664,11 @@ class Wizard
|
|||
$rows = $data['rows'];
|
||||
|
||||
$js = $data['js'];
|
||||
$rawjs = $data['js_block'];
|
||||
$cb_function = $data['cb_function'];
|
||||
$cb_args = $data['cb_args'];
|
||||
|
||||
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head .= '" '.$form['extra'].'>';
|
||||
|
||||
if ($return === false) {
|
||||
|
@ -895,45 +691,47 @@ class Wizard
|
|||
|
||||
$first_block_printed = false;
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if ($row['new_form_block'] == true) {
|
||||
if ($first_block_printed === true) {
|
||||
// If first form block has been placed, then close it before starting a new one.
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="white_box" style="margin-top: 30px;">';
|
||||
} else {
|
||||
$output .= '<div class="white_box">';
|
||||
if (is_array($rows)) {
|
||||
foreach ($rows as $row) {
|
||||
if ($row['new_form_block'] == true) {
|
||||
if ($first_block_printed === true) {
|
||||
// If first form block has been placed, then close it before starting a new one.
|
||||
$output .= '</div>';
|
||||
$output .= '<div class="white_box" style="margin-top: 30px;">';
|
||||
} else {
|
||||
$output .= '<div class="white_box">';
|
||||
}
|
||||
|
||||
$first_block_printed = true;
|
||||
}
|
||||
|
||||
$first_block_printed = true;
|
||||
}
|
||||
$output .= '<div class="edit_discovery_info" style="'.$row['style'].'">';
|
||||
|
||||
$output .= '<div class="edit_discovery_info" style="'.$row['style'].'">';
|
||||
foreach ($row['columns'] as $column) {
|
||||
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
|
||||
$padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
|
||||
$padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
|
||||
$extra_styles = isset($column['style']) ? $column['style'] : '';
|
||||
|
||||
foreach ($row['columns'] as $column) {
|
||||
$width = isset($column['width']) ? 'width: '.$column['width'].';' : 'width: 100%;';
|
||||
$padding_left = isset($column['padding-left']) ? 'padding-left: '.$column['padding-left'].';' : 'padding-left: 0;';
|
||||
$padding_right = isset($column['padding-right']) ? 'padding-right: '.$column['padding-right'].';' : 'padding-right: 0;';
|
||||
$extra_styles = isset($column['style']) ? $column['style'] : '';
|
||||
$output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">';
|
||||
|
||||
$output .= '<div style="'.$width.$padding_left.$padding_right.$extra_styles.'">';
|
||||
|
||||
foreach ($column['inputs'] as $input) {
|
||||
if (is_array($input)) {
|
||||
if ($input['arguments']['type'] != 'submit') {
|
||||
$output .= $this->printBlockAsGrid($input, true);
|
||||
foreach ($column['inputs'] as $input) {
|
||||
if (is_array($input)) {
|
||||
if ($input['arguments']['type'] != 'submit') {
|
||||
$output .= $this->printBlockAsGrid($input, true);
|
||||
} else {
|
||||
$output_submit .= $this->printBlockAsGrid($input, true);
|
||||
}
|
||||
} else {
|
||||
$output_submit .= $this->printBlockAsGrid($input, true);
|
||||
$output .= $input;
|
||||
}
|
||||
} else {
|
||||
$output .= $input;
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
@ -941,6 +739,9 @@ class Wizard
|
|||
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
|
||||
$output .= '</form>';
|
||||
$output .= '<script>'.$js.'</script>';
|
||||
if ($rawjs) {
|
||||
$output .= $rawjs;
|
||||
}
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
|
@ -964,10 +765,11 @@ class Wizard
|
|||
$form = $data['form'];
|
||||
$inputs = $data['inputs'];
|
||||
$js = $data['js'];
|
||||
$rawjs = $data['js_block'];
|
||||
$cb_function = $data['cb_function'];
|
||||
$cb_args = $data['cb_args'];
|
||||
|
||||
$output_head = '<form class="discovery" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head = '<form class="discovery" onsubmit="'.$form['onsubmit'].'" enctype="'.$form['enctype'].'" action="'.$form['action'].'" method="'.$form['method'];
|
||||
$output_head .= '" '.$form['extra'].'>';
|
||||
|
||||
if ($return === false) {
|
||||
|
@ -1001,6 +803,9 @@ class Wizard
|
|||
$output .= '<ul class="wizard">'.$output_submit.'</ul>';
|
||||
$output .= '</form>';
|
||||
$output .= '<script>'.$js.'</script>';
|
||||
if ($rawjs) {
|
||||
$output .= $rawjs;
|
||||
}
|
||||
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 978 B |
|
@ -583,6 +583,7 @@ define('DISCOVERY_APP_ORACLE', 5);
|
|||
define('DISCOVERY_CLOUD_AWS_EC2', 6);
|
||||
define('DISCOVERY_CLOUD_AWS_RDS', 7);
|
||||
define('DISCOVERY_CLOUD_AZURE_COMPUTE', 8);
|
||||
define('DISCOVERY_DEPLOY_AGENTS', 9);
|
||||
|
||||
|
||||
// Discovery types matching definition.
|
||||
|
|
|
@ -56,8 +56,6 @@ function credentials_get_all(
|
|||
|
||||
global $config;
|
||||
|
||||
$user_is_admin = users_is_admin();
|
||||
|
||||
if (!is_array($filter)) {
|
||||
error_log('[credential_get_all] Filter must be an array.');
|
||||
throw new Exception('[credential_get_all] Filter must be an array.');
|
||||
|
@ -295,9 +293,9 @@ function print_inputs($values=null)
|
|||
'type' => 'select',
|
||||
'script' => 'calculate_inputs()',
|
||||
'fields' => [
|
||||
// 'CUSTOM' => __('Custom'),
|
||||
'AWS' => __('Aws'),
|
||||
'AZURE' => __('Azure'),
|
||||
'CUSTOM' => __('Custom'),
|
||||
'AWS' => __('Aws'),
|
||||
'AZURE' => __('Azure'),
|
||||
// 'GOOGLE' => __('Google'),
|
||||
],
|
||||
'selected' => $values['product'],
|
||||
|
@ -331,6 +329,10 @@ function print_inputs($values=null)
|
|||
case 'GOOGLE':
|
||||
// Need further investigation.
|
||||
case 'CUSTOM':
|
||||
$user_label = __('Account ID');
|
||||
$pass_label = __('Password');
|
||||
$extra1 = false;
|
||||
$extra2 = false;
|
||||
default:
|
||||
// Use defaults.
|
||||
break;
|
||||
|
|
|
@ -3070,11 +3070,13 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='')
|
|||
/**
|
||||
* Print input using functions html lib.
|
||||
*
|
||||
* @param array $data Input definition.
|
||||
* @param array $data Input definition.
|
||||
* @param string $wrapper Wrapper 'div' or 'li'.
|
||||
* @param boolean $input_only Return or print only input or also label.
|
||||
*
|
||||
* @return string HTML code for desired input.
|
||||
*/
|
||||
function html_print_input($data)
|
||||
function html_print_input($data, $wrapper='div', $input_only=false)
|
||||
{
|
||||
if (is_array($data) === false) {
|
||||
return '';
|
||||
|
@ -3082,8 +3084,8 @@ function html_print_input($data)
|
|||
|
||||
$output = '';
|
||||
|
||||
if ($data['label']) {
|
||||
$output = '<div id="div-'.$data['name'].'" ';
|
||||
if ($data['label'] && $input_only === false) {
|
||||
$output = '<'.$wrapper.' id="'.$wrapper.'-'.$data['name'].'" ';
|
||||
$output .= ' class="'.$data['input_class'].'">';
|
||||
$output .= '<label class="'.$data['label_class'].'">';
|
||||
$output .= $data['label'];
|
||||
|
@ -3171,17 +3173,6 @@ function html_print_input($data)
|
|||
);
|
||||
break;
|
||||
|
||||
case 'image':
|
||||
$output .= html_print_input_image(
|
||||
$data['name'],
|
||||
$data['src'],
|
||||
$data['value'],
|
||||
((isset($data['style']) === true) ? $data['style'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['options']) === true) ? $data['options'] : false)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'hidden':
|
||||
$output .= html_print_input_hidden(
|
||||
$data['name'],
|
||||
|
@ -3286,13 +3277,13 @@ function html_print_input($data)
|
|||
break;
|
||||
|
||||
case 'submit':
|
||||
$output .= '<div class="action-buttons" style="width: 100%">'.html_print_submit_button(
|
||||
$output .= '<'.$wrapper.' class="action-buttons" style="width: 100%">'.html_print_submit_button(
|
||||
((isset($data['label']) === true) ? $data['label'] : 'OK'),
|
||||
((isset($data['name']) === true) ? $data['name'] : ''),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false)
|
||||
).'</div>';
|
||||
).'</'.$wrapper.'>';
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
|
@ -3335,20 +3326,33 @@ function html_print_input($data)
|
|||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : '')
|
||||
);
|
||||
break;
|
||||
|
||||
case 'button':
|
||||
$output .= html_print_button(
|
||||
((isset($data['label']) === true) ? $data['label'] : 'OK'),
|
||||
((isset($data['name']) === true) ? $data['name'] : ''),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : ''),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['imageButton']) === true) ? $data['imageButton'] : false),
|
||||
((isset($data['modal']) === true) ? $data['modal'] : false),
|
||||
((isset($data['message']) === true) ? $data['message'] : '')
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($data['label']) {
|
||||
$output .= '</div>';
|
||||
if ($data['label'] && $input_only === false) {
|
||||
$output .= '</'.$wrapper.'>';
|
||||
if (!$data['return']) {
|
||||
echo '</div>';
|
||||
echo '</'.$wrapper.'>';
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3094,38 +3094,7 @@ function ui_print_datatable(array $parameters)
|
|||
$filter .= '<ul class="datatable_filter content">';
|
||||
|
||||
foreach ($parameters['form']['inputs'] as $input) {
|
||||
$filter .= '<li>';
|
||||
$filter .= '<label>'.$input['label'].'</label>';
|
||||
if ($input['type'] != 'select') {
|
||||
$filter .= '<input type="'.$input['type'].'" ';
|
||||
$filter .= ' style="'.$input['style'].'" ';
|
||||
$filter .= ' class="'.$input['class'].'" ';
|
||||
$filter .= ' value="'.$input['value'].'" ';
|
||||
$filter .= ' name="'.$input['name'].'" id="'.$input['id'].'" />';
|
||||
} else {
|
||||
// Select.
|
||||
$filter .= '<select class="'.$input['class'].'"';
|
||||
$filter .= ' style="'.$input['style'].'" ';
|
||||
$filter .= ' name="'.$input['name'].'" ';
|
||||
$filter .= 'id="'.$input['id'].'">';
|
||||
|
||||
foreach ($input['options'] as $key => $opt) {
|
||||
if (is_array($opt)) {
|
||||
$filter .= '<option value="'.$opt['value'].'"';
|
||||
if ($opt['selected']) {
|
||||
$filter .= ' selected="yes" >';
|
||||
}
|
||||
|
||||
$filter .= __($opt['text']).'</option>';
|
||||
} else {
|
||||
$filter .= '<option value="'.$key.'">'.$opt.'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$filter .= '</select>';
|
||||
}
|
||||
|
||||
$filter .= '</li>';
|
||||
$filter .= html_print_input(($input + ['return' => true]), 'li');
|
||||
}
|
||||
|
||||
$filter .= '<li>';
|
||||
|
@ -3801,7 +3770,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
|
|||
$fullurl = $config['public_url'];
|
||||
if ($url == 'index.php' && is_metaconsole()) {
|
||||
$fullurl .= '/'.ENTERPRISE_DIR.'/meta';
|
||||
}
|
||||
}
|
||||
} else if (!empty($config['public_url'])
|
||||
&& (!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
|
||||
) {
|
||||
|
|
|
@ -1870,3 +1870,100 @@ function logo_preview(icon_name, icon_path, incoming_options) {
|
|||
// console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
// Advanced Form control.
|
||||
/* global $ */
|
||||
/* exported load_modal */
|
||||
function load_modal(settings) {
|
||||
var AJAX_RUNNING = 0;
|
||||
var data = new FormData();
|
||||
if (settings.extradata) {
|
||||
settings.extradata.forEach(function(item) {
|
||||
if (item.value != undefined) data.append(item.name, item.value);
|
||||
});
|
||||
}
|
||||
data.append("page", settings.onshow.page);
|
||||
data.append("method", settings.onshow.method);
|
||||
|
||||
var width = 630;
|
||||
if (settings.onshow.width) {
|
||||
width = settings.onshow.width;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: data,
|
||||
success: function(data) {
|
||||
settings.target.html(data);
|
||||
settings.target.dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
title: settings.modal.title,
|
||||
width: width,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||
text: settings.modal.cancel,
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
settings.cleanup();
|
||||
}
|
||||
},
|
||||
{
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||
text: settings.modal.ok,
|
||||
click: function() {
|
||||
if (AJAX_RUNNING) return;
|
||||
AJAX_RUNNING = 1;
|
||||
var formdata = new FormData();
|
||||
if (settings.extradata) {
|
||||
settings.extradata.forEach(function(item) {
|
||||
if (item.value != undefined)
|
||||
formdata.append(item.name, item.value);
|
||||
});
|
||||
}
|
||||
formdata.append("page", settings.onsubmit.page);
|
||||
formdata.append("method", settings.onsubmit.method);
|
||||
|
||||
$("#" + settings.form + " :input").each(function() {
|
||||
if (this.type == "file") {
|
||||
if ($(this).prop("files")[0]) {
|
||||
formdata.append(this.name, $(this).prop("files")[0]);
|
||||
}
|
||||
} else {
|
||||
formdata.append(this.name, $(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: formdata,
|
||||
success: function(data) {
|
||||
settings.ajax_callback(data);
|
||||
AJAX_RUNNING = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
],
|
||||
closeOnEscape: false,
|
||||
open: function() {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
ul.wizard li > label:not(.p-switch) {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
form.top-action-buttons ul.wizard {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
ul.wizard li {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
form.modal ul.wizard li {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 90%;
|
||||
margin: 0.5em auto;
|
||||
justify-items: center;
|
||||
}
|
||||
|
||||
form.modal ul.wizard li * {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
ul.wizard li.flex-indep {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
ul.wizard li > label:not(.p-switch) {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
form.top-action-buttons ul.wizard {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
ul.wizard li {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
form.modal ul.wizard li {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 90%;
|
||||
margin: 0.5em auto;
|
||||
justify-items: center;
|
||||
}
|
||||
|
||||
form.modal ul.wizard li * {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
ul.wizard li.flex-indep {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.datatable_filter.content li input[type="text"] {
|
||||
width: 150px;
|
||||
margin: 0 1em 0 0;
|
||||
}
|
|
@ -437,8 +437,17 @@ select:-internal-list-box {
|
|||
* - GLOBAL STYLES -
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
.truncate {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.truncate:hover {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.w120px {
|
||||
width: 120px;
|
||||
max-width: 120px;
|
||||
}
|
||||
.mw120px {
|
||||
min-width: 120px;
|
||||
|
@ -1588,6 +1597,8 @@ button.config,
|
|||
button.filter,
|
||||
button.cancel,
|
||||
button.default,
|
||||
button.deploy,
|
||||
input.deploy,
|
||||
input.next,
|
||||
input.upd,
|
||||
input.ok,
|
||||
|
@ -1708,7 +1719,10 @@ button.spinn,
|
|||
input.spinn {
|
||||
background-image: url(../../images/spinner_green.gif);
|
||||
}
|
||||
|
||||
button.deploy,
|
||||
input.deploy {
|
||||
background-image: url(../../images/input_deploy.png);
|
||||
}
|
||||
/*#table-add-item select, #table-add-sla select {
|
||||
width: 180px;
|
||||
}*/
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
letter-spacing: 0.3pt;
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.info_table tr th {
|
||||
|
@ -346,3 +347,8 @@ a.pandora_pagination.current:hover {
|
|||
background-position-y: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.info_table tr th.sorting_asc,
|
||||
.info_table tr th.sorting_desc {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
|
|
@ -3611,3 +3611,44 @@ CREATE TABLE IF NOT EXISTS `tvisual_console_elements_cache` (
|
|||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) engine=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_repository`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE `tagent_repository` (
|
||||
`id` SERIAL,
|
||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||
`version` VARCHAR(10) DEFAULT '',
|
||||
`path` text,
|
||||
`uploaded_by` VARCHAR(100) DEFAULT '',
|
||||
`uploaded` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was uploaded",
|
||||
`last_err` text,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tdeployment_hosts`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tdeployment_hosts` (
|
||||
`id` SERIAL,
|
||||
`id_cs` VARCHAR(100),
|
||||
`ip` VARCHAR(100) NOT NULL UNIQUE,
|
||||
`id_os` INT(10) UNSIGNED DEFAULT 0,
|
||||
`os_version` VARCHAR(100) DEFAULT '' COMMENT "OS version in STR format",
|
||||
`arch` ENUM('x64', 'x86') DEFAULT 'x64',
|
||||
`current_agent_version` VARCHAR(100) DEFAULT '' COMMENT "String latest installed agent",
|
||||
`target_agent_version_id` BIGINT UNSIGNED,
|
||||
`deployed` bigint(20) NOT NULL DEFAULT 0 COMMENT "When it was deployed",
|
||||
`server_ip` varchar(100) default NULL COMMENT "Where to point target agent",
|
||||
`last_err` text,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_cs`) REFERENCES `tcredential_store`(`identifier`)
|
||||
ON UPDATE CASCADE ON DELETE SET NULL,
|
||||
FOREIGN KEY (`id_os`) REFERENCES `tconfig_os`(`id_os`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`target_agent_version_id`) REFERENCES `tagent_repository`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -65,7 +65,8 @@ use constant {
|
|||
sub new ($$$$$$) {
|
||||
my ($class, $config, $dbh) = @_;
|
||||
|
||||
return undef unless $config->{'reconserver'} == 1 || $config->{'discoveryserver'} == 1;
|
||||
return undef unless (defined($config->{'reconserver'}) && $config->{'reconserver'} == 1)
|
||||
|| (defined($config->{'discoveryserver'}) && $config->{'discoveryserver'} == 1);
|
||||
|
||||
if (! -e $config->{'nmap'}) {
|
||||
logger ($config, ' [E] ' . $config->{'nmap'} . " needed by " . $config->{'rb_product_name'} . " Discovery Server not found.", 1);
|
||||
|
@ -227,6 +228,7 @@ sub data_consumer ($$) {
|
|||
server_id => $server_id,
|
||||
%{$pa_config},
|
||||
task_data => $task,
|
||||
public_url => PandoraFMS::Config::pandora_get_tconfig_token($dbh, 'public_url', ''),
|
||||
%cnf_extra
|
||||
);
|
||||
|
||||
|
@ -237,6 +239,12 @@ sub data_consumer ($$) {
|
|||
&& -f $cnf_extra{'creds_file'}) {
|
||||
unlink($cnf_extra{'creds_file'});
|
||||
}
|
||||
|
||||
|
||||
# Clean one shot tasks
|
||||
if ($task->{'type'} eq DISCOVERY_DEPLOY_AGENTS) {
|
||||
db_delete_limit($dbh, ' trecon_task ', ' id_rt = ? ', 1, $task->{'id_rt'});
|
||||
}
|
||||
};
|
||||
if ($@) {
|
||||
logger(
|
||||
|
@ -347,9 +355,10 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
|
|||
|
||||
# Use xprobe2 if available
|
||||
if (-e $self->{pa_config}->{xprobe2}) {
|
||||
my $output = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL | grep 'Running OS' | head -1`;
|
||||
return OS_OTHER if ($? != 0);
|
||||
my $output = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL | grep 'Running OS' | head -1`;
|
||||
if ($? == 0) {
|
||||
return pandora_get_os($self->{'dbh'}, $output);
|
||||
}
|
||||
}
|
||||
|
||||
# Use nmap by default
|
||||
|
|
|
@ -31,7 +31,9 @@ use constant {
|
|||
DISCOVERY_APP_MYSQL => 4,
|
||||
DISCOVERY_APP_ORACLE => 5,
|
||||
DISCOVERY_CLOUD_AWS_EC2 => 6,
|
||||
DISCOVERY_CLOUD_AWS_RDS => 7
|
||||
DISCOVERY_CLOUD_AWS_RDS => 7,
|
||||
DISCOVERY_CLOUD_AZURE_COMPUTE => 8,
|
||||
DISCOVERY_DEPLOY_AGENTS => 9,
|
||||
};
|
||||
|
||||
# /dev/null
|
||||
|
@ -1632,6 +1634,41 @@ sub app_scan($) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Perform a deployment scan.
|
||||
##########################################################################
|
||||
sub deploy_scan($) {
|
||||
my $self = shift;
|
||||
my ($progress, $step);
|
||||
|
||||
my $type = '';
|
||||
|
||||
# Initialize deployer object.
|
||||
my $deployer = PandoraFMS::Recon::Util::enterprise_new(
|
||||
'PandoraFMS::Recon::Deployer',
|
||||
[
|
||||
task_data => $self->{'task_data'},
|
||||
parent => $self
|
||||
]
|
||||
|
||||
);
|
||||
|
||||
if (!$deployer) {
|
||||
# Failed to initialize, check Cloud credentials or anything.
|
||||
call('message', 'Unable to initialize PandoraFMS::Recon::Deployer', 3);
|
||||
} else {
|
||||
# Let deployer object manage scan.
|
||||
$deployer->scan();
|
||||
}
|
||||
|
||||
# Update progress.
|
||||
# Done!
|
||||
$self->{'step'} = '';
|
||||
$self->call('update_progress', -1);
|
||||
}
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Perform a network scan.
|
||||
##########################################################################
|
||||
|
@ -1653,6 +1690,10 @@ sub scan($) {
|
|||
# Cloud scan.
|
||||
return $self->cloud_scan();
|
||||
}
|
||||
|
||||
if($self->{'task_data'}->{'type'} == DISCOVERY_DEPLOY_AGENTS) {
|
||||
return $self->deploy_scan();
|
||||
}
|
||||
}
|
||||
|
||||
# Find devices.
|
||||
|
|
|
@ -81,6 +81,7 @@ our @EXPORT = qw(
|
|||
DISCOVERY_CLOUD_AWS_EC2
|
||||
DISCOVERY_CLOUD_AWS_RDS
|
||||
DISCOVERY_CLOUD_AZURE_COMPUTE
|
||||
DISCOVERY_DEPLOY_AGENTS
|
||||
$DEVNULL
|
||||
$OS
|
||||
$OS_VERSION
|
||||
|
@ -191,6 +192,7 @@ use constant DISCOVERY_APP_ORACLE => 5;
|
|||
use constant DISCOVERY_CLOUD_AWS_EC2 => 6;
|
||||
use constant DISCOVERY_CLOUD_AWS_RDS => 7;
|
||||
use constant DISCOVERY_CLOUD_AZURE_COMPUTE => 8;
|
||||
use constant DISCOVERY_DEPLOY_AGENTS => 9;
|
||||
|
||||
# Set OS, OS version and /dev/null
|
||||
our $OS = $^O;
|
||||
|
|
Loading…
Reference in New Issue