mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
Make ascending sort by host or service severity initiatable
fixes #9059
This commit is contained in:
parent
149e893ecd
commit
386d4db851
@ -238,11 +238,11 @@ abstract class DataView implements Browsable, Countable, Filterable, Sortable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = $order === null ? (isset($sortColumns['order']) ? $sortColumns['order'] : static::SORT_ASC) : $order;
|
$globalDefaultOrder = isset($sortColumns['order']) ? $sortColumns['order'] : static::SORT_ASC;
|
||||||
$order = (strtoupper($order) === static::SORT_ASC) ? 'ASC' : 'DESC';
|
$globalDefaultOrder = (strtoupper($globalDefaultOrder) === static::SORT_ASC) ? 'ASC' : 'DESC';
|
||||||
|
|
||||||
foreach ($sortColumns['columns'] as $column) {
|
foreach ($sortColumns['columns'] as $column) {
|
||||||
list($column, $direction) = $this->query->splitOrder($column);
|
list($column, $specificDefaultOrder) = $this->query->splitOrder($column);
|
||||||
if (! $this->isValidFilterTarget($column)) {
|
if (! $this->isValidFilterTarget($column)) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
mt('monitoring', 'The sort column "%s" is not allowed in "%s".'),
|
mt('monitoring', 'The sort column "%s" is not allowed in "%s".'),
|
||||||
@ -250,7 +250,10 @@ abstract class DataView implements Browsable, Countable, Filterable, Sortable
|
|||||||
get_class($this)
|
get_class($this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->query->order($column, $direction !== null ? $direction : $order);
|
$this->query->order(
|
||||||
|
$column,
|
||||||
|
$order === null && $specificDefaultOrder !== null ? $specificDefaultOrder : $globalDefaultOrder
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->isSorted = true;
|
$this->isSorted = true;
|
||||||
return $this;
|
return $this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user