diff --git a/application/forms/Dashboard/WelcomeForm.php b/application/forms/Dashboard/WelcomeForm.php index ee3bcf58f..c59f5e9e4 100644 --- a/application/forms/Dashboard/WelcomeForm.php +++ b/application/forms/Dashboard/WelcomeForm.php @@ -28,7 +28,7 @@ class WelcomeForm extends Form public function hasBeenSubmitted() { - return parent::hasBeenSubmitted() || $this->getPressedSubmitElement(); + return parent::hasBeenSent() && $this->getPopulatedValue('btn_use_defaults'); } protected function assemble() @@ -53,28 +53,26 @@ class WelcomeForm extends Form protected function onSuccess() { - if ($this->getPopulatedValue('btn_use_defaults')) { - $home = $this->dashboard->getEntry(DashboardHome::DEFAULT_HOME); - $conn = DBUtils::getConn(); - $conn->beginTransaction(); + $home = $this->dashboard->getEntry(DashboardHome::DEFAULT_HOME); + $conn = DBUtils::getConn(); + $conn->beginTransaction(); - try { - // Default Home might have been disabled, so we have to update it first - $this->dashboard->manageEntry($home); - $home->manageEntry(Modules\DashletManager::getSystemDefaults(), null, true); + try { + // Default Home might have been disabled, so we have to update it first + $this->dashboard->manageEntry($home); + $home->manageEntry(Modules\DashletManager::getSystemDefaults(), null, true); - $conn->commitTransaction(); - } catch (\Exception $err) { - $conn->rollBackTransaction(); + $conn->commitTransaction(); + } catch (\Exception $err) { + $conn->rollBackTransaction(); - Logger::error('Unable to apply the system defaults into the DB. An error occurred: %s', $err); + Logger::error('Unable to apply the system defaults into the DB. An error occurred: %s', $err); - Notification::error(t('Failed to successfully save the data. Please check the logs for details.')); + Notification::error(t('Failed to successfully save the data. Please check the logs for details.')); - return; - } - - Notification::success(t('Imported system defaults successfully.')); + return; } + + Notification::success(t('Imported system defaults successfully.')); } } diff --git a/public/css/icinga/dashboards.less b/public/css/icinga/dashboards.less index cac33e6ac..7af57c335 100644 --- a/public/css/icinga/dashboards.less +++ b/public/css/icinga/dashboards.less @@ -1,3 +1,5 @@ +/*! Icinga Web 2 | (c) 2022 Icinga GmbH | GPLv2+ */ + // Welcome view and introduction .welcome-view { @@ -35,14 +37,14 @@ } } - input[disabled] { + input[name="btn_use_defaults"]:disabled { cursor: default; border: 1px solid @control-disabled-color; - } - input[disabled], input[disabled]:hover { - background: @body-bg-color; - color: @control-disabled-color; + &, &:hover { + background: @body-bg-color; + color: @control-disabled-color; + } } }