Skip to content

Commit

Permalink
Merge pull request #54 from Icinga/feature/icingadb
Browse files Browse the repository at this point in the history
Refactor for IcingaDB
  • Loading branch information
martialblog authored Jul 12, 2024
2 parents 16f245d + bb4e3c3 commit 56d7144
Show file tree
Hide file tree
Showing 78 changed files with 457 additions and 4,770 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
.*.sw[op]
*~
/.idea/

# Except those related to git
\#*
.\#*
*TODO*
!.git*

# Docker
/docker-compose.yml

# Artifacts from vendor parts in testing
.phplint.cache/
/docker-compose.yml
/*.phar
/Icinga
/Zend
Expand Down
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ please see the documentation on details.
## Requirements

* Icinga Web 2 >= 2.5.0
* and its monitoring module
* Icinga DB Web >= 1.0.0
* php-yaml

Also see [Introduction in docs](doc/01-Introduction.md).
Expand All @@ -26,21 +26,6 @@ Also see [Introduction in docs](doc/01-Introduction.md).

All documentation can be found inside the [doc](doc/) directory.

Also available inside Icinga Web 2 with the doc module.

## Development Environment

./test/setup_vendor.sh

cp docker-compose.dev.yml docker-compose.yml
# adjust to your needs

docker-compose up -d

Then access [http://localhost:8080](http://localhost:8080).

Default admin user is `icingaadmin` with password `icinga`.

## License

Icinga Web TopLevelView is licensed under the terms of the [GNU General Public License Version 2](COPYING).
104 changes: 0 additions & 104 deletions application/clicommands/ConvertCommand.php

This file was deleted.

92 changes: 0 additions & 92 deletions application/clicommands/LegacyCommand.php

This file was deleted.

16 changes: 9 additions & 7 deletions application/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
use Icinga\Module\Toplevelview\ViewConfig;
use Icinga\Module\Toplevelview\Web\Controller;

/**
* IndexController loads all existing Views from their YAML files.
*/
class IndexController extends Controller
{
public function indexAction()
{
$this->getTabs()->add(
'index',
array(
'title' => 'Top Level View',
'url' => 'toplevelview',
)
)->activate('index');
$this->getTabs()->add('index', [
'title' => 'Top Level View',
'url' => 'toplevelview',
])->activate('index');

// Load add views from the existing YAML files
$this->view->views = ViewConfig::loadAll();

$this->setAutorefreshInterval(30);
Expand Down
46 changes: 15 additions & 31 deletions application/controllers/ShowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,33 @@
use Icinga\Module\Toplevelview\ViewConfig;
use Icinga\Module\Toplevelview\Web\Controller;
use Icinga\Web\Url;
use Icinga\Web\Widget\Tab;

class ShowController extends Controller
{
public function init()
{
$tabs = $this->getTabs();

$tiles = Url::fromPath('toplevelview/show', array(
'name' => $this->params->getRequired('name')
));
$url = Url::fromRequest()->setParams(clone $this->params);

$tabs->add(
'index',
array(
'title' => $this->translate('Tiles'),
'url' => $tiles
)
);
$tiles = Url::fromPath('toplevelview/show', ['name' => $this->params->getRequired('name')]);

$tabs->add('index', [
'title' => $this->translate('Tree'),
'url' => $tiles
]);

// Add new Tabs for the entire tree
if (($id = $this->getParam('id')) !== null) {
$tabs->add(
'tree',
array(
'title' => $this->translate('Tree'),
'url' => Url::fromPath('toplevelview/show/tree', array(
'name' => $this->params->getRequired('name'),
'id' => $id
))
)
);
$tabs->add('tree', [
'title' => $this->translate('Tiles'),
'url' => Url::fromPath('toplevelview/show/tree', [
'name' => $this->params->getRequired('name'),
'id' => $id
])
]);
}

$fullscreen = new Tab(array(
'title' => $this->translate('Go Fullscreen'),
'icon' => 'dashboard',
'url' => ((string) $tiles) . '&view=compact&showFullscreen'
));
$fullscreen->setTargetBlank();
$tabs->addAsDropdown('fullscreen', $fullscreen);

$action = $this->getRequest()->getActionName();
if ($tab = $tabs->get($action)) {
$tab->setActive();
Expand All @@ -58,7 +44,6 @@ public function indexAction()
$this->view->name = $name = $this->params->getRequired('name');
$this->view->view = $view = ViewConfig::loadByName($name);
$tree = $view->getTree();
$tree->setBackend($this->monitoringBackend());

if (($lifetime = $this->getParam('cache')) !== null) {
$tree->setCacheLifetime($lifetime);
Expand All @@ -73,7 +58,6 @@ public function treeAction()
$this->view->view = $view = ViewConfig::loadByName($name);
$tree = $view->getTree();
$this->view->node = $tree->getById($this->params->getRequired('id'));
$tree->setBackend($this->monitoringBackend());

if (($lifetime = $this->getParam('cache')) !== null) {
$tree->setCacheLifetime($lifetime);
Expand Down
Binary file modified application/locale/de_DE/LC_MESSAGES/toplevelview.mo
Binary file not shown.
6 changes: 3 additions & 3 deletions application/locale/de_DE/LC_MESSAGES/toplevelview.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: Toplevelview Module (0.0.0)\n"
"Report-Msgid-Bugs-To: dev@icinga.com\n"
"POT-Creation-Date: 2017-10-13 11:53+0000\n"
"PO-Revision-Date: 2024-04-24 12:51+0200\n"
"PO-Revision-Date: 2024-06-14 16:05+0200\n"
"Last-Translator: Markus Opolka <markus.opolka@netways.de>\n"
"Language-Team: \n"
"Language: de_DE\n"
Expand Down Expand Up @@ -80,8 +80,8 @@ msgid "Find previous"
msgstr "Vorheriger Treffer"

#: ../../../../modules/toplevelview/application/controllers/ShowController.php:43
msgid "Go Fullscreen"
msgstr "Zur Vollbildansicht"
msgid "Fullscreen"
msgstr "Vollbild"

#: ../../../../modules/toplevelview/application/views/scripts/edit/index.phtml:33
msgid "Jump to line"
Expand Down
5 changes: 4 additions & 1 deletion application/views/helpers/Badges.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* Icinga Web 2 Top Level View | (c) 2017 Icinga Development Team | GPLv2+ */

use Icinga\Module\Toplevelview\Tree\TLVStatus;
use Icinga\Web\Url;

class Zend_View_Helper_Badges extends Zend_View_Helper_Abstract
{
Expand All @@ -18,6 +17,10 @@ protected function prettyTitle($identifier)
return trim($s);
}

/**
* badges renders a TLVNode's TLVStatus into HTML.
* A badge represents the number of status of a given node
*/
public function badges(TLVStatus $status, $problemsOnly = true, $showTotal = false)
{
$htm = '';
Expand Down
Loading

0 comments on commit 56d7144

Please sign in to comment.