Skip to content

Commit

Permalink
MibController: cleanup, be friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Gelf committed Dec 1, 2017
1 parent c8c1309 commit d9d4770
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions application/controllers/MibController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Icinga\Module\Snmp\Controllers;

use dipl\Html\Html;
use dipl\Html\Icon;
use dipl\Html\Link;
use dipl\Web\Widget\NameValueTable;
use Icinga\Module\Snmp\ActionController;
Expand All @@ -16,8 +17,7 @@ class MibController extends ActionController
public function uploadAction()
{
$form = (new MibForm())
->setDb($this->db())
->setSuccessUrl('snmp/mib/uploads');
->setDb($this->db());
$this->addSingleTab('Add');
$this->addTitle($this->translate('Add SNMP MIB file'));

Expand Down Expand Up @@ -47,21 +47,30 @@ public function processAction()
}
$this->content()->add([
$dependencies,
Html::tag('h2', null, 'MIB Tree'),
MibParser::getHtmlTreeFromParsedMib($parsed),
])->addAttributes(['class' => 'icinga-module module-director']);
}

public function uploadsAction()
{
$this->setAutorefreshInterval(1);
$this->setSnmpTabs()->activate('mib_uploads');
$this->addTitle('MIB file uploads');
$this->addTitle('Upload your MIB files');
$this->actions()->add(
Link::create($this->translate('Add'), 'snmp/mib/upload', null, [
'class' => 'icon-plus',
'data-base-target' => '_next'
])
);

(new MibUploadsTable($this->db()))->renderTo($this);
$table = new MibUploadsTable($this->db());
if (count($table)) {
$table->renderTo($this);
} else {
$this->content()
->add(Icon::create('ok'))
->add('There are no pending MIB files in our queue');
}
}
}

0 comments on commit d9d4770

Please sign in to comment.