diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php
index beb7c479..b5b0f5db 100644
--- a/application/controllers/ConfigController.php
+++ b/application/controllers/ConfigController.php
@@ -37,7 +37,7 @@ class ConfigController extends ActionController
if ($deploymentId = $this->params->get('deployment_id')) {
$tabs->add('deployment', array(
'label' => $this->translate('Deployment'),
- 'url' => 'director/deployment/show',
+ 'url' => 'director/deployment',
'urlParams' => array(
'id' => $deploymentId
)
diff --git a/application/controllers/DeploymentController.php b/application/controllers/DeploymentController.php
index 2fd87211..b814cb83 100644
--- a/application/controllers/DeploymentController.php
+++ b/application/controllers/DeploymentController.php
@@ -4,17 +4,22 @@ namespace Icinga\Module\Director\Controllers;
use Icinga\Module\Director\Web\Controller\ActionController;
use Icinga\Module\Director\Objects\DirectorDeploymentLog;
+use Icinga\Module\Director\IcingaConfig\IcingaConfig;
use Icinga\Module\Director\Util;
class DeploymentController extends ActionController
{
- public function showAction()
+ public function indexAction()
{
+ $this->view->title = $this->translate('Deployment details');
+
$deploymentId = $this->params->get('id');
$this->view->deployment = $deployment = DirectorDeploymentLog::load(
$deploymentId,
$this->db()
);
+ $this->view->config_checksum = Util::binary2hex($deployment->config_checksum);
+ $this->view->config = IcingaConfig::load($deployment->config_checksum, $this->db());
$tabs = $this->getTabs()->add('deployment', array(
'label' => $this->translate('Deployment'),
@@ -24,9 +29,9 @@ class DeploymentController extends ActionController
if ($deployment->config_checksum !== null) {
$tabs->add('config', array(
'label' => $this->translate('Config'),
- 'url' => 'director/config/show',
+ 'url' => 'director/config/files',
'urlParams' => array(
- 'checksum' => Util::binary2hex($deployment->config_checksum),
+ 'checksum' => $this->view->config_checksum,
'deployment_id' => $deploymentId
)
));
diff --git a/application/tables/DeploymentLogTable.php b/application/tables/DeploymentLogTable.php
index 9e4c8427..deac821e 100644
--- a/application/tables/DeploymentLogTable.php
+++ b/application/tables/DeploymentLogTable.php
@@ -25,6 +25,8 @@ class DeploymentLogTable extends QuickTable
$classes = array('succeeded');
} elseif ($row->startup_succeeded === 'n') {
$classes = array('failed');
+ } elseif ($row->stage_collected === null) {
+ $classes = array('pending');
} elseif ($row->dump_succeeded === 'y') {
$classes = array('sent');
} else {
@@ -64,7 +66,7 @@ class DeploymentLogTable extends QuickTable
protected function getActionUrl($row)
{
- return $this->url('director/deployment/show', array('id' => $row->id));
+ return $this->url('director/deployment', array('id' => $row->id));
}
public function getTitles()
diff --git a/application/views/scripts/deployment/index.phtml b/application/views/scripts/deployment/index.phtml
new file mode 100644
index 00000000..833f71a3
--- /dev/null
+++ b/application/views/scripts/deployment/index.phtml
@@ -0,0 +1,79 @@
+
+= $this->tabs ?>
+
= $this->escape($this->title) ?>
+
+
+
+
+
+ = $this->translate('Deployment time') ?> |
+ = $deployment->start_time ?> |
+
+
+ = $this->translate('Sent to') ?> |
+ = $deployment->peer_identity ?> |
+
+
+ = $this->translate('Configuration') ?> |
+ = $this->qlink(
+ sprintf(
+ $this->translate('%d files'),
+ $this->config->getFileCount()
+ ),
+ 'director/config/files',
+ array(
+ 'checksum' => $config_checksum,
+ 'deployment_id' => $deployment->id
+ )
+) ?>, = sprintf(
+ $this->translate('%d objects, %d templates'),
+ $config->getObjectCount(),
+ $config->getTemplateCount()
+ )?>, = Format::bytes($config->getSize()) ?> |
+
+
+ = $this->translate('Duration') ?> |
+ = sprintf(
+ $this->translate('Rendered in %0.2fs, deployed in %0.2fs'),
+ $config->getDuration() / 1000,
+ $deployment->duration_dump / 1000
+ ) ?> |
+
+
+ = $this->translate('Stage name') ?> |
+ = $deployment->stage_name ?> |
+
+
+ = $this->translate('Startup') ?> |
+ startup_succeeded === null) {
+ if ($deployment->stage_collected === null) {
+ echo $this->translate('Unknown, still waiting for config check outcome') . ' ' . $this->icon('spinner');
+ } else {
+ echo $this->translate('Unknown, failed to collect related information') . ' ' . $this->icon('help');
+ }
+} elseif ($deployment->startup_succeeded === 'y') {
+ echo ' ';
+ echo $this->translate('Succeeded') . ' ' . $this->icon('ok');
+ echo ' ';
+} else {
+ echo '';
+ echo $this->translate('Failed') . ' ' . $this->icon('cancel');
+ echo ' ';
+}
+
+ ?> |
+
+
+startup_succeeded !== null): ?>
+
Startup log
+
+= $this->escape($deployment->startup_log) ?>
+
+
+
diff --git a/application/views/scripts/deployment/show.phtml b/application/views/scripts/deployment/show.phtml
deleted file mode 100644
index 1ee675dd..00000000
--- a/application/views/scripts/deployment/show.phtml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-= $this->tabs ?>
-
-
-
-
= $this->escape($this->title) ?>
-deployment->startup_succeeded === 'y'): ?>
-
Startup succeeded
-
-
Startup failed
-
-
-= $this->escape($this->deployment->startup_log) ?>
-
-
diff --git a/library/Director/IcingaConfig/IcingaConfig.php b/library/Director/IcingaConfig/IcingaConfig.php
index 756ae795..398e398c 100644
--- a/library/Director/IcingaConfig/IcingaConfig.php
+++ b/library/Director/IcingaConfig/IcingaConfig.php
@@ -38,6 +38,43 @@ class IcingaConfig
$this->db = $connection->getDbAdapter();
}
+ public function getSize()
+ {
+ $size = 0;
+ foreach ($this->getFiles() as $file) {
+ $size += $file->getSize();
+ }
+ return $size;
+ }
+
+ public function getDuration()
+ {
+ return $this->duration;
+ }
+
+ public function getFileCount()
+ {
+ return count($this->files);
+ }
+
+ public function getObjectCount()
+ {
+ $cnt = 0;
+ foreach ($this->getFiles() as $file) {
+ $cnt += $file->getObjectCount();
+ }
+ return $cnt;
+ }
+
+ public function getTemplateCount()
+ {
+ $cnt = 0;
+ foreach ($this->getFiles() as $file) {
+ $cnt += $file->getTemplateCount();
+ }
+ return $cnt;
+ }
+
public function getChecksum()
{
return $this->checksum;
@@ -265,7 +302,7 @@ throw $e;
{
$query = $this->db->select()->from(
self::$table,
- array('checksum', 'last_activity_checksum')
+ array('checksum', 'last_activity_checksum', 'duration')
)->where('checksum = ?', $this->dbBin($checksum));
$result = $this->db->fetchRow($query);
@@ -274,6 +311,7 @@ throw $e;
}
$this->checksum = $result->checksum;
+ $this->duration = $result->duration;
$this->lastActivityChecksum = $result->last_activity_checksum;
if (is_resource($this->checksum)) {
diff --git a/library/Director/IcingaConfig/IcingaConfigFile.php b/library/Director/IcingaConfig/IcingaConfigFile.php
index 6e98f0a0..3b2054e8 100644
--- a/library/Director/IcingaConfig/IcingaConfigFile.php
+++ b/library/Director/IcingaConfig/IcingaConfigFile.php
@@ -48,6 +48,11 @@ class IcingaConfigFile
return $this->cntTemplate;
}
+ public function getSize()
+ {
+ return strlen($this->content);
+ }
+
public function setObjectCount($cnt)
{
$this->cntObject = $cnt;
diff --git a/public/css/module.less b/public/css/module.less
index 31f74dab..e6f501e6 100644
--- a/public/css/module.less
+++ b/public/css/module.less
@@ -427,6 +427,13 @@ table.deployment-log {
content: '\e803';
}
+ tr.pending td:first-child::before {
+ color: @gray;
+ // icon-spinner
+ content: '\e874';
+ .animate(spin 2s infinite linear);
+ }
+
tr.failed td:first-child::before {
// icon-ok
color: @color-critical;