Skip to content

Commit

Permalink
Revert "Make ascending sort by host or service severity initiatable"
Browse files Browse the repository at this point in the history
This reverts commit 386d4db.

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

refs #9059
  • Loading branch information
lippserd committed May 21, 2015
1 parent 87a46ea commit 82f9425
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions modules/monitoring/library/Monitoring/DataView/DataView.php
Expand Up @@ -247,22 +247,19 @@ public function sort($column = null, $order = null)
};
}

$globalDefaultOrder = isset($sortColumns['order']) ? $sortColumns['order'] : static::SORT_ASC;
$globalDefaultOrder = (strtoupper($globalDefaultOrder) === static::SORT_ASC) ? 'ASC' : 'DESC';
$order = $order === null ? (isset($sortColumns['order']) ? $sortColumns['order'] : static::SORT_ASC) : $order;
$order = (strtoupper($order) === static::SORT_ASC) ? 'ASC' : 'DESC';

foreach ($sortColumns['columns'] as $column) {
list($column, $specificDefaultOrder) = $this->query->splitOrder($column);
list($column, $direction) = $this->query->splitOrder($column);
if (! $this->isValidFilterTarget($column)) {
throw new QueryException(
mt('monitoring', 'The sort column "%s" is not allowed in "%s".'),
$column,
get_class($this)
);
}
$this->query->order(
$column,
$order === null && $specificDefaultOrder !== null ? $specificDefaultOrder : $globalDefaultOrder
);
$this->query->order($column, $direction !== null ? $direction : $order);
}
$this->isSorted = true;
return $this;
Expand Down

0 comments on commit 82f9425

Please sign in to comment.