From d297186acbd12b55b067397ca31b512fc73964af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?=
Date: Mon, 6 Jan 2020 20:12:36 +0100
Subject: [PATCH] fix: Cannot remove all variants in Admin UI
see https://github.com/Unleash/unleash/issues/544
---
.../update-variant-component-test.jsx.snap | 74 +++++++++++++++++++
.../variant/update-variant-component.jsx | 35 +++++----
2 files changed, 91 insertions(+), 18 deletions(-)
diff --git a/frontend/src/component/feature/variant/__tests__/__snapshots__/update-variant-component-test.jsx.snap b/frontend/src/component/feature/variant/__tests__/__snapshots__/update-variant-component-test.jsx.snap
index 4a2bc0ae5a..8668316f43 100644
--- a/frontend/src/component/feature/variant/__tests__/__snapshots__/update-variant-component-test.jsx.snap
+++ b/frontend/src/component/feature/variant/__tests__/__snapshots__/update-variant-component-test.jsx.snap
@@ -205,6 +205,59 @@ exports[`renders correctly with without variants 1`] = `
Add variant
+
`;
@@ -240,5 +293,26 @@ exports[`renders correctly with without variants and no permissions 1`] = `
>
The sum of variants weights needs to be a constant number to guarantee consistent hashing in the client implementations, this is why we will sometime allocate a few more percentages to the first variant if the sum is not exactly 100. In a final version of this feature it should be possible to the user to manually set the percentages for each variant.
+
`;
diff --git a/frontend/src/component/feature/variant/update-variant-component.jsx b/frontend/src/component/feature/variant/update-variant-component.jsx
index 91a7622244..e1c70ff401 100644
--- a/frontend/src/component/feature/variant/update-variant-component.jsx
+++ b/frontend/src/component/feature/variant/update-variant-component.jsx
@@ -122,26 +122,25 @@ class UpdateVariantComponent extends Component {
Add variant
+
) : null}
- {variants.length > 0 ? (
-
- ) : null}
+
);
}