Feature #7016
closed
system_information_widget.php - Indicate adaptive state timeout status when active
Added by Jim Pingle almost 8 years ago.
Updated about 4 years ago.
Description
It would be helpful to show the user that pf has enabled adaptive state timeout scaling when it kicks in.
Some sample code to calculate the scaling factor and to flag when it is active:
if (isset($config['system']['adaptivestart']) and $config['system']['adaptivestart'] > 0) {
$adaptivestart = "{$config['system']['adaptivestart']}";
} else {
$adaptivestart = intval($maxstates * 0.6);
}
if (isset($config['system']['adaptiveend']) and $config['system']['adaptiveend'] > 0) {
$adaptiveend = "{$config['system']['adaptiveend']}";
} else {
$adaptiveend = intval($maxstates * 1.2);
}
$adaptive_text = "";
if ($curentries > $adaptivestart) {
$scalingfactor = round(($adaptiveend - $curentries) / ($adaptiveend - $adaptivestart) * 100, 0);
$adaptive_text = "Adaptive state handling enabled, state timeouts reduced by {$scalingfactor}%)";
}
Main problem is formatting in the widget, getting it to a place where it's clear what it is without cluttering. Bonus points for changing the color of the progress bar to yellow when this is active.
- Assignee set to Jim Pingle
- Private changed from No to Yes
Suggest move this to factory
- Assignee changed from Jim Pingle to Anonymous
- Status changed from New to Feedback
- Assignee changed from Anonymous to Jim Pingle
- Status changed from Feedback to In Progress
- Assignee changed from Jim Pingle to Anonymous
A few problems as it is implemented:
1. It doesn't work because it's checking $curentries
not $pfstatetext
2. $pfstatetext
isn't populated a the time of the check, it needs to be moved up from where it is set
3. It only takes effect when the page is loaded, not dynamically when the widget is refreshed via JS. If the threshold is exceeded and the page isn't reloaded, the user wouldn't see the change in color. I thought the thermal sensors widget updated dynamically like that but I don't have a simple way to confirm that at the moment.
Logic has been updated but only on initial page load. Once this has been tested and confirmed as satisfactory I will add the Ajax magic.
- Private changed from Yes to No
Seems to also be susceptible to a PHP error, the code can end up dividing by 0: #10993
- Assignee changed from Anonymous to Jim Pingle
Functionality has been finalized by adding the required data and providing the needed Ajax logic.
- Assignee changed from Jim Pingle to Anonymous
I'm still only seeing the label and color change if I reload the page with a high state count. If I change the state count without reloading the page, the value changes as before but the color and labels stay the same.
- Assignee changed from Anonymous to Jim Pingle
- Status changed from In Progress to Resolved
Looks good after a gitsync
- Assignee changed from Jim Pingle to Anonymous
Also available in: Atom
PDF