fix browser blank page on gateways (#8453)

StorageInfo component will not be rendered if
Storage used is null.
master
Kanagaraj M 5 years ago committed by kannappanr
parent a2825702f8
commit 4e6bf136a8
  1. 8
      browser/app/js/browser/StorageInfo.js
  2. 11
      browser/app/js/browser/__tests__/StorageInfo.test.js
  3. 78
      browser/ui-assets.go

@ -26,7 +26,13 @@ export class StorageInfo extends React.Component {
}
render() {
const { used } = this.props.storageInfo
var totalUsed = used.reduce((v1, v2) => v1 + v2, 0)
if (!used) {
return <noscript />
}
const totalUsed = used.reduce((v1, v2) => v1 + v2, 0)
return (
<div className="feh-used">
<div className="fehu-chart">

@ -35,4 +35,15 @@ describe("StorageInfo", () => {
)
expect(fetchStorageInfo).toHaveBeenCalled()
})
it("should not render anything if used is null", () => {
const fetchStorageInfo = jest.fn()
const wrapper = shallow(
<StorageInfo
storageInfo={{ used: null }}
fetchStorageInfo={fetchStorageInfo}
/>
)
expect(wrapper.text()).toBe("")
})
})

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save