commit
ff58d1b675
|
@ -599,6 +599,14 @@ class Form extends Zend_Form
|
||||||
{
|
{
|
||||||
parent::addElement($element, $name, $options);
|
parent::addElement($element, $name, $options);
|
||||||
$el = $name ? $this->getElement($name) : $element;
|
$el = $name ? $this->getElement($name) : $element;
|
||||||
|
|
||||||
|
// Do not add structural elements to invisible elements
|
||||||
|
// which produces ugly views
|
||||||
|
if (strpos(strtolower(get_class($el)), 'hidden') !== false) {
|
||||||
|
$el->setDecorators(array('ViewHelper'));
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
if ($el) {
|
if ($el) {
|
||||||
$el->removeDecorator('HtmlTag');
|
$el->removeDecorator('HtmlTag');
|
||||||
$el->removeDecorator('Label');
|
$el->removeDecorator('Label');
|
||||||
|
|
|
@ -88,7 +88,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
|
|
||||||
$cfg = $this->getConfiguration();
|
$cfg = $this->getConfiguration();
|
||||||
$preferences = $this->getUserPreferences();
|
$preferences = $this->getUserPreferences();
|
||||||
$downtimes = Backend::getInstance($this->getRequest()->getParam('backend'))->select()
|
$downtimes = Backend::createBackend($this->getRequest()->getParam('backend'))->select()
|
||||||
->from(
|
->from(
|
||||||
'downtime',
|
'downtime',
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
use Icinga\Application\Icinga;
|
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,29 +15,102 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
|
||||||
* Creates a simple form without additional input fields
|
* Creates a simple form without additional input fields
|
||||||
*
|
*
|
||||||
* @param string $commandName Name of command (icinga 2 web name)
|
* @param string $commandName Name of command (icinga 2 web name)
|
||||||
* @param string $submitLabel Label of submit button
|
|
||||||
* @param array $arguments Add parameter as hidden fields
|
* @param array $arguments Add parameter as hidden fields
|
||||||
*
|
*
|
||||||
* @return string Html form content
|
* @return Form Form to modify
|
||||||
*/
|
*/
|
||||||
public function simpleForm($commandName, $submitLabel, array $arguments = array())
|
private function simpleForm($commandName, array $arguments = array())
|
||||||
{
|
{
|
||||||
$form = new Form();
|
$form = new Form();
|
||||||
|
|
||||||
$form->setIgnoreChangeDiscarding(true);
|
$form->setIgnoreChangeDiscarding(true);
|
||||||
$form->setAttrib('data-icinga-component', 'app/ajaxPostSubmitForm');
|
$form->setAttrib('data-icinga-component', 'app/ajaxPostSubmitForm');
|
||||||
|
|
||||||
$form->setRequest(Zend_Controller_Front::getInstance()->getRequest());
|
$form->setRequest(Zend_Controller_Front::getInstance()->getRequest());
|
||||||
$form->setSubmitLabel($submitLabel !== null ? $submitLabel : 'Submit');
|
|
||||||
$form->setAction($this->view->href('monitoring/command/' . $commandName));
|
$form->setAction($this->view->href('monitoring/command/' . $commandName));
|
||||||
|
|
||||||
foreach ($arguments as $elementName => $elementValue) {
|
foreach ($arguments as $elementName => $elementValue) {
|
||||||
$hiddenField = new Zend_Form_Element_Hidden($elementName);
|
$hiddenField = new Zend_Form_Element_Hidden($elementName);
|
||||||
$hiddenField->setValue($elementValue);
|
$hiddenField->setValue($elementValue);
|
||||||
$form->addElement($hiddenField);
|
$form->addElement($hiddenField);
|
||||||
|
|
||||||
|
$hiddenField = $form->getElement($elementName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $form->render();
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an iconized submit form
|
||||||
|
*
|
||||||
|
* @param string $iconCls Css class of icon
|
||||||
|
* @param string $submitTitle Title of submit button
|
||||||
|
* @param string $cls Css class names
|
||||||
|
* @param string $commandName Name of command
|
||||||
|
* @param array $arguments Additional arguments
|
||||||
|
*
|
||||||
|
* @return Form
|
||||||
|
*/
|
||||||
|
public function iconSubmitForm($iconCls, $submitTitle, $cls, $commandName, array $arguments = array())
|
||||||
|
{
|
||||||
|
$form = $this->labelSubmitForm('', $submitTitle, $cls, $commandName, $arguments);
|
||||||
|
$submit = $form->getElement('btn_submit');
|
||||||
|
$submit->setLabel(sprintf('<i class="%s"></i>', $iconCls));
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a simple for with a labeled submit button
|
||||||
|
*
|
||||||
|
* @param string $submitLabel Label of submit button
|
||||||
|
* @param string $submitTitle Title of submit button
|
||||||
|
* @param string $cls Css class names
|
||||||
|
* @param string $commandName Name of command
|
||||||
|
* @param array $arguments Additional arguments
|
||||||
|
*
|
||||||
|
* @return Form
|
||||||
|
*/
|
||||||
|
public function labelSubmitForm($submitLabel, $submitTitle, $cls, $commandName, array $arguments = array())
|
||||||
|
{
|
||||||
|
$form = $this->simpleForm($commandName, $arguments);
|
||||||
|
|
||||||
|
$button = new Zend_Form_Element_Button(
|
||||||
|
array(
|
||||||
|
'name' => 'btn_submit',
|
||||||
|
'class' => $this->mergeClass('button btn-common', $cls),
|
||||||
|
'escape' => false,
|
||||||
|
'value' => '1',
|
||||||
|
'type' => 'submit',
|
||||||
|
'label' => $submitLabel,
|
||||||
|
'title' => $submitTitle
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$form->addElement($button);
|
||||||
|
|
||||||
|
// Because of implicit added decorators
|
||||||
|
$form->getElement('btn_submit')->setDecorators(array('ViewHelper'));
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merges css class names together
|
||||||
|
*
|
||||||
|
* @param string $base
|
||||||
|
* @param string $additional
|
||||||
|
* @param string ...
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function mergeClass($base, $additional)
|
||||||
|
{
|
||||||
|
$args = func_get_args();
|
||||||
|
$base = explode(' ', array_shift($args));
|
||||||
|
while (($additional = array_shift($args))) {
|
||||||
|
$base = array_merge($base, explode(' ', $additional));
|
||||||
|
}
|
||||||
|
return implode(' ', $base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$dateHelper = $this->getHelper('DateFormat');
|
$dateHelper = $this->getHelper('DateFormat');
|
||||||
|
|
||||||
|
/** @var Zend_View_Helper_CommandForm $commandHelper */
|
||||||
$commandHelper = $this->getHelper('CommandForm');
|
$commandHelper = $this->getHelper('CommandForm');
|
||||||
?>
|
?>
|
||||||
<?= $this->tabs->render($this); ?>
|
<?= $this->tabs->render($this); ?>
|
||||||
|
@ -114,10 +116,12 @@ $viewHelper = $this->getHelper('MonitoringState');
|
||||||
$data['service'] = $comment->service_name;
|
$data['service'] = $comment->service_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $commandHelper->simpleForm(
|
echo $commandHelper->iconSubmitForm(
|
||||||
'removecomment',
|
'icinga-icon-remove',
|
||||||
'Remove Comment',
|
'Remove comment',
|
||||||
$data
|
'btn-small',
|
||||||
|
'removecomment',
|
||||||
|
$data
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
<div class="panel panel-default">
|
<div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
{{CHECK_COMMAND_ICON}}
|
<div class="panel-hostname">
|
||||||
<span>Check Command</span>
|
Check Command
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class="separator" />
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<?php
|
||||||
|
/** @var Zend_View_Helper_CommandForm $cf */
|
||||||
|
$cf = $this->getHelper('CommandForm');
|
||||||
|
?>
|
||||||
<div>
|
<div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="panel-hostname">
|
<div class="panel-hostname">
|
||||||
|
@ -32,9 +36,28 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<table class="table table-condensed table-detail">
|
<table class="table table-condensed table-detail">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<?php if (empty($object->comments)): ?>
|
||||||
|
<tr>
|
||||||
|
<td>No comments</td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
<?php foreach ($object->comments as $comment): ?>
|
<?php foreach ($object->comments as $comment): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
<div class="pull-right">
|
||||||
|
<?php
|
||||||
|
$deleteData = $data;
|
||||||
|
$deleteData['commentid'] = $comment->comment_internal_id;
|
||||||
|
|
||||||
|
echo $cf->iconSubmitForm(
|
||||||
|
'icinga-icon-remove',
|
||||||
|
'Remove comment',
|
||||||
|
'btn-small',
|
||||||
|
'removecomment',
|
||||||
|
$deleteData
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
<?= $this->escape($comment->comment_author); ?>, <?= $comment->comment_type; ?>
|
<?= $this->escape($comment->comment_author); ?>, <?= $comment->comment_type; ?>
|
||||||
(<?= $this->format()->timeSince($comment->comment_timestamp); ?>)
|
(<?= $this->format()->timeSince($comment->comment_timestamp); ?>)
|
||||||
<div class="small-row">
|
<div class="small-row">
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<?php if (!empty($object->contacts)): ?>
|
|
||||||
<?php
|
<?php
|
||||||
$contacts = array();
|
$contacts = array();
|
||||||
foreach ($object->contacts as $contact) {
|
foreach ($object->contacts as $contact) {
|
||||||
|
@ -14,17 +13,24 @@ foreach ($object->contacts as $contact) {
|
||||||
. '</a>';
|
. '</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="panel panel-default">
|
<div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
{{CONTACT_ICON}} <span>Contacts</span>
|
<div class="panel-hostname">
|
||||||
|
Contacts
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class="separator" />
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?= implode(', ', $contacts); ?>
|
<?php if (!count($contacts)): ?>
|
||||||
|
No Contacts
|
||||||
|
<?php else: ?>
|
||||||
|
<?= implode(', ', $contacts); ?>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (!empty($object->contactgroups)): ?>
|
|
||||||
<?php
|
<?php
|
||||||
$contactgroups = array();
|
$contactgroups = array();
|
||||||
foreach ($object->contactgroups as $contactgroup) {
|
foreach ($object->contactgroups as $contactgroup) {
|
||||||
|
@ -40,12 +46,20 @@ foreach ($object->contactgroups as $contactgroup) {
|
||||||
. '</a>';
|
. '</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="panel panel-default">
|
<div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
{{CONTACTGROUP_ICON}} <span>Contactgroups</span>
|
<div class="panel-hostname">
|
||||||
|
Contactgroups
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class="separator" />
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?= implode(', ', $contactgroups); ?>
|
<?php if (!count($contactgroups)): ?>
|
||||||
|
No Contactgroups
|
||||||
|
<?php else: ?>
|
||||||
|
<?= implode(', ', $contactgroups); ?>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
|
<div>
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<span>Customvariables</span>
|
<div class="panel-hostname">
|
||||||
|
Custom Variables
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class="separator" />
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?php if (isset($object->customvars) && count($object->customvars)) { ?>
|
<?php if (empty($this->object->customvars)): ?>
|
||||||
<table>
|
No customvars
|
||||||
<tr>
|
<?php else: ?>
|
||||||
<th>Name</th>
|
<dl class="dl-horizontal">
|
||||||
<th>Value</th>
|
<?php foreach ($this->object->customvars as $varname => $varvalue): ?>
|
||||||
</tr>
|
<dt><?= $varname; ?></dt>
|
||||||
<?php foreach ($object->customvars as $name => $value) { ?>
|
<dd><?= $varvalue; ?></dd>
|
||||||
<tr>
|
<?php endforeach; ?>
|
||||||
<td><?= $this->escape($name) ?></td>
|
</dl>
|
||||||
<td><?= $this->escape($value) ?></td>
|
<?php endif; ?>
|
||||||
</tr>
|
|
||||||
<?php } ?>
|
|
||||||
</table>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -28,20 +28,69 @@
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="panel panel-default">
|
<div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
{{IN_DOWNTIME_ICON}}<span>Downtimes</span>
|
<div class="panel-hostname">
|
||||||
|
|
||||||
|
<div class="pull-right">
|
||||||
|
<?php
|
||||||
|
$scheduleDowntimeData = array(
|
||||||
|
'host' => $this->object->host_name,
|
||||||
|
'service' => $this->object->service_description
|
||||||
|
);
|
||||||
|
|
||||||
|
$scheduleDowntimeHref = $this->href('monitoring/command/scheduleDowntime', $scheduleDowntimeData);
|
||||||
|
?>
|
||||||
|
<a href="<?= $scheduleDowntimeHref; ?>" class="btn-common btn-small button" title="Schedule downtime">
|
||||||
|
<i class="icinga-icon-in-downtime"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
Downtimes
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="separator" />
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<a href="#" class="button">{{SCHEDULE_DOWNTIME_COMMAND_BUTTON}}</a><br/>
|
<table class="table table-condensed table-detail">
|
||||||
<?php if (!empty($this->downtimes)): ?>
|
<tbody>
|
||||||
<table>
|
<?php if (empty($this->object->downtimes)): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<?= implode('</tr><tr>', $list); ?>
|
<td>No Downtimes</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($this->object->downtimes as $downtime): ?>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="pull-right">
|
||||||
|
<form action="<?= $this->href('monitoring/command/removeDowntime'); ?>" data-icinga-component="app/ajaxPostSubmitForm">
|
||||||
|
<button type="submit" class="button btn-common btn-small" name="btn_submit" value="1">
|
||||||
|
<i class="icinga-icon-remove"></i>
|
||||||
|
</button>
|
||||||
|
<input type="hidden" name="host" value="<?= $downtime->host_name; ?>" />
|
||||||
|
<input type="hidden" name="service" value="<?= $downtime->service_description; ?>" />
|
||||||
|
<input type="hidden" name="downtimeid" value="<?= $downtime->downtime_internal_downtime_id; ?>" />
|
||||||
|
<input type="hidden" name="CSRFToken" value="" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php if ($downtime->downtime_is_in_effect === '1'): ?>
|
||||||
|
Running since <?= $this->timeSince($downtime->downtime_actual_start_time); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php if ($downtime->downtime_is_fixed): ?>
|
||||||
|
Scheduled for <?= $downtime->downtime_scheduled_start_time; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
Waiting
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
Triggered by <?= $downtime->downtime_author_name; ?>
|
||||||
|
|
||||||
|
<div class="small-row">
|
||||||
|
<?= $downtime->downtime_comment_data; ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<?php else: ?>
|
|
||||||
Not in downtime
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,22 +1,55 @@
|
||||||
<div class="panel panel-default">
|
<?php
|
||||||
<div class="panel-heading">Heading</div>
|
$o = $this->object;
|
||||||
|
|
||||||
|
/** @var Zend_View_Helper_CommandForm $cf */
|
||||||
|
$cf = $this->getHelper('CommandForm');
|
||||||
|
?>
|
||||||
|
<div>
|
||||||
|
<div class="panel-heading">
|
||||||
|
<div class="panel-hostname">
|
||||||
|
Configuration
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class="separator" />
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed table-detail">
|
||||||
<?php foreach ($this->monitoringFlags($object) as $flag => $enabled): ?>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $flag; ?></th>
|
<td>Passive Checks</td>
|
||||||
<td>
|
<td><div class="icon-table-hint icon-edit pull-left"></div></td>
|
||||||
<?php if ($enabled === true): ?>
|
<td>
|
||||||
<span>{{ENABLED_ICON}} ENABLED</span>
|
<input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->passive_checks_enabled === '1') ? 'checked="true"' : '' ?> />
|
||||||
<?php else: ?>
|
</td>
|
||||||
<span>{{DISABLED_ICON}} DISABLED</span>
|
</tr>
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
<tr>
|
||||||
<td>
|
<td>Active Checks</td>
|
||||||
<a class="button" href="#">{{{ENABLE_OR_DISABLE_COMMAND}}}</a>
|
<td></td>
|
||||||
</td>
|
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->active_checks_enabled === '1') ? 'checked="true"' : '' ?> /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<tr>
|
||||||
|
<td>Obsessing</td>
|
||||||
|
<td></td>
|
||||||
|
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->obsessing === '1') ? 'checked="true"' : '' ?> /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Notifications</td>
|
||||||
|
<td></td>
|
||||||
|
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->notifications_enabled === '1') ? 'checked="true"' : '' ?> /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Event Handler</td>
|
||||||
|
<td></div></td>
|
||||||
|
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->event_handler_enabled === '1') ? 'checked="true"' : '' ?> /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Flap Detection</td>
|
||||||
|
<td></td>
|
||||||
|
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->flap_detection_enabled === '1') ? 'checked="true"' : '' ?> /></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<?php if (!empty($object->hostgroups)): ?>
|
|
||||||
<?php
|
<?php
|
||||||
$hostgroups = array();
|
$hostgroups = array();
|
||||||
foreach ($object->hostgroups as $name => $alias) {
|
foreach ($object->hostgroups as $name => $alias) {
|
||||||
|
@ -7,12 +6,20 @@ foreach ($object->hostgroups as $name => $alias) {
|
||||||
. '</a>';
|
. '</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="panel panel-default">
|
<div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
{{HOSTGROUP_ICON}} <span>Hostgroups</span>
|
<div class="panel-hostname">
|
||||||
|
Hostgroups
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class="separator" />
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?= implode(', ', $hostgroups); ?>
|
<?php if (!count($hostgroups)): ?>
|
||||||
|
No Hostgroups
|
||||||
|
<?php else: ?>
|
||||||
|
<?= implode(', ', $hostgroups); ?>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
|
@ -1,93 +1,22 @@
|
||||||
<div class="panel panel-default">
|
<div>
|
||||||
<div class="panel-heading">Properties</div>
|
<div class="panel-heading">
|
||||||
<div class="panel-body">
|
<div class="panel-hostname">
|
||||||
<table class="table table-bordered">
|
Check Statistics
|
||||||
<tr>
|
</div>
|
||||||
<th>Current Attempt</th>
|
|
||||||
<td>
|
|
||||||
<?= sprintf(
|
|
||||||
'%s/%s (%s state)',
|
|
||||||
$object->current_check_attempt,
|
|
||||||
$object->max_check_attempts,
|
|
||||||
($object->state_type === '1') ? 'HARD' : 'SOFT'
|
|
||||||
); ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Check Type</th>
|
|
||||||
<td>
|
|
||||||
<?php if ($object->passive_checks_enabled === '1' && $object->active_checks_enabled === '0'): ?>
|
|
||||||
PASSIVE
|
|
||||||
<?php elseif ($object->passive_checks_enabled === '0' && $object->active_checks_enabled === '0'): ?>
|
|
||||||
DISABLED
|
|
||||||
<?php else: ?>
|
|
||||||
ACTIVE
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Check Latency / Duration</th>
|
|
||||||
<td>
|
|
||||||
<?php if ($object->passive_checks_enabled === '0' && $object->active_checks_enabled === '0'): ?>
|
|
||||||
N/A
|
|
||||||
<?php else: ?>
|
|
||||||
<?= sprintf('%.4f', $object->check_latency); ?> / <?= sprintf('%.4f', $object->check_execution_time); ?> seconds
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Last Notification</th>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
if ($object->service_description) {
|
|
||||||
$notificationsHref = $this->href('monitoring/list/notifications',
|
|
||||||
array(
|
|
||||||
'host' => $object->host_name,
|
|
||||||
'service' => $object->service_description
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$notificationsHref = $this->href('monitoring/list/notifications',
|
|
||||||
array(
|
|
||||||
'host' => $object->host_name
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<a href="<?= $notificationsHref ?>">
|
|
||||||
<?php if ($object->last_notification === '0000-00-00 00:00:00'): ?>
|
|
||||||
N/A
|
|
||||||
<?php else: ?>
|
|
||||||
<?= $object->last_notification ?>
|
|
||||||
<?php if ($object->current_notification_number > 0): ?>
|
|
||||||
<br />
|
|
||||||
<?= $object->current_notification_number ?> notifications sent during current problem state
|
|
||||||
<?php endif ;?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Is This <?= $object->service_description ? 'Service' : 'Host' ?> Flapping?</th>
|
|
||||||
<td>
|
|
||||||
<?php if ($object->is_flapping === '1'): ?>
|
|
||||||
YES
|
|
||||||
<?php else: ?>
|
|
||||||
NO
|
|
||||||
<?php endif; ?>
|
|
||||||
<?= sprintf('%.2f', $object->percent_state_change); ?>% state change
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>In Scheduled Downtime?</th>
|
|
||||||
<td>
|
|
||||||
<?php if ($object->in_downtime === '1'): ?>
|
|
||||||
YES
|
|
||||||
<?php else: ?>
|
|
||||||
NO
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<hr class="separator" />
|
||||||
|
<div class="panel-body">
|
||||||
|
<dl class="dl-horizontal">
|
||||||
|
<dt>Latency</dt>
|
||||||
|
<dd><?= sprintf('%.2f', $this->object->check_execution_time); ?>s</dd>
|
||||||
|
<dt>Duration</dt>
|
||||||
|
<dd><?= sprintf('%.2f', $this->object->check_latency); ?>s</dd>
|
||||||
|
<dt>Attempt</dt>
|
||||||
|
<dd>
|
||||||
|
<?= $this->object->current_check_attempt; ?>/<?= $this->object->max_check_attempts; ?>
|
||||||
|
(<?= ($this->object->host_state_type === '1') ? 'Hard' : 'Soft'; ?>)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,4 +1,3 @@
|
||||||
<?php if (!empty($object->servicegroups)): ?>
|
|
||||||
<?php
|
<?php
|
||||||
$servicegroups = array();
|
$servicegroups = array();
|
||||||
foreach ($object->servicegroups as $name => $alias) {
|
foreach ($object->servicegroups as $name => $alias) {
|
||||||
|
@ -7,12 +6,20 @@ foreach ($object->servicegroups as $name => $alias) {
|
||||||
. '</a>';
|
. '</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="panel panel-default">
|
<div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
{{SERVICEGROUP_ICON}} <span>Servicegroups</span>
|
<div class="panel-hostname">
|
||||||
|
Servicegroups
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class="separator" />
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?= implode(', ', $servicegroups); ?>
|
<?php if (!count($servicegroups)): ?>
|
||||||
|
No Servicegroups
|
||||||
|
<?php else: ?>
|
||||||
|
<?= implode(', ', $servicegroups); ?>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
$object = $this->object;
|
$object = $this->object;
|
||||||
$type = (isset($object->service_description) === true) ? 'service' : 'host';
|
$type = (isset($object->service_description) === true) ? 'service' : 'host';
|
||||||
|
|
||||||
|
/** @var Zend_View_Helper_CommandForm $cf */
|
||||||
|
$cf = $this->getHelper('CommandForm');
|
||||||
|
|
||||||
if ($type === 'host') {
|
if ($type === 'host') {
|
||||||
$objectStateName = strtolower($this->util()->getHostStateName($this->object->host_state));
|
$objectStateName = strtolower($this->util()->getHostStateName($this->object->host_state));
|
||||||
$objectState = (int) $object->host_state;
|
$objectState = (int) $object->host_state;
|
||||||
|
@ -72,14 +75,44 @@
|
||||||
<div class="panel-row">
|
<div class="panel-row">
|
||||||
<p><?= $this->pluginOutput($object->output); ?></p>
|
<p><?= $this->pluginOutput($object->output); ?></p>
|
||||||
|
|
||||||
<form>
|
|
||||||
|
|
||||||
<?php if ($objectState > 0): ?>
|
<?php if ($objectState > 0): ?>
|
||||||
<button type="submit" class="button btn-cta btn-half-left">Acknowledge</button>
|
<?php if ($this->object->host_acknowledged || $this->object->service_acknowledged): ?>
|
||||||
|
<?= $cf->labelSubmitForm(
|
||||||
|
'Remove Ack',
|
||||||
|
'Remove problem acknowledgement',
|
||||||
|
'btn-cta btn-half-left',
|
||||||
|
'removeacknowledgement',
|
||||||
|
array(
|
||||||
|
'host' => $this->object->host_name,
|
||||||
|
'service' => $this->object->service_description
|
||||||
|
)
|
||||||
|
) ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<a href="<?=
|
||||||
|
$this->href(
|
||||||
|
'monitoring/command/acknowledgeproblem',
|
||||||
|
array(
|
||||||
|
'host' => $this->object->host_name,
|
||||||
|
'service' => $this->object->service_description
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>" class="button btn-cta btn-half-left">
|
||||||
|
Acknowledge
|
||||||
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
<button type="submit" class="button btn-cta <?= ($objectState > 0) ? 'btn-half-right' : 'btn-wide'; ?>">Recheck</button>
|
<?= $cf->labelSubmitForm(
|
||||||
</form>
|
'Recheck',
|
||||||
|
'Reschedule next check immediately',
|
||||||
|
'btn-cta ' . (($objectState > 0) ? 'btn-half-right' : 'btn-wide'),
|
||||||
|
'reschedulenextcheck',
|
||||||
|
array(
|
||||||
|
'host' => $this->object->host_name,
|
||||||
|
'service' => $this->object->service_description,
|
||||||
|
'checktime' => time(),
|
||||||
|
'forcecheck' => '1'
|
||||||
|
)
|
||||||
|
) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel-row">
|
<div class="panel-row">
|
||||||
|
@ -123,11 +156,17 @@
|
||||||
<?= $this->dateFormat()->formatDateTime($object->next_check); ?>
|
<?= $this->dateFormat()->formatDateTime($object->next_check); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-button">
|
<div class="panel-button">
|
||||||
<form>
|
<a href="<?=
|
||||||
<button class="button btn-common btn-small">
|
$this->href(
|
||||||
<i class="icinga-icon-reschedule"></i>
|
'monitoring/command/reschedulenextcheck',
|
||||||
</button>
|
array(
|
||||||
</form>
|
'host' => $this->object->host_name,
|
||||||
|
'service' => $this->object->serivce_description
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>" class="button btn-common btn-small">
|
||||||
|
<i class="icinga-icon-reschedule"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,10 @@
|
||||||
|
<?= $this->tabs->render($this); ?>
|
||||||
<?= $this->render('show/components/status.phtml'); ?>
|
<?= $this->render('show/components/status.phtml'); ?>
|
||||||
|
<?= $this->render('show/components/comments.phtml'); ?>
|
||||||
<?= $this->render('show/components/downtime.phtml'); ?>
|
<?= $this->render('show/components/downtime.phtml'); ?>
|
||||||
|
|
||||||
<?= $this->render('show/components/properties.phtml'); ?>
|
<?= $this->render('show/components/properties.phtml'); ?>
|
||||||
|
|
||||||
<?= $this->render('show/components/flags.phtml'); ?>
|
<?= $this->render('show/components/flags.phtml'); ?>
|
||||||
|
|
||||||
<?= $this->render('show/components/hostgroups.phtml'); ?>
|
|
||||||
|
|
||||||
<?= $this->render('show/components/eventHistory.phtml'); ?>
|
|
||||||
|
|
||||||
<?= $this->render('show/components/contacts.phtml'); ?>
|
|
||||||
|
|
||||||
<?= $this->render('show/components/customvars.phtml'); ?>
|
<?= $this->render('show/components/customvars.phtml'); ?>
|
||||||
|
<?= $this->render('show/components/hostgroups.phtml'); ?>
|
||||||
<?= $this->render('show/components/command.phtml'); ?>
|
<?= $this->render('show/components/contacts.phtml'); ?>
|
||||||
|
<?= $this->render('show/components/command.phtml') ?>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<?= $this->render('show/components/status.phtml'); ?>
|
<?= $this->render('show/components/status.phtml'); ?>
|
||||||
<?= $this->render('show/components/comments.phtml'); ?>
|
<?= $this->render('show/components/comments.phtml'); ?>
|
||||||
<?= $this->render('show/components/downtime.phtml'); ?>
|
<?= $this->render('show/components/downtime.phtml'); ?>
|
||||||
|
<?= $this->render('show/components/properties.phtml'); ?>
|
||||||
<?= $this->render('show/components/flags.phtml'); ?>
|
<?= $this->render('show/components/flags.phtml'); ?>
|
||||||
<?= $this->render('show/components/customvars.phtml'); ?>
|
<?= $this->render('show/components/customvars.phtml'); ?>
|
||||||
<?= $this->render('show/components/servicegroups.phtml'); ?>
|
<?= $this->render('show/components/servicegroups.phtml'); ?>
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
/**
|
||||||
|
* This file is part of Icinga 2 Web.
|
||||||
|
*
|
||||||
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||||
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
*
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||||
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
|
*/
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Module\Monitoring\DataView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent customvar view
|
||||||
|
*/
|
||||||
|
class Customvar extends DataView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Retrieve columns provided by this view
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getColumns()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'varname',
|
||||||
|
'varvalue',
|
||||||
|
'object_type'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve default sorting rules for particular columns. These involve sort order and potential additional to sort
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getSortRules()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'varname' => array(
|
||||||
|
'varname' => self::SORT_ASC,
|
||||||
|
'varvalue' => self::SORT_ASC,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,40 @@
|
||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
/**
|
||||||
|
* This file is part of Icinga 2 Web.
|
||||||
|
*
|
||||||
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||||
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
*
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||||
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
|
*/
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Module\Monitoring\Object;
|
namespace Icinga\Module\Monitoring\Object;
|
||||||
|
|
||||||
use Icinga\Data\AbstractQuery as Query;
|
use Icinga\Data\AbstractQuery as Query;
|
||||||
use \Icinga\Module\Monitoring\Backend;
|
use \Icinga\Module\Monitoring\Backend;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic icinga object with belongings
|
||||||
|
*/
|
||||||
abstract class AbstractObject
|
abstract class AbstractObject
|
||||||
{
|
{
|
||||||
protected $backend;
|
protected $backend;
|
||||||
|
@ -17,14 +47,7 @@ abstract class AbstractObject
|
||||||
|
|
||||||
protected $properties;
|
protected $properties;
|
||||||
|
|
||||||
protected $foreign = array(
|
protected $foreign = array();
|
||||||
// 'hostgroups' => null,
|
|
||||||
// 'contacts' => null,
|
|
||||||
// 'contactgroups' => null,
|
|
||||||
// 'servicegroups' => null,
|
|
||||||
// 'customvars' => null,
|
|
||||||
// 'comments' => null,
|
|
||||||
);
|
|
||||||
|
|
||||||
public function __construct(Backend $backend, $name1, $name2 = null)
|
public function __construct(Backend $backend, $name1, $name2 = null)
|
||||||
{
|
{
|
||||||
|
@ -81,10 +104,13 @@ abstract class AbstractObject
|
||||||
protected function fetchHostgroups()
|
protected function fetchHostgroups()
|
||||||
{
|
{
|
||||||
$this->foreign['hostgroups'] = $this->applyObjectFilter(
|
$this->foreign['hostgroups'] = $this->applyObjectFilter(
|
||||||
$this->backend->select()->from('hostgroup', array(
|
$this->backend->select()->from(
|
||||||
'hostgroup_name',
|
'hostgroup',
|
||||||
'hostgroup_alias'
|
array(
|
||||||
))
|
'hostgroup_name',
|
||||||
|
'hostgroup_alias'
|
||||||
|
)
|
||||||
|
)
|
||||||
)->fetchPairs();
|
)->fetchPairs();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -92,10 +118,13 @@ abstract class AbstractObject
|
||||||
protected function fetchServicegroups()
|
protected function fetchServicegroups()
|
||||||
{
|
{
|
||||||
$this->foreign['servicegroups'] = $this->applyObjectFilter(
|
$this->foreign['servicegroups'] = $this->applyObjectFilter(
|
||||||
$this->backend->select()->from('servicegroup', array(
|
$this->backend->select()->from(
|
||||||
'servicegroup_name',
|
'servicegroup',
|
||||||
'servicegroup_alias'
|
array(
|
||||||
))
|
'servicegroup_name',
|
||||||
|
'servicegroup_alias'
|
||||||
|
)
|
||||||
|
)
|
||||||
)->fetchPairs();
|
)->fetchPairs();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -103,12 +132,15 @@ abstract class AbstractObject
|
||||||
protected function fetchContacts()
|
protected function fetchContacts()
|
||||||
{
|
{
|
||||||
$this->foreign['contacts'] = $this->applyObjectFilter(
|
$this->foreign['contacts'] = $this->applyObjectFilter(
|
||||||
$this->backend->select()->from('contact', array(
|
$this->backend->select()->from(
|
||||||
'contact_name',
|
'contact',
|
||||||
'contact_alias',
|
array(
|
||||||
'contact_email',
|
'contact_name',
|
||||||
'contact_pager',
|
'contact_alias',
|
||||||
))
|
'contact_email',
|
||||||
|
'contact_pager',
|
||||||
|
)
|
||||||
|
)
|
||||||
)->fetchAll();
|
)->fetchAll();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -116,10 +148,13 @@ abstract class AbstractObject
|
||||||
protected function fetchContactgroups()
|
protected function fetchContactgroups()
|
||||||
{
|
{
|
||||||
$this->foreign['contactgroups'] = $this->applyObjectFilter(
|
$this->foreign['contactgroups'] = $this->applyObjectFilter(
|
||||||
$this->backend->select()->from('contactgroup', array(
|
$this->backend->select()->from(
|
||||||
'contactgroup_name',
|
'contactgroup',
|
||||||
'contactgroup_alias',
|
array(
|
||||||
))
|
'contactgroup_name',
|
||||||
|
'contactgroup_alias',
|
||||||
|
)
|
||||||
|
)
|
||||||
)->fetchAll();
|
)->fetchAll();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -127,12 +162,16 @@ abstract class AbstractObject
|
||||||
protected function fetchComments()
|
protected function fetchComments()
|
||||||
{
|
{
|
||||||
$this->foreign['comments'] = $this->applyObjectFilter(
|
$this->foreign['comments'] = $this->applyObjectFilter(
|
||||||
$this->backend->select()->from('comment', array(
|
$this->backend->select()->from(
|
||||||
'comment_timestamp',
|
'comment',
|
||||||
'comment_author',
|
array(
|
||||||
'comment_data',
|
'comment_timestamp',
|
||||||
'comment_type',
|
'comment_author',
|
||||||
))->where('comment_objecttype_id', $this->type)
|
'comment_data',
|
||||||
|
'comment_type',
|
||||||
|
'comment_internal_id'
|
||||||
|
)
|
||||||
|
)->where('comment_objecttype_id', $this->type)
|
||||||
)->fetchAll();
|
)->fetchAll();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -140,12 +179,13 @@ abstract class AbstractObject
|
||||||
protected function fetchCustomvars()
|
protected function fetchCustomvars()
|
||||||
{
|
{
|
||||||
$this->foreign['customvars'] = $this->applyObjectFilter(
|
$this->foreign['customvars'] = $this->applyObjectFilter(
|
||||||
$this->backend->select()->from('customvar', array(
|
$this->backend->select()->from(
|
||||||
'varname',
|
'customvar',
|
||||||
'varvalue'
|
array(
|
||||||
))
|
'varname',
|
||||||
->where('varname', '-*PW*,-*PASS*,-*COMMUNITY*')
|
'varvalue'
|
||||||
->where('object_type', 'host')
|
)
|
||||||
|
)->where('varname', '-*PW*,-*PASS*,-*COMMUNITY*')
|
||||||
)->fetchPairs();
|
)->fetchPairs();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -153,18 +193,52 @@ abstract class AbstractObject
|
||||||
public function fetchEventHistory()
|
public function fetchEventHistory()
|
||||||
{
|
{
|
||||||
$this->foreign['eventHistory'] = $this->applyObjectFilter(
|
$this->foreign['eventHistory'] = $this->applyObjectFilter(
|
||||||
$this->backend->select()->from('eventHistory', array(
|
$this->backend->select()->from(
|
||||||
'object_type',
|
'eventHistory',
|
||||||
'host_name',
|
array(
|
||||||
'service_description',
|
'object_type',
|
||||||
'timestamp',
|
'host_name',
|
||||||
'state',
|
'service_description',
|
||||||
'attempt',
|
'timestamp',
|
||||||
'max_attempts',
|
'state',
|
||||||
'output',
|
'attempt',
|
||||||
'type'
|
'max_attempts',
|
||||||
))
|
'output',
|
||||||
|
'type'
|
||||||
|
)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function fetchDowtimes()
|
||||||
|
{
|
||||||
|
$this->foreign['downtimes'] = $this->applyObjectFilter(
|
||||||
|
$this->backend->select()->from(
|
||||||
|
'downtime',
|
||||||
|
array(
|
||||||
|
'host_name',
|
||||||
|
'object_type',
|
||||||
|
'service_host_name',
|
||||||
|
'service_description',
|
||||||
|
'downtime_type',
|
||||||
|
'downtime_author_name',
|
||||||
|
'downtime_comment_data',
|
||||||
|
'downtime_is_fixed',
|
||||||
|
'downtime_duration',
|
||||||
|
'downtime_entry_time',
|
||||||
|
'downtime_scheduled_start_time',
|
||||||
|
'downtime_scheduled_end_time',
|
||||||
|
'downtime_was_started',
|
||||||
|
'downtime_actual_start_time',
|
||||||
|
'downtime_actual_start_time_usec',
|
||||||
|
'downtime_is_in_effect',
|
||||||
|
'downtime_trigger_time',
|
||||||
|
'downtime_triggered_by_id',
|
||||||
|
'downtime_internal_downtime_id'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)->fetchAll(9);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,39 @@
|
||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
/**
|
||||||
|
* This file is part of Icinga 2 Web.
|
||||||
|
*
|
||||||
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||||
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
*
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||||
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
|
*/
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Module\Monitoring\Object;
|
namespace Icinga\Module\Monitoring\Object;
|
||||||
|
|
||||||
use Icinga\Data\AbstractQuery as Query;
|
use Icinga\Data\AbstractQuery as Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent a host object
|
||||||
|
*/
|
||||||
class Host extends AbstractObject
|
class Host extends AbstractObject
|
||||||
{
|
{
|
||||||
protected $foreign = array(
|
protected $foreign = array(
|
||||||
|
@ -12,65 +42,92 @@ class Host extends AbstractObject
|
||||||
'contactgroups' => null,
|
'contactgroups' => null,
|
||||||
'customvars' => null,
|
'customvars' => null,
|
||||||
'comments' => null,
|
'comments' => null,
|
||||||
|
'downtimes' => null,
|
||||||
|
'customvars' => null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Statename
|
||||||
|
*/
|
||||||
public function stateName()
|
public function stateName()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter object belongings
|
||||||
|
*
|
||||||
|
* @param Query $query
|
||||||
|
*
|
||||||
|
* @return Query
|
||||||
|
*/
|
||||||
protected function applyObjectFilter(Query $query)
|
protected function applyObjectFilter(Query $query)
|
||||||
{
|
{
|
||||||
return $query->where('host_name', $this->name1);
|
return $query->where('host_name', $this->name1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load foreign object data
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
public function prefetch()
|
public function prefetch()
|
||||||
{
|
{
|
||||||
return $this->fetchHostgroups()
|
return $this->fetchHostgroups()
|
||||||
->fetchContacts()
|
->fetchContacts()
|
||||||
->fetchContactgroups()
|
->fetchContactgroups()
|
||||||
->fetchCustomvars()
|
->fetchCustomvars()
|
||||||
->fetchComments();
|
->fetchComments()
|
||||||
|
->fetchDowtimes()
|
||||||
|
->fetchCustomvars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object data
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
protected function fetchObject()
|
protected function fetchObject()
|
||||||
{
|
{
|
||||||
return $this->backend->select()->from('status', array(
|
return $this->backend->select()->from(
|
||||||
'host_name',
|
'status',
|
||||||
'host_alias',
|
array(
|
||||||
'host_address',
|
'host_name',
|
||||||
'host_state',
|
'host_alias',
|
||||||
'host_handled',
|
'host_address',
|
||||||
'in_downtime' => 'host_in_downtime',
|
'host_state',
|
||||||
'host_acknowledged',
|
'host_handled',
|
||||||
'host_last_state_change',
|
'host_in_downtime',
|
||||||
'last_state_change' => 'host_last_state_change',
|
'in_downtime' => 'host_in_downtime',
|
||||||
'last_notification' => 'host_last_notification',
|
'host_acknowledged',
|
||||||
'last_check' => 'host_last_check',
|
'host_last_state_change',
|
||||||
'next_check' => 'host_next_check',
|
'last_state_change' => 'host_last_state_change',
|
||||||
'check_execution_time' => 'host_check_execution_time',
|
'last_notification' => 'host_last_notification',
|
||||||
'check_latency' => 'host_check_latency',
|
'last_check' => 'host_last_check',
|
||||||
'output' => 'host_output',
|
'next_check' => 'host_next_check',
|
||||||
'long_output' => 'host_long_output',
|
'check_execution_time' => 'host_check_execution_time',
|
||||||
'check_command' => 'host_check_command',
|
'check_latency' => 'host_check_latency',
|
||||||
'perfdata' => 'host_perfdata',
|
'output' => 'host_output',
|
||||||
'host_icon_image',
|
'long_output' => 'host_long_output',
|
||||||
'passive_checks_enabled' => 'host_passive_checks_enabled',
|
'check_command' => 'host_check_command',
|
||||||
'obsessing' => 'host_obsessing',
|
'perfdata' => 'host_perfdata',
|
||||||
'notifications_enabled' => 'host_notifications_enabled',
|
'host_icon_image',
|
||||||
'event_handler_enabled' => 'host_event_handler_enabled',
|
'passive_checks_enabled' => 'host_passive_checks_enabled',
|
||||||
'flap_detection_enabled' => 'host_flap_detection_enabled',
|
'obsessing' => 'host_obsessing',
|
||||||
'active_checks_enabled' => 'host_active_checks_enabled',
|
'notifications_enabled' => 'host_notifications_enabled',
|
||||||
'current_check_attempt' => 'host_current_check_attempt',
|
'event_handler_enabled' => 'host_event_handler_enabled',
|
||||||
'max_check_attempts' => 'host_max_check_attempts',
|
'flap_detection_enabled' => 'host_flap_detection_enabled',
|
||||||
'last_notification' => 'host_last_notification',
|
'active_checks_enabled' => 'host_active_checks_enabled',
|
||||||
'current_notification_number' => 'host_current_notification_number',
|
'current_check_attempt' => 'host_current_check_attempt',
|
||||||
'percent_state_change' => 'host_percent_state_change',
|
'max_check_attempts' => 'host_max_check_attempts',
|
||||||
'is_flapping' => 'host_is_flapping',
|
'last_notification' => 'host_last_notification',
|
||||||
'last_comment' => 'host_last_comment',
|
'current_notification_number' => 'host_current_notification_number',
|
||||||
'action_url' => 'host_action_url',
|
'percent_state_change' => 'host_percent_state_change',
|
||||||
'notes_url' => 'host_notes_url',
|
'is_flapping' => 'host_is_flapping',
|
||||||
'percent_state_change' => 'host_percent_state_change'
|
'last_comment' => 'host_last_comment',
|
||||||
))->where('host_name', $this->name1)->fetchRow();
|
'action_url' => 'host_action_url',
|
||||||
|
'notes_url' => 'host_notes_url',
|
||||||
|
'percent_state_change' => 'host_percent_state_change'
|
||||||
|
)
|
||||||
|
)->where('host_name', $this->name1)->fetchRow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,84 +1,146 @@
|
||||||
<?php
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
/**
|
||||||
|
* This file is part of Icinga 2 Web.
|
||||||
|
*
|
||||||
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||||
|
* Copyright (C) 2013 Icinga Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
*
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||||
|
* @author Icinga Development Team <info@icinga.org>
|
||||||
|
*/
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Module\Monitoring\Object;
|
namespace Icinga\Module\Monitoring\Object;
|
||||||
|
|
||||||
use Icinga\Data\AbstractQuery as Query;
|
use Icinga\Data\AbstractQuery as Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent a single service
|
||||||
|
*/
|
||||||
class Service extends AbstractObject
|
class Service extends AbstractObject
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Foreign references to objects
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
protected $foreign = array(
|
protected $foreign = array(
|
||||||
'servicegroups' => null,
|
'servicegroups' => null,
|
||||||
'contacts' => null,
|
'contacts' => null,
|
||||||
'contactgroups' => null,
|
'contactgroups' => null,
|
||||||
'customvars' => null,
|
'customvars' => null,
|
||||||
'comments' => null,
|
'comments' => null,
|
||||||
|
'downtimes' => null,
|
||||||
|
'customvars' => null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Statename
|
||||||
|
*/
|
||||||
public function stateName()
|
public function stateName()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter foreign object belongings
|
||||||
|
*
|
||||||
|
* @param Query $query
|
||||||
|
*
|
||||||
|
* @return Query
|
||||||
|
*/
|
||||||
protected function applyObjectFilter(Query $query)
|
protected function applyObjectFilter(Query $query)
|
||||||
{
|
{
|
||||||
return $query->where('service_host_name', $this->name1)
|
return $query->where('service_host_name', $this->name1)
|
||||||
->where('service_description', $this->name2);
|
->where('service_description', $this->name2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collect foreign data
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
public function prefetch()
|
public function prefetch()
|
||||||
{
|
{
|
||||||
return $this->fetchServicegroups()
|
return $this->fetchServicegroups()
|
||||||
->fetchContacts()
|
->fetchContacts()
|
||||||
->fetchContactgroups()
|
->fetchContactgroups()
|
||||||
->fetchCustomvars()
|
->fetchCustomvars()
|
||||||
->fetchComments();
|
->fetchComments()
|
||||||
|
->fetchDowtimes()
|
||||||
|
->fetchCustomvars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object data
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
protected function fetchObject()
|
protected function fetchObject()
|
||||||
{
|
{
|
||||||
return $this->backend->select()->from('status', array(
|
return $this->backend->select()->from(
|
||||||
'host_name',
|
'status',
|
||||||
'host_alias',
|
array(
|
||||||
'host_address',
|
'host_name',
|
||||||
'host_state',
|
'host_alias',
|
||||||
'host_handled',
|
'host_address',
|
||||||
'host_in_downtime',
|
'host_state',
|
||||||
'host_acknowledged',
|
'host_handled',
|
||||||
'host_last_state_change',
|
'host_in_downtime',
|
||||||
'service_description',
|
'host_acknowledged',
|
||||||
'service_state',
|
'host_last_state_change',
|
||||||
'service_handled',
|
'service_description',
|
||||||
'service_acknowledged',
|
'service_state',
|
||||||
'service_in_downtime',
|
'service_handled',
|
||||||
'service_last_state_change',
|
'service_acknowledged',
|
||||||
'last_check' => 'service_last_check',
|
'service_in_downtime',
|
||||||
'next_check' => 'service_next_check',
|
'service_last_state_change',
|
||||||
'check_execution_time' => 'service_check_execution_time',
|
'last_check' => 'service_last_check',
|
||||||
'check_latency' => 'service_check_latency',
|
'next_check' => 'service_next_check',
|
||||||
'output' => 'service_output',
|
'check_execution_time' => 'service_check_execution_time',
|
||||||
'long_output' => 'service_long_output',
|
'check_latency' => 'service_check_latency',
|
||||||
'check_command' => 'service_check_command',
|
'output' => 'service_output',
|
||||||
'perfdata' => 'service_perfdata',
|
'long_output' => 'service_long_output',
|
||||||
'current_check_attempt' => 'service_current_check_attempt',
|
'check_command' => 'service_check_command',
|
||||||
'max_check_attempts' => 'service_max_check_attempts',
|
'perfdata' => 'service_perfdata',
|
||||||
'state_type' => 'service_state_type',
|
'current_check_attempt' => 'service_current_check_attempt',
|
||||||
'passive_checks_enabled' => 'service_passive_checks_enabled',
|
'max_check_attempts' => 'service_max_check_attempts',
|
||||||
'last_state_change' => 'service_last_state_change',
|
'state_type' => 'service_state_type',
|
||||||
'last_notification' => 'service_last_notification',
|
'passive_checks_enabled' => 'service_passive_checks_enabled',
|
||||||
'current_notification_number' => 'service_current_notification_number',
|
'last_state_change' => 'service_last_state_change',
|
||||||
'is_flapping' => 'service_is_flapping',
|
'last_notification' => 'service_last_notification',
|
||||||
'percent_state_change' => 'service_percent_state_change',
|
'current_notification_number' => 'service_current_notification_number',
|
||||||
'in_downtime' => 'service_in_downtime',
|
'is_flapping' => 'service_is_flapping',
|
||||||
'passive_checks_enabled' => 'service_passive_checks_enabled',
|
'percent_state_change' => 'service_percent_state_change',
|
||||||
'obsessing' => 'service_obsessing',
|
'in_downtime' => 'service_in_downtime',
|
||||||
'notifications_enabled' => 'service_notifications_enabled',
|
'passive_checks_enabled' => 'service_passive_checks_enabled',
|
||||||
'event_handler_enabled' => 'service_event_handler_enabled',
|
'obsessing' => 'service_obsessing',
|
||||||
'flap_detection_enabled' => 'service_flap_detection_enabled',
|
'notifications_enabled' => 'service_notifications_enabled',
|
||||||
'active_checks_enabled' => 'service_active_checks_enabled',
|
'event_handler_enabled' => 'service_event_handler_enabled',
|
||||||
'last_comment' => 'service_last_comment',
|
'flap_detection_enabled' => 'service_flap_detection_enabled',
|
||||||
'action_url' => 'service_action_url',
|
'active_checks_enabled' => 'service_active_checks_enabled',
|
||||||
'notes_url' => 'service_notes_url'
|
'last_comment' => 'service_last_comment',
|
||||||
))
|
'action_url' => 'service_action_url',
|
||||||
|
'notes_url' => 'service_notes_url'
|
||||||
|
)
|
||||||
|
)
|
||||||
->where('host_name', $this->name1)
|
->where('host_name', $this->name1)
|
||||||
->where('service_description', $this->name2)
|
->where('service_description', $this->name2)
|
||||||
->fetchRow();
|
->fetchRow();
|
||||||
|
|
|
@ -83,6 +83,13 @@ a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.button {
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.btn-small {
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Address `outline` inconsistency between Chrome and other browsers.
|
* Address `outline` inconsistency between Chrome and other browsers.
|
||||||
*/
|
*/
|
||||||
|
@ -149,6 +156,22 @@ th {
|
||||||
border-bottom: 2px solid #ddd;
|
border-bottom: 2px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.table-detail th {
|
||||||
|
font-size: 16px;
|
||||||
|
border-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-detail thead > tr > th, .table tbody > tr > th,
|
||||||
|
.table-detail tbody > tr > td, .table tfoot > tr > td {
|
||||||
|
border-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-detail > thead {
|
||||||
|
border-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
td {
|
td {
|
||||||
padding: 8px 10px 8px 8px !important;
|
padding: 8px 10px 8px 8px !important;
|
||||||
border-bottom: 1px dotted #ddd !important;
|
border-bottom: 1px dotted #ddd !important;
|
||||||
|
@ -223,6 +246,9 @@ td {
|
||||||
Forms
|
Forms
|
||||||
========================================================================== */
|
========================================================================== */
|
||||||
|
|
||||||
|
.panel-row form {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
.form-inline .form-group {
|
.form-inline .form-group {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -242,11 +268,7 @@ label {
|
||||||
.input-sm {
|
.input-sm {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|
||||||
|
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin-right: 15px;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.form-control {
|
.form-control {
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
|
@ -418,6 +440,16 @@ select.input-sm {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-table-hint {
|
||||||
|
width: 16px;
|
||||||
|
height: 20px;
|
||||||
|
display: block;
|
||||||
|
background-position: 50% 50%;
|
||||||
|
}
|
||||||
|
.icon-table-hint:after {
|
||||||
|
content: "edited";
|
||||||
|
padding-left: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
.icon-flapping {
|
.icon-flapping {
|
||||||
background-image: url('../img/icons/flapping.png');
|
background-image: url('../img/icons/flapping.png');
|
||||||
|
|
|
@ -54,7 +54,7 @@ define(['components/app/container', 'jquery'], function(Container, $) {
|
||||||
var submitHandler = function(e) {
|
var submitHandler = function(e) {
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
var url = form.attr('action');
|
var url = form.attr('action');
|
||||||
var submit = form.find('input[type="submit"]');
|
var submit = form.find('button[type="submit"]', 'input[type="submit"]');
|
||||||
var data = form.serialize();
|
var data = form.serialize();
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -70,13 +70,13 @@ define(['components/app/container', 'jquery'], function(Container, $) {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: data,
|
data: data,
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
submit.prop('disabled', true);
|
submit.attr('disabled', true);
|
||||||
}
|
}
|
||||||
}).done(function() {
|
}).done(function() {
|
||||||
var container = getOwnerContainer(form);
|
var container = getOwnerContainer(form);
|
||||||
container.replaceDomFromUrl(container.getContainerHref());
|
container.replaceDomFromUrl(container.getContainerHref());
|
||||||
}).error(function() {
|
}).error(function() {
|
||||||
submit.removeProp('disabled');
|
submit.removeAttr('disabled');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -125,13 +125,17 @@ function(Container, $, logger, URI) {
|
||||||
var targetEl = ev.target || ev.toElement || ev.relatedTarget,
|
var targetEl = ev.target || ev.toElement || ev.relatedTarget,
|
||||||
a = $(targetEl).closest('a');
|
a = $(targetEl).closest('a');
|
||||||
|
|
||||||
|
var nodeNames = [];
|
||||||
|
nodeNames.push($(targetEl).prop('nodeName').toLowerCase());
|
||||||
|
nodeNames.push($(targetEl).parent().prop('nodeName').toLowerCase());
|
||||||
|
|
||||||
if (a.length) {
|
if (a.length) {
|
||||||
// test if the URL is on the current server, if not open it directly
|
// test if the URL is on the current server, if not open it directly
|
||||||
if (true || Container.isExternalLink(a.attr('href'))) {
|
if (true || Container.isExternalLink(a.attr('href'))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (targetEl.nodeName.toLowerCase() === 'input') {
|
} else if ($.inArray('input', nodeNames) > -1 || $.inArray('button', nodeNames) > -1) {
|
||||||
var type = $(targetEl).attr('type');
|
var type = $(targetEl).attr('type') || $(targetEl).parent().attr('type');
|
||||||
if (type === 'submit') {
|
if (type === 'submit') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue