Fix wizard, no show cluster agents in wizard, and preview - #1748

This commit is contained in:
enriquecd 2018-01-23 19:33:48 +01:00
parent a149b3119e
commit 5dbf0eabbd
3 changed files with 115 additions and 66 deletions

View File

@ -237,8 +237,15 @@ elseif($step == 2){
echo "<td class='datos'>"; echo "<td class='datos'>";
$option_style = array(); $option_style = array();
$cluster_agents_in = agents_get_cluster_agents_alias($id_cluster); $cluster_agents_in = agents_get_cluster_agents_alias($id_cluster);
$cluster_agents_all = agents_get_group_agents(0, false, ''); // $cluster_agents_all = agents_get_group_agents(0, false, '');
$cluster_agents_all_pre = db_get_all_rows_sql('select * from tagente where id_os != 21');
foreach ($cluster_agents_all_pre as $key => $value) {
$cluster_agents_all[$value['id_agente']] = $value['alias'];
}
$cluster_agents_out = array(); $cluster_agents_out = array();
$cluster_agents_out = array_diff_key($template_agents_all, $template_agents_in); $cluster_agents_out = array_diff_key($template_agents_all, $template_agents_in);
@ -525,53 +532,53 @@ elseif ($step == 6) {
<script type="text/javascript"> <script type="text/javascript">
function filterByGroup(idGroup, idSelect) { // function filterByGroup(idGroup, idSelect) {
$('#loading_group').show(); // $('#loading_group').show();
//
$('#id_agents' + idSelect).empty (); // $('#id_agents' + idSelect).empty ();
search = $("#text-agent_filter" + idSelect).val(); // search = $("#text-agent_filter" + idSelect).val();
//
jQuery.post ( // jQuery.post (
<?php // <?php
echo "'" . ui_get_full_url(false, false, false, false) . "'"; // echo "'" . ui_get_full_url(false, false, false, false) . "'";
?> // ?>
+ "/ajax.php", { // + "/ajax.php", {
"page" : "godmode/groups/group_list", // "page" : "godmode/groups/group_list",
"get_group_agents" : 1, // "get_group_agents" : 1,
"search" : search, // "search" : search,
"id_group" : idGroup, // "id_group" : idGroup,
// Add a key prefix to avoid auto sorting in js object conversion // // Add a key prefix to avoid auto sorting in js object conversion
"keys_prefix" : "_", // "keys_prefix" : "_",
// Juanma (22/05/2014) Fix: Dont show void agents in template wizard // // Juanma (22/05/2014) Fix: Dont show void agents in template wizard
"show_void_agents" : 0 // "show_void_agents" : 0
}, // },
function (data, status) { // function (data, status) {
//
var group_agents = new Array(); // var group_agents = new Array();
var group_agents_keys = new Array(); // var group_agents_keys = new Array();
//
jQuery.each (data, function (id, value) { // jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index // // Remove keys_prefix from the index
id = id.substring(1); // id = id.substring(1);
//
group_agents.push(value); // group_agents.push(value);
group_agents_keys.push(id); // group_agents_keys.push(id);
}); // });
//
if(idSelect == '') { // if(idSelect == '') {
agents_out_keys = group_agents_keys; // agents_out_keys = group_agents_keys;
agents_out = group_agents; // agents_out = group_agents;
} // }
else { // else {
agents_in_keys = group_agents_keys; // agents_in_keys = group_agents_keys;
agents_in = group_agents; // agents_in = group_agents;
} // }
//
refresh_agents($("#text-agent_filter"+idSelect).attr('value'), agents_out_keys, agents_out, $("#id_agents"+idSelect), <?php if (defined('METACONSOLE')) echo 1; else echo 0; ?>); // refresh_agents($("#text-agent_filter"+idSelect).attr('value'), agents_out_keys, agents_out, $("#id_agents"+idSelect), <?php if (defined('METACONSOLE')) echo 1; else echo 0; ?>);
}, // },
"json" // "json"
); // );
} // }
function filterByGroupMetaconsole(groupName, idSelect) { function filterByGroupMetaconsole(groupName, idSelect) {
$('#loading_group_filter_group').show(); $('#loading_group_filter_group').show();
@ -685,21 +692,21 @@ elseif ($step == 6) {
} }
$(document).ready (function () { $(document).ready (function () {
if ($('#hidden-metaconsole_activated').val() == 1) { // if ($('#hidden-metaconsole_activated').val() == 1) {
filterByGroupMetaconsole($("#group").val(), ''); // filterByGroupMetaconsole($("#group").val(), '');
} // }
else { // else {
filterByGroup($("#group").val(), ''); // filterByGroup($("#group").val(), '');
} // }
//
$("select[name='group']").change(function(){ // $("select[name='group']").change(function(){
if ($('#hidden-metaconsole_activated').val() == 1) { // if ($('#hidden-metaconsole_activated').val() == 1) {
filterByGroupMetaconsole($(this).val(), ''); // filterByGroupMetaconsole($(this).val(), '');
} // }
else { // else {
filterByGroup($(this).val(), ''); // filterByGroup($(this).val(), '');
} // }
}); // });
$("#text-agent_filter").keyup (function () { $("#text-agent_filter").keyup (function () {
$('#loading_filter').show(); $('#loading_filter').show();

View File

@ -114,7 +114,7 @@ elseif ($step == 2) {
$agents_preasigned = db_get_all_rows_sql('select id_agent from tcluster_agent where id_cluster ='.$id_cluster); $agents_preasigned = db_get_all_rows_sql('select id_agent from tcluster_agent where id_cluster ='.$id_cluster);
foreach ($values_cluster_agents['id_agent'] as $key => $value) { foreach ($values_cluster_agents['id_agent'] as $key => $value) {
$tcluster_agent = db_process_sql('insert into tcluster_agent values ('.$id_cluster.','.$value.')'); $tcluster_agent = db_process_sql('insert into tcluster_agent values ('.$id_cluster.','.$value.')');
if ($tcluster_agent !== false){ if ($tcluster_agent !== false){

View File

@ -26,8 +26,50 @@ $buttons['editor'] = array('active' => false,
html_print_image("images/gm_setup.png", true, array ("title" => __('Cluster editor'))) .'</a>'); html_print_image("images/gm_setup.png", true, array ("title" => __('Cluster editor'))) .'</a>');
ui_print_page_header ( __("Cluster detail").' » '.clusters_get_name($id_cluster), "images/agent_mc.png", false, "agent_status", false, $buttons);
echo "<table style='width:100%;'>";
echo "<tr>";
echo "<td style='border:1px solid black;min-width:800px;min-height:800px;vertical-align: top;'>";
echo "<div id='cluster_map' style='width:600px;height:600px;'></div>";
echo "</td>";
echo "<td style='min-width:600px;min-height:600px;vertical-align: top;'>";
echo "<div style='width:50%;background-color:red;float:left;'>";
//
// echo "<div style='float:left;width:100px;margin-left:20px;margin-top:20px;font-size:2em;text-align:center;'>".__('CLUSTER STATUS')."</div>";
// echo "<div style='float:left;width:100px;margin-left:50px;margin-top:20px;height:50px;background-color:#82b92e;'></div>";
//
// echo "<div style='float:left;width:300px;margin-left:50px;margin-top:20px;height:400px;background-color:#82b92e;'></div>";
echo "</div>";
echo "<div style='width:50%;background-color:blue;float:right;'>";
//
// echo "<div style='float:left;width:100px;px;margin-top:20px;font-size:2em;text-align:center;'>".__('LAST UPDATE')."</div>";
// echo "<div style='float:left;width:220px;margin-left:20px;margin-top:30px;font-size:1.5em;text-align:center;'>88 Hours 88 Min 88 sec ago</div>";
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2' style='min-width:600px;min-height:600px;vertical-align: top;'>
<div id='cluster_modules' style='min-height:150px;'></div>
</td>";
echo "</tr>";
echo "</table>";
ui_print_page_header ( __("Cluster detail"), "images/agent_mc.png", false, "agent_status", false, $buttons);
echo 'El estado del modulo del cluster '.clusters_get_name($id_cluster).' es '.modules_get_agentmodule_last_status(40); echo 'El estado del modulo del cluster '.clusters_get_name($id_cluster).' es '.modules_get_agentmodule_last_status(40);