[icinga-checkins] icinga.org: icingaweb2-module-director/master: syncrule/history: split view script logic

git at icinga.org git at icinga.org
Fri Jun 24 08:46:50 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri Jun 24 08:38:18 2016 +0200

syncrule/history: split view script logic

---

 application/views/scripts/syncrule/history.phtml   |   71 +-------------------
 .../views/scripts/syncrule/runSummary.phtml        |   55 +++++++++++++++
 .../views/scripts/syncrule/syncRunDetails.phtml    |   14 ++++
 3 files changed, 72 insertions(+), 68 deletions(-)

diff --git a/application/views/scripts/syncrule/history.phtml b/application/views/scripts/syncrule/history.phtml
index 9994dd0..9acc5a1 100644
--- a/application/views/scripts/syncrule/history.phtml
+++ b/application/views/scripts/syncrule/history.phtml
@@ -11,74 +11,9 @@
 <div class="content"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
 <?php if ($this->run): ?>
 <h3><?= $this->translate('Sync run details') ?></h3>
-<table class="key-value-table">
- <tr>
-  <th><?= $this->translate('Start time') ?></th>
-  <td><?= $this->escape($run->start_time) ?></td>
- </tr>
- <tr>
-  <th><?= $this->translate('Duration') ?></th>
-  <td><?= sprintf('%.2fs', $run->duration_ms / 1000) ?></td>
- </tr>
- <tr>
-  <th><?= $this->translate('Activity') ?></th>
-  <td data-base-target="_next"><?php
-    $total = $run->objects_deleted + $run->objects_created + $run->objects_modified;
-    if ($total === 0) {
-        echo $this->translate('No changes have been made');
-    } else {
-        if ($total === 1) {
-            echo $this->translate('One object has been modified');
-        } else {
-            printf(
-                $this->translate('%s objects have been modified'),
-                $total
-            );
-        }
-
-        $activityUrl = sprintf(
-            'director/config/activities?id>%d&id<=%d',
-            $formerId,
-            $lastId
-        );
-
-        $links = array();
-        if ($run->objects_created > 0) {
-            $links[] = $this->qlink(
-                sprintf('%d created', $run->objects_created),
-                $activityUrl,
-                array('action_name' => 'create')
-            );
-        }
-        if ($run->objects_modified > 0) {
-            $links[] = $this->qlink(
-                sprintf('%d modified', $run->objects_modified),
-                $activityUrl,
-                array('action_name' => 'modify')
-            );
-        }
-        if ($run->objects_deleted > 0) {
-            $links[] = $this->qlink(
-                sprintf('%d deleted', $run->objects_deleted),
-                $activityUrl,
-                array('action_name' => 'delete')
-            );
-        }
-
-        if (count($links) > 1) {
-            $links[] = $this->qlink(
-                'Show all actions',
-                $activityUrl
-            );
-        }
-
-        if (! empty($links)) {
-            echo ': ' . implode(', ', $links);
-        }
-    }
-  ?></td>
- </tr>
-</table>
+<?= $this->render('syncrule/syncRunDetails.phtml') ?>
 <?php endif ?>
+<div data-base-target="_main">
 <?= $this->table->render() ?>
 </div>
+</div>
diff --git a/application/views/scripts/syncrule/runSummary.phtml b/application/views/scripts/syncrule/runSummary.phtml
new file mode 100644
index 0000000..e4965d1
--- /dev/null
+++ b/application/views/scripts/syncrule/runSummary.phtml
@@ -0,0 +1,55 @@
+<?php
+    $total = $run->objects_deleted + $run->objects_created + $run->objects_modified;
+    if ($total === 0) {
+        echo $this->translate('No changes have been made');
+    } else {
+        if ($total === 1) {
+            echo $this->translate('One object has been modified');
+        } else {
+            printf(
+                $this->translate('%s objects have been modified'),
+                $total
+            );
+        }
+
+        $activityUrl = sprintf(
+            'director/config/activities?id>%d&id<=%d',
+            $formerId,
+            $lastId
+        );
+
+        $links = array();
+        if ($run->objects_created > 0) {
+            $links[] = $this->qlink(
+                sprintf('%d created', $run->objects_created),
+                $activityUrl,
+                array('action_name' => 'create')
+            );
+        }
+        if ($run->objects_modified > 0) {
+            $links[] = $this->qlink(
+                sprintf('%d modified', $run->objects_modified),
+                $activityUrl,
+                array('action_name' => 'modify')
+            );
+        }
+        if ($run->objects_deleted > 0) {
+            $links[] = $this->qlink(
+                sprintf('%d deleted', $run->objects_deleted),
+                $activityUrl,
+                array('action_name' => 'delete')
+            );
+        }
+
+        if (count($links) > 1) {
+            $links[] = $this->qlink(
+                'Show all actions',
+                $activityUrl
+            );
+        }
+
+        if (! empty($links)) {
+            echo ': ' . implode(', ', $links);
+        }
+    }
+  ?>
diff --git a/application/views/scripts/syncrule/syncRunDetails.phtml b/application/views/scripts/syncrule/syncRunDetails.phtml
new file mode 100644
index 0000000..b494f76
--- /dev/null
+++ b/application/views/scripts/syncrule/syncRunDetails.phtml
@@ -0,0 +1,14 @@
+<table class="key-value-table">
+ <tr>
+  <th><?= $this->translate('Start time') ?></th>
+  <td><?= $this->escape($run->start_time) ?></td>
+ </tr>
+ <tr>
+  <th><?= $this->translate('Duration') ?></th>
+  <td><?= sprintf('%.2fs', $run->duration_ms / 1000) ?></td>
+ </tr>
+ <tr>
+  <th><?= $this->translate('Activity') ?></th>
+  <td data-base-target="_next"><?= $this->render('syncrule/runSummary.phtml') ?></td>
+ </tr>
+</table>



More information about the icinga-checkins mailing list