Rewrited all the data retrieving functionality of the different tree views

This commit is contained in:
Alejandro Gallardo Escobar 2015-01-21 17:37:51 +01:00
parent 6f957bb6a3
commit af36ed50d9
4 changed files with 853 additions and 839 deletions

View File

@ -31,27 +31,17 @@ if (is_ajax ()) {
if ($getChildren) {
$type = get_parameter('type', 'group');
$rootType = get_parameter('rootType', '');
$id = get_parameter('id', -1);
$rootID = get_parameter('rootID', -1);
$filter = get_parameter('filter', array('searchAgent' => '', 'statusAgent' => AGENT_STATUS_ALL));
$id = get_parameter('id', 0);
$childrenMethod = get_parameter('childrenMethod', 'on_demand');
$countModuleStatusMethod = get_parameter('countModuleStatusMethod', 'on_demand');
$countAgentStatusMethod = get_parameter('countAgentStatusMethod', 'live');
if (class_exists('TreeEnterprise')) {
$tree = new TreeEnterprise($type,
$id,
$childrenMethod,
$countModuleStatusMethod,
$countAgentStatusMethod
);
$tree = new TreeEnterprise($type, $rootType, $id, $rootID, $childrenMethod);
}
else {
$tree = new Tree($type,
$id,
$childrenMethod,
$countModuleStatusMethod,
$countAgentStatusMethod
);
$tree = new Tree($type, $rootType, $id, $rootID, $childrenMethod);
}
$tree->setFilter(array(

File diff suppressed because it is too large Load Diff

View File

@ -349,37 +349,42 @@ TreeController = {
}
// Graph pop-up
var $graphImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
+'images/chart_curve.png" /> ');
$graphImage
.addClass('module-graph')
.click(function (e) {
e.preventDefault();
if (typeof element.moduleGraph != 'undefined') {
var $graphImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
+'images/chart_curve.png" /> ');
$graphImage
.addClass('module-graph')
.click(function (e) {
e.preventDefault();
try {
winopeng(element.moduleGraph.url, element.moduleGraph.handle);
}
catch (error) {
console.log(error);
}
});
try {
winopeng(element.moduleGraph.url, element.moduleGraph.handle);
}
catch (error) {
console.log(error);
}
});
}
// Data pop-up
var $dataImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
+'images/binary.png" /> ');
$dataImage
.addClass('module-data')
.click(function (e) {
e.preventDefault();
if (typeof element.id != 'undefined'
&& !isNaN(element.id)) {
var $dataImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
+'images/binary.png" /> ');
$dataImage
.addClass('module-data')
.click(function (e) {
e.preventDefault();
try {
if ($("#module_details_window").length > 0)
show_module_detail_dialog(element.id, '', '', 0, 86400);
}
catch (error) {
console.log(error);
}
});
try {
if ($("#module_details_window").length > 0)
show_module_detail_dialog(element.id, '', '', 0, 86400);
}
catch (error) {
console.log(error);
}
});
}
$content
.append($graphImage)
@ -492,10 +497,9 @@ TreeController = {
getChildren: 1,
id: element.id,
type: element.type,
filter: controller.filter,
childrenMethod: 'live',
countModuleStatusMethod: 'live',
countAgentStatusMethod: 'live'
rootID: element.rootID,
rootType: element.rootType,
filter: controller.filter
},
complete: function(xhr, textStatus) {
$node.removeClass("leaf-loading");

View File

@ -168,10 +168,7 @@ echo "</div>";
parameters['filter'] = {};
parameters['type'] = "<?php echo $tab; ?>";
parameters['filter']['searchAgent'] = $("input#text-search").val();
parameters['filter']['status'] = $("select#status").val();
parameters['childrenMethod'] = 'live';
parameters['countModuleStatusMethod'] = 'live';
parameters['countAgentStatusMethod'] = 'live';
parameters['filter']['statusAgent'] = $("select#status").val();
$.ajax({
type: "POST",