Project

General

Profile

Feature #7016

system_information_widget.php - Indicate adaptive state timeout status when active

Added by Jim Pingle almost 4 years ago. Updated 9 days ago.

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

0%

Estimated time:

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.

History

#1 Updated by Steve Beaver 23 days ago

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

Suggest move this to factory

#2 Updated by Steve Beaver 23 days ago

  • Assignee changed from Jim Pingle to Steve Beaver

#3 Updated by Steve Beaver 13 days ago

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

Implemented as requested

#4 Updated by Jim Pingle 10 days 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.

#5 Updated by Steve Beaver 9 days 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.

#6 Updated by Jim Pingle 9 days 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

#7 Updated by Steve Beaver 9 days ago

  • Assignee changed from Steve Beaver to Jim Pingle

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

#8 Updated by Jim Pingle 9 days 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.

#9 Updated by Steve Beaver 9 days ago

Number format corrected

#10 Updated by Steve Beaver 9 days ago

  • Assignee changed from Steve Beaver to Jim Pingle

#11 Updated by Jim Pingle 9 days ago

  • Status changed from In Progress to Resolved

Looks good after a gitsync

#12 Updated by Jim Pingle 9 days ago

  • Assignee changed from Jim Pingle to Steve Beaver

Also available in: Atom PDF