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

Render SNI config tab next to the Jobs tab #216

Merged
merged 1 commit into from
Oct 27, 2023
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
6 changes: 6 additions & 0 deletions application/controllers/JobsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ class JobsController extends CompatController
public function indexAction()
{
$this->addTitleTab($this->translate('Jobs'));
$this->getTabs()->add('sni', [
'title' => $this->translate('Configure SNI'),
'label' => $this->translate('SNI'),
'url' => 'x509/sni',
'baseTarget' => '_main'
]);

$jobs = X509Job::on($this->getDb());
if ($this->hasPermission('config/x509')) {
Expand Down
29 changes: 24 additions & 5 deletions application/controllers/SniController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,34 @@
use Icinga\Exception\NotFoundError;
use Icinga\Module\X509\Forms\Config\SniConfigForm;
use Icinga\Module\X509\SniIniRepository;
use Icinga\Web\Controller;
use Icinga\Web\Url;
use ipl\Html\HtmlString;
use ipl\Web\Compat\CompatController;
use ipl\Web\Url;
use ipl\Web\Widget\ButtonLink;

class SniController extends Controller
class SniController extends CompatController
{
/**
* List all maps
*/
public function indexAction()
{
$this->view->tabs = $this->Module()->getConfigTabs()->activate('sni');
$this->getTabs()->add('jobs', [
'title' => $this->translate('Configure Jobs'),
'label' => $this->translate('Jobs'),
'url' => 'x509/jobs',
'baseTarget' => '_main'

]);
$this->addTitleTab($this->translate('SNI'));

$this->addControl(
(new ButtonLink($this->translate('New SNI Map'), Url::fromPath('x509/sni/new'), 'plus'))
->openInModal()
yhabteab marked this conversation as resolved.
Show resolved Hide resolved
);
$this->controls->getAttributes()->add('class', 'default-layout');

$this->view->controls = $this->controls;

$repo = new SniIniRepository();

Expand All @@ -29,11 +46,13 @@ public function indexAction()
*/
public function newAction()
{
$this->addTitleTab($this->translate('New SNI Map'));

$form = $this->prepareForm()->add();

$form->handleRequest();

$this->renderForm($form, $this->translate('New SNI Map'));
$this->addContent(new HtmlString($form->render()));
}

/**
Expand Down
1 change: 0 additions & 1 deletion application/forms/Config/SniConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ protected function createInsertElements(array $formData)
]
]);

$this->setTitle($this->translate('Create a New SNI Map'));
$this->setSubmitLabel($this->translate('Create'));
}

Expand Down
17 changes: 1 addition & 16 deletions application/views/scripts/sni/index.phtml
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
<div class="controls">
<?= /** @var \Icinga\Web\Widget\Tabs $tabs */ $tabs ?>
</div>
<?= $this->controls->render() ?>
<div class="content">
<div class="actions">
<?= $this->qlink(
$this->translate('Create a New SNI Map') ,
'x509/sni/new',
null,
[
'class' => 'button-link',
'data-base-target' => '_next',
'icon' => 'plus',
'title' => $this->translate('Create a New SNI Map')
]
) ?>
</div>
<?php /** @var \Icinga\Repository\RepositoryQuery $sni */ if (! $sni->hasResult()): ?>
<p><?= $this->escape($this->translate('No SNI maps configured yet.')) ?></p>
<?php else: ?>
Expand Down
10 changes: 2 additions & 8 deletions configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,14 @@
'priority' => 20
));

$section->add(N_('Jobs'), [
$section->add(N_('Configuration'), [
'url' => 'x509/jobs',
'priority' => 100,
'description' => $this->translate('Configure the scan jobs')
'description' => $this->translate('Configure the scan jobs and SNI map')
]);

$this->provideConfigTab('backend', array(
'title' => $this->translate('Configure the database backend'),
'label' => $this->translate('Backend'),
'url' => 'config/backend'
));

$this->provideConfigTab('sni', array(
'title' => $this->translate('Configure SNI'),
'label' => $this->translate('SNI'),
'url' => 'sni'
));