[icinga-checkins] icinga.org: icingaweb2-module-director/feature/icinga-legacy-config-13049: Revert "IcingaServiceTable: strip down the service table"

git at icinga.org git at icinga.org
Tue Nov 22 13:22:47 CET 2016


Module: icingaweb2-module-director
Branch: feature/icinga-legacy-config-13049
Commit: a3ecddcd9bbd2d8412b8c4e8a20b2584c2fede41
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=a3ecddcd9bbd2d8412b8c4e8a20b2584c2fede41

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Nov 16 16:16:49 2016 +0100

Revert "IcingaServiceTable: strip down the service table"

Will be added later on

This reverts commit cf6f9d42e2a8cfa847f35094a47f72d233491ef8.

---

 application/tables/IcingaServiceTable.php |   55 ++++++++++++++++++++++++++++-
 1 file changed, 54 insertions(+), 1 deletion(-)

diff --git a/application/tables/IcingaServiceTable.php b/application/tables/IcingaServiceTable.php
index 222120d..433dc12 100644
--- a/application/tables/IcingaServiceTable.php
+++ b/application/tables/IcingaServiceTable.php
@@ -23,6 +23,11 @@ class IcingaServiceTable extends QuickTable
         );
     }
 
+    protected function listTableClasses()
+    {
+        return array_merge(array('assignment-table'), parent::listTableClasses());
+    }
+
     protected function getActionUrl($row)
     {
         // TODO: Remove once we got a separate apply table
@@ -33,7 +38,55 @@ class IcingaServiceTable extends QuickTable
 
         }
 
-        return $this->url('director/service/edit', $params);
+        return $this->url('director/service', $params);
+    }
+
+    protected function renderRow($row)
+    {
+        $v = $this->view();
+        $extra = $this->appliedOnes($row->id);
+        $htm = "  <tr" . $this->getRowClassesString($row) . ">\n";
+        $htm .= '<td>' . $v->qlink($row->service, $this->getActionUrl($row));
+        if (empty($extra)) {
+            if ($row->check_command_id) {
+                $htm .= ' ' . $v->qlink(
+                        'Create apply-rule',
+                        'director/service/add',
+                        array('apply' => $row->service),
+                        array('class' => 'icon-plus')
+                    );
+            }
+
+        } else {
+            $htm .= '. Related apply rules: <table class="apply-rules">';
+            foreach ($extra as $service) {
+                $href = $v->url('director/service', array('id' => $service->id));
+                $htm .= "<tr href=\"$href\">";
+
+                try {
+                    $prettyFilter = AssignRenderer::forFilter(
+                        Filter::fromQueryString($service->assign_filter)
+                    )->renderAssign();
+                }
+                catch (IcingaException $e) {
+                    // ignore errors in filter rendering
+                    $prettyFilter = 'Error in Filter rendering: ' . $e->getMessage();
+                }
+
+                $htm .= "<td><a href=\"$href\">" . $service->object_name . '</a></td>';
+                $htm .= '<td>' . $prettyFilter . '</td>';
+                $htm .= '<tr>';
+            }
+            $htm .= '</table>';
+            $htm .= $v->qlink(
+                'Add more',
+                'director/service/add',
+                array('apply' => $row->service),
+                array('class' => 'icon-plus')
+            );
+        }
+        $htm .= '</td>';
+        return $htm . "  </tr>\n";
     }
 
     public function getTitles()



More information about the icinga-checkins mailing list