Add remote agent filter in manage agent, add remote field in database #4121

This commit is contained in:
enriquecd 2016-11-02 16:58:53 +01:00
parent b78d417410
commit 9523557145
7 changed files with 43 additions and 5 deletions

View File

@ -112,3 +112,4 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsign
-- Table `tagente`
-- ---------------------------------------------------------------------
ALTER TABLE tagente ADD `transactional_agent` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0;

View File

@ -90,3 +90,4 @@ ALTER TABLE tnetwork_component ADD COLUMN dynamic_two_tailed tinyint(1) unsigned
-- Table `tagente`
-- ---------------------------------------------------------------------
ALTER TABLE tagente ADD transactional_agent tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD remoteto tinyint(1) NOT NULL default 0;

View File

@ -27,3 +27,4 @@ ALTER TABLE tnetwork_component ADD COLUMN dynamic_two_tailed tinyint(1) unsigned
-- Table `tagente`
-- ---------------------------------------------------------------------
ALTER TABLE tagente ADD transactional_agent tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD remote tinyint(1) NOT NULL default 0;

View File

@ -178,7 +178,8 @@ echo "</tr></table>";
$order_collation = "";
switch ($config["dbtype"]) {
case "mysql":
$order_collation = "COLLATE utf8_general_ci";
$order_collation = "";
//$order_collation = "COLLATE utf8_general_ci";
break;
case "postgresql":
case "oracle":
@ -194,6 +195,22 @@ $selectOsDown = '';
$selectGroupUp = '';
$selectGroupDown = '';
switch ($sortField) {
case 'remote':
switch ($sort) {
case 'up':
$selectRemoteUp = $selected;
$order = array('field' => 'remote ' . $order_collation,
'field2' => 'nombre ' . $order_collation,
'order' => 'ASC');
break;
case 'down':
$selectRemoteDown = $selected;
$order = array('field' => 'remote ' . $order_collation,
'field2' => 'nombre ' . $order_collation,
'order' => 'DESC');
break;
}
break;
case 'name':
switch ($sort) {
case 'up':
@ -460,7 +477,10 @@ if ($agents !== false) {
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
echo "</th>";
echo "<th title='".__('Remote agent configuration')."'>".__('R')."</th>";
echo "<th title='".__('Remote agent configuration')."'>".__('R'). ' ' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectRemoteUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=remote&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectRemoteDown)) . '</a>';
echo "</th>";
echo "<th>".__('OS'). ' ' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=up&disabled=$disabled">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
'<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search .'&offset='.$offset.'&sort_field=os&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
@ -476,6 +496,18 @@ if ($agents !== false) {
$rowPair = true;
$iterator = 0;
foreach ($agents as $agent) {
/* Begin Update tagente.remote 0/1 with remote agent function return */
if(config_agents_has_remote_configuration($agent['id_agente'])){
db_process_sql_update('tagente', array('remote' => 1),'id_agente = '.$agent['id_agente'].'');
}
else{
db_process_sql_update('tagente', array('remote' => 0),'id_agente = '.$agent['id_agente'].'');
}
/* End Update tagente.remote 0/1 with remote agent function return */
$id_grupo = $agent["id_grupo"];
if (! check_acl ($config["id_user"], $id_grupo, "AW", $agent['id_agente']) && ! check_acl ($config["id_user"], $id_grupo, "AD", $agent['id_agente']))

View File

@ -86,6 +86,7 @@ CREATE TABLE tagente (
agent_version VARCHAR2(100) DEFAULT '',
ultimo_contacto_remoto TIMESTAMP DEFAULT to_timestamp('1970-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss'),
disabled NUMBER(5, 0) DEFAULT 0,
remote NUMBER(5, 0) DEFAULT 0,
id_parent NUMBER(10, 0) DEFAULT 0,
custom_id VARCHAR2(255) DEFAULT '',
server_name VARCHAR2(100) DEFAULT '',

View File

@ -67,6 +67,7 @@ CREATE TABLE "tagente" (
"agent_version" varchar(100) default '',
"ultimo_contacto_remoto" TIMESTAMP without time zone default '1970-01-01 00:00:00',
"disabled" SMALLINT NOT NULL default 0,
"remote" SMALLINT NOT NULL default 0,
"id_parent" INTEGER default 0,
"custom_id" varchar(255) default '',
"server_name" varchar(100) default '',

View File

@ -62,6 +62,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`agent_version` varchar(100) default '',
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
`disabled` tinyint(2) NOT NULL default '0',
`remote` tinyint(1) NOT NULL default 0,
`id_parent` int(10) unsigned default '0',
`custom_id` varchar(255) default '',
`server_name` varchar(100) default '',