Fix EventHistory Query and tests

refs #4868
This commit is contained in:
Jannis Moßhammer 2013-10-17 20:53:11 +02:00
parent 4a95ba3468
commit 7a7c10e8df
3 changed files with 22 additions and 36 deletions

View File

@ -384,12 +384,27 @@ class Monitoring_ListController extends MonitoringController
public function eventhistoryAction() public function eventhistoryAction()
{ {
$query = EventHistoryView::fromRequest($this->_request)->getQuery(); $query = EventHistoryView::fromRequest(
$this->getRequest(),
array(
'host_name',
'service_description',
'object_type',
'timestamp',
'raw_timestamp',
'state',
'attempt',
'max_attempts',
'output',
'type',
'host',
'service'
)
)->getQuery();
$this->handleFormatRequest($query); $this->handleFormatRequest($query);
$this->view->history = $query->paginate(); $this->view->history = $query->paginate();
$this->setupSortControl( $this->setupSortControl(
array( array()
)
); );
} }

View File

@ -52,7 +52,9 @@ class EventHistory extends DataView
'attempt', 'attempt',
'max_attempts', 'max_attempts',
'output', 'output',
'type' 'type',
'host',
'service'
); );
} }
@ -75,34 +77,3 @@ class EventHistory extends DataView
); );
} }
} }
=======
'type',
'host',
'service'
);
}
/**
* Return the table name
*
* @return string
*/
public static function getTableName()
{
return 'eventhistory';
}
/**
* Retrieve default sorting rules for particular columns. These involve sort order and potential additional to sort
*
* @return array
*/
public function getSortRules()
{
return array(
'raw_timestamp' => array(
'order' => self::SORT_DESC
)
);
}
}

View File

@ -155,7 +155,7 @@ class TabTest extends PHPUnit_Framework_TestCase
$this->assertEquals( $this->assertEquals(
1, 1,
preg_match( preg_match(
'/<li *><i class="icon-myIcon"><\/i> Title text<\/li>/i', '/<li *><i class="myIcon"><\/i> Title text<\/li>/i',
$html $html
), ),
'Asserting an url being rendered inside an HTML anchor. got ' . $html 'Asserting an url being rendered inside an HTML anchor. got ' . $html