Merge pull request #4164 from Icinga/fix/view-compact-handling
Fix view compact handling
This commit is contained in:
commit
aa14b59e14
|
@ -45,6 +45,11 @@ Please consider an upgrade of your central Icinga system to a newer distribution
|
|||
[icinga.com](https://icinga.com/subscription/support-details/) provides an overview about
|
||||
currently supported distributions.
|
||||
|
||||
**Framework changes affecting third-party code**
|
||||
|
||||
* Url parameter `view=compact` is now deprecated. `showCompact` should be used instead.
|
||||
Details are in pull request [#4164](https://github.com/Icinga/icingaweb2/pull/4164).
|
||||
|
||||
## Upgrading to Icinga Web 2 2.7.x <a id="upgrading-to-2.7.x"></a>
|
||||
|
||||
**Breaking changes**
|
||||
|
|
|
@ -235,7 +235,7 @@ class Controller extends ModuleActionController
|
|||
'sort', // setupSortControl()
|
||||
'dir', // setupSortControl()
|
||||
'backend', // Framework
|
||||
'view', // Framework
|
||||
'showCompact', // Framework
|
||||
'_dev' // Framework
|
||||
);
|
||||
|
||||
|
|
|
@ -129,7 +129,10 @@ class ActionController extends Zend_Controller_Action
|
|||
$this->_helper->layout()->showFullscreen = $request->getUrl()->shift('showFullscreen');
|
||||
$this->_helper->layout()->moduleName = $moduleName;
|
||||
|
||||
$this->view->compact = $request->getParam('view') === 'compact';
|
||||
if ($request->getUrl()->getParam('view') === 'compact') {
|
||||
$request->getUrl()->remove('view');
|
||||
$this->view->compact = true;
|
||||
}
|
||||
if ($request->getUrl()->shift('showCompact')) {
|
||||
$this->view->compact = true;
|
||||
}
|
||||
|
|
|
@ -828,6 +828,32 @@ class Url
|
|||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a copy of this url with only the given parameter(s)
|
||||
*
|
||||
* The argument can be either a single query parameter name or
|
||||
* an array of parameter names to keep on on the query
|
||||
*
|
||||
* @param string|array $keyOrArrayOfKeys
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function onlyWith($keyOrArrayOfKeys)
|
||||
{
|
||||
if (! is_array($keyOrArrayOfKeys)) {
|
||||
$keyOrArrayOfKeys = [$keyOrArrayOfKeys];
|
||||
}
|
||||
|
||||
$url = clone $this;
|
||||
foreach ($url->getParams()->toArray(false) as $key => $_) {
|
||||
if (! in_array($key, $keyOrArrayOfKeys, true)) {
|
||||
$url->remove($key);
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->params = clone $this->params;
|
||||
|
|
|
@ -285,12 +285,10 @@ class FilterEditor extends AbstractWidget
|
|||
}
|
||||
}
|
||||
|
||||
$url = $this->url()->setQueryString(
|
||||
$filter->toQueryString()
|
||||
)->addParams($preserve);
|
||||
if ($modify) {
|
||||
$url->getParams()->add('modifyFilter');
|
||||
}
|
||||
$url = Url::fromRequest()->onlyWith($this->preserveParams);
|
||||
$urlParams = $url->getParams();
|
||||
$url->setQueryString($filter->toQueryString());
|
||||
$url->getParams()->mergeValues($urlParams->toArray(false));
|
||||
$this->redirectNow($url);
|
||||
}
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ class ListController extends Controller
|
|||
$this->view->form = $form;
|
||||
|
||||
$this->params
|
||||
->remove('view')
|
||||
->remove('showCompact')
|
||||
->remove('format');
|
||||
$orientation = $this->params->shift('vertical', 0) ? 'vertical' : 'horizontal';
|
||||
/*
|
||||
|
|
|
@ -35,7 +35,7 @@ class ServicesController extends Controller
|
|||
$serviceList = new ServiceList($this->backend);
|
||||
$this->applyRestriction('monitoring/filter/objects', $serviceList);
|
||||
$serviceList->addFilter(Filter::fromQueryString(
|
||||
(string) $this->params->without(array('service_problem', 'service_handled', 'view'))
|
||||
(string) $this->params->without(array('service_problem', 'service_handled', 'showCompact'))
|
||||
));
|
||||
$this->serviceList = $serviceList;
|
||||
$this->serviceList->setColumns(array(
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<div class="action-links">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url()->without(array('view', 'limit')),
|
||||
$this->url()->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<div class="action-links">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url()->without(array('view', 'limit')),
|
||||
$this->url()->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -46,7 +46,7 @@ if (! $this->compact): ?>
|
|||
<div class="action-links">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url()->without(array('view', 'limit')),
|
||||
$this->url()->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -284,7 +284,7 @@ if (! $this->compact): ?>
|
|||
<div class="action-links">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url()->without(array('view', 'limit')),
|
||||
$this->url()->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -102,7 +102,7 @@ if (! $this->compact): ?>
|
|||
<div class="action-links">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url()->without(array('view', 'limit')),
|
||||
$this->url()->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -112,7 +112,7 @@ if (! $this->compact): ?>
|
|||
<div class="action-links">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url(isset($notificationsUrl) ? $notificationsUrl : null)->without(array('view', 'limit')),
|
||||
$this->url(isset($notificationsUrl) ? $notificationsUrl : null)->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -172,7 +172,7 @@ if (! $this->compact): ?>
|
|||
<div class="action-links">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url()->without(array('view', 'limit')),
|
||||
$this->url()->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -130,7 +130,7 @@ if (! $this->compact): ?>
|
|||
<div class="action-links">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url()->without(array('view', 'limit')),
|
||||
$this->url()->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -247,7 +247,7 @@ $rowAction = Url::fromPath('monitoring/event/show');
|
|||
<?php if ($this->compact) {
|
||||
echo $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$url->without(array('view', 'limit')),
|
||||
$url->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'class' => 'action-link',
|
||||
|
|
|
@ -4,7 +4,7 @@ if ($dataView->hasMore()): ?>
|
|||
<div class="text-right">
|
||||
<?= $this->qlink(
|
||||
$this->translate('Show More'),
|
||||
$this->url()->without(array('view', 'limit')),
|
||||
$this->url()->without(array('showCompact', 'limit')),
|
||||
null,
|
||||
array(
|
||||
'data-base-target' => '_next',
|
||||
|
|
|
@ -147,7 +147,7 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
|
|||
$dir = $url->shift('dir');
|
||||
$page = $url->shift('page');
|
||||
$format = $url->shift('format');
|
||||
$view = $url->shift('view');
|
||||
$view = $url->shift('showCompact');
|
||||
$view = $url->shift('backend');
|
||||
foreach ($url->getParams() as $k => $v) {
|
||||
$this->where($k, $v);
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
var $modal = _this.$ghost.clone();
|
||||
var $urlTarget = _this.icinga.loader.getLinkTargetFor($a);
|
||||
|
||||
// Add view=compact, we don't want controls in a modal
|
||||
url = _this.icinga.utils.addUrlParams(url, { 'view': 'compact' });
|
||||
// Add showCompact, we don't want controls in a modal
|
||||
url = _this.icinga.utils.addUrlFlag(url, 'showCompact');
|
||||
|
||||
// Set the toggle's base target on the modal to use it as redirect target
|
||||
$modal.data('redirectTarget', $urlTarget);
|
||||
|
|
Loading…
Reference in New Issue