Bug 2013990

Summary: Observe dashboard crashs on reload when perspective has changed (in another tab)
Product: OpenShift Container Platform Reporter: Christoph Jerolimov <cjerolim>
Component: Dev ConsoleAssignee: Vikram Raj <viraj>
Status: CLOSED ERRATA QA Contact: spathak <spathak>
Severity: medium Docs Contact:
Priority: high    
Version: 4.9CC: aos-bugs, ariroy, kjeeyar, msaud, nmukherj, viraj
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2027804 (view as bug list) Environment:
Last Closed: 2022-03-10 16:19:35 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: 2027804    
Attachments:
Description Flags
monitoring-crash-after-changing-perspective.mp4 none

Description Christoph Jerolimov 2021-10-14 08:41:53 UTC
Description of problem:
When the user opens the Observe > Dashboard in admin or developer perspective and switches the perspective in another tab, the observe dashboard crashs on reload.

Version-Release number of selected component (if applicable):
4.9

How reproducible:
Always

Steps to Reproduce:
1. Navigate to the Observe dashboard view
2. Select a dashboard
3. Open the console in another browser tab (right click in navigation > open in new tab)
4. Change the perspective in this new tab 
5. Switch back to the browser tab with the observe dashboard view and reload the browser tab

Actual results:
Content area crashs and shows "Oh no! Something went wrong."

StackTrace:
  TypeError: Cannot read properties of undefined (reading 'value')
  in VariableDropdown (public/components/monitoring/dashboards/index.tsx:176)

Quick code analyse shows that the variable to get the query is not defined here:

  const VariableDropdown: React.FC<VariableDropdownProps> = ({ id, name }) => {
    const [activePerspective] = useActivePerspective();
    const timespan = useSelector(({ UI }: RootState) =>
      UI.getIn(['monitoringDashboards', activePerspective, 'timespan']),
    );
    const variables = useSelector(({ UI }: RootState) =>
      UI.getIn(['monitoringDashboards', activePerspective, 'variables']),
    );
    const variable = variables.toJS()[name];
    const query = evaluateTemplate(variable.query, variables, timespan);

The reason is that that the redux state ... => 'monitoringDashboards' => 'activePerspective => 'variables' is not initialized correctly.


Expected results:
No crash

Additional info:

Comment 2 Christoph Jerolimov 2021-10-14 08:45:55 UTC
Assigned this to Dev Console because this is an followup issue after consolidating the admin monitoring dashboard to devconsole monitoring dashboard (https://issues.redhat.com/browse/ODC-6068 / https://github.com/openshift/console/pull/9644)

Comment 4 Aritra Roy 2021-12-05 22:18:54 UTC
verified on firefox 90.0.2, build 4.10.0-0.nightly-2021-12-03-213835
following the steps to reproduce doesn't crash the console.

Comment 6 Karthik Jeeyar 2021-12-14 09:45:06 UTC
Since nightly builds are not having the changes from Nov 17th, We decided to QE verify the 4.10 issues on a ci build. Changing the perspective in another tab and refreshing the original tab no longer breaks the UI, so marking the ticket as Verified.

Verified on: 
cluster build: 4.10.0-0.ci-2021-12-14-050037

Comment 10 errata-xmlrpc 2022-03-10 16:19:35 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 (Moderate: OpenShift Container Platform 4.10.3 security update), 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/RHSA-2022:0056