Adjust disabled input style sheets & remove unnecessary control structure within the WelcomeForm::onSuccess() method

This commit is contained in:
Yonas Habteab 2022-06-07 14:30:15 +02:00
parent af062b8cb2
commit 0c91a8a283
2 changed files with 23 additions and 23 deletions

View File

@ -28,7 +28,7 @@ class WelcomeForm extends Form
public function hasBeenSubmitted() public function hasBeenSubmitted()
{ {
return parent::hasBeenSubmitted() || $this->getPressedSubmitElement(); return parent::hasBeenSent() && $this->getPopulatedValue('btn_use_defaults');
} }
protected function assemble() protected function assemble()
@ -53,7 +53,6 @@ class WelcomeForm extends Form
protected function onSuccess() protected function onSuccess()
{ {
if ($this->getPopulatedValue('btn_use_defaults')) {
$home = $this->dashboard->getEntry(DashboardHome::DEFAULT_HOME); $home = $this->dashboard->getEntry(DashboardHome::DEFAULT_HOME);
$conn = DBUtils::getConn(); $conn = DBUtils::getConn();
$conn->beginTransaction(); $conn->beginTransaction();
@ -77,4 +76,3 @@ class WelcomeForm extends Form
Notification::success(t('Imported system defaults successfully.')); Notification::success(t('Imported system defaults successfully.'));
} }
} }
}

View File

@ -1,3 +1,5 @@
/*! Icinga Web 2 | (c) 2022 Icinga GmbH | GPLv2+ */
// Welcome view and introduction // Welcome view and introduction
.welcome-view { .welcome-view {
@ -35,16 +37,16 @@
} }
} }
input[disabled] { input[name="btn_use_defaults"]:disabled {
cursor: default; cursor: default;
border: 1px solid @control-disabled-color; border: 1px solid @control-disabled-color;
}
input[disabled], input[disabled]:hover { &, &:hover {
background: @body-bg-color; background: @body-bg-color;
color: @control-disabled-color; color: @control-disabled-color;
} }
} }
}
// Sortable dashboard styles // Sortable dashboard styles