mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
fix error cv item module graph periodicity mode pandora_enterprise#9640
This commit is contained in:
parent
cc12c77008
commit
27d76a0890
@ -13,6 +13,10 @@ SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tagente` DROP COLUMN `transactional_a
|
|||||||
prepare stmt from @sqlstmt;
|
prepare stmt from @sqlstmt;
|
||||||
execute stmt;
|
execute stmt;
|
||||||
|
|
||||||
|
ALTER TABLE `tlayout_template_data` ADD COLUMN `title` TEXT default '';
|
||||||
|
ALTER TABLE `tlayout_data` ADD COLUMN `period_chart_options` TEXT default '';
|
||||||
|
ALTER TABLE `tlayout_template_data` ADD COLUMN `period_chart_options` TEXT default '';
|
||||||
|
|
||||||
ALTER TABLE `tdashboard`
|
ALTER TABLE `tdashboard`
|
||||||
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
|
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
|
||||||
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
|
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
|
||||||
|
@ -81,7 +81,7 @@ final class ModuleGraph extends Item
|
|||||||
$return['show_statistics'] = static::parseBool($show_legend);
|
$return['show_statistics'] = static::parseBool($show_legend);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['label'] = json_encode(
|
$return['period_chart_options'] = json_encode(
|
||||||
[
|
[
|
||||||
'periodicityChart' => static::extractPeriodicityChart($data),
|
'periodicityChart' => static::extractPeriodicityChart($data),
|
||||||
'periodMaximum' => static::extractPeriodMaximum($data),
|
'periodMaximum' => static::extractPeriodMaximum($data),
|
||||||
@ -160,14 +160,14 @@ final class ModuleGraph extends Item
|
|||||||
$return['period'] = static::extractPeriod($data);
|
$return['period'] = static::extractPeriod($data);
|
||||||
$return['showLegend'] = static::extractShowLegend($data);
|
$return['showLegend'] = static::extractShowLegend($data);
|
||||||
|
|
||||||
$return['label'] = static::extractDynamicData($data);
|
$return['periodChartOptions'] = static::extractPeriodChartOptions($data);
|
||||||
$return['periodicityChart'] = static::extractPeriodicityChart($return['label']);
|
$return['periodicityChart'] = static::extractPeriodicityChart($return['periodChartOptions']);
|
||||||
$return['periodMaximum'] = static::extractPeriodMaximum($return['label']);
|
$return['periodMaximum'] = static::extractPeriodMaximum($return['periodChartOptions']);
|
||||||
$return['periodMinimum'] = static::extractPeriodMinimum($return['label']);
|
$return['periodMinimum'] = static::extractPeriodMinimum($return['periodChartOptions']);
|
||||||
$return['periodAverage'] = static::extractPeriodAverage($return['label']);
|
$return['periodAverage'] = static::extractPeriodAverage($return['periodChartOptions']);
|
||||||
$return['periodSummatory'] = static::extractPeriodSummatory($return['label']);
|
$return['periodSummatory'] = static::extractPeriodSummatory($return['periodChartOptions']);
|
||||||
$return['periodSliceChart'] = static::extractPeriodSliceChart($return['label']);
|
$return['periodSliceChart'] = static::extractPeriodSliceChart($return['periodChartOptions']);
|
||||||
$return['periodMode'] = static::extractPeriodMode($return['label']);
|
$return['periodMode'] = static::extractPeriodMode($return['periodChartOptions']);
|
||||||
|
|
||||||
$customGraphId = static::extractCustomGraphId($data);
|
$customGraphId = static::extractCustomGraphId($data);
|
||||||
|
|
||||||
@ -182,20 +182,20 @@ final class ModuleGraph extends Item
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract a dynamic data structure from the 'label' field.
|
* Extract a dynamic data structure from the 'periodChartOptions' field.
|
||||||
*
|
*
|
||||||
* @param array $data Unknown input data structure.
|
* @param array $data Unknown input data structure.
|
||||||
*
|
*
|
||||||
* @return array Dynamic data structure.
|
* @return array Dynamic data structure.
|
||||||
* @throws \InvalidArgumentException If the structure cannot be built.
|
* @throws \InvalidArgumentException If the structure cannot be built.
|
||||||
*/
|
*/
|
||||||
private static function extractDynamicData(array $data): array
|
private static function extractPeriodChartOptions(array $data): array
|
||||||
{
|
{
|
||||||
$sliceMode = static::notEmptyStringOr($data['label'], null);
|
$periodChartOptions = static::notEmptyStringOr($data['period_chart_options'], null);
|
||||||
$result = [];
|
$result = [];
|
||||||
if ($sliceMode !== null) {
|
if ($periodChartOptions !== null) {
|
||||||
try {
|
try {
|
||||||
$result = \json_decode($sliceMode, true);
|
$result = \json_decode($periodChartOptions, true);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
throw new \InvalidArgumentException('invalid dynamic data');
|
throw new \InvalidArgumentException('invalid dynamic data');
|
||||||
}
|
}
|
||||||
@ -444,14 +444,15 @@ final class ModuleGraph extends Item
|
|||||||
$backgroundType = static::extractBackgroundType($data);
|
$backgroundType = static::extractBackgroundType($data);
|
||||||
$period = static::extractPeriod($data);
|
$period = static::extractPeriod($data);
|
||||||
$showLegend = static::extractShowLegend($data);
|
$showLegend = static::extractShowLegend($data);
|
||||||
$label = static::extractDynamicData($data);
|
|
||||||
$periodicityChart = static::extractPeriodicityChart($label);
|
$periodChartOptions = static::extractPeriodChartOptions($data);
|
||||||
$periodMaximum = static::extractPeriodMaximum($label);
|
$periodicityChart = static::extractPeriodicityChart($periodChartOptions);
|
||||||
$periodMinimum = static::extractPeriodMinimum($label);
|
$periodMaximum = static::extractPeriodMaximum($periodChartOptions);
|
||||||
$periodAverage = static::extractPeriodAverage($label);
|
$periodMinimum = static::extractPeriodMinimum($periodChartOptions);
|
||||||
$periodSummatory = static::extractPeriodSummatory($label);
|
$periodAverage = static::extractPeriodAverage($periodChartOptions);
|
||||||
$periodSliceChart = static::extractPeriodSliceChart($label);
|
$periodSummatory = static::extractPeriodSummatory($periodChartOptions);
|
||||||
$periodMode = static::extractPeriodMode($label);
|
$periodSliceChart = static::extractPeriodSliceChart($periodChartOptions);
|
||||||
|
$periodMode = static::extractPeriodMode($periodChartOptions);
|
||||||
|
|
||||||
$customGraphId = static::extractCustomGraphId($data);
|
$customGraphId = static::extractCustomGraphId($data);
|
||||||
$graphType = static::extractGraphType($data);
|
$graphType = static::extractGraphType($data);
|
||||||
|
@ -746,6 +746,7 @@ p {
|
|||||||
strong {
|
strong {
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Styles for the solid icons */
|
/* Styles for the solid icons */
|
||||||
|
|
||||||
.fa {
|
.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
@ -1746,7 +1746,8 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` (
|
|||||||
`timezone` VARCHAR(60) NOT NULL DEFAULT 'Europe/Madrid',
|
`timezone` VARCHAR(60) NOT NULL DEFAULT 'Europe/Madrid',
|
||||||
`show_last_value` TINYINT UNSIGNED NULL DEFAULT 0,
|
`show_last_value` TINYINT UNSIGNED NULL DEFAULT 0,
|
||||||
`cache_expiration` INT UNSIGNED NOT NULL DEFAULT 0,
|
`cache_expiration` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
`title` TEXT ,
|
`title` TEXT,
|
||||||
|
`period_chart_options` TEXT,
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
INDEX `tlayout_data_layout` (`id_layout`)
|
INDEX `tlayout_data_layout` (`id_layout`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
@ -3822,6 +3823,8 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
|||||||
`timezone` VARCHAR(60) NOT NULL DEFAULT 'Europe/Madrid',
|
`timezone` VARCHAR(60) NOT NULL DEFAULT 'Europe/Madrid',
|
||||||
`show_last_value` TINYINT UNSIGNED NULL DEFAULT 0,
|
`show_last_value` TINYINT UNSIGNED NULL DEFAULT 0,
|
||||||
`cache_expiration` INT UNSIGNED NOT NULL DEFAULT 0,
|
`cache_expiration` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`title` TEXT,
|
||||||
|
`period_chart_options` TEXT,
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
||||||
|
@ -869,8 +869,6 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
// Change link.
|
// Change link.
|
||||||
if (prevProps && prevProps.isLinkEnabled !== this.props.isLinkEnabled) {
|
if (prevProps && prevProps.isLinkEnabled !== this.props.isLinkEnabled) {
|
||||||
const container = this.createContainerDomElement();
|
const container = this.createContainerDomElement();
|
||||||
// Add the children of the old element.
|
|
||||||
container.innerHTML = this.elementRef.innerHTML;
|
|
||||||
// Copy the attributes.
|
// Copy the attributes.
|
||||||
const attrs = this.elementRef.attributes;
|
const attrs = this.elementRef.attributes;
|
||||||
for (let i = 0; i < attrs.length; i++) {
|
for (let i = 0; i < attrs.length; i++) {
|
||||||
@ -879,7 +877,8 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
attrs[i].nodeName
|
attrs[i].nodeName
|
||||||
);
|
);
|
||||||
if (cloneIsNeeded !== null) {
|
if (cloneIsNeeded !== null) {
|
||||||
container.setAttributeNode(<any>cloneIsNeeded.cloneNode());
|
let cloneAttr = cloneIsNeeded.cloneNode(true) as Attr;
|
||||||
|
container.setAttributeNode(cloneAttr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -890,6 +889,10 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
|
|
||||||
// Changed the reference to the main element. It's ugly, but needed.
|
// Changed the reference to the main element. It's ugly, but needed.
|
||||||
this.elementRef = container;
|
this.elementRef = container;
|
||||||
|
|
||||||
|
// Insert the elements into the container.
|
||||||
|
this.elementRef.appendChild(this.childElementRef);
|
||||||
|
this.elementRef.appendChild(this.labelElementRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user