diff --git a/ui/src/Components/Grid/EmptyGrid/__snapshots__/index.test.js.snap b/ui/src/Components/Grid/EmptyGrid/__snapshots__/index.test.js.snap
new file mode 100644
index 000000000..5b20e7684
--- /dev/null
+++ b/ui/src/Components/Grid/EmptyGrid/__snapshots__/index.test.js.snap
@@ -0,0 +1,23 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[` matches snapshot 1`] = `
+"
+
+
+
+"
+`;
diff --git a/ui/src/Components/Grid/EmptyGrid/index.js b/ui/src/Components/Grid/EmptyGrid/index.js
new file mode 100644
index 000000000..9bdb71b21
--- /dev/null
+++ b/ui/src/Components/Grid/EmptyGrid/index.js
@@ -0,0 +1,14 @@
+import React from "react";
+
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faCheckCircle } from "@fortawesome/free-solid-svg-icons/faCheckCircle";
+
+import "./index.scss";
+
+const EmptyGrid = () => (
+
+
+
+);
+
+export { EmptyGrid };
diff --git a/ui/src/Components/Grid/EmptyGrid/index.scss b/ui/src/Components/Grid/EmptyGrid/index.scss
new file mode 100644
index 000000000..17175a910
--- /dev/null
+++ b/ui/src/Components/Grid/EmptyGrid/index.scss
@@ -0,0 +1,7 @@
+.screen-center {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ margin-right: -50%;
+ transform: translate(-50%, -50%);
+}
diff --git a/ui/src/Components/Grid/EmptyGrid/index.test.js b/ui/src/Components/Grid/EmptyGrid/index.test.js
new file mode 100644
index 000000000..aa9a767cd
--- /dev/null
+++ b/ui/src/Components/Grid/EmptyGrid/index.test.js
@@ -0,0 +1,14 @@
+import React from "react";
+
+import { shallow } from "enzyme";
+
+import toDiffableHtml from "diffable-html";
+
+import { EmptyGrid } from ".";
+
+describe("", () => {
+ it("matches snapshot", () => {
+ const tree = shallow();
+ expect(toDiffableHtml(tree.html())).toMatchSnapshot();
+ });
+});
diff --git a/ui/src/Components/Grid/index.js b/ui/src/Components/Grid/index.js
index 4ca1de28f..83818de40 100644
--- a/ui/src/Components/Grid/index.js
+++ b/ui/src/Components/Grid/index.js
@@ -10,6 +10,7 @@ import { AlertGrid } from "./AlertGrid";
import { FatalError } from "./FatalError";
import { UpstreamError } from "./UpstreamError";
import { UpgradeNeeded } from "./UpgradeNeeded";
+import { EmptyGrid } from "./EmptyGrid";
const Grid = observer(
class Grid extends Component {
@@ -47,6 +48,13 @@ const Grid = observer(
);
}
+ if (
+ alertStore.info.version !== "unknown" &&
+ alertStore.info.totalAlerts === 0
+ ) {
+ return ;
+ }
+
return (
{alertStore.data.upstreams.instances
diff --git a/ui/src/Components/Grid/index.test.js b/ui/src/Components/Grid/index.test.js
index 0107c3394..49503e643 100644
--- a/ui/src/Components/Grid/index.test.js
+++ b/ui/src/Components/Grid/index.test.js
@@ -94,6 +94,27 @@ describe("", () => {
expect(tree.text()).toBe("");
});
+ it("renders AlertGrid before any fetch finished when totalAlerts is 0", () => {
+ alertStore.info.version = "unknown";
+ alertStore.info.totalAlerts = 0;
+ const tree = ShallowGrid();
+ expect(tree.text()).toBe("");
+ });
+
+ it("renders EmptyGrid after first fetch when totalAlerts is 0", () => {
+ alertStore.info.version = "1.2.3";
+ alertStore.info.totalAlerts = 0;
+ const tree = ShallowGrid();
+ expect(tree.text()).toBe("");
+ });
+
+ it("renders AlertGrid after first fetch finished when totalAlerts is >0", () => {
+ alertStore.info.version = "unknown";
+ alertStore.info.totalAlerts = 1;
+ const tree = ShallowGrid();
+ expect(tree.text()).toBe("");
+ });
+
it("unmounts without crashes", () => {
const tree = ShallowGrid();
tree.unmount();