From 212a88158e5124bf3cfeb833d06e571f2f8b4d86 Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Sun, 22 Oct 2023 13:10:39 +0200 Subject: [PATCH] ISPN-15257 Fixes initial values from string to String when needed --- src/app/Caches/Entries/CacheEntries.tsx | 25 ++++++++++++++++++- .../Entries/CreateOrUpdateEntryForm.tsx | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/app/Caches/Entries/CacheEntries.tsx b/src/app/Caches/Entries/CacheEntries.tsx index 89c8cc26..6019e5a0 100644 --- a/src/app/Caches/Entries/CacheEntries.tsx +++ b/src/app/Caches/Entries/CacheEntries.tsx @@ -65,7 +65,30 @@ const CacheEntries = (props: { cacheName: string }) => { }); useEffect(() => { - if (cacheEntries) setFilteredEntries(cacheEntries); + if (cache.encoding.key == EncodingType.Protobuf) { + setSelectSearchOption(ContentType.string); + setKeyContentTypeToEdit(ContentType.string); + } else if (cache.encoding.key == EncodingType.Java || + cache.encoding.key == EncodingType.JBoss || + cache.encoding.key == EncodingType.JavaSerialized) { + setSelectSearchOption(ContentType.StringContentType); + setKeyContentTypeToEdit(ContentType.StringContentType); + } else if (cache.encoding.key == EncodingType.XML){ + setSelectSearchOption(ContentType.XML); + setKeyContentTypeToEdit(ContentType.XML); + } else if (cache.encoding.key == EncodingType.JSON) { + setSelectSearchOption(ContentType.JSON); + setSelectSearchOption(ContentType.JSON); + } else if (cache.encoding.key == EncodingType.Text) { + setSelectSearchOption(ContentType.StringContentType); + setSelectSearchOption(ContentType.StringContentType); + } + }, [cache]); + + useEffect(() => { + if (cacheEntries) { + setFilteredEntries(cacheEntries); + } }, [loadingEntries, errorEntries, cacheEntries]); useEffect(() => { diff --git a/src/app/Caches/Entries/CreateOrUpdateEntryForm.tsx b/src/app/Caches/Entries/CreateOrUpdateEntryForm.tsx index bc98101d..c7bd93f5 100644 --- a/src/app/Caches/Entries/CreateOrUpdateEntryForm.tsx +++ b/src/app/Caches/Entries/CreateOrUpdateEntryForm.tsx @@ -431,7 +431,7 @@ const CreateOrUpdateEntryForm = (props: { aria-describedby="key-entry-helper" onChange={(_event, key) => onChangeKey(key)} onBlur={onBlurKey} - disabled={isEdition} + isDisabled={isEdition} />