Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cleanup #38

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions application/controllers/GraphController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Icinga\Web\Controller;
use Icinga\Web\Notification;

/**
* GraphController for the graphs configuration table and forms.
*/
class GraphController extends Controller
{
public function init()
Expand Down Expand Up @@ -38,8 +41,7 @@ public function newAction()

$graphs = new GraphForm();

$graphs
->setIniConfig($this->Config('graphs'))
$graphs->setIniConfig($this->Config('graphs'))
->setRedirectUrl('grafana/graph')
->handleRequest();

Expand All @@ -61,9 +63,7 @@ public function removeAction()
$graphs = new GraphForm();

try {
$graphs
->setIniConfig($this->Config('graphs'))
->bind($graph);
$graphs->setIniConfig($this->Config('graphs'))->bind($graph);
} catch (NotFoundError $e) {
$this->httpNotFound($e->getMessage());
}
Expand All @@ -79,8 +79,7 @@ public function removeAction()
}
]);

$confirmation
->setRedirectUrl('grafana/graph')
$confirmation->setRedirectUrl('grafana/graph')
->setSubmitLabel($this->translate('Remove graph'))
->handleRequest();

Expand All @@ -102,16 +101,12 @@ public function updateAction()
$graphs = new GraphForm();

try {
$graphs
->setIniConfig($this->Config('graphs'))
->bind($graph);
$graphs->setIniConfig($this->Config('graphs'))->bind($graph);
} catch (NotFoundError $e) {
$this->httpNotFound($e->getMessage());
}

$graphs
->setRedirectUrl('grafana/graph')
->handleRequest();
$graphs->setRedirectUrl('grafana/graph')->handleRequest();

$this->view->form = $graphs;
}
Expand Down
6 changes: 1 addition & 5 deletions application/controllers/IcingadbdashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,10 @@ public function indexAction()

if ($serviceName != null) {
$object = $this->getServiceObject($serviceName, $hostName);
$graph = new ServiceDetailExtension();
} else {
$object = $this->getHostObject($hostName);
}

if ($object instanceof Host) {
$graph = new HostDetailExtension();
} else {
$graph = new ServiceDetailExtension();
}

$this->addContent($graph->getPreviewHtml($object));
Expand Down
4 changes: 2 additions & 2 deletions library/Grafana/Helpers/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public static function getUserThemeMode(User $user): string
}

/**
* httpStatusCodetoString translates a HTTP status code to a readable message
* httpStatusCodeToString translates a HTTP status code to a readable message
*
* @param int $code HTTP status code
* @return string
*/
public static function httpStatusCodetoString(int $code = 0): string
public static function httpStatusCodeToString(int $code = 0): string
{
$statuscodes = [
'100' => 'Continue',
Expand Down