From 612b54c19d9ea7ebaf3bef327895069d257cc773 Mon Sep 17 00:00:00 2001 From: ironAiken2 <51399982+ironAiken2@users.noreply.github.com> Date: Fri, 6 Sep 2024 09:45:55 +0000 Subject: [PATCH] fix: disable edit button based on endpoint status (#2695) ### TL;DR An update that prevents modifications to an endpoint in `destroyed` and `destroying` state. ### What changed? - Updated status checks to include both 'destroying' and 'destroyed' states - Disabled certain buttons and actions when an endpoint is in 'destroying' or 'destroyed' state [Additionally] - Changed "LLM Playground" tooltip to "LLM Chat Test" in EndpointDetailPage ### How to test? 1. Navigate to the Endpoint List and Detail pages 2. Verify that buttons are properly disabled for endpoints in 'destroying' or 'destroyed' states 3. Check that the tooltip for the LLM chat test button now reads "LLM Chat Test" 4. Attempt to perform actions on endpoints in various states to ensure correct behavior ### Why make this change? This change improves the user experience by: 1. Providing more accurate UI feedback for endpoint statuses 2. Preventing actions on endpoints that are no longer active 3. Ensuring consistency in how endpoint statuses are handled across the application 4. Clarifying the purpose of the LLM chat test button with an updated tooltip --- **Checklist:** (if applicable) - [ ] Mention to the original issue - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after --- react/src/pages/EndpointDetailPage.tsx | 22 +++++++++++++++++---- react/src/pages/EndpointListPage.tsx | 27 ++++++++++++++++---------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/react/src/pages/EndpointDetailPage.tsx b/react/src/pages/EndpointDetailPage.tsx index 0a28766bd0..0f4c5f4f74 100644 --- a/react/src/pages/EndpointDetailPage.tsx +++ b/react/src/pages/EndpointDetailPage.tsx @@ -18,6 +18,7 @@ import { } from '../hooks'; import { useCurrentUserInfo } from '../hooks/backendai'; import { useTanMutation } from '../hooks/reactQueryAlias'; +import { isDestroyingStatus } from './EndpointListPage'; import { EndpointDetailPageQuery, EndpointDetailPageQuery$data, @@ -300,7 +301,7 @@ const EndpointDetailPage: React.FC = () => { children: endpoint?.url ? ( <> {endpoint?.url} - +