Bug 1357447

Summary: main dashboard utilization
Product: [Red Hat Storage] Red Hat Storage Console Reporter: Martin Kudlej <mkudlej>
Component: UIAssignee: kamlesh <kaverma>
Status: CLOSED ERRATA QA Contact: Martin Kudlej <mkudlej>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2CC: julim, kchidamb, nthomas, sankarshan, shtripat, vsarmila
Target Milestone: ---   
Target Release: 2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhscon-ui-0.0.51-1.el7scon.noarch Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-23 19:57:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1353450    
Attachments:
Description Flags
wrong graph data none

Description Martin Kudlej 2016-07-18 09:06:08 UTC
Created attachment 1180976 [details]
wrong graph data

Description of problem:
As you can see at screenshot 142/200 GB info is synchronized with percentage info but these 2 are not synchronized with graph data. It shows utilization graph 118 GB from 200 GB.
All utilization info is wrong because in reality there is usage 132GB.

Version-Release number of selected component (if applicable):
ceph-ansible-1.0.5-27.el7scon.noarch
ceph-installer-1.0.14-1.el7scon.noarch
rhscon-ceph-0.0.33-1.el7scon.x86_64
rhscon-core-0.0.34-1.el7scon.x86_64
rhscon-core-selinux-0.0.34-1.el7scon.noarch
rhscon-ui-0.0.48-1.el7scon.noarch

How reproducible:
100%

Steps to Reproduce:
1. copy some objects to pool and pass treshold for pool
2. remove some objects
3. check graphs

Actual results:
It seems that graph and all related data are updating separately. 

Expected results:
Graphs with related info will update at once with real data.

Comment 2 Ju Lim 2016-07-21 19:23:53 UTC
Problem:
In the dashboard, the donut chart showing utilization information does not get updated whenever utilization values change, specifically the the donut is not re-drawn with the updated value unless the User forces a manual refresh.

USM is using angular-patternfly (which sits on top of a C3 chart), and there appears to be no re-draw function in there, and the C3 chart does have the redraw function.  Right now, the angular-patternfly does not provide any control over this redraw function.

UXD Feedback (from the PatternFly UI Dev team): 
This appears to be a known issue with C3 charts.  Firing a resize event seems to be the recommended way to refresh C3 charts.

We encountered this issue when we were creating the PatternFly website when switching between tabs.  This is the JS we're using to solve our particular problem.  Whenever the tab is toggled, a resize event is fired, and the C3 chart is refreshed.

<script>
    // Workaround for bug with hidden C3 charts in v0.4.11.
    $(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function () {
        if (window.dispatchEvent) {
            window.dispatchEvent(new Event('resize'));
        }
        // Special case for IE
        if ($(document).fireEvent) {
            $(document).fireEvent('onresize');
        }
    });
</script>

Comment 3 Ju Lim 2016-07-21 20:14:36 UTC
Per the PatternFly UI Development Team, the following are two choices to fix this issue:

1) Patch release the release of Angular Patternfly USM is currently using
  Small change but they need to update their version of Angular Patternfly

2) Provide a fix that works around the problem:

Currently they use the angular patternfly directive as such:

<div pf-donut-pct-chart class="fix-this" config="usedConfig" data="usedData" center-label="usedLabel"></div>
The fix would be to add another directive to wrap the pfDonutPctChart directive. Their HTML would become:

<div pf-donut-pct-chart-fixed>
   <div pf-donut-pct-chart class="fix-this" config="usedConfig" data="usedData" center-label="usedLabel"></div>
</div>

Then add the pfDonutPctChart directive (this could be named whatever USM wants and be in any module in USM):

angular.module('patternfly.charts').directive('pfDonutPctChartFixed', function (pfUtils, $timeout) {
  'use strict';
  return {
    restrict: 'A',
    transclude: true,
    template: '<div ng-transclude></div>',
    link: function (scope, iElm) {
      $timeout(function() {
        var pfDonutPctChart = iElm.find('span')[0];
        var innerScope = angular.element(pfDonutPctChart).isolateScope();
        innerScope.updateAll = function (scope) {
          scope.updateAvailable();
          scope.config.data = pfUtils.merge( scope.config.data, scope.getDonutData(scope));
          scope.config.color = scope.statusDonutColor(scope);
          scope.config.data.onclick = scope.config.onClickFn;
        };
      }, 200);
    }
  };
});

Basically, this outer directive gets the original directive and updates the erroneous method updateAll.

Please let us know which option they prefer and if we need to create the patch release.

Comment 4 kamlesh 2016-07-22 12:08:03 UTC
@julim : we have preferred second option for this .. means created custom directive for updating this donut chart arc.

Comment 5 kamlesh 2016-07-22 12:08:21 UTC
(In reply to kamlesh from comment #4)
> @julim : we had preferred second option for this .. means created custom
> directive for updating this donut chart arc.

Comment 6 Martin Kudlej 2016-08-05 09:01:26 UTC
Bug 1358267 will be solved in next version of Ceph. All other related BZ were filed so I verify this BZ.

Comment 8 errata-xmlrpc 2016-08-23 19:57:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2016:1754