Add selection count hint in grids with help for hosts and services
refs #7654
This commit is contained in:
parent
f427577067
commit
46df428e28
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
$helpMessage = $this->translate('Press and hold the Ctrl key while clicking on rows to select multiple rows or press and hold the Shift key to select a range of rows.', 'multiselection');
|
||||||
|
?>
|
||||||
|
<div class="selection-info">
|
||||||
|
<span class="selection-info-count">0</span> <?= $this->translate('row(s) selected', 'multiselection') ?> <?= $this->icon('unhandled.png', $helpMessage) ?>
|
||||||
|
</div>
|
|
@ -16,6 +16,7 @@ if ($this->compact): ?>
|
||||||
<?= $this->widget('limiter')->setMaxLimit($this->hosts->count()) ?>
|
<?= $this->widget('limiter')->setMaxLimit($this->hosts->count()) ?>
|
||||||
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?>
|
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?>
|
||||||
<?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())) ?>
|
<?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())) ?>
|
||||||
|
<?= $this->render('list/components/selectioninfo.phtml') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
|
@ -20,6 +20,7 @@ if (!$this->compact): ?>
|
||||||
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)) ?>
|
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?= $this->selectionToolbar('multi', $this->href('monitoring/services/show?' . $this->filter->toQueryString())) ?>
|
<?= $this->selectionToolbar('multi', $this->href('monitoring/services/show?' . $this->filter->toQueryString())) ?>
|
||||||
|
<?= $this->render('list/components/selectioninfo.phtml') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
|
@ -141,3 +141,7 @@ table.avp .customvar ul {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
padding-left: 1.5em;
|
padding-left: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.selection-info {
|
||||||
|
padding-top:1em;
|
||||||
|
}
|
||||||
|
|
|
@ -306,17 +306,20 @@
|
||||||
var query = icinga.ui.selectionDataToQuery(selectionData);
|
var query = icinga.ui.selectionDataToQuery(selectionData);
|
||||||
icinga.loader.loadUrl(url + '?' + query, $target);
|
icinga.loader.loadUrl(url + '?' + query, $target);
|
||||||
icinga.ui.storeSelectionData(selectionData);
|
icinga.ui.storeSelectionData(selectionData);
|
||||||
|
icinga.ui.provideSelectionCount();
|
||||||
} else if ($trs.length === 1) {
|
} else if ($trs.length === 1) {
|
||||||
// display a single row
|
// display a single row
|
||||||
$tr = $trs.first();
|
$tr = $trs.first();
|
||||||
icinga.loader.loadUrl($tr.attr('href'), $target);
|
icinga.loader.loadUrl($tr.attr('href'), $target);
|
||||||
icinga.ui.storeSelectionData($tr.attr('href'));
|
icinga.ui.storeSelectionData($tr.attr('href'));
|
||||||
|
icinga.ui.provideSelectionCount();
|
||||||
} else {
|
} else {
|
||||||
// display nothing
|
// display nothing
|
||||||
if ($target.attr('id') === 'col2') {
|
if ($target.attr('id') === 'col2') {
|
||||||
icinga.ui.layout1col();
|
icinga.ui.layout1col();
|
||||||
}
|
}
|
||||||
icinga.ui.storeSelectionData(null);
|
icinga.ui.storeSelectionData(null);
|
||||||
|
icinga.ui.provideSelectionCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -470,9 +470,25 @@
|
||||||
* (when only a single row was selected) or Null when nothing was selected.
|
* (when only a single row was selected) or Null when nothing was selected.
|
||||||
*/
|
*/
|
||||||
loadSelectionData: function() {
|
loadSelectionData: function() {
|
||||||
|
this.provideSelectionCount();
|
||||||
return selectionData;
|
return selectionData;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the selections row count hint info
|
||||||
|
*/
|
||||||
|
provideSelectionCount: function() {
|
||||||
|
var $count = $('.selection-info-count');
|
||||||
|
|
||||||
|
if (typeof selectionData === 'string') {
|
||||||
|
$count.text(1);
|
||||||
|
} else if (selectionData.length > 1) {
|
||||||
|
$count.text(selectionData.length);
|
||||||
|
} else {
|
||||||
|
$count.text(0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focus the given table by deselecting all selections on all other tables.
|
* Focus the given table by deselecting all selections on all other tables.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue