mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-26 11:19:14 +02:00
Don't perform DB updates when the home/pane hasn't been changed
This commit is contained in:
parent
89cbc9f644
commit
51370a9e37
@ -41,6 +41,10 @@ class HomeForm extends BaseDashboardForm
|
||||
{
|
||||
if ($this->isUpdating()) {
|
||||
$home = $this->dashboard->getActiveHome();
|
||||
if ($home->getTitle() === $this->getPopulatedValue('title')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$home->setTitle($this->getPopulatedValue('title'));
|
||||
|
||||
$this->dashboard->manageEntry($home);
|
||||
|
@ -88,12 +88,18 @@ class PaneForm extends BaseDashboardForm
|
||||
|
||||
if ($this->isUpdating()) {
|
||||
$orgHome = $dashboard->getEntry($this->requestUrl->getParam('home'));
|
||||
$orgPane = $orgHome->getEntry($this->getValue('org_name'));
|
||||
|
||||
$currentPane = clone $orgHome->getEntry($this->getValue('org_name'));
|
||||
$currentPane = clone $orgPane;
|
||||
$currentPane
|
||||
->setHome($currentHome)
|
||||
->setTitle($this->getValue('title'));
|
||||
|
||||
$diff = array_filter(array_diff_assoc($currentPane->toArray(), $orgPane->toArray()));
|
||||
if (empty($diff)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($orgHome->getName() !== $currentHome->getName() && $currentHome->hasEntry($currentPane->getName())) {
|
||||
Notification::error(sprintf(
|
||||
t('Failed to move dashboard "%s": Dashbaord pane already exists within the "%s" dashboard home'),
|
||||
@ -104,12 +110,6 @@ class PaneForm extends BaseDashboardForm
|
||||
return;
|
||||
}
|
||||
|
||||
if ($currentHome->getName() === $orgHome->getName()) {
|
||||
// There is no dashboard home diff so clear all the dashboard pane
|
||||
// of the org home
|
||||
$orgHome->setEntries([]);
|
||||
}
|
||||
|
||||
$conn->beginTransaction();
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user