fix rerors duplicate in CVS pandora_enterprise#9640

This commit is contained in:
daniel 2023-12-18 11:14:55 +01:00
parent 70dd1719db
commit d56e3a5496
3 changed files with 13 additions and 44 deletions

View File

@ -648,41 +648,14 @@ function createVisualConsole(
item.setMeta({ isUpdating: false });
var itemRetrieved = item.props;
if (itemRetrieved["type"] == 13 || itemRetrieved["type"] == 21) {
var startIsLeft =
itemRetrieved["startPosition"]["x"] -
itemRetrieved["endPosition"]["x"] <=
0;
var startIsTop =
itemRetrieved["startPosition"]["y"] -
itemRetrieved["endPosition"]["y"] <=
0;
itemRetrieved["startX"] = startIsLeft
? itemRetrieved["x"] + 20
: itemRetrieved["width"] + itemRetrieved["x"] + 20;
itemRetrieved["startY"] = startIsTop
? itemRetrieved["y"] + 20
: itemRetrieved["height"] + itemRetrieved["y"] + 20;
itemRetrieved["endX"] = startIsLeft
? itemRetrieved["width"] + itemRetrieved["x"] + 20
: itemRetrieved["x"] + 20;
itemRetrieved["endY"] = startIsTop
? itemRetrieved["height"] + itemRetrieved["y"] + 20
: itemRetrieved["y"] + 20;
} else {
itemRetrieved["x"] = itemRetrieved["x"] + 20;
itemRetrieved["y"] = itemRetrieved["y"] + 20;
}
itemRetrieved["receivedAt"] = new Date();
itemRetrieved["id"] = data;
var newItem = visualConsole.addElement(itemRetrieved);
newItem.setMeta({ editMode: true, isSelected: true });
var newItemData = JSON.parse(data);
newItemData["receivedAt"] = new Date();
var newItem = visualConsole.addElement(newItemData);
newItem.setMeta({
editMode: true,
isSelected: true,
isUpdating: false
});
visualConsole.selectItem(newItem.props.id);
done();
@ -1232,7 +1205,7 @@ function cleanupDOM() {
$("#modalVCItemForm").empty();
}
/* Defined in operations/visual_console/view.php */
/* global $, load_modal, tinyMCE */
/* global $, load_modal, UndefineTinyMCE */
function createOrUpdateVisualConsoleItem(
visualConsole,
asyncTaskManager,

View File

@ -307,18 +307,19 @@ if ($getVisualConsole === true) {
}
unset($data['id']);
$class = VisualConsole::getItemClass((int) $data['type']);
try {
// Save the new item.
$result = $class::create($data);
$itemId = $class::create($data);
$item = VisualConsole::getItemFromDB($itemId);
$result = $item->toArray();
} catch (\Throwable $th) {
// There is no item in the database.
echo false;
return;
}
echo $result;
echo json_encode($result);
return;
} else if ($getImagesVisualConsole) {
$img = get_parameter('nameImg', 'appliance');

View File

@ -1149,11 +1149,6 @@ if ($edit_capable === true) {
visualConsoleManager.copyItem(item);
}
});
setTimeout(
function()
{
visualConsoleManager.forceUpdateVisualConsole();
}, 500);
});
$('.link-create-item').click(function (event){