summaryrefslogtreecommitdiffstats
path: root/library/Director/Web/Widget/ActivityLogInfo.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Director/Web/Widget/ActivityLogInfo.php')
-rw-r--r--library/Director/Web/Widget/ActivityLogInfo.php46
1 files changed, 42 insertions, 4 deletions
diff --git a/library/Director/Web/Widget/ActivityLogInfo.php b/library/Director/Web/Widget/ActivityLogInfo.php
index 8454b26..2b64fd4 100644
--- a/library/Director/Web/Widget/ActivityLogInfo.php
+++ b/library/Director/Web/Widget/ActivityLogInfo.php
@@ -3,7 +3,10 @@
namespace Icinga\Module\Director\Web\Widget;
use gipfl\Json\JsonString;
+use Icinga\Module\Director\Data\FieldReferenceLoader;
+use Icinga\Module\Director\DirectorObject\Automation\BasketSnapshotFieldResolver;
use Icinga\Module\Director\Objects\DirectorActivityLog;
+use Icinga\Module\Director\Web\Form\IcingaObjectFieldLoader;
use ipl\Html\HtmlDocument;
use ipl\Html\HtmlElement;
use Icinga\Date\DateFormatter;
@@ -83,8 +86,7 @@ class ActivityLogInfo extends HtmlDocument
/** @var Url $url */
$url = $url->without('checksum')->without('show');
$div = Html::tag('div', [
- 'class' => 'pagination-control',
- 'style' => 'float: right; width: 5em'
+ 'class' => ['pagination-control', 'activity-log-control'],
]);
$ul = Html::tag('ul', ['class' => 'nav tab-nav']);
@@ -434,11 +436,30 @@ class ActivityLogInfo extends HtmlDocument
{
if ($object instanceof IcingaService) {
return $this->previewService($object);
+ } elseif ($object instanceof IcingaServiceSet) {
+ return $this->previewServiceSet($object);
} else {
return $object->toSingleIcingaConfig();
}
}
+ /**
+ * Render service set to be previewed
+ *
+ * @param IcingaServiceSet $object
+ *
+ * @return IcingaConfig
+ */
+ protected function previewServiceSet(IcingaServiceSet $object)
+ {
+ $config = $object->toSingleIcingaConfig();
+ foreach ($object->getCachedServices() as $service) {
+ $service->renderToConfig($config);
+ }
+
+ return $config;
+ }
+
protected function previewService(IcingaService $service)
{
if (($set = $service->get('service_set')) !== null) {
@@ -625,10 +646,27 @@ class ActivityLogInfo extends HtmlDocument
$newProps['object_type'] = $props->object_type;
}
- return IcingaObject::createByType(
+ $object = IcingaObject::createByType(
$type,
$newProps,
$this->db
- )->setProperties((array) $props);
+ );
+
+ if ($type === 'icinga_service_set' && isset($props->services)) {
+ $services = [];
+ foreach ($props->services as $service) {
+ $services[$service->object_name] = IcingaObject::createByType(
+ 'icinga_service',
+ (array) $service,
+ $this->db
+ );
+ }
+
+ /** @var IcingaServiceSet $object */
+ $object->setCachedServices($services);
+ unset($props->services);
+ }
+
+ return $object->setProperties((array) $props);
}
}