fixed errors VC
This commit is contained in:
parent
76dd28fbdc
commit
481f08bd5f
|
@ -1181,8 +1181,8 @@ function createOrUpdateVisualConsoleItem(
|
|||
}
|
||||
|
||||
if (item.itemProps.id) {
|
||||
item.setMeta({ isUpdating: false });
|
||||
visualConsole.updateElement(data);
|
||||
item.setMeta({ isUpdating: false });
|
||||
} else {
|
||||
data["receivedAt"] = new Date();
|
||||
var newItem = visualConsole.addElement(data);
|
||||
|
@ -1548,6 +1548,11 @@ function linkedVisualConsoleTypeChange() {
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
function imageVCChange(baseUrl, vcId, only) {
|
||||
var nameImg = document.getElementById("imageSrc").value;
|
||||
if (nameImg == 0) {
|
||||
$("#li-image-item label").empty();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!only) {
|
||||
only = 0;
|
||||
}
|
||||
|
|
|
@ -2124,9 +2124,11 @@ class Item extends CachedModel
|
|||
/**
|
||||
* List images for Vc Icons.
|
||||
*
|
||||
* @param boolean|null $service If service item.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getListImagesVC():array
|
||||
public function getListImagesVC(?bool $service=false):array
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -2167,6 +2169,10 @@ class Item extends CachedModel
|
|||
}
|
||||
}
|
||||
|
||||
if ($service === true) {
|
||||
\array_unshift($result, ['name' => __('None')]);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -2382,32 +2388,34 @@ class Item extends CachedModel
|
|||
string $image,
|
||||
?bool $only=false
|
||||
):string {
|
||||
$type_image = [''];
|
||||
if ($only === false) {
|
||||
$type_image = [
|
||||
'bad',
|
||||
'ok',
|
||||
'warning',
|
||||
'',
|
||||
];
|
||||
}
|
||||
|
||||
$images = '';
|
||||
foreach ($type_image as $k => $v) {
|
||||
$type = '';
|
||||
if ($v !== '') {
|
||||
$type = '_'.$v;
|
||||
if ($image !== '0') {
|
||||
$type_image = [''];
|
||||
if ($only === false) {
|
||||
$type_image = [
|
||||
'bad',
|
||||
'ok',
|
||||
'warning',
|
||||
'',
|
||||
];
|
||||
}
|
||||
|
||||
$images .= html_print_image(
|
||||
'images/console/icons/'.$image.$type.'.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Image Vc'),
|
||||
'alt' => __('Image Vc'),
|
||||
'style' => 'max-width:70px; max-height:70px;',
|
||||
]
|
||||
);
|
||||
foreach ($type_image as $k => $v) {
|
||||
$type = '';
|
||||
if ($v !== '') {
|
||||
$type = '_'.$v;
|
||||
}
|
||||
|
||||
$images .= html_print_image(
|
||||
'images/console/icons/'.$image.$type.'.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Image Vc'),
|
||||
'alt' => __('Image Vc'),
|
||||
'style' => 'max-width:70px; max-height:70px;',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $images;
|
||||
|
|
|
@ -489,7 +489,12 @@ class View extends \HTML
|
|||
break;
|
||||
|
||||
case SERVICE:
|
||||
$data['imageSrc'] = \get_parameter('imageSrc');
|
||||
$imageSrc = \get_parameter('imageSrc');
|
||||
if ($imageSrc === '0') {
|
||||
$imageSrc = '';
|
||||
}
|
||||
|
||||
$data['imageSrc'] = $imageSrc;
|
||||
$data['serviceId'] = \get_parameter('serviceId');
|
||||
break;
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -775,11 +775,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||
}
|
||||
}
|
||||
// Change link.
|
||||
if (
|
||||
prevProps &&
|
||||
(prevProps.isLinkEnabled !== this.props.isLinkEnabled ||
|
||||
(this.props.isLinkEnabled && prevProps.link !== this.props.link))
|
||||
) {
|
||||
if (prevProps && prevProps.isLinkEnabled !== this.props.isLinkEnabled) {
|
||||
const container = this.createContainerDomElement();
|
||||
// Add the children of the old element.
|
||||
container.innerHTML = this.elementRef.innerHTML;
|
||||
|
@ -787,7 +783,12 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||
const attrs = this.elementRef.attributes;
|
||||
for (let i = 0; i < attrs.length; i++) {
|
||||
if (attrs[i].nodeName !== "id") {
|
||||
container.setAttributeNode(attrs[i]);
|
||||
let cloneIsNeeded = this.elementRef.getAttributeNode(
|
||||
attrs[i].nodeName
|
||||
);
|
||||
if (cloneIsNeeded !== null) {
|
||||
container.setAttributeNode(<any>cloneIsNeeded.cloneNode());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Replace the reference.
|
||||
|
@ -799,6 +800,15 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||
this.elementRef = container;
|
||||
}
|
||||
|
||||
if (
|
||||
prevProps &&
|
||||
(this.props.isLinkEnabled && prevProps.link !== this.props.link)
|
||||
) {
|
||||
if (this.props.link !== null) {
|
||||
this.elementRef.setAttribute("href", this.props.link);
|
||||
}
|
||||
}
|
||||
|
||||
// Change metadata related things.
|
||||
if (!prevMeta || prevMeta.editMode !== this.meta.editMode) {
|
||||
if (this.meta.editMode) {
|
||||
|
|
|
@ -81,9 +81,12 @@ export default class Service extends Item<ServiceProps> {
|
|||
*/
|
||||
protected updateDomElement(element: HTMLElement): void {
|
||||
if (this.props.statusImageSrc !== null) {
|
||||
const imgSrc = this.props.statusImageSrc || this.props.imageSrc;
|
||||
element.style.backgroundImage = `url(${imgSrc})`;
|
||||
element.style.background = `url(${this.props.statusImageSrc}) no-repeat`;
|
||||
element.style.backgroundSize = "contain";
|
||||
element.style.backgroundPosition = "center";
|
||||
element.innerHTML = "";
|
||||
} else if (this.props.encodedTitle !== null) {
|
||||
element.innerHTML = decodeBase64(this.props.encodedTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue