mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
fixed errors CV dashboards
This commit is contained in:
parent
442d0d440a
commit
6db07e5fe0
@ -70,8 +70,7 @@ function initialiceLayout(data) {
|
|||||||
draggable: false
|
draggable: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var positionGrid = 0; //grid[0].getBoundingClientRect();
|
var positionGrid = grid.el.getBoundingClientRect();
|
||||||
// var gridHeight = positionGrid.height;
|
|
||||||
var gridWidth = positionGrid.width;
|
var gridWidth = positionGrid.width;
|
||||||
|
|
||||||
getCellsLayout();
|
getCellsLayout();
|
||||||
|
@ -571,9 +571,9 @@ class Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->width === 0) {
|
if ($this->width === 0) {
|
||||||
$width = (((int) $this->position['width'] / 12 * $gridWidth) - 50);
|
$width = (((int) $this->position['width'] / 12 * $gridWidth) - 60);
|
||||||
} else {
|
} else {
|
||||||
$width = (((int) $this->width / 12 * $gridWidth) - 50);
|
$width = (((int) $this->width / 12 * $gridWidth) - 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->height === 0) {
|
if ($this->height === 0) {
|
||||||
|
@ -395,6 +395,11 @@ class CustomGraphWidget extends Widget
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not posible height < 0.
|
||||||
|
if ($height <= 0) {
|
||||||
|
$height = 10;
|
||||||
|
}
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'period' => $this->values['period'],
|
'period' => $this->values['period'],
|
||||||
'width' => ($size['width'] - 10),
|
'width' => ($size['width'] - 10),
|
||||||
|
@ -372,32 +372,54 @@ class MapsMadeByUser extends Widget
|
|||||||
// it is necessary to modify specific classes of each
|
// it is necessary to modify specific classes of each
|
||||||
// of the visual consoles.
|
// of the visual consoles.
|
||||||
$output .= '<style type="text/css">';
|
$output .= '<style type="text/css">';
|
||||||
$output .= '.c-'.$uniq.', .c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt; }';
|
// $output .= '.c-'.$uniq.', .c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt; }';
|
||||||
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span { font-size: '.(4 * $ratio_t).'pt; line-height:'.(4 * $ratio_t * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual-console-item div.label > strong { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt;}';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt; line-height:'.(4 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual-console-item div.label > strong > span { font-size: '.(10 * $ratio_t).'pt;}';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt; line-height:'.(6 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual-console-item div.label p { overflow:initial !important; margin:0px;}';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual-console-item div.label img { height: 100%; width: 100%; object-fit: contain;}';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt; line-height:'.(10 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt !important; line-height:'.(4 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt; line-height:'.(12 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt !important; line-height:'.(6 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt; line-height:'.(14 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt; line-height:'.(18 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt; line-height:'.(24 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt !important; line-height:'.(12 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt; line-height:'.(28 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt !important; line-height:'.(14 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt; line-height:'.(36 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt !important; line-height:'.(18 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt; line-height:'.(48 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt !important; line-height:'.(24 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt; line-height:'.(60 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt !important; line-height:'.(28 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt; line-height:'.(72 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt !important; line-height:'.(36 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt; line-height:'.(84 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt !important; line-height:'.(48 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt; line-height:'.(96 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt !important; line-height:'.(60 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt; line-height:'.(116 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt !important; line-height:'.(72 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt; line-height:'.(128 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt !important; line-height:'.(84 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt; line-height:'.(140 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt !important; line-height:'.(96 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt; line-height:'.(154 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt !important; line-height:'.(116 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt; line-height:'.(196 * ($ratio_t) * 1.8).'pt; }';
|
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt !important; line-height:'.(128 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt !important; line-height:'.(140 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt !important; line-height:'.(154 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt !important; line-height:'.(196 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td p { overflow:initial !important; margin:0px; font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * $ratio_t * 1.5).'pt !important;}';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * $ratio_t * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_4pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt !important; line-height:'.(4 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_6pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt !important; line-height:'.(6 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_8pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_10pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_12pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt !important; line-height:'.(12 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_14pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt !important; line-height:'.(14 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_18pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt !important; line-height:'.(18 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_24pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt !important; line-height:'.(24 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_28pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt !important; line-height:'.(28 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_36pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt !important; line-height:'.(36 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_48pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt !important; line-height:'.(48 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_60pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt !important; line-height:'.(60 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_72pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt !important; line-height:'.(72 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_84pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt !important; line-height:'.(84 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_96pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt !important; line-height:'.(96 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_116pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt !important; line-height:'.(116 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_128pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt !important; line-height:'.(128 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_140pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt !important; line-height:'.(140 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_154pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt !important; line-height:'.(154 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
|
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_196pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt !important; line-height:'.(196 * ($ratio_t) * 1.5).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t)).'pt !important; }';
|
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t)).'pt !important; }';
|
||||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.time {font-size: '.(50 * $ratio_t).'px !important; line-height: '.(50 * $ratio_t).'px !important;}';
|
|
||||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.date {font-size: '.(25 * $ratio_t).'px !important; line-height: '.(25 * $ratio_t).'px !important;}';
|
|
||||||
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.timezone {font-size: '.(25 * $ratio_t).'px !important; line-height: '.(25 * $ratio_t).'px !important;}';
|
|
||||||
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio_t).'px !important; line-height: '.(8 * $ratio_t).'px !important;}';
|
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio_t).'px !important; line-height: '.(8 * $ratio_t).'px !important;}';
|
||||||
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio_t).' !important; height: '.(15 * $ratio_t).' !important;}';
|
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio_t).' !important; height: '.(15 * $ratio_t).' !important;}';
|
||||||
$output .= '</style>';
|
$output .= '</style>';
|
||||||
|
@ -123,11 +123,6 @@ final class Clock extends Item
|
|||||||
*/
|
*/
|
||||||
protected function decode(array $data): array
|
protected function decode(array $data): array
|
||||||
{
|
{
|
||||||
// Default values.
|
|
||||||
if (empty($data['height']) === true) {
|
|
||||||
$data['height'] = ($data['width'] / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$clockData = parent::decode($data);
|
$clockData = parent::decode($data);
|
||||||
$clockData['type'] = CLOCK;
|
$clockData['type'] = CLOCK;
|
||||||
$clockData['clockType'] = static::extractClockType($data);
|
$clockData['clockType'] = static::extractClockType($data);
|
||||||
@ -405,11 +400,48 @@ final class Clock extends Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($values['height']) === false) {
|
if (isset($values['height']) === false) {
|
||||||
$values['height'] = 100;
|
$values['height'] = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch a vc item data structure from the database using a filter.
|
||||||
|
*
|
||||||
|
* @param array $filter Filter of the Visual Console Item.
|
||||||
|
*
|
||||||
|
* @return array The Visual Console Item data structure stored into the DB.
|
||||||
|
* @throws \InvalidArgumentException When an agent Id cannot be found.
|
||||||
|
*
|
||||||
|
* @override Item::fetchDataFromDB.
|
||||||
|
*/
|
||||||
|
protected static function fetchDataFromDB(
|
||||||
|
array $filter,
|
||||||
|
?float $ratio=0
|
||||||
|
): array {
|
||||||
|
// Due to this DB call, this function cannot be unit tested without
|
||||||
|
// a proper mock.
|
||||||
|
$data = parent::fetchDataFromDB($filter, $ratio);
|
||||||
|
|
||||||
|
// Default values.
|
||||||
|
if ((int) $data['width'] === 0) {
|
||||||
|
$data['width'] = 100;
|
||||||
|
if ($ratio != 0) {
|
||||||
|
$data['width'] *= $ratio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int) $data['height'] === 0) {
|
||||||
|
$data['height'] = 50;
|
||||||
|
if ($ratio != 0) {
|
||||||
|
$data['height'] *= $ratio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -107,8 +107,15 @@ final class EventsHistory extends Item
|
|||||||
if ((int) $data['width'] === 0 && (int) $data['height'] === 0) {
|
if ((int) $data['width'] === 0 && (int) $data['height'] === 0) {
|
||||||
$data['width'] = 420;
|
$data['width'] = 420;
|
||||||
$data['height'] = 80;
|
$data['height'] = 80;
|
||||||
|
|
||||||
|
if ($ratio != 0) {
|
||||||
|
$data['width'] = ($data['width'] * $ratio);
|
||||||
|
$data['height'] = ($data['height'] * $ratio);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data['height'] = ($data['height'] - 20);
|
||||||
|
|
||||||
if ((int) $data['width'] < 11) {
|
if ((int) $data['width'] < 11) {
|
||||||
$data['width'] = 11;
|
$data['width'] = 11;
|
||||||
}
|
}
|
||||||
@ -122,7 +129,7 @@ final class EventsHistory extends Item
|
|||||||
$agentId,
|
$agentId,
|
||||||
$moduleId,
|
$moduleId,
|
||||||
100,
|
100,
|
||||||
((int) $data['height'] - 20),
|
(int) $data['height'],
|
||||||
static::extractMaxTime($data),
|
static::extractMaxTime($data),
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
|
@ -31,25 +31,6 @@ final class Label extends Item
|
|||||||
*/
|
*/
|
||||||
protected function decode(array $data): array
|
protected function decode(array $data): array
|
||||||
{
|
{
|
||||||
$data['label'] = \preg_replace(
|
|
||||||
'/overflow: hidden;/',
|
|
||||||
'',
|
|
||||||
$data['label']
|
|
||||||
);
|
|
||||||
// Default values.
|
|
||||||
if ((empty($data['width']) === true)
|
|
||||||
&& (empty($data['height']) === true)
|
|
||||||
) {
|
|
||||||
preg_match(
|
|
||||||
'/visual_font_size_(.*)pt/',
|
|
||||||
$data['label'],
|
|
||||||
$matches
|
|
||||||
);
|
|
||||||
|
|
||||||
$data['width'] = (($matches[1] * 10) + 5);
|
|
||||||
$data['height'] = ($matches[1] * 2.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = parent::decode($data);
|
$return = parent::decode($data);
|
||||||
$return['type'] = LABEL;
|
$return['type'] = LABEL;
|
||||||
return $return;
|
return $return;
|
||||||
|
@ -218,8 +218,13 @@ final class StaticGraph extends Item
|
|||||||
if ($width === 0 || $height === 0) {
|
if ($width === 0 || $height === 0) {
|
||||||
if (isset($imagePath) && $imagePath !== false) {
|
if (isset($imagePath) && $imagePath !== false) {
|
||||||
$sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
|
$sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
|
||||||
$data['width'] = $sizeImage[0];
|
if ($ratio != 0) {
|
||||||
$data['height'] = $sizeImage[1];
|
$data['width'] = ($sizeImage[0] * $ratio);
|
||||||
|
$data['height'] = ($sizeImage[1] * $ratio);
|
||||||
|
} else {
|
||||||
|
$data['width'] = $sizeImage[0];
|
||||||
|
$data['height'] = $sizeImage[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ h1 {
|
|||||||
|
|
||||||
.grid-stack-item-content {
|
.grid-stack-item-content {
|
||||||
color: #2c3e50;
|
color: #2c3e50;
|
||||||
text-align: center;
|
/*text-align: center;*/
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
-webkit-box-shadow: 5px 5px 5px 0px rgba(214, 214, 214, 1);
|
-webkit-box-shadow: 5px 5px 5px 0px rgba(214, 214, 214, 1);
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -844,7 +844,8 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
prevProps &&
|
prevProps &&
|
||||||
this.props.isLinkEnabled && prevProps.link !== this.props.link
|
this.props.isLinkEnabled &&
|
||||||
|
prevProps.link !== this.props.link
|
||||||
) {
|
) {
|
||||||
if (this.props.link !== null) {
|
if (this.props.link !== null) {
|
||||||
this.elementRef.setAttribute("href", this.props.link);
|
this.elementRef.setAttribute("href", this.props.link);
|
||||||
@ -1024,8 +1025,8 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
this.props.type != ItemType.LINE_ITEM &&
|
this.props.type != ItemType.LINE_ITEM &&
|
||||||
this.props.type != ItemType.NETWORK_LINK
|
this.props.type != ItemType.NETWORK_LINK
|
||||||
) {
|
) {
|
||||||
this.childElementRef.style.width = width > 0 ? `${width}px` : "0";
|
this.childElementRef.style.width = width > 0 ? `${width}px` : null;
|
||||||
this.childElementRef.style.height = height > 0 ? `${height}px` : "0";
|
this.childElementRef.style.height = height > 0 ? `${height}px` : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.label && this.props.label.length > 0) {
|
if (this.props.label && this.props.label.length > 0) {
|
||||||
@ -1037,11 +1038,11 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
switch (this.props.labelPosition) {
|
switch (this.props.labelPosition) {
|
||||||
case "up":
|
case "up":
|
||||||
case "down":
|
case "down":
|
||||||
table.style.width = width > 0 ? `${width}px` : "0";
|
table.style.width = width > 0 ? `${width}px` : null;
|
||||||
break;
|
break;
|
||||||
case "left":
|
case "left":
|
||||||
case "right":
|
case "right":
|
||||||
table.style.height = height > 0 ? `${height}px` : "0";
|
table.style.height = height > 0 ? `${height}px` : null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user