Revert "Make ascending sort by host or service severity initiatable"

This reverts commit 386d4db851.

The commit introduced the bug that changing the sort direction no longer changed the sort direction :)

refs #9059
This commit is contained in:
Eric Lippmann 2015-05-21 12:01:58 +02:00
parent 87a46ea5b1
commit 82f9425b90
1 changed files with 4 additions and 7 deletions

View File

@ -247,11 +247,11 @@ abstract class DataView implements QueryInterface, IteratorAggregate
}; };
} }
$globalDefaultOrder = isset($sortColumns['order']) ? $sortColumns['order'] : static::SORT_ASC; $order = $order === null ? (isset($sortColumns['order']) ? $sortColumns['order'] : static::SORT_ASC) : $order;
$globalDefaultOrder = (strtoupper($globalDefaultOrder) === static::SORT_ASC) ? 'ASC' : 'DESC'; $order = (strtoupper($order) === static::SORT_ASC) ? 'ASC' : 'DESC';
foreach ($sortColumns['columns'] as $column) { foreach ($sortColumns['columns'] as $column) {
list($column, $specificDefaultOrder) = $this->query->splitOrder($column); list($column, $direction) = $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".'),
@ -259,10 +259,7 @@ abstract class DataView implements QueryInterface, IteratorAggregate
get_class($this) get_class($this)
); );
} }
$this->query->order( $this->query->order($column, $direction !== null ? $direction : $order);
$column,
$order === null && $specificDefaultOrder !== null ? $specificDefaultOrder : $globalDefaultOrder
);
} }
$this->isSorted = true; $this->isSorted = true;
return $this; return $this;