mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
IcingaServiceTable: Update apply rule rendering
For new storage format, and change to table. refs #12033
This commit is contained in:
parent
0d86c24cd8
commit
b3eb5ea102
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Tables;
|
namespace Icinga\Module\Director\Tables;
|
||||||
|
|
||||||
|
use Icinga\Data\Filter\Filter;
|
||||||
|
use Icinga\Exception\IcingaException;
|
||||||
|
use Icinga\Module\Director\IcingaConfig\AssignRenderer;
|
||||||
use Icinga\Module\Director\Web\Table\QuickTable;
|
use Icinga\Module\Director\Web\Table\QuickTable;
|
||||||
|
|
||||||
class IcingaServiceTable extends QuickTable
|
class IcingaServiceTable extends QuickTable
|
||||||
@ -55,13 +58,26 @@ class IcingaServiceTable extends QuickTable
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$htm .= '. Related apply rules: <ul class="apply-rules">';
|
$htm .= '. Related apply rules: <table class="apply-rules">';
|
||||||
foreach ($extra as $id => $service) {
|
foreach ($extra as $service) {
|
||||||
$htm .= '<li>'
|
$href = $v->url('director/service', array('id' => $service->id));
|
||||||
. $v->qlink($service, 'director/service', array('id' => $id))
|
$htm .= "<tr href=\"$href\">";
|
||||||
. '</li>';
|
|
||||||
|
try {
|
||||||
|
$prettyFilter = AssignRenderer::forFilter(
|
||||||
|
Filter::fromQueryString($service->assign_filter)
|
||||||
|
)->renderAssign();
|
||||||
}
|
}
|
||||||
$htm .= '</ul>';
|
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(
|
$htm .= $v->qlink(
|
||||||
'Add more',
|
'Add more',
|
||||||
'director/service/add',
|
'director/service/add',
|
||||||
@ -110,7 +126,8 @@ class IcingaServiceTable extends QuickTable
|
|||||||
array('s' => 'icinga_service'),
|
array('s' => 'icinga_service'),
|
||||||
array(
|
array(
|
||||||
'id' => 's.id',
|
'id' => 's.id',
|
||||||
'objectname' => $nameCol,
|
'object_name' => 's.object_name',
|
||||||
|
'assign_filter' => 's.assign_filter',
|
||||||
)
|
)
|
||||||
)->join(
|
)->join(
|
||||||
array('i' => 'icinga_service_inheritance'),
|
array('i' => 'icinga_service_inheritance'),
|
||||||
@ -119,13 +136,7 @@ class IcingaServiceTable extends QuickTable
|
|||||||
)->where('i.parent_service_id = ?', $id)
|
)->where('i.parent_service_id = ?', $id)
|
||||||
->where('s.object_type = ?', 'apply');
|
->where('s.object_type = ?', 'apply');
|
||||||
|
|
||||||
$query->joinLeft(
|
return $db->fetchAll($query);
|
||||||
array('a' => 'icinga_service_assignment'),
|
|
||||||
'a.service_id = s.id',
|
|
||||||
array()
|
|
||||||
)->group('s.id');
|
|
||||||
|
|
||||||
return $db->fetchPairs($query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBaseQuery()
|
public function getBaseQuery()
|
||||||
|
@ -887,25 +887,25 @@ table.icinga-objects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
table.assignment-table {
|
table.assignment-table {
|
||||||
ul.apply-rules {
|
table.apply-rules {
|
||||||
margin: 1em 0 1em 0;
|
margin: 1em 0 1em 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 1px solid @gray-lighter;
|
width: 100%;
|
||||||
|
|
||||||
li {
|
tr {
|
||||||
display: block;
|
border-bottom: 1px solid @gray-lighter;
|
||||||
|
border-left: 5px solid transparent;
|
||||||
|
|
||||||
a {
|
td {
|
||||||
display: block;
|
padding: 0.5em 1em;
|
||||||
float: none;
|
|
||||||
font-weight: normal;
|
|
||||||
background-color: white;
|
|
||||||
padding: 0.3em 1.5em;
|
|
||||||
&:hover {
|
|
||||||
background-color: @icinga-blue;
|
|
||||||
color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover, &:active, &.active {
|
||||||
|
border-left: 5px solid @icinga-blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user