Skip to content

Commit

Permalink
Merge pull request phpmyadmin#317 from xmujay/20130505_monitor
Browse files Browse the repository at this point in the history
server_status_monitor.php refactor, split long function into small ones:
  • Loading branch information
nijel committed May 5, 2013
2 parents 374c20e + dcb97f4 commit d8a8281
Showing 1 changed file with 99 additions and 72 deletions.
171 changes: 99 additions & 72 deletions server_status_monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,78 +467,8 @@
*/
function getPrintMonitorHtml($ServerStatusData)
{
$retval = '<div class="tabLinks">';
$retval .= '<a href="#pauseCharts">';
$retval .= PMA_Util::getImage('play.png') . __('Start Monitor');
$retval .= '</a>';
$retval .= '<a href="#settingsPopup" class="popupLink">';
$retval .= PMA_Util::getImage('s_cog.png') . __('Settings');
$retval .= '</a>';
if (! PMA_DRIZZLE) {
$retval .= '<a href="#monitorInstructionsDialog">';
$retval .= PMA_Util::getImage('b_help.png') . __('Instructions/Setup');
}
$retval .= '<a href="#endChartEditMode" style="display:none;">';
$retval .= PMA_Util::getImage('s_okay.png');
$retval .= __('Done rearranging/editing charts');
$retval .= '</a>';
$retval .= '</div>';

$retval .= '<div class="popupContent settingsPopup">';
$retval .= '<a href="#addNewChart">';
$retval .= PMA_Util::getImage('b_chart.png') . __('Add chart');
$retval .= '</a>';
//$retval .= '<a href="#rearrangeCharts">';
//$retval .= PMA_Util::getImage('b_tblops.png') . __('Rearrange/edit charts');
//$retval .= '</a>';
$retval .= '<div class="clearfloat paddingtop"></div>';
$retval .= '<div class="floatleft">';
$retval .= __('Refresh rate') . '<br />';
$retval .= PMA_getRefreshList(
'gridChartRefresh',
5,
Array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200)
);
$retval .= '<br />';
$retval .= '</div>';
$retval .= '<div class="floatleft">';
$retval .= __('Chart columns');
$retval .= '<br />';
$retval .= '<select name="chartColumns">';
$retval .= '<option>1</option>';
$retval .= '<option>2</option>';
$retval .= '<option>3</option>';
$retval .= '<option>4</option>';
$retval .= '<option>5</option>';
$retval .= '<option>6</option>';
$retval .= '<option>7</option>';
$retval .= '<option>8</option>';
$retval .= '<option>9</option>';
$retval .= '<option>10</option>';
$retval .= '</select>';
$retval .= '</div>';
$retval .= '<div class="clearfloat paddingtop">';
$retval .= '<b>' . __('Chart arrangement') . '</b> ';
$retval .= PMA_Util::showHint(
__(
'The arrangement of the charts is stored to the browsers local storage. '
. 'You may want to export it if you have a complicated set up.'
)
);
$retval .= '<br/>';
$retval .= '<a class="ajax" href="#importMonitorConfig">';
$retval .= __('Import');
$retval .= '</a>';
$retval .= '&nbsp;&nbsp;';
$retval .= '<a class="disableAjax" href="#exportMonitorConfig">';
$retval .= __('Export');
$retval .= '</a>';
$retval .= '&nbsp;&nbsp;';
$retval .= '<a href="#clearMonitorConfig">';
$retval .= __('Reset to default');
$retval .= '</a>';
$retval .= '</div>';
$retval .= '</div>';
$retval = getTabLinksHtml();
$retval .= getPopContentHtml();

$retval .= '<div id="monitorInstructionsDialog" title="';
$retval .= __('Monitor Instructions') . '" style="display:none;">';
Expand Down Expand Up @@ -753,4 +683,101 @@ function PMA_getRefreshList($name,
return $return;
}

/**
* Prints html with Tab Links
*
* @param null
*
* @return string
*/
function getTabLinksHtml()
{
$retval = '<div class="tabLinks">';
$retval .= '<a href="#pauseCharts">';
$retval .= PMA_Util::getImage('play.png') . __('Start Monitor');
$retval .= '</a>';
$retval .= '<a href="#settingsPopup" class="popupLink">';
$retval .= PMA_Util::getImage('s_cog.png') . __('Settings');
$retval .= '</a>';
if (! PMA_DRIZZLE) {
$retval .= '<a href="#monitorInstructionsDialog">';
$retval .= PMA_Util::getImage('b_help.png') . __('Instructions/Setup');
}
$retval .= '<a href="#endChartEditMode" style="display:none;">';
$retval .= PMA_Util::getImage('s_okay.png');
$retval .= __('Done rearranging/editing charts');
$retval .= '</a>';
$retval .= '</div>';

return $retval;
}

/**
* Prints html with Pop Content
*
* @param null
*
* @return string
*/
function getPopContentHtml()
{
$retval = '<div class="popupContent settingsPopup">';
$retval .= '<a href="#addNewChart">';
$retval .= PMA_Util::getImage('b_chart.png') . __('Add chart');
$retval .= '</a>';
//$retval .= '<a href="#rearrangeCharts">';
//$retval .= PMA_Util::getImage('b_tblops.png') . __('Rearrange/edit charts');
//$retval .= '</a>';
$retval .= '<div class="clearfloat paddingtop"></div>';
$retval .= '<div class="floatleft">';
$retval .= __('Refresh rate') . '<br />';
$retval .= PMA_getRefreshList(
'gridChartRefresh',
5,
Array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200)
);
$retval .= '<br />';
$retval .= '</div>';
$retval .= '<div class="floatleft">';
$retval .= __('Chart columns');
$retval .= '<br />';
$retval .= '<select name="chartColumns">';
$retval .= '<option>1</option>';
$retval .= '<option>2</option>';
$retval .= '<option>3</option>';
$retval .= '<option>4</option>';
$retval .= '<option>5</option>';
$retval .= '<option>6</option>';
$retval .= '<option>7</option>';
$retval .= '<option>8</option>';
$retval .= '<option>9</option>';
$retval .= '<option>10</option>';
$retval .= '</select>';
$retval .= '</div>';
$retval .= '<div class="clearfloat paddingtop">';
$retval .= '<b>' . __('Chart arrangement') . '</b> ';
$retval .= PMA_Util::showHint(
__(
'The arrangement of the charts is stored to the browsers local storage. '
. 'You may want to export it if you have a complicated set up.'
)
);
$retval .= '<br/>';
$retval .= '<a class="ajax" href="#importMonitorConfig">';
$retval .= __('Import');
$retval .= '</a>';
$retval .= '&nbsp;&nbsp;';
$retval .= '<a class="disableAjax" href="#exportMonitorConfig">';
$retval .= __('Export');
$retval .= '</a>';
$retval .= '&nbsp;&nbsp;';
$retval .= '<a href="#clearMonitorConfig">';
$retval .= __('Reset to default');
$retval .= '</a>';
$retval .= '</div>';
$retval .= '</div>';

return $retval;
}

?>

0 comments on commit d8a8281

Please sign in to comment.