[icinga-checkins] icinga.org: icingaweb2-module-elasticsearch/master: Remove old list view

git at icinga.org git at icinga.org
Thu Jun 30 17:08:10 CEST 2016


Module: icingaweb2-module-elasticsearch
Branch: master
Commit: 2968d91e0e270a1d43b8a382963a811be636c52d
URL:    https://git.icinga.org/?p=icingaweb2-module-elasticsearch.git;a=commit;h=2968d91e0e270a1d43b8a382963a811be636c52d

Author: Markus Frosch <lazyfrosch at icinga.org>
Date:   Thu Jun 30 11:44:44 2016 +0200

Remove old list view

refs #11636

---

 application/controllers/EventController.php |  106 ---------------------------
 application/views/scripts/event/list.phtml  |   83 ---------------------
 2 files changed, 189 deletions(-)

diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index aa75929..40603c2 100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -151,110 +151,4 @@ class EventController extends Controller
         ));
         $this->redirectNow($url);
     }
-
-    /**
-     * @todo reimplement with log-types!
-     * @throws IcingaException
-     * @throws \Icinga\Exception\Http\HttpNotFoundException
-     * @throws \Icinga\Exception\ProgrammingError
-     */
-    public function listAction() {
-        throw new NotImplementedError('list action is currently not implemented!');
-        /*
-        $host_name = $this->_getParam('host');
-        $service_name = $this->_getParam('service');
-
-        if (!$host_name or !$service_name)
-            throw new IcingaException('host and service are required params!');
-
-        // TODO: monitoring enabled?
-        $backend = Backend::createBackend();
-
-        $service = new Service($backend, $host_name, $service_name);
-
-        if (!$service->fetch())
-            throw new IcingaException('Service could not be found!');
-
-        $cv = (array) $service->customvars;
-
-        // data from service
-        if (isset($cv['logstash_query']))
-            $this->view->query = $cv['logstash_query'];
-        else throw new IcingaException('Could not find cv logstash_query!');
-
-        $this->view->filter = null;
-        if (isset($cv['logstash_filter']))
-            $this->view->filter = $cv['logstash_filter'];
-
-        $this->view->fields = null;
-        if (isset($cv['logstash_fields']))
-            $this->view->fields = $cv['logstash_fields'];
-
-        $this->view->warning = null;
-        if (isset($cv['logstash_warning']))
-            $this->view->warning = $cv['logstash_warning'];
-
-        $this->view->critical = null;
-        if (isset($cv['logstash_critical']))
-            $this->view->critical = $cv['logstash_critical'];
-
-        // query elasticsearch
-        $client = new RestApiClient($this->elasticsearch_url);
-        $query = $client->select(array($this->index_pattern));
-
-        $query->setQueryString($this->view->query);
-        $query->setFilterQueryString($this->view->filter);
-
-        if ($this->view->warning)
-            $query->setIcingaWarningQuery($this->view->warning);
-        if ($this->view->critical)
-            $query->setIcingaCriticalQuery($this->view->critical);
-        $query->setFilteredByIcingaQueries(true);
-
-        // extra params
-        $this->view->show_ack = $this->_getParam('show_ack', 0);
-        if (! $this->view->show_ack)
-            $query->setWithoutAck(true);
-
-        $limit = $this->_getParam('limit', 100);
-        $page = $this->_getParam('page', 1);
-        $query->limit($limit, $limit * ($page-1));
-
-        // other params and view setup
-        $this->view->compact = $this->_getParam('view') === 'compact';
-
-        $this->view->live = $this->params->shift('live');
-        if ($this->view->live) {
-            $this->setAutorefreshInterval(1);
-        } else {
-            $this->setAutorefreshInterval(15);
-        }
-
-        $this->view->fieldlist = array();
-        if ($this->view->fields) {
-            $this->view->fieldlist = preg_split('#\s*[,]\s*#', $this->view->fields);
-        }
-
-        $this->view->limiter = new Limiter();
-        $this->view->limiter->setDefaultLimit(100);
-
-        $this->view->paginator = new Paginator();
-        $this->view->paginator->setQuery($query);
-
-        $this->view->events = $query->fetchAll();
-        $this->view->count = $query->count();
-        $this->view->took = $query->getTook();
-        $this->view->warnings = $query->getIcingaWarningCount();
-        $this->view->criticals = $query->getIcingaCriticalCount();
-
-        if ($page > 1 and count($this->view->events) == 0) {
-            $this->redirectNow($this->view->url()->without( 'page'));
-        }
-
-        $this->getTabs()->add('list', array(
-            'title' => $this->translate('Events'),
-            'url'   => $this->view->url()
-        ))->activate(('list'));;
-        */
-    }
 }
