mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Merge branch 'ent-5408-consola-visual-nueva-bugs' into 'develop'
Module graph paint direct See merge request artica/pandorafms!3044
This commit is contained in:
commit
433ee4b43b
@ -213,85 +213,109 @@ if ($config['menu_type'] == 'classic') {
|
||||
$select[0]['autorefresh_white_list']
|
||||
);
|
||||
|
||||
if ($autorefresh_list !== null
|
||||
&& array_search($_GET['sec2'], $autorefresh_list) !== false
|
||||
if ($config['legacy_vc']
|
||||
|| ($_GET['sec2'] !== 'operation/visual_console/render_view')
|
||||
|| (($_GET['sec2'] !== 'operation/visual_console/render_view')
|
||||
&& $config['legacy_vc'])
|
||||
) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
$do_refresh = false;
|
||||
if ($autorefresh_list !== null
|
||||
&& array_search($_GET['sec2'], $autorefresh_list) !== false
|
||||
) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
if ($do_refresh) {
|
||||
$autorefresh_img = html_print_image(
|
||||
'images/header_refresh_gray.png',
|
||||
true,
|
||||
[
|
||||
'class' => 'bot',
|
||||
'alt' => 'lightning',
|
||||
'title' => __('Configure autorefresh'),
|
||||
]
|
||||
);
|
||||
|
||||
if ((isset($select[0]['time_autorefresh']) === true)
|
||||
&& $select[0]['time_autorefresh'] !== 0
|
||||
&& $config['refr'] === null
|
||||
) {
|
||||
$config['refr'] = $select[0]['time_autorefresh'];
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">';
|
||||
$autorefresh_txt .= date(
|
||||
'i:s',
|
||||
$config['refr']
|
||||
);
|
||||
$autorefresh_txt .= '</span>)';
|
||||
} else if ($_GET['refr']) {
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">';
|
||||
$autorefresh_txt .= date('i:s', $config['refr']);
|
||||
$autorefresh_txt .= '</span>)';
|
||||
}
|
||||
|
||||
$ignored_params['refr'] = '';
|
||||
$values = get_refresh_time_array();
|
||||
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
|
||||
$autorefresh_additional .= html_print_select(
|
||||
$values,
|
||||
'ref',
|
||||
'',
|
||||
'',
|
||||
__('Select'),
|
||||
'0',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset($values);
|
||||
if ($home_page != '') {
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="index.php?refr=">';
|
||||
} else {
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
}
|
||||
|
||||
if ($_GET['refr']
|
||||
|| ((isset($select[0]['time_autorefresh']) === true)
|
||||
&& $select[0]['time_autorefresh'] !== 0)
|
||||
) {
|
||||
if ($home_page != '') {
|
||||
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="index.php?refr=">';
|
||||
} else {
|
||||
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
}
|
||||
} else {
|
||||
$autorefresh_link_open_txt = '<a>';
|
||||
}
|
||||
|
||||
$autorefresh_link_close = '</a>';
|
||||
$display_counter = 'display:block';
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled_gray.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
|
||||
$display_counter = 'display:none';
|
||||
}
|
||||
} else {
|
||||
$autorefresh_img = html_print_image(
|
||||
'images/header_refresh_gray.png',
|
||||
'images/header_refresh_disabled_gray.png',
|
||||
true,
|
||||
[
|
||||
'class' => 'bot',
|
||||
'class' => 'bot autorefresh_disabled',
|
||||
'alt' => 'lightning',
|
||||
'title' => __('Configure autorefresh'),
|
||||
'title' => __('Disabled autorefresh'),
|
||||
]
|
||||
);
|
||||
|
||||
if ((isset($select[0]['time_autorefresh']) === true)
|
||||
&& $select[0]['time_autorefresh'] !== 0
|
||||
&& $config['refr'] === null
|
||||
) {
|
||||
$config['refr'] = $select[0]['time_autorefresh'];
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">';
|
||||
$autorefresh_txt .= date(
|
||||
'i:s',
|
||||
$config['refr']
|
||||
);
|
||||
$autorefresh_txt .= '</span>)';
|
||||
} else if ($_GET['refr']) {
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">';
|
||||
$autorefresh_txt .= date('i:s', $config['refr']);
|
||||
$autorefresh_txt .= '</span>)';
|
||||
}
|
||||
|
||||
$ignored_params['refr'] = '';
|
||||
$values = get_refresh_time_array();
|
||||
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
|
||||
$autorefresh_additional .= html_print_select(
|
||||
$values,
|
||||
'ref',
|
||||
'',
|
||||
'',
|
||||
__('Select'),
|
||||
'0',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset($values);
|
||||
if ($home_page != '') {
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="index.php?refr=">';
|
||||
} else {
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
}
|
||||
|
||||
if ($_GET['refr']
|
||||
|| ((isset($select[0]['time_autorefresh']) === true)
|
||||
&& $select[0]['time_autorefresh'] !== 0)
|
||||
) {
|
||||
if ($home_page != '') {
|
||||
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="index.php?refr=">';
|
||||
} else {
|
||||
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
}
|
||||
} else {
|
||||
$autorefresh_link_open_txt = '<a>';
|
||||
}
|
||||
|
||||
$autorefresh_link_close = '</a>';
|
||||
$display_counter = 'display:block';
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled_gray.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
@ -300,39 +324,21 @@ if ($config['menu_type'] == 'classic') {
|
||||
|
||||
$display_counter = 'display:none';
|
||||
}
|
||||
} else {
|
||||
$autorefresh_img = html_print_image(
|
||||
'images/header_refresh_disabled_gray.png',
|
||||
true,
|
||||
[
|
||||
'class' => 'bot autorefresh_disabled',
|
||||
'alt' => 'lightning',
|
||||
'title' => __('Disabled autorefresh'),
|
||||
]
|
||||
);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
$header_autorefresh = '<div id="header_autorefresh">';
|
||||
$header_autorefresh .= $autorefresh_link_open_img;
|
||||
$header_autorefresh .= $autorefresh_img;
|
||||
$header_autorefresh .= $autorefresh_link_close;
|
||||
$header_autorefresh .= '</div>';
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
|
||||
$display_counter = 'display:none';
|
||||
$header_autorefresh_counter = '<div id="header_autorefresh_counter" style="'.$display_counter.'">';
|
||||
$header_autorefresh_counter .= $autorefresh_link_open_txt;
|
||||
$header_autorefresh_counter .= $autorefresh_txt;
|
||||
$header_autorefresh_counter .= $autorefresh_link_close;
|
||||
$header_autorefresh_counter .= $autorefresh_additional;
|
||||
$header_autorefresh_counter .= '</div>';
|
||||
}
|
||||
|
||||
$header_autorefresh = '<div id="header_autorefresh">';
|
||||
$header_autorefresh .= $autorefresh_link_open_img;
|
||||
$header_autorefresh .= $autorefresh_img;
|
||||
$header_autorefresh .= $autorefresh_link_close;
|
||||
$header_autorefresh .= '</div>';
|
||||
|
||||
$header_autorefresh_counter = '<div id="header_autorefresh_counter" style="'.$display_counter.'">';
|
||||
$header_autorefresh_counter .= $autorefresh_link_open_txt;
|
||||
$header_autorefresh_counter .= $autorefresh_txt;
|
||||
$header_autorefresh_counter .= $autorefresh_link_close;
|
||||
$header_autorefresh_counter .= $autorefresh_additional;
|
||||
$header_autorefresh_counter .= '</div>';
|
||||
|
||||
// Button for feedback pandora.
|
||||
if (enterprise_installed()) {
|
||||
$header_feedback = '<div id="feedback-icon-header">';
|
||||
|
@ -783,10 +783,13 @@ $buttons['wizard'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_base.$action.'&tab=wizard&id_visual_console='.$idVisualConsole.'">'.html_print_image('images/wand.png', true, ['title' => __('Wizard')]).'</a>',
|
||||
];
|
||||
$buttons['editor'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_base.$action.'&tab=editor&id_visual_console='.$idVisualConsole.'">'.html_print_image('images/builder.png', true, ['title' => __('Builder')]).'</a>',
|
||||
];
|
||||
if ($config['legacy_vc']) {
|
||||
$buttons['editor'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_base.$action.'&tab=editor&id_visual_console='.$idVisualConsole.'">'.html_print_image('images/builder.png', true, ['title' => __('Builder')]).'</a>',
|
||||
];
|
||||
}
|
||||
|
||||
$buttons['view'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_view.'">'.html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>',
|
||||
|
@ -3714,6 +3714,12 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
||||
$params['value'] = $agent_name;
|
||||
$params['javascript_is_function_select'] = true;
|
||||
|
||||
if (isset($data['get_only_string_modules']) === true
|
||||
&& $data['get_only_string_modules'] === true
|
||||
) {
|
||||
$params['get_only_string_modules'] = $data['get_only_string_modules'];
|
||||
}
|
||||
|
||||
if (isset($data['module_input']) === true
|
||||
&& $data['module_input'] === true
|
||||
) {
|
||||
@ -3755,12 +3761,18 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
||||
0 => __('Select an Agent first'),
|
||||
];
|
||||
} else {
|
||||
$string_filter .= '';
|
||||
if ($data['get_only_string_modules'] === true) {
|
||||
$string_filter = 'AND id_tipo_modulo IN (17,23,3,10,33,36)';
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT id_agente_modulo, nombre
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = %d
|
||||
AND delete_pending = 0',
|
||||
$data['agent_id']
|
||||
AND delete_pending = 0 %s',
|
||||
$data['agent_id'],
|
||||
$string_filter
|
||||
);
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
|
@ -1,10 +1,11 @@
|
||||
/* globals d3 */
|
||||
(function() {
|
||||
// Chart design based on the recommendations of Stephen Few. Implementation
|
||||
// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
|
||||
// http://projects.instantcognition.com/protovis/bulletchart/
|
||||
|
||||
// Chart design based on the recommendations of Stephen Few. Implementation
|
||||
// based on the work of Clint Ivy, Jamie Love, and Jason Davies.
|
||||
// http://projects.instantcognition.com/protovis/bulletchart/
|
||||
d3.bullet = function() {
|
||||
var orient = "right", // TODO top & bottom
|
||||
d3.bullet = function() {
|
||||
var orient = "right", // TODO top & bottom
|
||||
reverse = false,
|
||||
duration = 0,
|
||||
ranges = bulletRanges,
|
||||
@ -14,228 +15,259 @@ d3.bullet = function() {
|
||||
height = 30,
|
||||
tickFormat = null;
|
||||
|
||||
// For each small multiple…
|
||||
function bullet(g) {
|
||||
g.each(function(d, i) {
|
||||
var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
|
||||
markerz = markers.call(this, d, i).slice().sort(d3.descending),
|
||||
measurez = measures.call(this, d, i).slice().sort(d3.descending),
|
||||
// For each small multiple…
|
||||
function bullet(g) {
|
||||
g.each(function(d, i) {
|
||||
var rangez = ranges
|
||||
.call(this, d, i)
|
||||
.slice()
|
||||
.sort(d3.descending),
|
||||
markerz = markers
|
||||
.call(this, d, i)
|
||||
.slice()
|
||||
.sort(d3.descending),
|
||||
measurez = measures
|
||||
.call(this, d, i)
|
||||
.slice()
|
||||
.sort(d3.descending),
|
||||
g = d3.select(this);
|
||||
|
||||
// Compute the new x-scale.
|
||||
var x1 = d3.scale.linear()
|
||||
// Compute the new x-scale.
|
||||
var x1 = d3.scale
|
||||
.linear()
|
||||
.domain([0, Math.max(rangez[0], markerz[0], measurez[0])])
|
||||
.range(reverse ? [width, 0] : [0, width-160]);
|
||||
.range(reverse ? [width, 0] : [0, width - 160]);
|
||||
|
||||
// Retrieve the old x-scale, if this is an update.
|
||||
var x0 = this.__chart__ || d3.scale.linear()
|
||||
.domain([0, Infinity])
|
||||
.range(x1.range());
|
||||
// Retrieve the old x-scale, if this is an update.
|
||||
var x0 =
|
||||
this.__chart__ ||
|
||||
d3.scale
|
||||
.linear()
|
||||
.domain([0, Infinity])
|
||||
.range(x1.range());
|
||||
|
||||
// Stash the new scale.
|
||||
this.__chart__ = x1;
|
||||
// Stash the new scale.
|
||||
this.__chart__ = x1;
|
||||
|
||||
// Derive width-scales from the x-scales.
|
||||
var w0 = bulletWidth(x0),
|
||||
// Derive width-scales from the x-scales.
|
||||
var w0 = bulletWidth(x0),
|
||||
w1 = bulletWidth(x1);
|
||||
|
||||
// Update the range rects.
|
||||
var range = g.selectAll("rect.range")
|
||||
.data(rangez);
|
||||
// Update the range rects.
|
||||
var range = g.selectAll("rect.range").data(rangez);
|
||||
|
||||
range.enter().append("rect")
|
||||
.attr("class", function(d, i) { return "range s" + i; })
|
||||
range
|
||||
.enter()
|
||||
.append("rect")
|
||||
.attr("class", function(d, i) {
|
||||
return "range s" + i;
|
||||
})
|
||||
.attr("width", w0)
|
||||
.attr("height", height)
|
||||
.attr("x", reverse ? x0 : 0)
|
||||
.transition()
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("width", w1)
|
||||
.attr("x", reverse ? x1 : 0);
|
||||
|
||||
range.transition()
|
||||
range
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("x", reverse ? x1 : 0)
|
||||
.attr("width", w1)
|
||||
.attr("height", height);
|
||||
|
||||
// Update the measure rects.
|
||||
var measure = g.selectAll("rect.measure")
|
||||
.data(measurez);
|
||||
// Update the measure rects.
|
||||
var measure = g.selectAll("rect.measure").data(measurez);
|
||||
|
||||
measure.enter().append("rect")
|
||||
.attr("class", function(d, i) { return "measure s" + i; })
|
||||
measure
|
||||
.enter()
|
||||
.append("rect")
|
||||
.attr("class", function(d, i) {
|
||||
return "measure s" + i;
|
||||
})
|
||||
.attr("width", w0)
|
||||
.attr("height", height / 3)
|
||||
.attr("x", reverse ? x0 : 0)
|
||||
.attr("y", height / 3)
|
||||
.transition()
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("width", w1)
|
||||
.attr("x", reverse ? x1 : 0);
|
||||
|
||||
measure.transition()
|
||||
measure
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("width", w1)
|
||||
.attr("height", height / 3)
|
||||
.attr("x", reverse ? x1 : 0)
|
||||
.attr("y", height / 3);
|
||||
|
||||
// Update the marker lines.
|
||||
var marker = g.selectAll("line.marker")
|
||||
.data(markerz);
|
||||
// Update the marker lines.
|
||||
var marker = g.selectAll("line.marker").data(markerz);
|
||||
|
||||
marker.enter().append("line")
|
||||
.attr("class", function(d, i) { return "marker s" + i; })
|
||||
marker
|
||||
.enter()
|
||||
.append("line")
|
||||
.attr("class", function(d, i) {
|
||||
return "marker s" + i;
|
||||
})
|
||||
.attr("x1", x0)
|
||||
.attr("x2", x0)
|
||||
.attr("y1", height / 6)
|
||||
.attr("y2", height * 5 / 6)
|
||||
.transition()
|
||||
.attr("y2", (height * 5) / 6)
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("x1", x1)
|
||||
.attr("x2", x1);
|
||||
|
||||
marker.transition()
|
||||
marker
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("x1", x1)
|
||||
.attr("x2", x1)
|
||||
.attr("y1", height / 6)
|
||||
.attr("y2", height * 5 / 6);
|
||||
.attr("y2", (height * 5) / 6);
|
||||
|
||||
// Compute the tick format.
|
||||
var format = tickFormat || x1.tickFormat(8);
|
||||
// Compute the tick format.
|
||||
var format = tickFormat || x1.tickFormat(8);
|
||||
|
||||
// Update the tick groups.
|
||||
var tick = g.selectAll("g.tick")
|
||||
.data(x1.ticks(8), function(d) {
|
||||
return this.textContent || format(d);
|
||||
});
|
||||
// Update the tick groups.
|
||||
var tick = g.selectAll("g.tick").data(x1.ticks(8), function(d) {
|
||||
return this.textContent || format(d);
|
||||
});
|
||||
|
||||
// Initialize the ticks with the old scale, x0.
|
||||
var tickEnter = tick.enter().append("g")
|
||||
// Initialize the ticks with the old scale, x0.
|
||||
var tickEnter = tick
|
||||
.enter()
|
||||
.append("g")
|
||||
.attr("class", "tick")
|
||||
.attr("transform", bulletTranslate(x0))
|
||||
.style("opacity", 1e-6);
|
||||
|
||||
tickEnter.append("line")
|
||||
tickEnter
|
||||
.append("line")
|
||||
.attr("y1", height)
|
||||
.attr("y2", height * 7 / 6);
|
||||
.attr("y2", (height * 7) / 6);
|
||||
|
||||
tickEnter.append("text")
|
||||
tickEnter
|
||||
.append("text")
|
||||
.attr("text-anchor", "middle")
|
||||
.attr("dy", "1em")
|
||||
.attr("y", height * 7 / 6)
|
||||
.attr("y", (height * 7) / 6)
|
||||
.text(format);
|
||||
|
||||
// Transition the entering ticks to the new scale, x1.
|
||||
tickEnter.transition()
|
||||
// Transition the entering ticks to the new scale, x1.
|
||||
tickEnter
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("transform", bulletTranslate(x1))
|
||||
.style("opacity", 1);
|
||||
|
||||
// Transition the updating ticks to the new scale, x1.
|
||||
var tickUpdate = tick.transition()
|
||||
// Transition the updating ticks to the new scale, x1.
|
||||
var tickUpdate = tick
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("transform", bulletTranslate(x1))
|
||||
.style("opacity", 1);
|
||||
|
||||
tickUpdate.select("line")
|
||||
tickUpdate
|
||||
.select("line")
|
||||
.attr("y1", height)
|
||||
.attr("y2", height + 7);
|
||||
|
||||
tickUpdate.select("text")
|
||||
.attr("y", height + 7);
|
||||
tickUpdate.select("text").attr("y", height + 7);
|
||||
|
||||
// Transition the exiting ticks to the new scale, x1.
|
||||
tick.exit().transition()
|
||||
// Transition the exiting ticks to the new scale, x1.
|
||||
tick
|
||||
.exit()
|
||||
.transition()
|
||||
.duration(duration)
|
||||
.attr("transform", bulletTranslate(x1))
|
||||
.style("opacity", 1e-6)
|
||||
.remove();
|
||||
});
|
||||
d3.timer.flush();
|
||||
});
|
||||
d3.timer.flush();
|
||||
}
|
||||
|
||||
// left, right, top, bottom
|
||||
bullet.orient = function(x) {
|
||||
if (!arguments.length) return orient;
|
||||
orient = x;
|
||||
reverse = orient == "right" || orient == "bottom";
|
||||
return bullet;
|
||||
};
|
||||
|
||||
// ranges (bad, satisfactory, good)
|
||||
bullet.ranges = function(x) {
|
||||
if (!arguments.length) return ranges;
|
||||
ranges = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
// markers (previous, goal)
|
||||
bullet.markers = function(x) {
|
||||
if (!arguments.length) return markers;
|
||||
markers = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
// measures (actual, forecast)
|
||||
bullet.measures = function(x) {
|
||||
if (!arguments.length) return measures;
|
||||
measures = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
bullet.width = function(x) {
|
||||
if (!arguments.length) return width;
|
||||
width = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
bullet.height = function(x) {
|
||||
if (!arguments.length) return height;
|
||||
height = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
bullet.tickFormat = function(x) {
|
||||
if (!arguments.length) return tickFormat;
|
||||
tickFormat = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
bullet.duration = function(x) {
|
||||
if (!arguments.length) return duration;
|
||||
duration = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
return bullet;
|
||||
};
|
||||
|
||||
function bulletRanges(d) {
|
||||
return d.ranges;
|
||||
}
|
||||
|
||||
// left, right, top, bottom
|
||||
bullet.orient = function(x) {
|
||||
if (!arguments.length) return orient;
|
||||
orient = x;
|
||||
reverse = orient == "right" || orient == "bottom";
|
||||
return bullet;
|
||||
};
|
||||
function bulletMarkers(d) {
|
||||
return d.markers;
|
||||
}
|
||||
|
||||
// ranges (bad, satisfactory, good)
|
||||
bullet.ranges = function(x) {
|
||||
if (!arguments.length) return ranges;
|
||||
ranges = x;
|
||||
return bullet;
|
||||
};
|
||||
function bulletMeasures(d) {
|
||||
return d.measures;
|
||||
}
|
||||
|
||||
// markers (previous, goal)
|
||||
bullet.markers = function(x) {
|
||||
if (!arguments.length) return markers;
|
||||
markers = x;
|
||||
return bullet;
|
||||
};
|
||||
function bulletTranslate(x) {
|
||||
return function(d) {
|
||||
return "translate(" + x(d) + ",0)";
|
||||
};
|
||||
}
|
||||
|
||||
// measures (actual, forecast)
|
||||
bullet.measures = function(x) {
|
||||
if (!arguments.length) return measures;
|
||||
measures = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
bullet.width = function(x) {
|
||||
if (!arguments.length) return width;
|
||||
width = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
bullet.height = function(x) {
|
||||
if (!arguments.length) return height;
|
||||
height = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
bullet.tickFormat = function(x) {
|
||||
if (!arguments.length) return tickFormat;
|
||||
tickFormat = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
bullet.duration = function(x) {
|
||||
if (!arguments.length) return duration;
|
||||
duration = x;
|
||||
return bullet;
|
||||
};
|
||||
|
||||
return bullet;
|
||||
};
|
||||
|
||||
function bulletRanges(d) {
|
||||
return d.ranges;
|
||||
}
|
||||
|
||||
function bulletMarkers(d) {
|
||||
return d.markers;
|
||||
}
|
||||
|
||||
function bulletMeasures(d) {
|
||||
return d.measures;
|
||||
}
|
||||
|
||||
function bulletTranslate(x) {
|
||||
return function(d) {
|
||||
return "translate(" + x(d) + ",0)";
|
||||
};
|
||||
}
|
||||
|
||||
function bulletWidth(x) {
|
||||
var x0 = x(0);
|
||||
return function(d) {
|
||||
return Math.abs(x(d) - x0);
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
||||
function bulletWidth(x) {
|
||||
var x0 = x(0);
|
||||
return function(d) {
|
||||
return Math.abs(x(d) - x0);
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
@ -175,12 +175,15 @@ function d3_bullet_chart(
|
||||
$output = '';
|
||||
$output .= include_javascript_d3(true);
|
||||
|
||||
$output .= '<script language="javascript" type="text/javascript">';
|
||||
$output .= file_get_contents($homeurl.'include/graphs/bullet.js');
|
||||
$output .= '</script>';
|
||||
|
||||
$id_bullet = uniqid();
|
||||
$font = array_shift(explode('.', array_pop(explode('/', $font))));
|
||||
|
||||
$output .= '<div id="bullet_graph_'.$id_bullet.'" class="bullet" style="overflow: hidden; width: '.$width.'px; margin-left: auto; margin-right: auto;"></div>
|
||||
<style>
|
||||
|
||||
.bullet_graph {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
margin: auto;
|
||||
@ -188,7 +191,7 @@ function d3_bullet_chart(
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.bullet { font: 7px sans-serif; }
|
||||
.bullet .marker.s0 { stroke: #e63c52; stroke-width: 2px; }
|
||||
.bullet .marker.s1 { stroke: #f3b200; stroke-width: 2px; }
|
||||
@ -204,14 +207,13 @@ function d3_bullet_chart(
|
||||
.bullet g text { font-size:'.$font_size.'pt;}
|
||||
|
||||
</style>
|
||||
<script src="'.$homeurl.'include/graphs/bullet.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
|
||||
var margin = {top: 5, right: 40, bottom: 20, left: 120};
|
||||
|
||||
width = ('.$width.'+10);
|
||||
height = '.$height.'- margin.top - margin.bottom;
|
||||
|
||||
|
||||
var width = ('.$width.'+10);
|
||||
var height = '.$height.'- margin.top - margin.bottom;
|
||||
|
||||
var chart = d3.bullet()
|
||||
.width(width)
|
||||
.height(height)
|
||||
@ -240,7 +242,6 @@ function d3_bullet_chart(
|
||||
$output .= 'var data = ['.implode(',', $temp).'];
|
||||
';
|
||||
$output .= '
|
||||
|
||||
var svg = d3.select("#bullet_graph_'.$id_bullet.'").selectAll("svg")
|
||||
.data(data)
|
||||
.enter().append("svg")
|
||||
@ -250,33 +251,30 @@ function d3_bullet_chart(
|
||||
.append("g")
|
||||
.attr("transform", "translate(" + (margin.left) + "," + margin.top + ")")
|
||||
.call(chart);
|
||||
|
||||
|
||||
|
||||
var title = svg.append("g")
|
||||
.style("text-anchor", "end")
|
||||
.attr("transform", "translate(-10, 15)");
|
||||
|
||||
|
||||
title.append("text")
|
||||
.attr("class", "'.$font.'")
|
||||
.text(function(d) { return d.title; });
|
||||
|
||||
|
||||
title.append("text")
|
||||
.attr("class", "subtitle")
|
||||
.attr("dy", "1em")
|
||||
.text(function(d) { return d.subtitle; });
|
||||
|
||||
.attr("class", "subtitle")
|
||||
.attr("dy", "1em")
|
||||
.text(function(d) { return d.subtitle; });
|
||||
|
||||
$(".tick>text").each(function() {
|
||||
|
||||
label = $(this).text().replace(/,/g,"");
|
||||
var label = $(this).text().replace(/,/g,"");
|
||||
label = parseFloat(label);
|
||||
text = label.toLocaleString();
|
||||
var text = label.toLocaleString();
|
||||
if ( label >= 1000000)
|
||||
text = text.substring(0,3) + "M";
|
||||
else if (label >= 100000)
|
||||
text = text.substring(0,3) + "K";
|
||||
else if (label >= 1000)
|
||||
text = text.substring(0,2) + "K";
|
||||
|
||||
$(this).text(text);
|
||||
});
|
||||
</script>';
|
||||
|
@ -45,6 +45,21 @@ function createVisualConsole(
|
||||
visualConsoleId,
|
||||
function(error, data) {
|
||||
if (error) {
|
||||
//Remove spinner change VC.
|
||||
document
|
||||
.getElementById("visual-console-container")
|
||||
.classList.remove("is-updating");
|
||||
|
||||
var div = document
|
||||
.getElementById("visual-console-container")
|
||||
.querySelector(".div-visual-console-spinner");
|
||||
|
||||
if (div !== null) {
|
||||
var parent = div.parentElement;
|
||||
if (parent !== null) {
|
||||
parent.removeChild(div);
|
||||
}
|
||||
}
|
||||
console.log(
|
||||
"[ERROR]",
|
||||
"[VISUAL-CONSOLE-CLIENT]",
|
||||
|
@ -75,39 +75,26 @@ abstract class CachedModel extends Model
|
||||
public static function fromDB(array $filter): Model
|
||||
{
|
||||
global $config;
|
||||
|
||||
// TODO: Remove references to the VC items. This class should be usable with any resource.
|
||||
$save_cache = false;
|
||||
if ($filter['cache_expiration'] > 0) {
|
||||
// Obtain the item's data from cache.
|
||||
$cachedData = static::fetchCachedData($filter);
|
||||
if ($cachedData === null) {
|
||||
$userId = (static::$indexCacheByUser === true) ? $config['id_user'] : null;
|
||||
$data = static::fetchCachedData($filter);
|
||||
$save_cache = true;
|
||||
}
|
||||
|
||||
// Delete expired data cache.
|
||||
static::clearCachedData(
|
||||
[
|
||||
'vc_item_id' => $filter['id'],
|
||||
'vc_id' => $filter['id_layout'],
|
||||
'user_id' => $userId,
|
||||
]
|
||||
);
|
||||
// Obtain the item's data from the database.
|
||||
$data = static::fetchDataFromDB($filter);
|
||||
// Save the item's data in cache.
|
||||
static::saveCachedData(
|
||||
[
|
||||
'vc_item_id' => $filter['id'],
|
||||
'vc_id' => $filter['id_layout'],
|
||||
'user_id' => $userId,
|
||||
'expiration' => $filter['cache_expiration'],
|
||||
],
|
||||
$data
|
||||
);
|
||||
} else {
|
||||
$data = $cachedData;
|
||||
}
|
||||
} else {
|
||||
if (isset($data) === false) {
|
||||
$data = static::fetchDataFromDB($filter);
|
||||
} else {
|
||||
// Retrieved from cache.
|
||||
$save_cache = false;
|
||||
}
|
||||
|
||||
if ($save_cache === true) {
|
||||
// Rebuild cache.
|
||||
if (static::saveCachedData($filter, $data) !== true) {
|
||||
throw new \Exception(
|
||||
$config['dbconnection']->error
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return static::fromArray($data);
|
||||
|
@ -413,7 +413,7 @@ final class Container extends Model
|
||||
try {
|
||||
array_push($items, $class::fromDB($data));
|
||||
} catch (\Throwable $e) {
|
||||
// TODO: Log this?
|
||||
error_log('VC[Container]: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,13 @@ class Item extends CachedModel
|
||||
*/
|
||||
protected static $useHtmlOutput = false;
|
||||
|
||||
/**
|
||||
* Enable the cache index by user id.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $indexCacheByUser = true;
|
||||
|
||||
|
||||
/**
|
||||
* Validate the received data structure to ensure if we can extract the
|
||||
@ -815,6 +822,14 @@ class Item extends CachedModel
|
||||
);
|
||||
|
||||
if ($data === false) {
|
||||
// Invalid entry, clean it.
|
||||
self::clearCachedData(
|
||||
[
|
||||
'vc_id' => $filter['vc_id'],
|
||||
'vc_item_id' => $filter['vc_item_id'],
|
||||
'user_id' => $filter['user_id'],
|
||||
]
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -835,14 +850,19 @@ class Item extends CachedModel
|
||||
*/
|
||||
protected static function saveCachedData(array $filter, array $data): bool
|
||||
{
|
||||
global $config;
|
||||
if (static::$indexCacheByUser === true) {
|
||||
$filter['user_id'] = $config['id_user'];
|
||||
}
|
||||
|
||||
return \db_process_sql_insert(
|
||||
'tvisual_console_elements_cache',
|
||||
[
|
||||
'vc_id' => $filter['vc_id'],
|
||||
'vc_item_id' => $filter['vc_item_id'],
|
||||
'vc_id' => $data['id_layout'],
|
||||
'vc_item_id' => $data['id'],
|
||||
'user_id' => $filter['user_id'],
|
||||
'data' => base64_encode(json_encode($data)),
|
||||
'expiration' => $filter['expiration'],
|
||||
'expiration' => $data['cache_expiration'],
|
||||
]
|
||||
) > 0;
|
||||
}
|
||||
@ -1052,6 +1072,19 @@ class Item extends CachedModel
|
||||
// The layout can be from another node.
|
||||
$linkedLayoutNodeId = $linkedVisualConsole['linkedLayoutNodeId'];
|
||||
|
||||
// Check ACL.
|
||||
$visualConsole = VC::fromDB(['id' => $vcId]);
|
||||
$visualConsoleData = $visualConsole->toArray();
|
||||
$vcGroupId = $visualConsoleData['groupId'];
|
||||
|
||||
$aclRead = \check_acl($config['id_user'], $vcGroupId, 'VR');
|
||||
// To build the link to another visual console
|
||||
// you must have read permissions of the visual console
|
||||
// with which it is linked.
|
||||
if ($aclRead === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (empty($linkedLayoutNodeId) === true && \is_metaconsole()) {
|
||||
/*
|
||||
* A Visual Console from this console.
|
||||
@ -1885,16 +1918,18 @@ class Item extends CachedModel
|
||||
],
|
||||
];
|
||||
|
||||
// Link enabled.
|
||||
$inputs[] = [
|
||||
'label' => __('Link enabled'),
|
||||
'arguments' => [
|
||||
'name' => 'isLinkEnabled',
|
||||
'id' => 'isLinkEnabled',
|
||||
'type' => 'switch',
|
||||
'value' => $values['isLinkEnabled'],
|
||||
],
|
||||
];
|
||||
if ($values['type'] !== LABEL) {
|
||||
// Link enabled.
|
||||
$inputs[] = [
|
||||
'label' => __('Link enabled'),
|
||||
'arguments' => [
|
||||
'name' => 'isLinkEnabled',
|
||||
'id' => 'isLinkEnabled',
|
||||
'type' => 'switch',
|
||||
'value' => $values['isLinkEnabled'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
// Show on top.
|
||||
$inputs[] = [
|
||||
@ -2232,7 +2267,19 @@ class Item extends CachedModel
|
||||
{
|
||||
// LinkConsoleInputGroup.
|
||||
$fields = self::getAllVisualConsole($values['vCId']);
|
||||
\array_unshift($fields, ['id' => 0, 'name' => __('None')]);
|
||||
|
||||
if ($fields === false) {
|
||||
$fields = [];
|
||||
} else {
|
||||
$fields = \array_reduce(
|
||||
$fields,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id']] = $item['name'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
$getAllVisualConsoleValue = $values['linkedLayoutId'];
|
||||
if (\is_metaconsole() === true) {
|
||||
@ -2246,12 +2293,14 @@ class Item extends CachedModel
|
||||
$inputs[] = [
|
||||
'label' => __('Linked visual console'),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'name' => 'getAllVisualConsole',
|
||||
'selected' => $getAllVisualConsoleValue,
|
||||
'script' => 'linkedVisualConsoleChange()',
|
||||
'return' => true,
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'name' => 'getAllVisualConsole',
|
||||
'selected' => $getAllVisualConsoleValue,
|
||||
'script' => 'linkedVisualConsoleChange()',
|
||||
'return' => true,
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -340,57 +340,67 @@ final class BarsGraph extends Item
|
||||
$height = (int) $data['height'];
|
||||
}
|
||||
|
||||
if ($typeGraph === 'horizontal') {
|
||||
$graph = \hbar_graph(
|
||||
$moduleData,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
if (empty($moduleData) === true) {
|
||||
$image = ui_get_full_url(
|
||||
'images/image_problem_area.png',
|
||||
'',
|
||||
'',
|
||||
$waterMark,
|
||||
$config['fontpath'],
|
||||
$config['fontsize'],
|
||||
'',
|
||||
2,
|
||||
$config['homeurl'],
|
||||
$backGroundColor,
|
||||
$gridColor,
|
||||
null,
|
||||
null,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$graph = \vbar_graph(
|
||||
$moduleData,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
\ui_get_full_url(
|
||||
'images/image_problem_area.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
'',
|
||||
'',
|
||||
$waterMark,
|
||||
$config['fontpath'],
|
||||
$config['fontsize'],
|
||||
'',
|
||||
2,
|
||||
$config['homeurl'],
|
||||
$backGroundColor,
|
||||
true,
|
||||
false,
|
||||
$gridColor,
|
||||
true
|
||||
false,
|
||||
false
|
||||
);
|
||||
$graph = base64_encode(file_get_contents($image));
|
||||
} else {
|
||||
if ($typeGraph === 'horizontal') {
|
||||
$graph = \hbar_graph(
|
||||
$moduleData,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
'images/image_problem_area.png',
|
||||
'',
|
||||
'',
|
||||
$waterMark,
|
||||
$config['fontpath'],
|
||||
$config['fontsize'],
|
||||
'',
|
||||
2,
|
||||
$config['homeurl'],
|
||||
$backGroundColor,
|
||||
$gridColor,
|
||||
null,
|
||||
null,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$graph = \vbar_graph(
|
||||
$moduleData,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
\ui_get_full_url(
|
||||
'images/image_problem_area.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
'',
|
||||
'',
|
||||
$waterMark,
|
||||
$config['fontpath'],
|
||||
$config['fontsize'],
|
||||
'',
|
||||
2,
|
||||
$config['homeurl'],
|
||||
$backGroundColor,
|
||||
true,
|
||||
false,
|
||||
$gridColor,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Restore connection.
|
||||
@ -483,16 +493,17 @@ final class BarsGraph extends Item
|
||||
$inputs[] = [
|
||||
'label' => __('Agent'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_agent',
|
||||
'name' => 'agentAlias',
|
||||
'id_agent_hidden' => $values['agentId'],
|
||||
'name_agent_hidden' => 'agentId',
|
||||
'server_id_hidden' => $values['metaconsoleId'],
|
||||
'name_server_hidden' => 'metaconsoleId',
|
||||
'return' => true,
|
||||
'module_input' => true,
|
||||
'module_name' => 'moduleId',
|
||||
'module_none' => false,
|
||||
'type' => 'autocomplete_agent',
|
||||
'name' => 'agentAlias',
|
||||
'id_agent_hidden' => $values['agentId'],
|
||||
'name_agent_hidden' => 'agentId',
|
||||
'server_id_hidden' => $values['metaconsoleId'],
|
||||
'name_server_hidden' => 'metaconsoleId',
|
||||
'return' => true,
|
||||
'module_input' => true,
|
||||
'module_name' => 'moduleId',
|
||||
'module_none' => false,
|
||||
'get_only_string_modules' => true,
|
||||
],
|
||||
];
|
||||
|
||||
@ -500,14 +511,15 @@ final class BarsGraph extends Item
|
||||
$inputs[] = [
|
||||
'label' => __('Module'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_module',
|
||||
'fields' => $fields,
|
||||
'name' => 'moduleId',
|
||||
'selected' => $values['moduleId'],
|
||||
'return' => true,
|
||||
'sort' => false,
|
||||
'agent_id' => $values['agentId'],
|
||||
'metaconsole_id' => $values['metaconsoleId'],
|
||||
'type' => 'autocomplete_module',
|
||||
'fields' => $fields,
|
||||
'name' => 'moduleId',
|
||||
'selected' => $values['moduleId'],
|
||||
'return' => true,
|
||||
'sort' => false,
|
||||
'agent_id' => $values['agentId'],
|
||||
'metaconsole_id' => $values['metaconsoleId'],
|
||||
'get_only_string_modules' => true,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -210,16 +210,17 @@ final class DonutGraph extends Item
|
||||
$inputs[] = [
|
||||
'label' => __('Agent'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_agent',
|
||||
'name' => 'agentAlias',
|
||||
'id_agent_hidden' => $values['agentId'],
|
||||
'name_agent_hidden' => 'agentId',
|
||||
'server_id_hidden' => $values['metaconsoleId'],
|
||||
'name_server_hidden' => 'metaconsoleId',
|
||||
'return' => true,
|
||||
'module_input' => true,
|
||||
'module_name' => 'moduleId',
|
||||
'module_none' => false,
|
||||
'type' => 'autocomplete_agent',
|
||||
'name' => 'agentAlias',
|
||||
'id_agent_hidden' => $values['agentId'],
|
||||
'name_agent_hidden' => 'agentId',
|
||||
'server_id_hidden' => $values['metaconsoleId'],
|
||||
'name_server_hidden' => 'metaconsoleId',
|
||||
'return' => true,
|
||||
'module_input' => true,
|
||||
'module_name' => 'moduleId',
|
||||
'module_none' => false,
|
||||
'get_only_string_modules' => true,
|
||||
],
|
||||
];
|
||||
|
||||
@ -227,14 +228,15 @@ final class DonutGraph extends Item
|
||||
$inputs[] = [
|
||||
'label' => __('Module'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_module',
|
||||
'fields' => $fields,
|
||||
'name' => 'moduleId',
|
||||
'selected' => $values['moduleId'],
|
||||
'return' => true,
|
||||
'sort' => false,
|
||||
'agent_id' => $values['agentId'],
|
||||
'metaconsole_id' => $values['metaconsoleId'],
|
||||
'type' => 'autocomplete_module',
|
||||
'fields' => $fields,
|
||||
'name' => 'moduleId',
|
||||
'selected' => $values['moduleId'],
|
||||
'return' => true,
|
||||
'sort' => false,
|
||||
'agent_id' => $values['agentId'],
|
||||
'metaconsole_id' => $values['metaconsoleId'],
|
||||
'get_only_string_modules' => true,
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -102,6 +102,19 @@ final class EventsHistory extends Item
|
||||
throw new \InvalidArgumentException('missing agent Id');
|
||||
}
|
||||
|
||||
if ((int) $data['width'] === 0 && (int) $data['height'] === 0) {
|
||||
$data['width'] = 420;
|
||||
$data['height'] = 80;
|
||||
}
|
||||
|
||||
if ((int) $data['width'] < 11) {
|
||||
$data['width'] = 11;
|
||||
}
|
||||
|
||||
if ((int) $data['height'] < 11) {
|
||||
$data['height'] = 11;
|
||||
}
|
||||
|
||||
// Use the same HTML output as the old VC.
|
||||
$html = \graph_graphic_moduleevents(
|
||||
$agentId,
|
||||
@ -111,7 +124,7 @@ final class EventsHistory extends Item
|
||||
static::extractMaxTime($data),
|
||||
'',
|
||||
true,
|
||||
2
|
||||
1
|
||||
);
|
||||
|
||||
$data['html'] = $html;
|
||||
|
@ -60,6 +60,16 @@ final class Label extends Item
|
||||
);
|
||||
}
|
||||
|
||||
if ($values['tabSelected'] === 'specific') {
|
||||
// Inputs LinkedVisualConsole.
|
||||
$inputsLinkedVisualConsole = self::inputsLinkedVisualConsole(
|
||||
$values
|
||||
);
|
||||
foreach ($inputsLinkedVisualConsole as $key => $value) {
|
||||
$inputs[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
@ -75,10 +85,6 @@ final class Label extends Item
|
||||
*/
|
||||
public function getDefaultGeneralValues(array $values): array
|
||||
{
|
||||
if (isset($values['isLinkEnabled']) === false) {
|
||||
$values['isLinkEnabled'] = false;
|
||||
}
|
||||
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::getDefaultGeneralValues($values);
|
||||
|
||||
|
@ -276,7 +276,7 @@ final class ModuleGraph extends Item
|
||||
\enterprise_include_once('include/functions_metaconsole.php');
|
||||
}
|
||||
|
||||
$imageOnly = true;
|
||||
$imageOnly = false;
|
||||
|
||||
$backgroundType = static::extractBackgroundType($data);
|
||||
$period = static::extractPeriod($data);
|
||||
@ -344,7 +344,10 @@ final class ModuleGraph extends Item
|
||||
'modules_series' => $customGraph['modules_series'],
|
||||
];
|
||||
|
||||
$imgbase64 = 'data:image/jpg;base64,';
|
||||
if ($imageOnly !== false) {
|
||||
$imgbase64 = 'data:image/jpg;base64,';
|
||||
}
|
||||
|
||||
$imgbase64 .= \graphic_combined_module(
|
||||
false,
|
||||
$params,
|
||||
@ -376,7 +379,10 @@ final class ModuleGraph extends Item
|
||||
'show_title' => false,
|
||||
];
|
||||
|
||||
$imgbase64 = 'data:image/jpg;base64,';
|
||||
if ($imageOnly !== false) {
|
||||
$imgbase64 = 'data:image/jpg;base64,';
|
||||
}
|
||||
|
||||
$imgbase64 .= \grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
@ -411,9 +417,16 @@ final class ModuleGraph extends Item
|
||||
);
|
||||
}
|
||||
|
||||
$data[0] = __('None');
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id_graph']] = $item['name'];
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
return array_reverse($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@ -446,6 +459,10 @@ final class ModuleGraph extends Item
|
||||
$values['period'] = 3600;
|
||||
}
|
||||
|
||||
if (isset($values['showLegend']) === false) {
|
||||
$values['showLegend'] = true;
|
||||
}
|
||||
|
||||
// Background color.
|
||||
$fields = [
|
||||
'white' => __('White'),
|
||||
@ -554,11 +571,13 @@ final class ModuleGraph extends Item
|
||||
'hidden' => $hiddenCustom,
|
||||
'label' => __('Custom graph'),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'name' => 'customGraphId',
|
||||
'selected' => $values['customGraphId'],
|
||||
'return' => true,
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'name' => 'customGraphId',
|
||||
'selected' => $values['customGraphId'],
|
||||
'return' => true,
|
||||
'nothing' => __('None'),
|
||||
'nothing_value' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -81,19 +81,6 @@ class View extends \HTML
|
||||
$activetabs = 2;
|
||||
if ($type === LABEL) {
|
||||
$activetabs = 0;
|
||||
$tabs = [
|
||||
[
|
||||
'name' => __('Label settings'),
|
||||
'id' => 'tab-label',
|
||||
'href' => $url.'&tabSelected=label',
|
||||
'img' => 'zoom.png',
|
||||
],[
|
||||
'name' => __('General settings'),
|
||||
'id' => 'tab-general',
|
||||
'href' => $url.'&tabSelected=general',
|
||||
'img' => 'pencil.png',
|
||||
],
|
||||
];
|
||||
} else if ($type === LINE_ITEM) {
|
||||
$activetabs = 0;
|
||||
$tabs = [
|
||||
@ -501,6 +488,9 @@ class View extends \HTML
|
||||
break;
|
||||
|
||||
case LABEL:
|
||||
$data['isLinkEnabled'] = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not posible.
|
||||
break;
|
||||
|
@ -4,6 +4,7 @@
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
background-position: center;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.visual-console-item {
|
||||
@ -699,7 +700,8 @@ li#li-timeZone-item > select:not(:first-child) {
|
||||
}
|
||||
|
||||
div.label,
|
||||
div.simple-value {
|
||||
div.simple-value,
|
||||
div.module-graph {
|
||||
display: inline-table;
|
||||
min-width: -webkit-fit-content;
|
||||
min-width: -moz-fit-content;
|
||||
@ -709,6 +711,10 @@ div.simple-value {
|
||||
min-height: fit-content;
|
||||
}
|
||||
|
||||
.textDecorationNone:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Styles for the solid icons */
|
||||
|
||||
.fa {
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -685,7 +685,7 @@ if (is_ajax()) {
|
||||
);
|
||||
|
||||
if ($get_only_string_modules) {
|
||||
$filter['tagente_modulo.id_tipo_modulo IN'] = '(17,23,3,10,33)';
|
||||
$filter['tagente_modulo.id_tipo_modulo IN'] = '(17,23,3,10,33,36)';
|
||||
}
|
||||
|
||||
// Status selector.
|
||||
|
@ -399,4 +399,4 @@ $ignored_params['refr'] = '';
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
@ -200,10 +200,16 @@ if (!is_metaconsole()) {
|
||||
html_print_input_hidden('metaconsole', 1);
|
||||
}
|
||||
|
||||
$edit_capable = (bool) (
|
||||
check_acl($config['id_user'], 0, 'VM')
|
||||
|| check_acl($config['id_user'], 0, 'VW')
|
||||
);
|
||||
|
||||
if ($pure === false) {
|
||||
echo '<div id ="edit-vc">';
|
||||
echo '<div id ="edit-controls" class="visual-console-edit-controls" style="visibility:hidden">';
|
||||
echo '<div>';
|
||||
if ($edit_capable === true) {
|
||||
echo '<div id ="edit-vc">';
|
||||
echo '<div id ="edit-controls" class="visual-console-edit-controls" style="visibility:hidden">';
|
||||
echo '<div>';
|
||||
visual_map_print_button_editor_refactor(
|
||||
'STATIC_GRAPH',
|
||||
__('Static Image'),
|
||||
@ -278,24 +284,25 @@ if ($pure === false) {
|
||||
enterprise_hook(
|
||||
'enterprise_visual_map_editor_print_toolbox_refactor'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '<div class="visual-console-copy-delete">';
|
||||
visual_map_print_button_editor_refactor(
|
||||
'button_delete',
|
||||
__('Delete Item'),
|
||||
'delete_item delete_min',
|
||||
true
|
||||
);
|
||||
visual_map_print_button_editor_refactor(
|
||||
'button_copy',
|
||||
__('Copy Item'),
|
||||
'copy_item',
|
||||
true
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo html_print_checkbox_switch('edit-mode', 1, false, true);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '<div class="visual-console-copy-delete">';
|
||||
visual_map_print_button_editor_refactor(
|
||||
'button_delete',
|
||||
__('Delete Item'),
|
||||
'delete_item delete_min',
|
||||
true
|
||||
);
|
||||
visual_map_print_button_editor_refactor(
|
||||
'button_copy',
|
||||
__('Copy Item'),
|
||||
'copy_item',
|
||||
true
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo html_print_checkbox_switch('edit-mode', 1, false, true);
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div id="visual-console-container"></div>';
|
||||
@ -502,6 +509,9 @@ ui_require_css_file('form');
|
||||
handleUpdate
|
||||
);
|
||||
|
||||
<?php
|
||||
if ($edit_capable === true) {
|
||||
?>
|
||||
// Enable/disable the edition mode.
|
||||
$('input[name=edit-mode]').change(function(event) {
|
||||
if ($(this).prop('checked')) {
|
||||
@ -510,10 +520,14 @@ ui_require_css_file('form');
|
||||
$('#edit-controls').css('visibility', '');
|
||||
} else {
|
||||
visualConsoleManager.visualConsole.disableEditMode();
|
||||
visualConsoleManager.visualConsole.unSelectItems();
|
||||
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
|
||||
$('#edit-controls').css('visibility', 'hidden');
|
||||
}
|
||||
});
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
// Update the data fetch interval.
|
||||
$('select#vc-refr').change(function(event) {
|
||||
|
@ -486,12 +486,18 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
||||
let box;
|
||||
if (this.props.isLinkEnabled) {
|
||||
box = document.createElement("a") as HTMLAnchorElement;
|
||||
if (this.props.link) box.href = this.props.link;
|
||||
|
||||
if (this.props.link) {
|
||||
box.href = this.props.link;
|
||||
} else {
|
||||
box.className = "textDecorationNone";
|
||||
}
|
||||
} else {
|
||||
box = document.createElement("div") as HTMLDivElement;
|
||||
box.className = "textDecorationNone";
|
||||
}
|
||||
|
||||
box.className = "visual-console-item";
|
||||
box.classList.add("visual-console-item");
|
||||
if (this.props.isOnTop) {
|
||||
box.classList.add("is-on-top");
|
||||
}
|
||||
@ -516,7 +522,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
// Add loading click item.
|
||||
if (this.itemProps.isLinkEnabled) {
|
||||
if (this.itemProps.isLinkEnabled && this.itemProps.link != null) {
|
||||
const divParent = document.createElement("div");
|
||||
divParent.className = "div-visual-console-spinner";
|
||||
const divSpinner = document.createElement("div");
|
||||
|
@ -88,21 +88,72 @@ export function moduleGraphPropsDecoder(
|
||||
export default class ModuleGraph extends Item<ModuleGraphProps> {
|
||||
protected createDomElement(): HTMLElement {
|
||||
const element = document.createElement("div");
|
||||
//element.className = "module-graph";
|
||||
//element.style.backgroundImage = `url(${this.props.html})`;
|
||||
//element.style.backgroundRepeat = "no-repeat";
|
||||
//element.style.backgroundSize = `${this.props.width}px ${
|
||||
// this.props.height
|
||||
//}px`;
|
||||
|
||||
element.innerHTML = this.props.html;
|
||||
element.className = "module-graph";
|
||||
element.style.backgroundImage = `url(${this.props.html})`;
|
||||
element.style.backgroundRepeat = "no-repeat";
|
||||
element.style.backgroundSize = `${this.props.width}px ${
|
||||
this.props.height
|
||||
}px`;
|
||||
|
||||
// Remove the overview graph.
|
||||
const legendP = element.getElementsByTagName("p");
|
||||
for (let i = 0; i < legendP.length; i++) {
|
||||
legendP[i].style.margin = "0px";
|
||||
}
|
||||
|
||||
// Remove the overview graph.
|
||||
const overviewGraphs = element.getElementsByClassName("overview_graph");
|
||||
for (let i = 0; i < overviewGraphs.length; i++) {
|
||||
overviewGraphs[i].remove();
|
||||
}
|
||||
|
||||
// Hack to execute the JS after the HTML is added to the DOM.
|
||||
const scripts = element.getElementsByTagName("script");
|
||||
for (let i = 0; i < scripts.length; i++) {
|
||||
if (scripts[i].src.length === 0) {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
eval(scripts[i].innerHTML.trim());
|
||||
} catch (ignored) {} // eslint-disable-line no-empty
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// element.innerHTML = this.props.html;
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
protected updateDomElement(element: HTMLElement): void {
|
||||
element.style.backgroundImage = `url(${this.props.html})`;
|
||||
element.style.backgroundRepeat = "no-repeat";
|
||||
element.style.backgroundSize = `${this.props.width}px ${
|
||||
this.props.height
|
||||
}px`;
|
||||
//element.style.backgroundImage = `url(${this.props.html})`;
|
||||
//element.style.backgroundRepeat = "no-repeat";
|
||||
//element.style.backgroundSize = `${this.props.width}px ${
|
||||
// this.props.height
|
||||
//}px`;
|
||||
|
||||
element.innerHTML = this.props.html;
|
||||
|
||||
// Remove the overview graph.
|
||||
const legendP = element.getElementsByTagName("p");
|
||||
for (let i = 0; i < legendP.length; i++) {
|
||||
legendP[i].style.margin = "0px";
|
||||
}
|
||||
|
||||
// Remove the overview graph.
|
||||
const overviewGraphs = element.getElementsByClassName("overview_graph");
|
||||
for (let i = 0; i < overviewGraphs.length; i++) {
|
||||
overviewGraphs[i].remove();
|
||||
}
|
||||
|
||||
// Hack to execute the JS after the HTML is added to the DOM.
|
||||
const scripts = element.getElementsByTagName("script");
|
||||
for (let i = 0; i < scripts.length; i++) {
|
||||
if (scripts[i].src.length === 0) {
|
||||
eval(scripts[i].innerHTML.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
background-position: center;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.visual-console-item {
|
||||
@ -525,8 +526,13 @@ li#li-timeZone-item > select:not(:first-child) {
|
||||
}
|
||||
|
||||
div.label,
|
||||
div.simple-value {
|
||||
div.simple-value,
|
||||
div.module-graph {
|
||||
display: inline-table;
|
||||
min-width: fit-content;
|
||||
min-height: fit-content;
|
||||
}
|
||||
|
||||
.textDecorationNone:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user