diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml
index 6093adb35..fb3408f16 100644
--- a/modules/monitoring/application/views/scripts/list/comments.phtml
+++ b/modules/monitoring/application/views/scripts/list/comments.phtml
@@ -1,9 +1,3 @@
-getHelper('CommandForm');
-
-?>
-
compact): ?>
= $this->tabs->render($this); ?>
@@ -56,7 +50,7 @@ $helper = $this->getHelper('CommandForm');
objecttype === 'service'): ?>
- = $this->icon('service.png'); ?> href('monitoring/service/show', array(
'host' => $comment->host,
'service' => $comment->service,
)); ?>">
@@ -66,7 +60,7 @@ $helper = $this->getHelper('CommandForm');
= $this->translate('on') . ' ' . $comment->host; ?>
- = $this->icon('host.png'); ?> href('monitoring/host/show', array(
'host' => $comment->host
)); ?>">
= $comment->host; ?>
@@ -89,23 +83,17 @@ $helper = $this->getHelper('CommandForm');
date('H:i', $comment->expiration)
) : $this->translate('This comment does not expire.'); ?>
|
- $comment->id,
- 'host' => $comment->host
- );
- if ($comment->objecttype === 'service') {
- $data['service'] = $comment->service;
- }
- ?>
- = $helper->labelSubmitForm(
- 'X',
- $this->translate('Remove Comment'),
- 'link-like',
- 'removecomment',
- $data
- ); ?>
+ populate(array('comment_id' => $comment->id, 'redirect' => $this->url));
+ if ($comment->objecttype === 'host') {
+ $delCommentForm->setAction($this->url('monitoring/host/remove-comment', array('host' => $comment->host)));
+ } else {
+ $delCommentForm->setAction($this->url('monitoring/service/remove-comment', array('host' => $comment->host, 'service' => $comment->service)));
+ }
+ echo $delCommentForm;
+ ?>
|
diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml
index babb76074..956427b77 100644
--- a/modules/monitoring/application/views/scripts/list/downtimes.phtml
+++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml
@@ -1,7 +1,3 @@
-getHelper('CommandForm');
-?>
-
compact): ?>
= $this->tabs->render($this); ?>
@@ -37,7 +33,7 @@ $helper = $this->getHelper('CommandForm');
service)): ?>
- href('monitoring/service/show', array(
'host' => $downtime->host,
'service' => $downtime->service
)); ?>">
@@ -47,7 +43,7 @@ $helper = $this->getHelper('CommandForm');
= $this->translate('on'); ?> = $downtime->host; ?>
- href('monitoring/host/show', array(
'host' => $downtime->host
)); ?>">
= $downtime->host; ?>
@@ -96,23 +92,17 @@ $helper = $this->getHelper('CommandForm');
|
- $downtime->id,
- 'host' => $downtime->host
- );
- if (isset($downtime->service)) {
- $data['service'] = $downtime->service;
- }
- ?>
- = $helper->labelSubmitForm(
- 'X',
- 'Remove Downtime',
- 'link-like',
- 'removedowntime',
- $data
- ); ?>
+ populate(array('downtime_id' => $downtime->id, 'redirect' => $this->url));
+ if (! isset($downtime->service)) {
+ $delDowntimeForm->setAction($this->url('monitoring/host/delete-downtime', array('host' => $downtime->host)));
+ } else {
+ $delDowntimeForm->setAction($this->url('monitoring/service/delete-downtime', array('host' => $downtime->host, 'service' => $downtime->service)));
+ }
+ echo $delDowntimeForm;
+ ?>
|
diff --git a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php
index 4ad204e5c..ae257e9f1 100644
--- a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php
+++ b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php
@@ -119,4 +119,33 @@ abstract class MonitoredObjectController extends Controller
* Schedule a downtime
*/
abstract public function scheduleDowntimeAction();
+
+
+ /**
+ * Remove a comment
+ */
+ public function removeCommentAction()
+ {
+ /*
+ * TODO(el): This is here because monitoring/list/comments has buttons to remove comments. Because of the nature
+ * of an action, the form is accessible via GET which does not make much sense because the form requires
+ * us to populate the ID of the comment which is to be deleted. We may introduce a combo box for choosing
+ * the comment ID on GET or deny GET access.
+ */
+ $this->handleCommandForm(new DeleteCommentCommandForm());
+ }
+
+ /**
+ * Remove a downtime
+ */
+ public function deleteDowntimeAction()
+ {
+ /*
+ * TODO(el): This is here because monitoring/list/downtimes has buttons to remove comments. Because of the
+ * nature of an action, the form is accessible via GET which does not make much sense because the form requires
+ * us to populate the ID of the downtime which is to be deleted. We may introduce a combo box for choosing
+ * the downtime ID on GET or deny GET access.
+ */
+ $this->handleCommandForm(new DeleteDowntimeCommandForm());
+ }
}