Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

// SPDX-FileCopyrightText: 2026 Icinga GmbH <https://icinga.com>
// SPDX-License-Identifier: GPL-3.0-or-later

namespace Icinga\Module\Icingadb\ProvidedHook\Notifications;

use GuzzleHttp\Psr7\ServerRequest;
use Icinga\Module\Notifications\Common\Database;
use Icinga\Module\Notifications\Hook\SourceIntegrationSetupHook;
use Icinga\Web\Notification;
use ipl\Html\Form;
use ipl\Html\ValidHtml;
use ipl\I18n\Translation;
use ipl\Web\Compat\CompatForm;
use ipl\Web\Url;

class SourceIntegrationSetup extends SourceIntegrationSetupHook
{
use Translation;

public function getIntegration(): ValidHtml
{
return (new CompatForm())
->addAttributes(['class' => 'inline'])
->setAction((string) Url::fromRequest())
->addElement('submit', 'submit', ['label' => $this->translate('Icinga2 Integration')])

Check failure on line 27 in library/Icingadb/ProvidedHook/Notifications/SourceIntegrationSetup.php

View workflow job for this annotation

GitHub Actions / PHP / Lint (8.5) / Linters 8.5

Expected 1 space after comma in argument list; 2 found

Check failure on line 27 in library/Icingadb/ProvidedHook/Notifications/SourceIntegrationSetup.php

View workflow job for this annotation

GitHub Actions / PHP / Lint (8.4) / Linters 8.4

Expected 1 space after comma in argument list; 2 found

Check failure on line 27 in library/Icingadb/ProvidedHook/Notifications/SourceIntegrationSetup.php

View workflow job for this annotation

GitHub Actions / PHP / Lint (8.3) / Linters 8.3

Expected 1 space after comma in argument list; 2 found

Check failure on line 27 in library/Icingadb/ProvidedHook/Notifications/SourceIntegrationSetup.php

View workflow job for this annotation

GitHub Actions / PHP / Lint (8.2) / Linters 8.2

Expected 1 space after comma in argument list; 2 found
->on(Form::ON_SUBMIT, function (): void {
// Database::get()->update('source', ['listener_username' => 'test', 'deleted' => 'n'], ['id = ?' => 1]);
Notification::success($this->translate('Icinga2 source integration setup completed'));

$this->setFinished();
})
->handleRequest(ServerRequest::fromGlobals());
}
}
1 change: 1 addition & 0 deletions run.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
if ($this::exists('notifications')) {
$this->provideHook('Notifications/v1/Source');
$this->provideHook('Notifications/v2/Icinga2Source');
$this->provideHook('Notifications/SourceIntegrationSetup');
}

if ($this::exists('reporting')) {
Expand Down
Loading