[ 
https://issues.apache.org/jira/browse/HDDS-12025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Abhishek Pal updated HDDS-12025:
--------------------------------
    Description: 
When we load the disk usage page, it is expected that all the metadata has 
already been processed by Recon.
However in the edge-case where Recon was just freshly installed and we directly 
access the Disk Usage page, it will give an error/exception as there is no path 
value (i.e undefined)

This can be reproduced by building Ozone, running it via docker and then 
immediately accessing *localhost:9888/#/DiskUsage* as soon as Recon comes up.

This error will be thrown 
[here|https://github.com/devabhishekpal/ozone/blob/8f2689dfe5f9b79e64f7d78acbaaf300c1ccbd1c/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/plots/duPieChart.tsx#L99]
 and 
[here|https://github.com/devabhishekpal/ozone/blob/8f2689dfe5f9b79e64f7d78acbaaf300c1ccbd1c/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/plots/duPieChart.tsx#L105]

We should wrap the above path references in nullish coalescing operator 
({*}??{*}) and provide an empty string as a fallback for the 'path' property in 
case it is undefined so that the split() method isn't invoked on undefined.

Expected change:
{code:javascript}
[(path ?? '').split('/').pop() ?? '']
{code}

  was:
When we load the disk usage page, it is expected that all the metadata has 
already been processed by Recon.
However in the edge-case where Recon was just freshly installed and we directly 
access the Disk Usage page, it will give an error/exception as there is no path 
value (i.e undefined)

This can be reproduced by building Ozone, running it via docker and then 
immediately accessing *localhost:9888/#/DiskUsage* as soon as Recon comes up.

This error will be thrown 
[here|https://github.com/devabhishekpal/ozone/blob/8f2689dfe5f9b79e64f7d78acbaaf300c1ccbd1c/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/plots/duPieChart.tsx#L99]
 and 
[here|https://github.com/devabhishekpal/ozone/blob/8f2689dfe5f9b79e64f7d78acbaaf300c1ccbd1c/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/plots/duPieChart.tsx#L105]

We should wrap the above path references in nullish coalescing operator (*??*) 
and provide an empty string as a fallback for the 'path' property in case it is 
undefined so that the split() method isn't invoked on undefined.


> [UI] Disk Usage page will fail to load if there is not path response from 
> backend
> ---------------------------------------------------------------------------------
>
>                 Key: HDDS-12025
>                 URL: https://issues.apache.org/jira/browse/HDDS-12025
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: Ozone Recon
>    Affects Versions: 2.0.0
>            Reporter: Abhishek Pal
>            Priority: Minor
>              Labels: newbie
>
> When we load the disk usage page, it is expected that all the metadata has 
> already been processed by Recon.
> However in the edge-case where Recon was just freshly installed and we 
> directly access the Disk Usage page, it will give an error/exception as there 
> is no path value (i.e undefined)
> This can be reproduced by building Ozone, running it via docker and then 
> immediately accessing *localhost:9888/#/DiskUsage* as soon as Recon comes up.
> This error will be thrown 
> [here|https://github.com/devabhishekpal/ozone/blob/8f2689dfe5f9b79e64f7d78acbaaf300c1ccbd1c/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/plots/duPieChart.tsx#L99]
>  and 
> [here|https://github.com/devabhishekpal/ozone/blob/8f2689dfe5f9b79e64f7d78acbaaf300c1ccbd1c/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/plots/duPieChart.tsx#L105]
> We should wrap the above path references in nullish coalescing operator 
> ({*}??{*}) and provide an empty string as a fallback for the 'path' property 
> in case it is undefined so that the split() method isn't invoked on undefined.
> Expected change:
> {code:javascript}
> [(path ?? '').split('/').pop() ?? '']
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to