Display apply_for in apply listings

This commit is contained in:
Markus Frosch 2019-05-06 14:38:17 +02:00
parent 83245f2dd4
commit 767296ce6a
2 changed files with 17 additions and 2 deletions

View File

@ -79,9 +79,15 @@ class ApplyRulesTable extends ZfQueryBasedTable
}
$url = Url::fromPath("director/{$this->baseObjectUrl}/edit", $params);
$assignWhere = $this->renderApplyFilter($row->assign_filter);
if (! empty($row->apply_for)) {
$assignWhere = sprintf('apply for %s / %s', $row->apply_for, $assignWhere);
}
$tr = static::tr([
static::td(Link::create($row->object_name, $url)),
static::td($this->renderApplyFilter($row->assign_filter)),
static::td($assignWhere),
// NOT (YET) static::td($this->createActionLinks($row))->setSeparator(' ')
]);
@ -203,6 +209,7 @@ class ApplyRulesTable extends ZfQueryBasedTable
'object_name' => 'o.object_name',
'disabled' => 'o.disabled',
'assign_filter' => 'o.assign_filter',
'apply_for' => 'o.apply_for',
];
$query = $this->db()->select()->from(
['o' => $table],

View File

@ -98,9 +98,15 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
$link = Html::tag('a', $row->name);
}
} else {
$applyFor = '';
if (! empty($row->apply_for)) {
$applyFor = sprintf('(apply for %s) ', $row->apply_for);
}
$link = Link::create(sprintf(
$this->translate('%s (%s)'),
$this->translate('%s %s(%s)'),
$row->name,
$applyFor,
$this->renderApplyFilter($row->filter)
), 'director/host/appliedservice', [
'name' => $this->host->getObjectName(),
@ -148,6 +154,7 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
'disabled' => 'disabled',
'blacklisted' => 'blacklisted',
'assign_filter' => 'assign_filter',
'apply_for' => 'apply_for',
]);
}
@ -178,6 +185,7 @@ class IcingaHostAppliedServicesTable extends SimpleQueryBasedTable
'id' => 's.id',
'name' => 's.object_name',
'assign_filter' => 's.assign_filter',
'apply_for' => 's.apply_for',
'disabled' => 's.disabled',
'blacklisted' => "CASE WHEN hsb.service_id IS NULL THEN 'n' ELSE 'y' END",
]