diff --git a/ui/src/Components/Toast/AppToasts.tsx b/ui/src/Components/Toast/AppToasts.tsx
index c69debffe..47b4fa0bf 100644
--- a/ui/src/Components/Toast/AppToasts.tsx
+++ b/ui/src/Components/Toast/AppToasts.tsx
@@ -56,6 +56,7 @@ const AppToasts: FC<{
message={upstream.error}
/>
}
+ hasClose
/>
))}
{alertStore.info.upgradeReady ? (
@@ -64,6 +65,7 @@ const AppToasts: FC<{
icon={faArrowUp}
iconClass="text-success"
message={}
+ hasClose={false}
/>
) : null}
diff --git a/ui/src/Components/Toast/__snapshots__/AppToasts.test.tsx.snap b/ui/src/Components/Toast/__snapshots__/AppToasts.test.tsx.snap
index 16a2f59dc..0d2c2000c 100644
--- a/ui/src/Components/Toast/__snapshots__/AppToasts.test.tsx.snap
+++ b/ui/src/Components/Toast/__snapshots__/AppToasts.test.tsx.snap
@@ -99,24 +99,6 @@ exports[` renders UpgradeToastMessage when alertStore.info.upgradeR
-
diff --git a/ui/src/Components/Toast/index.test.tsx b/ui/src/Components/Toast/index.test.tsx
index d9060914c..9f31f6b1a 100644
--- a/ui/src/Components/Toast/index.test.tsx
+++ b/ui/src/Components/Toast/index.test.tsx
@@ -17,6 +17,7 @@ describe("", () => {
icon={faExclamation}
iconClass="text-danger"
message="fake error"
+ hasClose
/>
);
expect(toDiffableHtml(tree.html())).toMatch(/fake error/);
@@ -28,6 +29,7 @@ describe("", () => {
icon={faExclamation}
iconClass="text-danger"
message="fake error"
+ hasClose
/>
);
expect(toDiffableHtml(tree.html())).toMatch(/fake error/);
@@ -42,6 +44,7 @@ describe("", () => {
icon={faExclamation}
iconClass="text-danger"
message="fake error"
+ hasClose
/>
);
expect(toDiffableHtml(tree.html())).toMatch(/fake error/);
@@ -57,12 +60,37 @@ describe("", () => {
expect(toDiffableHtml(tree.html())).toMatch(/fake error/);
});
+ it("renders close icon when hasClose=true", () => {
+ const tree = mount(
+
+ );
+ expect(toDiffableHtml(tree.html())).toMatch(/fa-times/);
+ });
+
+ it("doesn't render close icon when hasClose=false", () => {
+ const tree = mount(
+
+ );
+ expect(toDiffableHtml(tree.html())).not.toMatch(/fa-times/);
+ });
+
it("unmounts cleanly", () => {
const tree = mount(
);
tree.unmount();
diff --git a/ui/src/Components/Toast/index.tsx b/ui/src/Components/Toast/index.tsx
index 36a6baba4..eae7abae2 100644
--- a/ui/src/Components/Toast/index.tsx
+++ b/ui/src/Components/Toast/index.tsx
@@ -15,7 +15,8 @@ const Toast: FC<{
icon: IconDefinition;
iconClass: string;
message: ReactNode;
-}> = ({ icon, iconClass, message }) => {
+ hasClose: boolean;
+}> = ({ icon, iconClass, message, hasClose }) => {
const [isOpen, setIsOpen] = useState(true);
useEffect(() => {
@@ -41,14 +42,16 @@ const Toast: FC<{
{message}
-
- setIsOpen(false)}
- >
-
-
-
+ {hasClose ? (
+
+ setIsOpen(false)}
+ >
+
+
+
+ ) : null}
);