Ent 7144 consola visual poder cambiar color de leyenda de event histogram
This commit is contained in:
parent
4e45885de3
commit
b73924052c
|
@ -254,8 +254,7 @@ Licensed under the MIT license.
|
|||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
'font-size': "smaller",
|
||||
color: "#545454"
|
||||
'font-size': "smaller"
|
||||
})
|
||||
.insertAfter(this.element);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1770,6 +1770,7 @@ class Item extends CachedModel
|
|||
'gridColor',
|
||||
'color',
|
||||
'legendBackgroundColor',
|
||||
'legendColor',
|
||||
]
|
||||
),
|
||||
null
|
||||
|
|
|
@ -49,6 +49,7 @@ final class EventsHistory extends Item
|
|||
$return = parent::decode($data);
|
||||
$return['type'] = AUTO_SLA_GRAPH;
|
||||
$return['maxTime'] = static::extractMaxTime($data);
|
||||
$return['legendColor'] = $this->extractLegendColor($data);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -69,6 +70,22 @@ final class EventsHistory extends Item
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract legend color value.
|
||||
*
|
||||
* @param array $data Unknown input data structure.
|
||||
*
|
||||
* @return mixed String representing the grid color (not empty) or null.
|
||||
*/
|
||||
private function extractLegendColor(array $data): string
|
||||
{
|
||||
return static::notEmptyStringOr(
|
||||
static::issetInArray($data, ['legendColor', 'border_color']),
|
||||
'#000000'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch a vc item data structure from the database using a filter.
|
||||
*
|
||||
|
@ -100,6 +117,7 @@ final class EventsHistory extends Item
|
|||
$linkedModule = static::extractLinkedModule($data);
|
||||
$agentId = static::parseIntOr($linkedModule['agentId'], null);
|
||||
$moduleId = static::parseIntOr($linkedModule['moduleId'], null);
|
||||
$legendColor = static::extractLegendColor($data);
|
||||
|
||||
if ($agentId === null) {
|
||||
throw new \InvalidArgumentException('missing agent Id');
|
||||
|
@ -267,6 +285,18 @@ final class EventsHistory extends Item
|
|||
],
|
||||
];
|
||||
|
||||
// Legend color.
|
||||
$inputs[] = [
|
||||
'label' => __('Legend color'),
|
||||
'arguments' => [
|
||||
'wrapper' => 'div',
|
||||
'name' => 'legendColor',
|
||||
'type' => 'color',
|
||||
'value' => $values['legendColor'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
// Inputs LinkedVisualConsole.
|
||||
$inputsLinkedVisualConsole = self::inputsLinkedVisualConsole(
|
||||
$values
|
||||
|
|
|
@ -434,6 +434,7 @@ class View extends \HTML
|
|||
$data['agentAlias'] = \get_parameter('agentAlias');
|
||||
$data['moduleId'] = \get_parameter('moduleId');
|
||||
$data['maxTime'] = \get_parameter('maxTime');
|
||||
$data['legendColor'] = \get_parameter('legendColor');
|
||||
break;
|
||||
|
||||
case DONUT_GRAPH:
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,7 @@ import Item, { ItemType, ItemProps, itemBasePropsDecoder } from "../Item";
|
|||
export type EventsHistoryProps = {
|
||||
type: ItemType.AUTO_SLA_GRAPH;
|
||||
maxTime: number | null;
|
||||
legendColor: string;
|
||||
html: string;
|
||||
} & ItemProps &
|
||||
WithModuleProps;
|
||||
|
@ -35,6 +36,7 @@ export function eventsHistoryPropsDecoder(
|
|||
...itemBasePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
|
||||
type: ItemType.AUTO_SLA_GRAPH,
|
||||
maxTime: parseIntOr(data.maxTime, null),
|
||||
legendColor: data.legendColor,
|
||||
html: !stringIsEmpty(data.html)
|
||||
? data.html
|
||||
: decodeBase64(data.encodedHtml),
|
||||
|
@ -67,6 +69,11 @@ export default class EventsHistory extends Item<EventsHistoryProps> {
|
|||
}
|
||||
}
|
||||
|
||||
var flotText = element.getElementsByClassName(
|
||||
"noresizevc"
|
||||
) as HTMLCollectionOf<HTMLElement>;
|
||||
flotText[0].style.color = this.props.legendColor;
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
|
@ -82,5 +89,10 @@ export default class EventsHistory extends Item<EventsHistoryProps> {
|
|||
eval(scripts[i].innerHTML.trim());
|
||||
}
|
||||
}
|
||||
|
||||
var flotText = element.getElementsByClassName(
|
||||
"noresizevc"
|
||||
) as HTMLCollectionOf<HTMLElement>;
|
||||
flotText[0].style.color = this.props.legendColor;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue