Merge branch 'bugfix/selected-row-lost-after-autorefresh-8623'

fixes 
This commit is contained in:
Matthias Jentsch 2015-07-29 17:30:45 +02:00
commit 20aa17c831
12 changed files with 45 additions and 24 deletions
application
library/Icinga/Web/Widget
modules/monitoring/application/views/scripts/list
public/js/icinga

View File

@ -32,12 +32,14 @@ class ConfigController extends Controller
$tabs->add('general', array( $tabs->add('general', array(
'title' => $this->translate('Adjust the general configuration of Icinga Web 2'), 'title' => $this->translate('Adjust the general configuration of Icinga Web 2'),
'label' => $this->translate('General'), 'label' => $this->translate('General'),
'url' => 'config/general' 'url' => 'config/general',
'baseTarget' => '_main'
)); ));
$tabs->add('resource', array( $tabs->add('resource', array(
'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'), 'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'),
'label' => $this->translate('Resources'), 'label' => $this->translate('Resources'),
'url' => 'config/resource' 'url' => 'config/resource',
'baseTarget' => '_main'
)); ));
return $tabs; return $tabs;
} }
@ -51,12 +53,14 @@ class ConfigController extends Controller
$tabs->add('userbackend', array( $tabs->add('userbackend', array(
'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'), 'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'),
'label' => $this->translate('User Backends'), 'label' => $this->translate('User Backends'),
'url' => 'config/userbackend' 'url' => 'config/userbackend',
'baseTarget' => '_main'
)); ));
$tabs->add('usergroupbackend', array( $tabs->add('usergroupbackend', array(
'title' => $this->translate('Configure how users are associated with groups by Icinga Web 2'), 'title' => $this->translate('Configure how users are associated with groups by Icinga Web 2'),
'label' => $this->translate('User Group Backends'), 'label' => $this->translate('User Group Backends'),
'url' => 'usergroupbackend/list' 'url' => 'usergroupbackend/list',
'baseTarget' => '_main'
)); ));
return $tabs; return $tabs;
} }

View File

@ -166,7 +166,8 @@ class RoleController extends AuthBackendController
'Configure roles to permit or restrict users and groups accessing Icinga Web 2' 'Configure roles to permit or restrict users and groups accessing Icinga Web 2'
), ),
'label' => $this->translate('Roles'), 'label' => $this->translate('Roles'),
'url' => 'role/list' 'url' => 'role/list',
'baseTarget' => '_main'
) )
); );

View File

@ -1,4 +1,4 @@
<div class="controls" data-base-target="_main"> <div class="controls">
<?= $tabs; ?> <?= $tabs; ?>
</div> </div>
<div class="content" data-base-target="_next"> <div class="content" data-base-target="_next">

View File

@ -1,4 +1,4 @@
<div class="controls" data-base-target="_main"> <div class="controls">
<?= $tabs; ?> <?= $tabs; ?>
</div> </div>
<div class="content" data-base-target="_next"> <div class="content" data-base-target="_next">

View File

@ -16,7 +16,8 @@
array('backend' => $backendNames[$i]), array('backend' => $backendNames[$i]),
array( array(
'icon' => 'edit', 'icon' => 'edit',
'title' => sprintf($this->translate('Edit user backend %s'), $backendNames[$i]) 'class' => 'rowaction',
'title' => sprintf($this->translate('rEdit user backend %s'), $backendNames[$i])
) )
); ?> ); ?>
</td> </td>

View File

@ -1,4 +1,4 @@
<div class="controls" data-base-target="_main"> <div class="controls">
<?= $tabs ?> <?= $tabs ?>
</div> </div>
<div class="content"> <div class="content">

View File

@ -91,6 +91,13 @@ class Tab extends AbstractWidget
*/ */
private $targetBlank = false; private $targetBlank = false;
/**
* Data base target that determines if the link will be opened in a side-bar or in the main container
*
* @var null
*/
private $baseTarget = null;
/** /**
* Sets an icon image for this tab * Sets an icon image for this tab
* *
@ -210,6 +217,11 @@ class Tab extends AbstractWidget
$this->targetBlank = $value; $this->targetBlank = $value;
} }
public function setBaseTarget($value)
{
$this->baseTarget = $value;
}
/** /**
* Create a new Tab with the given properties * Create a new Tab with the given properties
* *
@ -274,6 +286,10 @@ class Tab extends AbstractWidget
} }
} }
if ($this->baseTarget !== null) {
$tagParams['data-base-target'] = $this->baseTarget;
}
if ($this->icon !== null) { if ($this->icon !== null) {
if (strpos($this->icon, '.') === false) { if (strpos($this->icon, '.') === false) {
$caption = $view->icon($this->icon) . $caption; $caption = $view->icon($this->icon) . $caption;

View File

@ -15,7 +15,7 @@ if (count($servicegroups) === 0) {
return; return;
} }
?> ?>
<table class="groupview" data-base-target="_next"> <table class="groupview action" data-base-target="_next">
<thead> <thead>
<th><?= $this->translate('Last Problem'); ?></th> <th><?= $this->translate('Last Problem'); ?></th>
<th><?= $this->translate('Service Group'); ?></th> <th><?= $this->translate('Service Group'); ?></th>

View File

@ -313,13 +313,16 @@
*/ */
ActionTable.prototype.onRowClicked = function (event) { ActionTable.prototype.onRowClicked = function (event) {
var self = event.data.self; var self = event.data.self;
var $tr = $(event.target).closest('tr'); var $target = $(event.target);
var $tr = $target.closest('tr');
var table = new Selection($tr.closest('table.action')[0], self.icinga); var table = new Selection($tr.closest('table.action')[0], self.icinga);
// allow form actions in table rows to pass through // some rows may contain form actions that trigger a different action, pass those through
if ($(event.target).closest('form').length) { if (!$target.hasClass('rowaction') && $target.closest('form').length &&
($target.closest('a').length || $target.closest('button').length)) {
return; return;
} }
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();

View File

@ -354,18 +354,16 @@
return true; return true;
} }
// Special checks for link clicks in multiselect rows // Special checks for link clicks in action tables
if (! $a.is('tr[href]') && $a.closest('tr[href]').length > 0 && $a.closest('table.multiselect').length > 0) { if (! $a.is('tr[href]') && $a.closest('table.action').length > 0) {
// ignoray clicks to ANY link with special key pressed // ignoray clicks to ANY link with special key pressed
if (event.ctrlKey || event.metaKey || event.shiftKey) if ($a.closest('table.multiselect').length > 0 && (event.ctrlKey || event.metaKey || event.shiftKey)) {
{
return true; return true;
} }
// ignore inner links matching the row URL // ignore inner links matching the row URL
if ($a.attr('href') === $a.closest('tr[href]').attr('href')) if ($a.attr('href') === $a.closest('tr[href]').attr('href')) {
{
return true; return true;
} }
} }

View File

@ -139,8 +139,10 @@
icinga.logger.debug('History state', event.originalEvent.state); icinga.logger.debug('History state', event.originalEvent.state);
} }
self.applyLocationBar(); // keep the last pushed url in sync with history changes
self.lastPushUrl = location.href;
self.applyLocationBar();
}, },
applyLocationBar: function (onload) { applyLocationBar: function (onload) {

View File

@ -587,8 +587,6 @@
if (req.$target[0].id === 'col1') { if (req.$target[0].id === 'col1') {
self.icinga.behaviors.navigation.resetActive(); self.icinga.behaviors.navigation.resetActive();
} }
} else if ($(el).closest('table.action').length) {
$(el).closest('table.action').find('.active').removeClass('active');
} }
}); });
@ -604,8 +602,6 @@
} }
// Interrupt .each, only on menu item shall be active // Interrupt .each, only on menu item shall be active
return false; return false;
} else if ($(el).closest('table.action').length) {
$el.addClass('active');
} }
}); });
} }