From f76bdc4f230b04c6cf1b68de9eb4997e326169ad Mon Sep 17 00:00:00 2001 From: Harsh Modi Date: Mon, 5 Feb 2024 18:24:02 -0500 Subject: [PATCH] make sure available are valid Remove the package itself from available list Remove duplicates if there are any Remove all other packages of not the same type Signed-off-by: Harsh Modi --- .../content/common/PackageTypeSelect.jsx | 20 +++- .../components/content/group/GroupEdit.jsx | 93 ++++++++----------- 2 files changed, 58 insertions(+), 55 deletions(-) diff --git a/src/main/webui/src/app/components/content/common/PackageTypeSelect.jsx b/src/main/webui/src/app/components/content/common/PackageTypeSelect.jsx index 21f023c..d572cff 100644 --- a/src/main/webui/src/app/components/content/common/PackageTypeSelect.jsx +++ b/src/main/webui/src/app/components/content/common/PackageTypeSelect.jsx @@ -21,7 +21,7 @@ import {Utils} from '#utils/AppUtils'; const {statsRes} = IndyRest; -export const PackageTypeSelect = ({register, formErrors}) =>{ +export const PackageTypeSelect = ({register, formErrors, updatePackageType}) =>{ const [state, setState] = useState({ pkgTypes: [] }); @@ -43,9 +43,22 @@ export const PackageTypeSelect = ({register, formErrors}) =>{ if(register){ registered = register("packageType", {required: true}); } + + const {onChange, onBlur, name, ref} = registered; + + const change = e => { + setSelected(e.target.value); + if (typeof updatePackageType === "function") { + updatePackageType(e.target.value); + } + if (typeof onChange === "function") { + onChange(e); + } + }; + return