diff --git a/application/views/scripts/event/list.phtml b/application/views/scripts/event/list.phtml
deleted file mode 100644
index 368501b..0000000
--- a/application/views/scripts/event/list.phtml
+++ /dev/null
@@ -1,83 +0,0 @@
-    <?php if (! $this->compact): ?>
-<div class="controls">
-    <?= $this->tabs ?>
-    <?= $this->limiter; ?>
-    <?= $this->paginator; ?>
-</div>
-<?php endif ?>
-<div class="filter">
-    <?php if ($this->live): ?>
-    <?= $this->qlink('Refresh slow', $this->url()->without('live')) ?>
-    <?php else: ?>
-    <?= $this->qlink('Refresh fast', $this->url()->setParam('live', true)) ?>
-    <?php endif ?>
-    -
-    <?php if ($this->show_ack): ?>
-        <?= $this->qlink('Hide acknowledged', $this->url()->without('show_ack')) ?>
-    <?php else: ?>
-        <?= $this->qlink('Show Acknowledged', $this->url()->setParam('show_ack', 1)) ?>
-    <?php endif ?>
-    -
-    <?php /* TODO: admin only */ ?>
-    <?= $this->qlink('Go to search', $this->url('elasticsearch/event/search', array(
-        'query' => $this->query,
-        'filter' => $this->filter,
-        'fields' => $this->fields,
-        'warning' => $this->warning,
-        'critical' => $this->critical,
-    ))) ?>
-
-</div>
-<div class="content">
-    <?php /** TODO: split template and load with partial()  */ ?>
-
-    <?php if ($this->count == 0): ?>
-        <p>No results found!</p>
-    <?php else: ?>
-
-    <p class="small">Found <?= $this->count ?> hits in <?= $this->took ?>ms, <?= $this->warnings ?> warning and <?= $this->criticals ?> critical are shown</p>
-
-    <table class="documents" data-base-target="_next">
-    <?php if ($this->count > 0): ?>
-        <?php if (count($this->fieldlist) > 0): ?>
-        <tr class="header">
-            <?php foreach($this->fieldlist as $field): ?>
-            <th><?= $this->escape($field) ?></th>
-            <?php endforeach ?>
-        </tr>
-        <?php endif; ?>
-        <?php foreach ($this->hits as $hit):
-            $classes = array();
-            $icons = array();
-            if (isset($hit['icinga_status']))
-                $classes[] = $hit['icinga_status'] == 2 ? 'critical' :
-                    ($hit['icinga_status'] == 1 ? 'warning' : '');
-            if (isset($hit['icinga_acknowledge']) and $hit['icinga_acknowledge'] === 1) {
-                $classes[] = 'handled';
-                $icons[] = $this->icon('ok', 'Acknowledged');
-            }
-            $num = 0;
-            $href = $this->url("elasticsearch/event/show", array('index' => $hit['_index'], 'type' => $hit['_type'], 'id' => $hit['_id']));
-        ?>
-            <tr class="document state <?= join(" ", $classes) ?>"
-                data-elastic-index="<?= $hit['_index'] ?>"
-                data-elastic-type="<?= $hit['_type'] ?>"
-                data-elastic-id="<?= $hit['_id'] ?>"
-                href="<?= $href ?>">
-                <?php if(count($this->fieldlist) > 0) foreach($this->fieldlist as $field): ?>
-                    <td><?php $value = (array_key_exists($field, $hit) ? $hit[$field] : null);
-                        if ($value === null) $value = ' ';
-                        else $value = $this->escape($value);
-                        if ($num++ == 0): ?><a href="<?= $href ?>"><?= $value ?></a><?= join("", $icons) ?><?php
-                        else: echo $value; endif ?></td>
-                <?php endforeach ?>
-
-                <?php if (count($this->fieldlist) == 0): ?>
-                    <td class="rawjson"><pre><?= json_encode($hit, JSON_PRETTY_PRINT); ?></pre></td>
-                <?php endif ?>
-            </tr>
-        <?php endforeach ?>
-        <?php endif ?>
-    </table>
-    <?php endif ?>
-</div>



More information about the icinga-checkins mailing list