Skip to content

Commit

Permalink
Only display fields in log file tab if log files have been registered…
Browse files Browse the repository at this point in the history
…. Display error message otherwise.
  • Loading branch information
jakr committed Aug 7, 2012
1 parent cf4c542 commit 289a0e3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions code/DashboardLogFileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ public static function add_log_file_panel(){
}

public function getPanelContent(DashboardPanel $panel) {
$panel->addFormField(new AutomaticRefreshButton('readlogfile', 'Update'));
$lines = array('10'=>'10', '20'=>'20', '50' => '50', '100'=>'100', '100+'=>'100+');
$panel->addFormField(new DropDownField('show_last_lines',
'Number of lines to show', $lines, '100+'));
$fields = array();
foreach(DashboardLogFile::get_available_log_files() as $name){
$this->fileKey = $name;
Expand All @@ -24,7 +20,17 @@ public function getPanelContent(DashboardPanel $panel) {
$logarea->addExtraClass('SSDD-log-file-area-'.$name);
$fields[$name] = $logarea;
}
$panel->addFormField(new SelectionGroup('SSDD-files-selection', $fields));
if(count($fields) > 0){
$panel->addFormField(new AutomaticRefreshButton('readlogfile', 'Update'));
$lines = array('10'=>'10', '20'=>'20', '50' => '50', '100'=>'100', '100+'=>'100+');
$panel->addFormField(new DropDownField('show_last_lines',
'Number of lines to show', $lines, '100+'));
$panel->addFormField(new SelectionGroup('SSDD-files-selection',
$fields));
} else {
$panel->addFormField(new LiteralField('internalName',
'Use DashboardLogFile::register_log_file() to register log files.'));
}
}

public function ReadLogData(){
Expand Down

0 comments on commit 289a0e3

Please sign in to comment.