mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
NCM WIP
This commit is contained in:
parent
dae8a9ba14
commit
6781e513c8
@ -37,7 +37,6 @@ CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
|
|||||||
`id` serial,
|
`id` serial,
|
||||||
`id_template` bigint(20) unsigned NOT NULL,
|
`id_template` bigint(20) unsigned NOT NULL,
|
||||||
`id_script` bigint(20) unsigned NOT NULL,
|
`id_script` bigint(20) unsigned NOT NULL,
|
||||||
`order` int unsigned not null default 0,
|
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
|
@ -4120,7 +4120,6 @@ CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
|
|||||||
`id` serial,
|
`id` serial,
|
||||||
`id_template` bigint(20) unsigned NOT NULL,
|
`id_template` bigint(20) unsigned NOT NULL,
|
||||||
`id_script` bigint(20) unsigned NOT NULL,
|
`id_script` bigint(20) unsigned NOT NULL,
|
||||||
`order` int unsigned not null default 0,
|
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
@ -4131,13 +4130,13 @@ CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
|
|||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
CREATE TABLE IF NOT EXISTS `tncm_agent` (
|
CREATE TABLE IF NOT EXISTS `tncm_agent` (
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`vendor` text,
|
`vendor` text,
|
||||||
`model` text,
|
`model` text,
|
||||||
`protocol` int unsigned not null default 0,
|
`protocol` int unsigned not null default 0,
|
||||||
`cred_key` varchar(100),
|
`cred_key` varchar(100),
|
||||||
`status` int(4) NOT NULL default 5,
|
`status` int(4) NOT NULL default 5,
|
||||||
`updated_at` bigint(20) NOT NULL default 0,
|
`updated_at` bigint(20) NOT NULL default 0,
|
||||||
`config_backup_id` bigint(20) UNSIGNED DEFAULT NULL,
|
`config_backup_id` bigint(20) UNSIGNED DEFAULT NULL,
|
||||||
PRIMARY KEY (`id_agent`),
|
PRIMARY KEY (`id_agent`),
|
||||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`cred_key`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL
|
FOREIGN KEY (`cred_key`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL
|
||||||
@ -4149,9 +4148,9 @@ CREATE TABLE IF NOT EXISTS `tncm_agent` (
|
|||||||
CREATE TABLE IF NOT EXISTS `tncm_agent_templates` (
|
CREATE TABLE IF NOT EXISTS `tncm_agent_templates` (
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`id_template` bigint(20) unsigned NOT NULL,
|
`id_template` bigint(20) unsigned NOT NULL,
|
||||||
`status` int(4) NOT NULL default 5,
|
`status` int(4) NOT NULL default 5,
|
||||||
`updated_at` bigint(20) NOT NULL default 0,
|
`updated_at` bigint(20) NOT NULL default 0,
|
||||||
|
`execute` int(2) UNSIGNED NOT NULL default 0,
|
||||||
PRIMARY KEY (`id_agent`, `id_template`),
|
PRIMARY KEY (`id_agent`, `id_template`),
|
||||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
@ -4163,9 +4162,9 @@ CREATE TABLE IF NOT EXISTS `tncm_agent_templates` (
|
|||||||
CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
|
CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`id_template` bigint(20) unsigned NOT NULL,
|
`id_template` bigint(20) unsigned NOT NULL,
|
||||||
`data` LONGBLOB,
|
`data` LONGBLOB,
|
||||||
`status` int(4) NOT NULL default 5,
|
`status` int(4) NOT NULL default 5,
|
||||||
`updated_at` bigint(20) NOT NULL default 0,
|
`updated_at` bigint(20) NOT NULL default 0,
|
||||||
PRIMARY KEY (`id_agent`, `id_template`),
|
PRIMARY KEY (`id_agent`, `id_template`),
|
||||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
|
@ -36,6 +36,13 @@ namespace PandoraFMS;
|
|||||||
abstract class Entity
|
abstract class Entity
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load from DB or new one.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $existsInDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity fields (from table).
|
* Entity fields (from table).
|
||||||
*
|
*
|
||||||
@ -88,6 +95,7 @@ abstract class Entity
|
|||||||
$obj->{$k}($v);
|
$obj->{$k}($v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$obj->existsInDB = true;
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +145,9 @@ abstract class Entity
|
|||||||
foreach ($data as $k => $v) {
|
foreach ($data as $k => $v) {
|
||||||
$this->fields[$k] = $v;
|
$this->fields[$k] = $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark as existing object.
|
||||||
|
$this->existsInDB = true;
|
||||||
} else {
|
} else {
|
||||||
// Empty one.
|
// Empty one.
|
||||||
$data = \db_get_all_rows_sql(
|
$data = \db_get_all_rows_sql(
|
||||||
@ -149,6 +160,9 @@ abstract class Entity
|
|||||||
foreach ($data as $row) {
|
foreach ($data as $row) {
|
||||||
$this->fields[$row['Field']] = null;
|
$this->fields[$row['Field']] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark as virtual object.
|
||||||
|
$this->existsInDB = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\enterprise_installed() === true
|
if (\enterprise_installed() === true
|
||||||
|
10
pandora_console/include/styles/ncm.css
Normal file
10
pandora_console/include/styles/ncm.css
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
span.select2.select2-container.select2-container--default {
|
||||||
|
max-width: 175px !important;
|
||||||
|
width: 175px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit_discovery_input b {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
@ -4056,7 +4056,6 @@ CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
|
|||||||
`id` serial,
|
`id` serial,
|
||||||
`id_template` bigint(20) unsigned NOT NULL,
|
`id_template` bigint(20) unsigned NOT NULL,
|
||||||
`id_script` bigint(20) unsigned NOT NULL,
|
`id_script` bigint(20) unsigned NOT NULL,
|
||||||
`order` int unsigned not null default 0,
|
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
@ -4067,13 +4066,13 @@ CREATE TABLE IF NOT EXISTS `tncm_template_scripts` (
|
|||||||
-- ----------------------------------------------------------------------
|
-- ----------------------------------------------------------------------
|
||||||
CREATE TABLE IF NOT EXISTS `tncm_agent` (
|
CREATE TABLE IF NOT EXISTS `tncm_agent` (
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`vendor` text,
|
`vendor` text,
|
||||||
`model` text,
|
`model` text,
|
||||||
`protocol` int unsigned not null default 0,
|
`protocol` int unsigned not null default 0,
|
||||||
`cred_key` varchar(100),
|
`cred_key` varchar(100),
|
||||||
`status` int(4) NOT NULL default 5,
|
`status` int(4) NOT NULL default 5,
|
||||||
`udpated_at` bigint(20) NOT NULL default 0,
|
`updated_at` bigint(20) NOT NULL default 0,
|
||||||
`config_backup_id` bigint(20) UNSIGNED DEFAULT NULL,
|
`config_backup_id` bigint(20) UNSIGNED DEFAULT NULL,
|
||||||
PRIMARY KEY (`id_agent`),
|
PRIMARY KEY (`id_agent`),
|
||||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`cred_key`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL
|
FOREIGN KEY (`cred_key`) REFERENCES `tcredential_store`(`identifier`) ON UPDATE CASCADE ON DELETE SET NULL
|
||||||
@ -4085,9 +4084,9 @@ CREATE TABLE IF NOT EXISTS `tncm_agent` (
|
|||||||
CREATE TABLE IF NOT EXISTS `tncm_agent_templates` (
|
CREATE TABLE IF NOT EXISTS `tncm_agent_templates` (
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`id_template` bigint(20) unsigned NOT NULL,
|
`id_template` bigint(20) unsigned NOT NULL,
|
||||||
`status` int(4) NOT NULL default 5,
|
`status` int(4) NOT NULL default 5,
|
||||||
`udpated_at` bigint(20) NOT NULL default 0,
|
`updated_at` bigint(20) NOT NULL default 0,
|
||||||
`execute` int(2) UNSIGNED NOT NULL default 0,
|
`execute` int(2) UNSIGNED NOT NULL default 0,
|
||||||
PRIMARY KEY (`id_agent`, `id_template`),
|
PRIMARY KEY (`id_agent`, `id_template`),
|
||||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
@ -4099,9 +4098,9 @@ CREATE TABLE IF NOT EXISTS `tncm_agent_templates` (
|
|||||||
CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
|
CREATE TABLE IF NOT EXISTS `tncm_agent_data` (
|
||||||
`id_agent` int(10) unsigned NOT NULL,
|
`id_agent` int(10) unsigned NOT NULL,
|
||||||
`id_template` bigint(20) unsigned NOT NULL,
|
`id_template` bigint(20) unsigned NOT NULL,
|
||||||
`data` LONGBLOB,
|
`data` LONGBLOB,
|
||||||
`status` int(4) NOT NULL default 5,
|
`status` int(4) NOT NULL default 5,
|
||||||
`udpated_at` bigint(20) NOT NULL default 0,
|
`updated_at` bigint(20) NOT NULL default 0,
|
||||||
PRIMARY KEY (`id_agent`, `id_template`),
|
PRIMARY KEY (`id_agent`, `id_template`),
|
||||||
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
FOREIGN KEY (`id_agent`) REFERENCES `tagente`(`id_agente`) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
FOREIGN KEY (`id_template`) REFERENCES `tncm_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user