From 7127d180724152cd34d7656ca695662be3bb816a Mon Sep 17 00:00:00 2001 From: Kia Lam Date: Thu, 13 Oct 2022 19:09:03 -0700 Subject: Fix pending state for health check button. --- awx/ui/src/components/HealthCheckButton/HealthCheckButton.js | 4 +++- awx/ui/src/screens/InstanceGroup/Instances/InstanceList.js | 6 +++--- awx/ui/src/screens/Instances/InstanceList/InstanceList.js | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/awx/ui/src/components/HealthCheckButton/HealthCheckButton.js b/awx/ui/src/components/HealthCheckButton/HealthCheckButton.js index 464521d68c..ee74883990 100644 --- a/awx/ui/src/components/HealthCheckButton/HealthCheckButton.js +++ b/awx/ui/src/components/HealthCheckButton/HealthCheckButton.js @@ -33,8 +33,10 @@ function HealthCheckButton({ component="button" onClick={onClick} ouiaId="health-check" + isLoading={healthCheckPending} + spinnerAriaLabel={t`Running health check`} > - {t`Run health check`} + {healthCheckPending ? t`Running health check` : t`Run health check`} ); diff --git a/awx/ui/src/screens/InstanceGroup/Instances/InstanceList.js b/awx/ui/src/screens/InstanceGroup/Instances/InstanceList.js index 8479591673..cac7daa04d 100644 --- a/awx/ui/src/screens/InstanceGroup/Instances/InstanceList.js +++ b/awx/ui/src/screens/InstanceGroup/Instances/InstanceList.js @@ -58,10 +58,10 @@ function InstanceList({ instanceGroup }) { InstanceGroupsAPI.readInstances(instanceGroupId, params), InstanceGroupsAPI.readInstanceOptions(instanceGroupId), ]); - setPendingHealthCheck( - response?.data?.result?.some((i) => i.health_check_pending === true) + const isPending = response.data.results.some( + (i) => i.health_check_pending === true ); - + setPendingHealthCheck(isPending); return { instances: response.data.results, count: response.data.count, diff --git a/awx/ui/src/screens/Instances/InstanceList/InstanceList.js b/awx/ui/src/screens/Instances/InstanceList/InstanceList.js index ad7d13bb5c..c16ac3ffd4 100644 --- a/awx/ui/src/screens/Instances/InstanceList/InstanceList.js +++ b/awx/ui/src/screens/Instances/InstanceList/InstanceList.js @@ -53,9 +53,10 @@ function InstanceList() { InstancesAPI.readOptions(), SettingsAPI.readCategory('system'), ]); - setPendingHealthCheck( - response?.data?.result?.some((i) => i.health_check_pending === true) + const isPending = response.data.results.some( + (i) => i.health_check_pending === true ); + setPendingHealthCheck(isPending); return { instances: response.data.results, isK8s: sysSettings.data.IS_K8S, -- cgit v1.2.3