mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
fix browser blank page on gateways (#8453)
StorageInfo component will not be rendered if Storage used is null.
This commit is contained in:
parent
a2825702f8
commit
4e6bf136a8
@ -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…
Reference in New Issue
Block a user