mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
fixed errors VC
This commit is contained in:
parent
76dd28fbdc
commit
481f08bd5f
@ -1181,8 +1181,8 @@ function createOrUpdateVisualConsoleItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.itemProps.id) {
|
if (item.itemProps.id) {
|
||||||
item.setMeta({ isUpdating: false });
|
|
||||||
visualConsole.updateElement(data);
|
visualConsole.updateElement(data);
|
||||||
|
item.setMeta({ isUpdating: false });
|
||||||
} else {
|
} else {
|
||||||
data["receivedAt"] = new Date();
|
data["receivedAt"] = new Date();
|
||||||
var newItem = visualConsole.addElement(data);
|
var newItem = visualConsole.addElement(data);
|
||||||
@ -1548,6 +1548,11 @@ function linkedVisualConsoleTypeChange() {
|
|||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
function imageVCChange(baseUrl, vcId, only) {
|
function imageVCChange(baseUrl, vcId, only) {
|
||||||
var nameImg = document.getElementById("imageSrc").value;
|
var nameImg = document.getElementById("imageSrc").value;
|
||||||
|
if (nameImg == 0) {
|
||||||
|
$("#li-image-item label").empty();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!only) {
|
if (!only) {
|
||||||
only = 0;
|
only = 0;
|
||||||
}
|
}
|
||||||
|
@ -2124,9 +2124,11 @@ class Item extends CachedModel
|
|||||||
/**
|
/**
|
||||||
* List images for Vc Icons.
|
* List images for Vc Icons.
|
||||||
*
|
*
|
||||||
|
* @param boolean|null $service If service item.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getListImagesVC():array
|
public function getListImagesVC(?bool $service=false):array
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -2167,6 +2169,10 @@ class Item extends CachedModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($service === true) {
|
||||||
|
\array_unshift($result, ['name' => __('None')]);
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2382,6 +2388,8 @@ class Item extends CachedModel
|
|||||||
string $image,
|
string $image,
|
||||||
?bool $only=false
|
?bool $only=false
|
||||||
):string {
|
):string {
|
||||||
|
$images = '';
|
||||||
|
if ($image !== '0') {
|
||||||
$type_image = [''];
|
$type_image = [''];
|
||||||
if ($only === false) {
|
if ($only === false) {
|
||||||
$type_image = [
|
$type_image = [
|
||||||
@ -2392,7 +2400,6 @@ class Item extends CachedModel
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$images = '';
|
|
||||||
foreach ($type_image as $k => $v) {
|
foreach ($type_image as $k => $v) {
|
||||||
$type = '';
|
$type = '';
|
||||||
if ($v !== '') {
|
if ($v !== '') {
|
||||||
@ -2409,6 +2416,7 @@ class Item extends CachedModel
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $images;
|
return $images;
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,12 @@ class View extends \HTML
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SERVICE:
|
case SERVICE:
|
||||||
$data['imageSrc'] = \get_parameter('imageSrc');
|
$imageSrc = \get_parameter('imageSrc');
|
||||||
|
if ($imageSrc === '0') {
|
||||||
|
$imageSrc = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['imageSrc'] = $imageSrc;
|
||||||
$data['serviceId'] = \get_parameter('serviceId');
|
$data['serviceId'] = \get_parameter('serviceId');
|
||||||
break;
|
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.
|
// Change link.
|
||||||
if (
|
if (prevProps && prevProps.isLinkEnabled !== this.props.isLinkEnabled) {
|
||||||
prevProps &&
|
|
||||||
(prevProps.isLinkEnabled !== this.props.isLinkEnabled ||
|
|
||||||
(this.props.isLinkEnabled && prevProps.link !== this.props.link))
|
|
||||||
) {
|
|
||||||
const container = this.createContainerDomElement();
|
const container = this.createContainerDomElement();
|
||||||
// Add the children of the old element.
|
// Add the children of the old element.
|
||||||
container.innerHTML = this.elementRef.innerHTML;
|
container.innerHTML = this.elementRef.innerHTML;
|
||||||
@ -787,7 +783,12 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
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++) {
|
||||||
if (attrs[i].nodeName !== "id") {
|
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.
|
// Replace the reference.
|
||||||
@ -799,6 +800,15 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||||||
this.elementRef = container;
|
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.
|
// Change metadata related things.
|
||||||
if (!prevMeta || prevMeta.editMode !== this.meta.editMode) {
|
if (!prevMeta || prevMeta.editMode !== this.meta.editMode) {
|
||||||
if (this.meta.editMode) {
|
if (this.meta.editMode) {
|
||||||
|
@ -81,9 +81,12 @@ export default class Service extends Item<ServiceProps> {
|
|||||||
*/
|
*/
|
||||||
protected updateDomElement(element: HTMLElement): void {
|
protected updateDomElement(element: HTMLElement): void {
|
||||||
if (this.props.statusImageSrc !== null) {
|
if (this.props.statusImageSrc !== null) {
|
||||||
const imgSrc = this.props.statusImageSrc || this.props.imageSrc;
|
element.style.background = `url(${this.props.statusImageSrc}) no-repeat`;
|
||||||
element.style.backgroundImage = `url(${imgSrc})`;
|
element.style.backgroundSize = "contain";
|
||||||
|
element.style.backgroundPosition = "center";
|
||||||
|
element.innerHTML = "";
|
||||||
} else if (this.props.encodedTitle !== null) {
|
} else if (this.props.encodedTitle !== null) {
|
||||||
|
element.innerHTML = decodeBase64(this.props.encodedTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user