Project

General

Profile

Actions

Feature #7016

closed

system_information_widget.php - Indicate adaptive state timeout status when active

Added by Jim Pingle almost 5 years ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Dashboard
Target version:
Start date:
12/16/2016
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:

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.

Actions #1

Updated by Steve Beaver about 1 year ago

  • Assignee set to Jim Pingle
  • Private changed from No to Yes

Suggest move this to factory

Actions #2

Updated by Steve Beaver about 1 year ago

  • Assignee changed from Jim Pingle to Steve Beaver
Actions #3

Updated by Steve Beaver about 1 year ago

  • Status changed from New to Feedback
  • Assignee changed from Steve Beaver to Jim Pingle

Implemented as requested

Actions #4

Updated by Jim Pingle about 1 year ago

  • Status changed from Feedback to In Progress
  • Assignee changed from Jim Pingle to Steve Beaver

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.

Actions #5

Updated by Steve Beaver about 1 year ago

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.

Actions #6

Updated by Jim Pingle about 1 year ago

  • Private changed from Yes to No

Seems to also be susceptible to a PHP error, the code can end up dividing by 0: #10993

Actions #7

Updated by Steve Beaver about 1 year ago

  • Assignee changed from Steve Beaver to Jim Pingle

Functionality has been finalized by adding the required data and providing the needed Ajax logic.

Actions #8

Updated by Jim Pingle about 1 year ago

  • Assignee changed from Jim Pingle to Steve Beaver

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.

Actions #9

Updated by Steve Beaver about 1 year ago

Number format corrected

Actions #10

Updated by Steve Beaver about 1 year ago

  • Assignee changed from Steve Beaver to Jim Pingle
Actions #11

Updated by Jim Pingle about 1 year ago

  • Status changed from In Progress to Resolved

Looks good after a gitsync

Actions #12

Updated by Jim Pingle about 1 year ago

  • Assignee changed from Jim Pingle to Steve Beaver
Actions

Also available in: Atom PDF