From f353f0175825f8590da706a0857b488853d71f25 Mon Sep 17 00:00:00 2001 From: Prabhjyot Singh Date: Tue, 25 Aug 2026 10:36:58 -0400 Subject: [PATCH] RANGER-5711: Key Manager shows "Data not found" error upon access by keyadmin user --- .../src/views/Encryption/KeyManager.jsx | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/security-admin/src/main/webapp/react-webapp/src/views/Encryption/KeyManager.jsx b/security-admin/src/main/webapp/react-webapp/src/views/Encryption/KeyManager.jsx index 75dc4a82c4..f74375c30c 100644 --- a/security-admin/src/main/webapp/react-webapp/src/views/Encryption/KeyManager.jsx +++ b/security-admin/src/main/webapp/react-webapp/src/views/Encryption/KeyManager.jsx @@ -265,6 +265,17 @@ const KeyManager = () => { }); }; + // When landing via the sidebar (no service in the route), pre-select the first KMS service + useEffect(() => { + if (params.kmsManagePage == "new" && isEmpty(onChangeValue)) { + fetchServices().then((serviceOptions) => { + if (!isEmpty(serviceOptions)) { + selectOnchange(serviceOptions[0]); + } + }); + } + }, []); + const confirmKeyDelete = () => { handleKeyDelete(); dispatch({ @@ -377,6 +388,22 @@ const KeyManager = () => { type: "SET_LOADER", loader: true }); + + // No KMS service selected yet (e.g. landed via the sidebar): nothing to fetch + if (!onChangeValue?.label) { + dispatch({ + type: "SET_SEL_SERVICE", + keyDataList: [], + pageCount: 0, + totalCount: 0 + }); + dispatch({ + type: "SET_LOADER", + loader: false + }); + return; + } + let selectedServicesResponse = []; let selectedServicesData = null; let totalCount = 0;