diff --git a/ui/src/Components/Grid/UpgradeNeeded/index.js b/ui/src/Components/Grid/UpgradeNeeded/index.js index dcd8d898f..be6f0eadf 100644 --- a/ui/src/Components/Grid/UpgradeNeeded/index.js +++ b/ui/src/Components/Grid/UpgradeNeeded/index.js @@ -9,7 +9,8 @@ import "csshake/scss/csshake-slow.scss"; class UpgradeNeeded extends Component { static propTypes = { - newVersion: PropTypes.string.isRequired + newVersion: PropTypes.string.isRequired, + reloadAfter: PropTypes.number.isRequired }; reloadApp = () => { @@ -17,7 +18,8 @@ class UpgradeNeeded extends Component { }; componentDidMount() { - this.timer = setTimeout(this.reloadApp, 3000); + const { reloadAfter } = this.props; + this.timer = setTimeout(this.reloadApp, reloadAfter); } componentWillUnmount() { diff --git a/ui/src/Components/Grid/UpgradeNeeded/index.test.js b/ui/src/Components/Grid/UpgradeNeeded/index.test.js index 1a4691faf..3b97c90c5 100644 --- a/ui/src/Components/Grid/UpgradeNeeded/index.test.js +++ b/ui/src/Components/Grid/UpgradeNeeded/index.test.js @@ -18,7 +18,9 @@ afterEach(() => { describe("", () => { it("matches snapshot", () => { - const tree = shallow(); + const tree = shallow( + + ); expect(toDiffableHtml(tree.html())).toMatchSnapshot(); }); @@ -26,13 +28,15 @@ describe("", () => { const reloadSpy = jest .spyOn(global.window.location, "reload") .mockImplementation(() => {}); - mount(); + mount(); jest.runOnlyPendingTimers(); expect(reloadSpy).toBeCalled(); }); it("timer is cleared on unmount", () => { - const tree = mount(); + const tree = mount( + + ); const instance = tree.instance(); instance.componentWillUnmount(); diff --git a/ui/src/Components/Grid/index.js b/ui/src/Components/Grid/index.js index 67f71e16f..4ca1de28f 100644 --- a/ui/src/Components/Grid/index.js +++ b/ui/src/Components/Grid/index.js @@ -27,7 +27,12 @@ const Grid = observer( } if (alertStore.info.upgradeNeeded) { - return ; + return ( + + ); } if ( diff --git a/ui/src/Components/Grid/index.stories.js b/ui/src/Components/Grid/index.stories.js index eff27cdcf..769a6d1db 100644 --- a/ui/src/Components/Grid/index.stories.js +++ b/ui/src/Components/Grid/index.stories.js @@ -81,7 +81,7 @@ storiesOf("Grid", module) return ; }) .add("UpgradeNeeded", () => { - return ; + return ; }) .add("AlertGrid", () => { const alertStore = new AlertStore([]);