From 78705a5a413413d39b3635af668a4cddb3ee7607 Mon Sep 17 00:00:00 2001 From: Jacob Shandling <61553566+jacobshandling@users.noreply.github.com> Date: Tue, 17 Jan 2023 15:33:04 -0800 Subject: [PATCH] UI: Update local MDM default team UI after editing it in the modal (#9384) # Fixes On MDM settings page, local state of the MDM default team was not getting updated when the user updates that team via the edit team modal. Now it's fixed. **Before:** https://user-images.githubusercontent.com/61553566/213004206-4f0bb138-24ca-406b-8f65-d98f4c443993.mov **After:** https://user-images.githubusercontent.com/61553566/213004263-efa46870-4d36-4067-a77d-d8f5300d55fe.mov # Checklist for submitter - [x] Manual QA for all new/changed functionality Co-authored-by: Jacob Shandling --- .../admin/IntegrationsPage/cards/Mdm/Mdm.tsx | 11 +++++++-- .../cards/Mdm/components/EditTeamModal.tsx | 23 ++++++++++--------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx b/frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx index 37c2b3b3cc..7165c2c886 100644 --- a/frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx +++ b/frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx @@ -40,6 +40,7 @@ const Mdm = (): JSX.Element => { const [showRequestCSRModal, setShowRequestCSRModal] = useState(false); const [showEditTeamModal, setShowEditTeamModal] = useState(false); + const [defaultTeamName, setDefaultTeamName] = useState("No team"); const [showCSRFlag, setShowCSRFlag] = useState(true); @@ -66,6 +67,9 @@ const Mdm = (): JSX.Element => { { enabled: isPremiumTier, staleTime: 5000, + onSuccess: (appleBmData) => { + setDefaultTeamName(appleBmData.default_team ?? "No team"); + }, } ); @@ -242,7 +246,7 @@ const Mdm = (): JSX.Element => {

- {mdmAppleBm.default_team || "No team"}{" "} + {defaultTeamName}{" "}